Browse Source

Merge branch 'release-20170915'

yangc 8 years ago
parent
commit
280a94f55d

+ 3 - 0
components/common/buyOrCar/buyComponent.vue

@@ -52,6 +52,9 @@
                   }
                   }
                 }, err => {
                 }, err => {
                   console.log(err)
                   console.log(err)
+                  if (this.item.minBuyQty > this.item.reserve) {
+                    this.$message.error('商品' + this.item.code + '的库存已经不满足起订量')
+                  }
                 })
                 })
             } else {
             } else {
               // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
               // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})

+ 9 - 4
components/store/CommodityInfo.vue

@@ -88,7 +88,7 @@
                  <span>{{(calculate || 0)}}</span>
                  <span>{{(calculate || 0)}}</span>
               </span>
               </span>
             </div>
             </div>
-            <div class="button" ng-controller="GoodsPickUpCtrl">
+            <div class="button">
               <button class="btn btn-default btn-primary" @click="buyNow(false, commodity)">加入购物车</button>
               <button class="btn btn-default btn-primary" @click="buyNow(false, commodity)">加入购物车</button>
               <button class="btn btn-default btn-now" @click="buyNow(true, commodity)">立即购买</button>
               <button class="btn btn-default btn-now" @click="buyNow(true, commodity)">立即购买</button>
             </div>
             </div>
@@ -214,7 +214,7 @@ export default {
       }
       }
     },
     },
     changeNum: function (newNum) {
     changeNum: function (newNum) {
-      let pack = this.commodity.minPackQty
+      let pack = this.commodity.perQty || this.commodity.minPackQty
       let buy = this.commodity.minBuyQty
       let buy = this.commodity.minBuyQty
       let reserve = this.commodity.reserve
       let reserve = this.commodity.reserve
       if (newNum < buy) {
       if (newNum < buy) {
@@ -258,12 +258,14 @@ export default {
       }
       }
     },
     },
     subNum () {
     subNum () {
-      let newNum = this.fragment.num - this.commodity.minPackQty
+      let pack = this.commodity.perQty || this.commodity.minPackQty
+      let newNum = this.fragment.num - pack
       this.changeNum(newNum)
       this.changeNum(newNum)
       getFragment(this.commodity, this.fragment)
       getFragment(this.commodity, this.fragment)
     },
     },
     addNum () {
     addNum () {
-      let newNum = this.fragment.num + this.commodity.minPackQty
+      let pack = this.commodity.perQty || this.commodity.minPackQty
+      let newNum = this.fragment.num + pack
       this.changeNum(newNum)
       this.changeNum(newNum)
       getFragment(this.commodity, this.fragment)
       getFragment(this.commodity, this.fragment)
     },
     },
@@ -319,6 +321,9 @@ export default {
                 }
                 }
               }, err => {
               }, err => {
                 console.log(err)
                 console.log(err)
+                if (item.minBuyQty > item.reserve) {
+                  this.$message.error('商品' + item.code + '的库存已经不满足起订量')
+                }
               })
               })
           } else {
           } else {
             // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
             // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})

+ 3 - 1
components/store/RecommendProduct.vue

@@ -43,7 +43,6 @@
     },
     },
     methods: {
     methods: {
       buyNow: function (isBuy, item) {
       buyNow: function (isBuy, item) {
-        console.log(item)
         if (!this.$store.state.option.user.logged) {
         if (!this.$store.state.option.user.logged) {
           this.$http.get('/login/page').then(response => {
           this.$http.get('/login/page').then(response => {
             if (response.data) {
             if (response.data) {
@@ -86,6 +85,9 @@
                   }
                   }
                 }, err => {
                 }, err => {
                   console.log(err)
                   console.log(err)
+                  if (item.minBuyQty > item.reserve) {
+                    this.$message.error('商品' + item.code + '的库存已经不满足起订量')
+                  }
                 })
                 })
             } else {
             } else {
               // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
               // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})

+ 1 - 1
plugins/axios.js

@@ -4,7 +4,7 @@ import store from '~store'
 
 
 const service = axios.create({
 const service = axios.create({
   withCredentials: true,
   withCredentials: true,
-  baseURL: '/'
+  baseURL: process.env.proxyUrl || process.env.baseUrl
 })
 })
 
 
 service.interceptors.request.use(config => {
 service.interceptors.request.use(config => {

+ 14 - 8
server.js

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