Kaynağa Gözat

修改下单页

pangqijun 1 yıl önce
ebeveyn
işleme
384d7e6dee

+ 9 - 5
pages/groupbuying_details/index.vue

@@ -145,13 +145,13 @@
 												</view>
 
 												<view class="u-number-box" v-if="!storeInfo.isEnd && storeInfo.goodsList[index].isSale === 1 && item.totalStock > 0">
-													<view class="symbol symboll" @click="numberBox(-1,index)">
+													<view class="symbol symboll" :class="{'number-no': storeInfo.goodsList[index].num === 0}" @click="numberBox(-1,index)">
 														<text>-</text>
 													</view>
 													<view class="number-box">
 														<text>{{storeInfo.goodsList[index].num}}</text>
 													</view>
-													<view class="symbol symbolr" @click="numberBox(1,index)">
+													<view class="symbol symbolr" :class="{'number-no': storeInfo.goodsList[index].num === (storeInfo.goodsList[index].max || 10)}" @click="numberBox(1,index)">
 														<text>+</text>
 													</view>
 												</view>
@@ -662,18 +662,17 @@ export default {
 
 
 		numberBox(number,index){
+      let max = this.storeInfo.goodsList[index].max || 10;
 			if (!this.isShowBottom){
 				return
 			}
-			console.log('+++++++++++++++++')
 			if (number<0 && this.storeInfo.goodsList[index].num ===0){
 				return
 			}
-			if (number>0 && this.storeInfo.goodsList[index].num ===10){
+			if (number>0 && this.storeInfo.goodsList[index].num === max){
 				return
 			}
 			this.storeInfo.goodsList[index].num = this.storeInfo.goodsList[index].num + number
-			console.log(this.storeInfo.goodsList[index].num)
 		},
 
 		// goFirendo(){
@@ -2477,5 +2476,10 @@ action-sheet-item {
 		border-left: 2rpx solid rgba(180,42,62,0.3);
 	}
 
+  .number-no {
+    background: #fdfbfc;
+    color: #d598a0;
+  }
+
 </style>
 

+ 22 - 15
pages/groupbuying_details/order_details_confirm/index.vue

@@ -18,13 +18,15 @@
 						<view class="u-number-box">
 <!--							<u-number-box :name="item.id" :min="0" :max="10" v-model="grouponOrderData.goodsInfos[index].num" @change="calGoodsPrice"></u-number-box>-->
 
-							<view class="symbol symboll" @click="numberBox(-1,index)">
+							<view class="symbol symboll" :class="{'number-no': grouponOrderData.goodsInfos[index].num === 0}"
+                    @click="numberBox(-1,index)">
 								<text>-</text>
 							</view>
 							<view class="number-box">
 								<text>{{grouponOrderData.goodsInfos[index].num}}</text>
 							</view>
-							<view class="symbol symbolr" @click="numberBox(1,index)">
+							<view class="symbol symbolr" :class="{'number-no': grouponOrderData.goodsInfos[index].num === (grouponOrderData.goodsInfos[index].max || 10)}"
+                    @click="numberBox(1,index)">
 								<text>+</text>
 							</view>
 
@@ -379,7 +381,7 @@ export default {
 			cartInfo: [],
 			priceGroup: {},
 			animated: false,
-			totalPrice: 0,
+			totalPrice: 0.0,
 			integralRatio: "0",
 			pagesUrl: "",
 			orderKey: "",
@@ -469,15 +471,15 @@ export default {
 	methods: {
 
 		numberBox(number,index){
-			console.log('+++++++++++++++++')
-			if (number<0 && this.grouponOrderData.goodsInfos[index].num ===0){
-				return
+      let max = this.grouponOrderData.goodsInfos[index].max || 10;
+			if (number < 0 && this.grouponOrderData.goodsInfos[index].num ===0){
+          return
 			}
-			if (number>0 && this.grouponOrderData.goodsInfos[index].num ===10){
-				return
+			if (number > 0 && this.grouponOrderData.goodsInfos[index].num === max) {
+          return
 			}
-			this.grouponOrderData.goodsInfos[index].num = this.grouponOrderData.goodsInfos[index].num + number
-			console.log(this.grouponOrderData.goodsInfos[index].num)
+			this.grouponOrderData.goodsInfos[index].num = this.grouponOrderData.goodsInfos[index].num + number;
+      this.calGoodsPrice()
 		},
 
 
@@ -541,13 +543,12 @@ export default {
 				});
 			});
 		},
-		calGoodsPrice(value) {
+		calGoodsPrice() {
+      let total = 0.00;
 			this.grouponOrderData.goodsInfos.forEach(e => {
-				if (value.name == e.id) {
-					let c = value.value - e.num;
-					this.totalPrice = this.totalPrice + (c*e.discountPrice)
-				}
+        total = total + (e.num*e.discountPrice);
 			});
+			this.totalPrice = total;
 		},
 		getOrderData() {
       uni.showLoading({ title: '加载中' });
@@ -2332,4 +2333,10 @@ export default {
     line-height: 40rpx;
     margin: 24rpx 128rpx 0 122rpx;
   }
+
+
+  .number-no {
+    background: #fdfbfc;
+    color: #d598a0;
+  }
 </style>