lilei 4 months ago
parent
commit
d1a7ff6e4d

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.2.132:9110/saas/clz/', // 本地
+			// baseUrl: 'http://192.168.2.10:9110/saas/clz/', // 本地
 			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},

+ 13 - 9
pagesB/procureOrder/creatOrder.vue

@@ -173,7 +173,7 @@
 			},
 			// 充值余额支付是否显示,合计金额小于充值余额
 			hasBalancePay(){
-				return this.$store.state.vuex_showBalanceAuth&&this.storeAccount&&!this.disCzOption
+				return this.showBalanceAuth&&this.storeAccount&&!this.disCzOption
 			},
 			// 抵扣余额
 			storeAccount(){
@@ -182,7 +182,7 @@
 			// 禁用抵扣金额
 			disKdk(){
 				const kdk = this.storeAccount&&this.subsidyAmount>0&&this.subsidyAmount<=this.storeAccount.giveBalance
-				return this.payType==2 || !kdk
+				return !kdk
 			},
 			// 禁用的支付选项
 			disCzOption(){
@@ -197,7 +197,7 @@
 			//是否开启线上支付
 			hasPay(){
 				const shelfInfo = this.shelfInfo
-				return shelfInfo&&shelfInfo.payOnlineFlag&&shelfInfo.payOnlineFlag=='1'&&this.payType!=2
+				return shelfInfo&&shelfInfo.payOnlineFlag&&shelfInfo.payOnlineFlag=='1'
 			},
 			// 付款信息
 			payInfo(){
@@ -243,8 +243,8 @@
 						 	qty: item.qty,
 						 	price:item.orginPrice,
 							promoSn: item.promoSn,
-							shopProductSubsidy: item.shopProductSubsidy,
-							shopPromoProduct: item.shopPromoProduct
+							promoProductSn: item.shopProductSubsidy&&item.shopProductSubsidy.productSubsidySn,
+							resultValue: item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount
 						 })
 						 cartSn.push({
 							 cartSn: item.cartSn,
@@ -279,8 +279,8 @@
 								qty: item.qty,
 								price: item.price,
 								promoSn: item.promoSn,
-								shopProductSubsidy: item.shopProductSubsidy,
-								shopPromoProduct: item.shopPromoProduct
+								promoProductSn: item.promoProductSn,
+								resultValue: item.resultValue
 							}
 						})
 						const delSn = cartSn.filter(item => successList.find(k => k.productSn == item.productSn)).map(item => item.cartSn)
@@ -389,7 +389,9 @@
 						this.total += 1 // 总款数
 						// 有抵扣金额,且没有促销活动
 						if(item.shopProductSubsidy&&!item.shopPromoProduct){
-							this.subsidyAmount += (item.shopProductSubsidy.subsidyAmount||0) * item.qty
+							// 抵扣金额是否小于售价
+							const isXPrice = item.shopProductSubsidy.subsidyAmount<=item.price
+							this.subsidyAmount += isXPrice ? (item.shopProductSubsidy.subsidyAmount||0) * item.qty : 0
 						}
 						// 如果是返券类型
 						if(item.promoType=='BUY_PROD_GIVE_VALID'){
@@ -403,8 +405,10 @@
 						item.giftQty = item.promoType=='BUY_PROD_GIVE_PROD' ? Math.floor(item.qty / item.conditionValue)*item.resultValue : 0
 					})
 				})
-				// 总可抵扣金额有余额支付权限,且抵扣金额小于等于抵扣余额
+				// 总可抵扣金额有余额支付权限,且抵扣金额小于等于抵扣余额
 				this.hasKdk = this.subsidyAmount>0&&this.storeAccount&&this.subsidyAmount<=this.storeAccount.giveBalance&&this.showBalanceAuth
+				// 默认支付方式
+				this.payType = this.hasBalancePay ? 0 : (this.hasPay ? 1 : 2)
 			},
 		}
 	}

+ 1 - 1
pagesB/procureOrder/orderDetail.vue

@@ -154,7 +154,7 @@
 					</view>
 					<view class="infoList" v-if="isPayOk">
 						<text>支付方式</text>
-						<text>{{info.payInfo.payWay=='WXPAY_ONLINE_XCX'?'微信支付':'--'}}</text>
+						<text>{{info.payInfo.payOnlineTypeDictValue}}</text>
 					</view>
 					<view class="infoList" v-if="isPayOk">
 						<text>支付时间</text>

+ 29 - 22
pagesB/shopiing/productDetail.vue

@@ -39,7 +39,7 @@
 							<view class="flex align_center tejia-tag" v-if="detail.promoType=='PROMO_PROD'">
 								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
-							<view class="flex align_center rebate-tag" v-if="detail.shopProductSubsidy&&!detail.shopPromoProduct&&showBalanceAuth">
+							<view class="flex align_center rebate-tag" v-if="detail.shopProductSubsidy&&detail.shopProductSubsidy.subsidyAmount<detail.price&&!detail.shopPromoProduct&&showBalanceAuth">
 								可抵扣<text>¥{{detail.shopProductSubsidy.subsidyAmount}}</text>
 							</view>
 						</view>
@@ -183,7 +183,7 @@
 								<view>总金额</view>
 								<view><text class="pf">¥</text>{{totalAmount}}</view>
 							</view>
-							<view class="flex align_center justify_between" v-if="subsidyAmount">
+							<view class="flex align_center justify_between">
 								<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> 
@@ -194,7 +194,7 @@
 									<text class="pf">¥</text>{{subsidyAmount}}
 								</view>
 							</view>
-							<view class="flex align_center justify_end" v-if="detail.shopProductSubsidy">
+							<view class="flex align_center justify_end" v-if="detail&&detail.shopProductSubsidy">
 								<view>合计:</view>
 								<view style="font-weight: bold;"><text class="pf">¥</text>{{payAmount}}</view>
 							</view>
@@ -338,7 +338,7 @@
 			//是否开启线上支付,且支付方式不是线下支付
 			hasPay(){
 				const shelfInfo = this.shelfInfo
-				return shelfInfo&&shelfInfo.payOnlineFlag&&shelfInfo.payOnlineFlag=='1'&&this.payType!=2
+				return shelfInfo&&shelfInfo.payOnlineFlag&&shelfInfo.payOnlineFlag=='1'
 			},
 			// 最小支付金额
 			minPayAmount(){
@@ -351,7 +351,13 @@
 			},
 			// 抵扣余额支付是否可用,有【余额支付权限】且该产品有抵扣金额
 			hasBalancePay(){
-				return this.$store.state.vuex_showBalanceAuth&&this.storeAccount&&this.storeAccount.giveBalance&&this.detail&&!this.detail.shopPromoProduct
+				// 抵扣金额是否小于售价
+				const isXPrice = this.detail&&this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount<=this.detail.price
+				// 是否有促销活动
+				const hasProm = this.detail&&!this.detail.shopPromoProduct
+				// 抵扣余额是否为零
+				const izYue = this.storeAccount&&this.storeAccount.giveBalance
+				return this.$store.state.vuex_showBalanceAuth&&izYue&&hasProm&&isXPrice
 			},
 			// 门店账户信息
 			storeAccount(){
@@ -361,14 +367,18 @@
 			disCzOption(){
 				return this.storeAccount && this.payAmount>this.storeAccount.rechargeBalance
 			},
-			// 禁用抵扣金额
+			// 是否禁用抵扣金额
 			disKdk(){
 				const kdk = this.detail&&this.detail.shopProductSubsidy&&this.storeAccount&&this.subsidyAmount>0&&this.subsidyAmount<=this.storeAccount.giveBalance
-				return this.payType=='2' || !kdk
+				return !kdk
+			},
+			// 总金额
+			totalAmount(){
+				return Number(this.hasLogin&&this.detail&&this.detail.price * this.qty).toFixed(2)
 			},
 			// 抵扣金额
 			subsidyAmount(){
-				return this.detail&&this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount||0
+				return Number(this.hasBalancePay?(this.detail&&this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount||0) * this.qty:0).toFixed(2)
 			},
 			// 经销商电话
 			dealerPhone(){
@@ -379,10 +389,6 @@
 			totalNum(){
 				return this.hasLogin&&this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_cartTotal : 0
 			},
-			// 总金额
-			totalAmount(){
-				return Number(this.hasLogin&&this.detail&&this.detail.price * this.qty).toFixed(2)
-			},
 			// 支付合计,结算金额
 			payAmount(){
 				return Number(this.totalAmount-(this.hasKdk&&this.detail&&this.detail.shopProductSubsidy?this.subsidyAmount:0)).toFixed(2)
@@ -553,10 +559,10 @@
 							// 打开数量选择弹框
 							if(!this.showPopu){
 								this.showPopu = true
-								this.payType = this.showBalanceAuth ? '0' : (this.hasPay ? '1' : '2')
-								if(this.hasBalancePay){
-									this.payType = this.storeAccount.rechargeBalance<this.payAmount ? (this.hasPay? '1' : '2'):'0'
-								}
+								// 结算金额大于充值余额时不可使用充值余额
+								this.payType = this.storeAccount.rechargeBalance<this.payAmount ? (this.hasPay? '1' : '2'):'0'
+								// 没有充值余额权限
+								this.payType = this.showBalanceAuth ? this.payType : (this.hasPay? '1' : '2')
 								// 有余额支付权限,且没有促销活动,且有抵扣金额,且抵扣金额小于等于抵扣余额
 								this.hasKdk = this.detail.shopProductSubsidy&&this.subsidyAmount>0&&this.subsidyAmount<this.storeAccount.giveBalance&&!this.detail.shopPromoProduct&&this.showBalanceAuth
 							}else{
@@ -618,8 +624,8 @@
 							qty: this.qty,
 							price:this.detail.price,
 							promoSn: this.detail.promoSn,
-							shopProductSubsidy: this.detail.shopProductSubsidy,
-							shopPromoProduct: this.detail.shopPromoProduct
+							promoProductSn: this.detail.shopProductSubsidy.productSubsidySn,
+							resultValue: this.detail.shopProductSubsidy.subsidyAmount
 						}]}).then(res => {
 							uni.hideLoading()
 							if(res.status == 200){
@@ -630,8 +636,8 @@
 										qty: item.qty,
 										price:item.price,
 										promoSn: item.promoSn,
-										shopProductSubsidy: item.shopProductSubsidy,
-										shopPromoProduct: item.shopPromoProduct
+										promoProductSn: item.promoProductSn,
+										resultValue: item.resultValue
 									}
 								}) : []
 								const removeList = res.data.removeList ? res.data.removeList.map(item => item.productCode) : []
@@ -651,11 +657,12 @@
 									})
 								}else{
 									const promoChangeFlag = res.data.promoChangeFlag
+									const subsidyChangeFlag = res.data.subsidyChangeFlag
 									// 活动变更
-									if(promoChangeFlag){
+									if(promoChangeFlag||subsidyChangeFlag){
 										uni.showModal({
 											title: '提示',
-											content: '促销活动已变更,请刷新?',
+											content: promoChangeFlag ? '促销活动已变更,请刷新!' : (subsidyChangeFlag?'抵扣规则已变更,请刷新!':''),
 											confirmText:'确定刷新',
 											success(ret) {
 												if(ret.confirm){

+ 1 - 1
pagesB/transactionRecord/transactionRecord.vue

@@ -77,7 +77,7 @@ export default {
 	this.tabType = opts.type
 	this.accountType = ['RECHARGE','GIVE'][opts.type]
 	uni.setNavigationBarTitle({
-		title: opts.type==0?'充值交易记录':'消费交易记录'
+		title: opts.type==0?'充值余额记录':'抵扣余额记录'
 	})
   },
   onShow() {