Explorar o código

Merge remote-tracking branch 'origin/release-20170915' into release-20170915

suntg %!s(int64=8) %!d(string=hai) anos
pai
achega
a671de34de

+ 9 - 1
components/product/ComponentGoods.vue

@@ -25,7 +25,7 @@
         <td>
           <!--store/{{compGoods.storeId}}#/batchInfo/{{compGoods.batchCode}}-->
           <nuxt-link v-if="compGoods.batchCode" :to="`/store/${compGoods.storeId}/${compGoods.batchCode}`" target="_blank">
-            <img :src="compGoods.img?compGoods.img:compGoods.brand.logoUrl?compGoods.brand.logoUrl:'/images/all/default.png'"/>
+            <img :src="compGoods.img?compGoods.img:'/images/all/default.png'"/>
           </nuxt-link>
           <img v-if="!compGoods.batchCode" :src="compGoods.img || '/images/all/default.png'"/>
           <!--store/{{compGoods.storeId}}#/home-->
@@ -53,6 +53,7 @@
           <!--<div class="multiple" v-if="compGoods.reserve > 0">
             倍数:<span>{{compGoods.minPackQty}}</span>
           </div>-->
+          <div class="can-div-sell" v-if="compGoods.reserve" v-text="compGoods.breakUp?'可拆卖':'不可拆卖'"></div>
         </td>
         <td>
           <div v-if="!compGoods.prices">
@@ -233,6 +234,10 @@
   }
   .product-list td a{
     color: #337ab7;
+    max-width: 160px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    display: block;
   }
   .product-list td a:hover {
     color: #23527c;
@@ -273,6 +278,9 @@
   .product-list tbody tr td{
     padding: 10px 0;
   }
+  .product-list tbody tr td .can-div-sell {
+    color: #333;
+  }
   .search-record{
     width: 100%;
     margin: 0 auto;

+ 13 - 2
components/product/component/ComponentDetail.vue

@@ -6,7 +6,7 @@
       </div>-->
       <div class="detail">
         <div class="component-img">
-          <img :src="list.img?list.img:list.brand.logoUrl?list.brand.logoUrl:'/images/component/default.png'"/>
+          <img :src="list.img||'/images/component/default.png'"/>
         </div>
         <div class="component-message">
           <div class="message-code">
@@ -37,7 +37,7 @@
             <div class="form-group row">
               <div class="message-item">下载</div>
               <div class="colon">:</div>
-              <div class="message-body"><a :href="list.attach" v-if="list.attach">规格书</a><span v-if="!list.attach">暂无规格书</span></div>
+              <div class="message-body"><a @click="toAttach(list.attach)" v-if="list.attach">规格书</a><span v-if="!list.attach">暂无规格书</span></div>
             </div>
             <div class="form-group">
                <button type="text" v-if="!collectList" @click="collect(list.id)" class="btn btn-default btn-stroe" style="line-height: 26px;">加入收藏</button>
@@ -115,6 +115,17 @@
             }
           })
         }
+      },
+      toAttach: function (url) {
+        if (url === '1') {
+          this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
+            if (response.data) {
+              this.$router.push('/auth/login')
+            }
+          })
+        } else {
+          window.open(url)
+        }
       }
     }
   }

+ 7 - 2
components/product/component/StoreInfo.vue

@@ -70,6 +70,7 @@
                   <span>起拍:</span>
                   <span v-if="list.minBuyQty">{{list.minBuyQty}}</span>
                 </div>
+                <div class="can-div-sell" v-text="list.breakUp?'可拆卖':'不可拆卖'"></div>
 
                 <!--<div>-->
                   <!--<span>倍数:</span>-->
@@ -270,7 +271,7 @@
   .storeInfo .storeIn-active {
     width: 98px;
     height: 49px;
-    line-height: 49px;
+    line-height: 46px;
     float: left;
     border: 1px solid #5078cb;
     text-align: center;
@@ -282,6 +283,7 @@
     display: table-cell;
     height: 46px;
     width: 98px;
+    line-height: 46px;
     text-align: center;
     vertical-align: middle;
   }
@@ -364,7 +366,6 @@
     border-right: #ddd 1px solid;
   }
   .storeInfo .table tbody td div{
-    text-align: center;
     margin-left: 10%;
   }
   .storeInfo .table tbody tr:hover{
@@ -373,4 +374,8 @@
   .storeInfo .table tbody tr:hover{
     background: #f5f5f5;
   }
+  .storeInfo .goodsList .can-div-sell {
+    text-align: left;
+    color: #333;
+  }
 </style>

+ 4 - 2
components/search/GoodList.vue

@@ -55,8 +55,9 @@
           <tbody id="productList-content">
           <tr v-for="item in good_list.components">
             <td>
-              <nuxt-link class="component-img-box" :to="`/product/component/${item.uuid}`">
-                <img :src="item.img?item.img:item.brand.logoUrl?item.brand.logoUrl:'/images/component/default.png'">
+              <nuxt-link class="component-img-box" :to="item.batchCode?`/store/${item.storeId}/${item.batchCode}`:`/product/component/${item.uuid}`">
+                <img :src="item.img?item.img:item.brand&&item.brand.logoUrl?item.brand.logoUrl:'/images/component/default.png'">
+                <img :src="item.batchCode?item.img?item.img:'/images/component/default.png':item.brand&&item.brand.logoUrl?item.brand.logoUrl:'/images/component/default.png'">
               </nuxt-link>
             </td>
             <td class="brand-code">
@@ -90,6 +91,7 @@
              <!-- <div class="multiple" v-if="item.reserve > 0">
                 倍数:<span v-text="item.minPackQty"></span>
               </div>-->
+              <div v-if="item.reserve" v-text="item.breakUp?'可拆卖':'不可拆卖'"></div>
             </td>
             <td>
               <div v-show="!item.prices">

+ 34 - 1
components/store/CommodityInfo.vue

@@ -48,9 +48,10 @@
             <div class="com-info">
               <span class="name">库&nbsp;存</span>:<span v-text="commodity.reserve || 0"></span>
               (<span v-text="commodity.minBuyQty || 1"></span>个起订)
+              <span :class="commodity.breakUp?'div-sell can-div-sell':'div-sell not-div-sell'" v-text="commodity.breakUp?'可拆卖':'不可拆卖'" ></span>
             </div>
             <div class="com-info">
-              <span class="name">&nbsp;期</span>:
+              <span class="name">&nbsp;期</span>:
               <div class="delivery">
                 <span v-text="commodity.b2cMinDelivery || 0"></span>
                 <span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">-</span>
@@ -612,4 +613,36 @@ export default {
 	#commodity-info-fragment{
 		margin-bottom: 20px;
 	}
+
+  .commodity-detail .content .com-info .div-sell {
+    font-size: 12px;
+    height: 16px;
+    line-height: 16px;
+    color: #fff;
+    padding: 0 5px;
+    display: inline-block;
+    position: relative;
+  }
+  .commodity-detail .content .com-info .can-div-sell {
+    background: #5078cb;
+  }
+  .commodity-detail .content .com-info .not-div-sell {
+    background: #fc8200;
+  }
+  .commodity-detail .content .com-info .can-div-sell:before {
+    content: '';
+    position: absolute;
+    left: -8px;
+    top: 10px;
+    border-left: 8px solid transparent;
+    border-bottom: 6px solid #5078cb;
+  }
+  .commodity-detail .content .com-info .not-div-sell:before {
+    content: '';
+    position: absolute;
+    left: -8px;
+    top: 10px;
+    border-left: 8px solid transparent;
+    border-bottom: 6px solid #fc8200;
+  }
 </style>

+ 4 - 0
components/store/CommodityList.vue

@@ -70,6 +70,7 @@
               <!--<div class="multiple">
                 倍数:<span>1</span>
               </div>-->
+              <div class="can-div-sell" v-if="commodity.reserve" v-text="commodity.breakUp?'可拆卖':'不可拆卖'"></div>
             </td>
             <td>
               <div v-for="price in commodity.prices" v-text="price.start + '+'"></div>
@@ -420,6 +421,9 @@ export default {
 		text-align: center;
 		line-height: 20px;
 	}
+  #goods-list-fragment .goodslist tbody>tr td .can-div-sell {
+    color: #333;
+  }
 
 	/* 物品列表按钮 */
 	#goods-list-fragment .btn-buy-now {

+ 1 - 1
nuxt.config.js

@@ -107,5 +107,5 @@ module.exports = {
     ssr: false
   }],
   /* TODO 暂时代理到商城测试版,之后再做出调整 */
-  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**']
+  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**']
 }

+ 2 - 2
plugins/axios.js

@@ -4,12 +4,12 @@ import store from '~store'
 
 const service = axios.create({
   withCredentials: true,
-  baseURL: process.env.proxyUrl || process.env.baseUrl
+  baseURL: '/'
 })
 
 service.interceptors.request.use(config => {
   // is server render, use ${baseUrl} directly rather than ${proxyUrl}
-  if (process.env.proxyUrl && typeof window === 'undefined') {
+  if (typeof window === 'undefined') {
     config.url = process.env.baseUrl + config.url
     config.headers.cookie = store.state.option.cookies + '; ' + store.state.option.sessionId
     config.headers['User-Agent'] = store.state.option.userAgent

+ 1 - 0
run.sh

@@ -4,6 +4,7 @@ echo "NODE_ENV: $NODE_ENV"
 echo "BASE_URL: $BASE_URL"
 
 if [ "$NODE_ENV" == 'production' ]; then
+  npm run build
   npm run start
 else
   npm run dev-start

+ 8 - 14
server.js

@@ -57,20 +57,14 @@ const nuxt = new Nuxt(config)
 app.use(nuxt.render)
 
 // Build only in dev mode
-// if (config.dev) {
-//   nuxt.build()
-//     .catch((error) => {
-//       // eslint-disable-line no-console
-//       console.error(error)
-//       process.exit(1)
-//     })
-// }
-nuxt.build()
-  .catch((error) => {
-    // eslint-disable-line no-console
-    console.error(error)
-    process.exit(1)
-  })
+if (config.dev) {
+  nuxt.build()
+    .catch((error) => {
+      // eslint-disable-line no-console
+      console.error(error)
+      process.exit(1)
+    })
+}
 
 // Listen the server
 app.listen(port)