lilei 4 months ago
parent
commit
232e5decab
2 changed files with 24 additions and 11 deletions
  1. 7 3
      pagesB/procureOrder/creatOrder.vue
  2. 17 8
      pagesB/shopiing/productDetail.vue

+ 7 - 3
pagesB/procureOrder/creatOrder.vue

@@ -242,7 +242,9 @@
 						 	productCode:item.productCode,
 						 	qty: item.qty,
 						 	price:item.orginPrice,
-							promoSn: item.promoSn
+							promoSn: item.promoSn,
+							shopProductSubsidy: item.shopProductSubsidy,
+							shopPromoProduct: item.shopPromoProduct
 						 })
 						 cartSn.push({
 							 cartSn: item.cartSn,
@@ -276,7 +278,9 @@
 								productCode: item.productCode,
 								qty: item.qty,
 								price: item.price,
-								promoSn: item.promoSn
+								promoSn: item.promoSn,
+								shopProductSubsidy: item.shopProductSubsidy,
+								shopPromoProduct: item.shopPromoProduct
 							}
 						})
 						const delSn = cartSn.filter(item => successList.find(k => k.productSn == item.productSn)).map(item => item.cartSn)
@@ -385,7 +389,7 @@
 						this.total += 1 // 总款数
 						// 有抵扣金额,且没有促销活动
 						if(item.shopProductSubsidy&&!item.shopPromoProduct){
-							this.subsidyAmount += item.shopProductSubsidy.subsidyAmount||0
+							this.subsidyAmount += (item.shopProductSubsidy.subsidyAmount||0) * item.qty
 						}
 						// 如果是返券类型
 						if(item.promoType=='BUY_PROD_GIVE_VALID'){

+ 17 - 8
pagesB/shopiing/productDetail.vue

@@ -183,15 +183,15 @@
 								<view>总金额</view>
 								<view><text class="pf">¥</text>{{totalAmount}}</view>
 							</view>
-							<view class="flex align_center justify_between" v-if="detail.shopProductSubsidy.subsidyAmount">
+							<view class="flex align_center justify_between" v-if="subsidyAmount">
 								<view v-if="storeAccount">抵扣(余额:<text class="pf">¥</text>{{storeAccount.giveBalance}})</view>
 								<view class="flex align_center" v-if="!disKdk" @click="hasKdk=!hasKdk">
 									<uni-icons size="18" :type="hasKdk?'checkbox-filled':'checkbox'" color="#2196f3"></uni-icons> 
-									<text class="pf">¥</text>{{detail.shopProductSubsidy.subsidyAmount}}
+									<text class="pf">¥</text>{{subsidyAmount}}
 								</view>
 								<view class="flex align_center" v-else>
 									<uni-icons size="18" type="circle-filled" color="#aaa"></uni-icons> 
-									<text class="pf">¥</text>{{detail.shopProductSubsidy.subsidyAmount}}
+									<text class="pf">¥</text>{{subsidyAmount}}
 								</view>
 							</view>
 							<view class="flex align_center justify_end" v-if="detail.shopProductSubsidy">
@@ -363,9 +363,13 @@
 			},
 			// 禁用抵扣金额
 			disKdk(){
-				const kdk = this.detail&&this.detail.shopProductSubsidy&&this.storeAccount&&this.detail.shopProductSubsidy.subsidyAmount>0&&this.detail.shopProductSubsidy.subsidyAmount<=this.storeAccount.giveBalance
+				const kdk = this.detail&&this.detail.shopProductSubsidy&&this.storeAccount&&this.subsidyAmount>0&&this.subsidyAmount<=this.storeAccount.giveBalance
 				return this.payType=='2' || !kdk
 			},
+			// 抵扣金额
+			subsidyAmount(){
+				return this.detail&&this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount||0
+			},
 			// 经销商电话
 			dealerPhone(){
 				const shelfInfo = this.shelfInfo
@@ -381,7 +385,7 @@
 			},
 			// 支付合计,结算金额
 			payAmount(){
-				return Number(this.totalAmount-(this.hasKdk&&this.detail&&this.detail.shopProductSubsidy?this.detail.shopProductSubsidy.subsidyAmount:0)).toFixed(2)
+				return Number(this.totalAmount-(this.hasKdk&&this.detail&&this.detail.shopProductSubsidy?this.subsidyAmount:0)).toFixed(2)
 			},
 			// 赠品数量
 			giftNum(){
@@ -554,7 +558,7 @@
 									this.payType = this.storeAccount.rechargeBalance<this.payAmount ? (this.hasPay? '1' : '2'):'0'
 								}
 								// 有余额支付权限,且没有促销活动,且有抵扣金额,且抵扣金额小于等于抵扣余额
-								this.hasKdk = this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount>0&&this.detail.shopProductSubsidy.subsidyAmount<this.storeAccount.giveBalance&&!this.detail.shopPromoProduct&&this.showBalanceAuth
+								this.hasKdk = this.detail.shopProductSubsidy&&this.subsidyAmount>0&&this.subsidyAmount<this.storeAccount.giveBalance&&!this.detail.shopPromoProduct&&this.showBalanceAuth
 							}else{
 								// 充值余额支付
 								if(this.payType == 0){
@@ -607,12 +611,15 @@
 					mask: true
 				})
 				const _this = this
-				purchaseCheck({detailList: [{
+				purchaseCheck({
+					   detailList: [{
 							productSn:this.detail.productSn,
 							productCode:this.detail.productCode,
 							qty: this.qty,
 							price:this.detail.price,
-							promoSn: this.detail.promoSn
+							promoSn: this.detail.promoSn,
+							shopProductSubsidy: this.detail.shopProductSubsidy,
+							shopPromoProduct: this.detail.shopPromoProduct
 						}]}).then(res => {
 							uni.hideLoading()
 							if(res.status == 200){
@@ -623,6 +630,8 @@
 										qty: item.qty,
 										price:item.price,
 										promoSn: item.promoSn,
+										shopProductSubsidy: item.shopProductSubsidy,
+										shopPromoProduct: item.shopPromoProduct
 									}
 								}) : []
 								const removeList = res.data.removeList ? res.data.removeList.map(item => item.productCode) : []