zhengjinyi 2 years ago
parent
commit
ee37382820

+ 11 - 8
src/main/resources/static/js/product/detail.js

@@ -179,6 +179,7 @@ var productDetail = new Vue({
                     var $pageLabel = '';
                     _self.product = response.data;
                     _self.pcActType = product.pcActType;
+                    _self.productStock = product.stock;
                     _self.addParams.skuId = product.skus[0].skuId;
                     _self.beautyActFlag = product.beautyActFlag;
                     _self.productTypeName = product.typeName;
@@ -375,10 +376,12 @@ var productDetail = new Vue({
         },
         numberSub: function () {
             this.number -= this.priceObj.step;
+            console.log('number', this.number)
             this.numberResize();
         },
         numberAdd: function () {
             this.number += this.priceObj.step;
+            console.log('number', this.number)
             this.numberResize();
 
         },
@@ -395,13 +398,14 @@ var productDetail = new Vue({
             if (this.number > this.productStock) {
                 this.number = this.productStock;
             }
-            if (this.priceObj.ladderPriceFlag) {
-                this.ladderList.forEach(function (ladder) {
-                    if (_self.number >= ladder.buyNum) {
-                        _self.priceObj.price = ladder.buyPrice;
-                    }
-                });
-            }
+            // if (this.priceObj.ladderPriceFlag) {
+            //     this.ladderList.forEach(function (ladder) {
+            //         if (_self.number >= ladder.buyNum) {
+            //             _self.priceObj.price = ladder.buyPrice;
+            //         }
+            //     });
+            // }
+            console.log('number', this.number)
         },
         handleCollection:function (){// 收藏操作
             var _self = this;
@@ -695,7 +699,6 @@ var productDetail = new Vue({
         this.typeId = $("#typeId").val();
         console.log('typeId', this.typeId)
         this.userId = this.couponParam.userId = this.listQuery.userId = GLOBAL_USER_ID;
-        this.productStock = $("#productStock").val();
         // this.getImages();
         // identity: 0个人,1协销,2会员机构,3供应商,4普通机构
         // visibility:3:所有人可见,2:普通机构可见,1:会员机构可见 4:仅医美机构可见

+ 2 - 0
src/main/resources/static/js/product/mixins/productMixins.js

@@ -85,6 +85,8 @@ var productMixins = function () {
                 this.priceObj.originalPrice = sku.originalPrice;
                 this.priceObj.price = sku.price;
                 this.addParams.skuId = sku.skuId;
+                this.number = this.priceObj.minBuyNumber = sku.minBuyNumber;
+                this.productStock = sku.stock;
                 this.ladderList = sku.ladderPriceList ? sku.ladderPriceList : [];
                 this.isDetailsBtnDisable = sku.stock === 0;
             },