Sfoglia il codice sorgente

Merge branch 'master' of http://git.izouma.com/xiongzhu/jetour

xiongzhu 5 anni fa
parent
commit
3945276df3
3 ha cambiato i file con 13 aggiunte e 2 eliminazioni
  1. 4 1
      src/components/GoodsSuk.vue
  2. 8 0
      src/pages/shoppingDetail.vue
  3. 1 1
      src/pages/submit.vue

+ 4 - 1
src/components/GoodsSuk.vue

@@ -28,7 +28,7 @@
 
         <div class="num">
             <div class="text1">购买数量</div>
-            <van-stepper :value="num" @change="changeNum" />
+            <van-stepper :value="num" @change="changeNum" :max="stock" />
         </div>
 
         <div style="flex-grow:1;min-height:10px"></div>
@@ -71,6 +71,9 @@ export default {
         },
         mainImg() {
             return this.info.images ? [...this.info.images].shift() : '';
+        },
+        stock() {
+            return this.info.stock || 0;
         }
     },
     watch: {

+ 8 - 0
src/pages/shoppingDetail.vue

@@ -363,6 +363,14 @@ export default {
                 });
                 return;
             }
+
+            if (this.num > this.info.stock || 0) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '商品库存不足'
+                });
+                return;
+            }
             // if (!this.cityId) {
             //     wx.showToast({
             //         icon: 'none',

+ 1 - 1
src/pages/submit.vue

@@ -184,7 +184,7 @@ export default {
                         { header: { 'Content-Type': 'application/json' } }
                     )
                     .then(res => {
-                        if (res.code === 200) {
+                        if (res.data.result === '0') {
                             return this.$http.post('/applets/appletsPay', {
                                 orderCode: res.data.orderCode,
                                 orderType: 2