From fb809790d865c5ec0a107c752f1a8c0be151cb9b Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期五, 07 三月 2025 11:27:13 +0800
Subject: [PATCH] feat(支付):折扣券最大减免金额支持
---
pay/scanpay.vue | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/pay/scanpay.vue b/pay/scanpay.vue
index eb489a4..e3f3f53 100644
--- a/pay/scanpay.vue
+++ b/pay/scanpay.vue
@@ -166,6 +166,7 @@
data() {
return {
tips: '璇ュ晢鎴锋殏鏈紑閫氭敮浠樺姛鑳�',
+ payLoading: false,
loading: false,
remark: '',
buyerNote: '',
@@ -198,12 +199,14 @@
couponInfo: {
id: '',
discount: 0,
- thresholdValue: 0
+ thresholdValue: 0,
+ discountMax: 0,
}, // 浼樻儬鍒稿唴瀹�
checkCoupon: {
id: null,
discount: 0,
- thresholdValue: 0
+ thresholdValue: 0,
+ discountMax: 0,
},
};
},
@@ -223,7 +226,10 @@
return parseFloat(num);
}
const dis = 1 - parseFloat(this.checkCoupon.discount)
- const dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+ let dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+ if(dic>this.checkCoupon.discountMax){
+ dic = this.checkCoupon.discountMax
+ }
return this.$utils.fenToYuan(dic).toFixed(2);
},
discount() {
@@ -235,7 +241,10 @@
return parseFloat(num);
}
const dis = 1 - parseFloat(this.couponInfo.discount)
- const dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+ let dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+ if(dic>this.couponInfo.discountMax){
+ dic = this.couponInfo.discountMax
+ }
return this.$utils.fenToYuan(dic).toFixed(2);
},
payMoney() {
@@ -247,9 +256,6 @@
}
},
onLoad(opt) {
- uni.setStorageSync('CID', opt.cid)
- uni.setStorageSync('SHOPID', opt.shopId)
- uni.setStorageSync('AQCI', opt.activityQrcodeId)
this.UNIONID = uni.getStorageSync('UNIONID') || null
this.isNew = uni.getStorageSync('IS_NEW')
@@ -430,6 +436,7 @@
thresholdValue: res.thresholdValue,
discount: res.discount,
discountType: res.discountType,
+ discountMax: res.discountMax
}
}
}
@@ -596,6 +603,8 @@
return
}
this.bordShow = false
+ if (this.payLoading) return
+ this.payLoading = true
// 閲戦 this.money
uni.showLoading({
title: '涓嬪崟涓�',
@@ -618,7 +627,7 @@
params.cid = this.cid
}
if (this.onlineId) {
- params = {payWay: this.payWay,onlineId: this.onlineId}
+ params.onlineId = this.onlineId
}
//鐢熸垚璁㈠崟
saveOrder(params).then(res => {
@@ -637,10 +646,12 @@
this.aliPay(res.paymentUrl)
}
} catch (e) {
+ this.payLoading = false
//TODO handle the exception
console.error(e);
}
}).catch(() => {
+ this.payLoading = false
uni.hideLoading()
})
},
@@ -657,6 +668,7 @@
"paySign": res.paySign //寰俊绛惧悕
},
(res) => {
+ this.payLoading = false
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 浣跨敤浠ヤ笂鏂瑰紡鍒ゆ柇鍓嶇杩斿洖,寰俊鍥㈤槦閮戦噸鎻愮ず锛�
//res.err_msg灏嗗湪鐢ㄦ埛鏀粯鎴愬姛鍚庤繑鍥瀘k锛屼絾骞朵笉淇濊瘉瀹冪粷瀵瑰彲闈犮��
@@ -674,6 +686,7 @@
ap.tradePay({
tradeNO: res.tradeNO
}, (res) => {
+ this.payLoading = false
if (res.resultCode == 9000) {
uni.navigateTo({
url: `/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
--
Gitblit v1.9.1