lilei 10 tháng trước cách đây
mục cha
commit
3995a8d353
1 tập tin đã thay đổi với 24 bổ sung5 xóa
  1. 24 5
      pagesB/promoDetail.vue

+ 24 - 5
pagesB/promoDetail.vue

@@ -14,7 +14,7 @@
 						<view class="video-item">
 							<view>
 								<u-image :src="item.productImage" height="140px" width="100%"></u-image>
-								<view class="back-price">返<text>{{item.promoRuleValue}}</text></view>
+								<view class="back-price">返<text>{{item.promoRuleValue}}</text></view>
 							</view>
 							<view>
 								<view class="product-name">{{item.productName}}</view>
@@ -41,11 +41,11 @@
 					<view class="bottom-bar-left-item">
 						<view class="bottom-bar-left-item-icon" @click="openChoose">
 							<u-icon name="shopping-cart" size="40"></u-icon>
-							<u-badge type="error" :count="chooseLength" :offset="[-7,-8]"></u-badge>
+							<u-badge type="error" :count="totalNum" :offset="[-7,-8]"></u-badge>
 						</view>
 					</view>
 					<view class="bottom-bar-left-item" v-if="showChoosePopu">
-						合计:<view class="price-txt">¥<text>325.63</text></view>
+						合计:<view class="price-txt">¥<text>{{totalAmount}}</text></view>
 					</view>
 				</view>
 				<view :class="'bottom-bar-right bg-'+(showChoosePopu?'1':'0')" @click="submitOrder">
@@ -152,6 +152,22 @@
 			// 已选产品总款数
 			chooseLength(){
 				return this.chooseList.length
+			},
+			// 已选产品总金额
+			totalAmount(){
+				let total = 0
+				this.chooseList.forEach(key => {
+					total = total + key.cost * key.qty
+				})
+				return total.toFixed(2)
+			},
+			// 已选产品总数量
+			totalNum(){
+				let total = 0
+				this.chooseList.forEach(key => {
+					total = total + key.qty
+				})
+				return total
 			}
 		},
 		onLoad(opts) {
@@ -181,7 +197,10 @@
 				}else{
 					// 已添加,则增加数量
 					const row = this.chooseList.find(key => key.id == item.id)
-					if(row){row.qty = row.qty + 1}
+					if(row){
+						row.qty = row.qty + 1
+					}
+					this.chooseList.splice()
 				}
 			},
 			// 渲染已选产品列表
@@ -556,7 +575,7 @@
 		}
 		.back-price{
 			padding: 6rpx 55rpx;
-			background: rgb(255 87 34 / 0.6);
+			background: rgba(255 ,87 ,34 , 0.6);
 			position: absolute;
 			top: 16rpx;
 			left: -50rpx;