From d283a1cc5804618ac9735f25573ef1bb31e4e9e4 Mon Sep 17 00:00:00 2001 From: Sun_sun <469361609@qq.com> Date: Fri, 24 Oct 2025 09:54:23 +0800 Subject: [PATCH] =?UTF-8?q?2025-10-24=20=E5=A4=9A=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/pay.vue | 58 ++++++++++++++++++++++++++++++++-------------- pages/my/car.vue | 3 +-- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/pages/home/pay.vue b/pages/home/pay.vue index 7b851e3..539a142 100644 --- a/pages/home/pay.vue +++ b/pages/home/pay.vue @@ -56,12 +56,11 @@ 选择优惠券后自动换算扣除 - + 支付方式 - + 融豆 @@ -69,8 +68,7 @@ - + 积分 @@ -78,8 +76,7 @@ - + 融豆+积分 @@ -87,8 +84,7 @@ - + 支付宝 @@ -96,8 +92,7 @@ - + 微信 @@ -113,8 +108,8 @@ 实际支付: - + + {{allPayNum}} @@ -267,8 +262,11 @@ // 计算实际支付 const calculateAllPay = () => { + allPayNum.value = 0 if (rongdouChecked.value) { // 融豆 - allPayNum.value = dataInfo.value.items[0].rongdou_price * dataInfo.value.items[0].quantity + dataInfo.value.items.forEach(item => { + allPayNum.value += item.rongdou_price * item.quantity + }) // 选择优惠券 if (couponRecordId.value) { let couponInfo = couponList.value.filter(item => item.couponInfo.id == couponRecordId.value)[0] @@ -276,7 +274,9 @@ handle1to1(couponInfo) } } else if (pointsChecked.value) { // 积分 - allPayNum.value = dataInfo.value.items[0].points_price * dataInfo.value.items[0].quantity + dataInfo.value.items.forEach(item => { + allPayNum.value += item.points_price * item.quantity + }) // 选择优惠券 if (couponRecordId.value) { let couponInfo = couponList.value.filter(item => item.couponInfo.id == couponRecordId.value)[0] @@ -284,7 +284,9 @@ handle1to10000(couponInfo) } } else if (rpChecked.value) { // 融豆+积分 - allPayNum.value = dataInfo.value.items[0].points_price * dataInfo.value.items[0].quantity + dataInfo.value.items.forEach(item => { + allPayNum.value += item.points_price * item.quantity + }) // 选择优惠券 if (couponRecordId.value) { let couponInfo = couponList.value.filter(item => item.couponInfo.id == couponRecordId.value)[0] @@ -292,7 +294,9 @@ handle1to10000(couponInfo) } } else if (alipayChecked.value) { // 支付宝 - allPayNum.value = dataInfo.value.items[0].price * dataInfo.value.items[0].quantity + dataInfo.value.items.forEach(item => { + allPayNum.value += item.price * item.quantity + }) // 选择优惠券 if (couponRecordId.value) { let couponInfo = couponList.value.filter(item => item.couponInfo.id == couponRecordId.value)[0] @@ -300,7 +304,9 @@ handle1to1(couponInfo) } } else if (wechatpayChecked.value) { // 微信 - allPayNum.value = dataInfo.value.items[0].price * dataInfo.value.items[0].quantity + dataInfo.value.items.forEach(item => { + allPayNum.value += item.price * item.quantity + }) // 选择优惠券 if (couponRecordId.value) { let couponInfo = couponList.value.filter(item => item.couponInfo.id == couponRecordId.value)[0] @@ -311,6 +317,7 @@ if (allPayNum.value < 0) allPayNum.value = 0 } + // 折扣计算 const handle1to1 = (couponInfo) => { if (couponInfo.type == 'discount_for_a_amount') { // 满减 if (allPayNum.value > couponInfo.for_a_amount) { @@ -323,6 +330,7 @@ } } + // 折扣计算 const handle1to10000 = (couponInfo) => { if (couponInfo.type == 'discount_for_a_amount') { // 满减 if (allPayNum.value > (couponInfo.for_a_amount * 10000)) { @@ -411,6 +419,19 @@ const dataInfo = ref({}) const couponList = ref({}) + const supportMethod = ref([]) + + function getCommonPaymentMethods(data) { + if (!data.items || data.items.length === 0) { + return []; + } + + return data.items + .map(item => item.payment_methods) + .reduce((common, current) => + common.filter(method => current.includes(method)) + ); + } const loadData = async () => { // 订单信息 @@ -420,6 +441,7 @@ if (item.payment_methods.includes('rongdou') && item.payment_methods.includes( 'points')) item.payment_methods.push('mixed') }) + supportMethod.value = getCommonPaymentMethods(dataInfo.value) }) uni.stopPullDownRefresh() } diff --git a/pages/my/car.vue b/pages/my/car.vue index e4c0502..5c9686e 100644 --- a/pages/my/car.vue +++ b/pages/my/car.vue @@ -165,8 +165,7 @@ if (response.success) { // 进入支付页面 uni.navigateTo({ - url: '/pages/home/pay?preOrderId=' + response.data - .preOrderId + url: '/pages/home/pay?preOrderId=' + response.data.preOrderId }) } else { msgRef.value.show({