From 0bc9cace0c28122fcf80b55d3cfbce64f44eb2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Fri, 26 Sep 2025 10:11:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=89=A9=E4=B8=9A=E7=BC=B4?= =?UTF-8?q?=E8=B4=B9=E4=B8=AD=E7=9A=84=E7=BB=84=E5=90=88=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/community/propertyPayment/index.vue | 82 +++++++++++++++++--- 1 file changed, 70 insertions(+), 12 deletions(-) diff --git a/packages/community/propertyPayment/index.vue b/packages/community/propertyPayment/index.vue index f44fae20..07442198 100644 --- a/packages/community/propertyPayment/index.vue +++ b/packages/community/propertyPayment/index.vue @@ -83,8 +83,8 @@ {{ items.community_fee_type ? items.community_fee_type.type_name : '' }} ¥{{ items.money }} - 未付款 - + 未付款 + 已付款 @@ -447,7 +447,7 @@ export default { } else if (this.payType == 2) { name_mini = "物业公积金"; } else { - name_mimi = "微信 + 物业公积金"; + name_mini = "微信 + 物业公积金"; } if (!this.currentMoney) { return uni.showToast({ @@ -455,22 +455,79 @@ export default { duration: 2000, }); } - await request(apiArr.createPayOrder, "POST", { + + // 构建支付参数,根据支付类型决定传递哪些字段 + const payParams = { order_ids: order_ids, community_id: this.currentCommunity.id, room_id: this.currentRoom.room_id, pay_user_id: uni.getStorageSync("userId"), user_name: uni.getStorageSync("nickName"), pay_user_name: uni.getStorageSync("nickName"), - //格式化年月日 时分秒 pay_time: formatDate(new Date()), - money: this.currentMoney, name_mini, - }).then((res) => { - console.log(res); - this.payInfoId = res.id; - this.OrderPay(); - }); + }; + + // 判断是否是组合支付 + const isComboPay = this.show2; + + if (this.payType == 1 || isComboPay) { + //微信支付或组合支付 + payParams.money = this.currentMoney; + } + + if (this.payType == 2 || isComboPay) { + // 公积金支付或组合支付 + const fundAmount = Math.min(Number(this.balanceMoney), Number(this.currentMoney)); + payParams.property_housing_fund = fundAmount.toFixed(2); + + // 仅公积金支付 公积金不足 + if (this.payType == 2 && !isComboPay) { + if (Number(this.balanceMoney) < Number(this.currentMoney)) { + uni.showToast({ + title: '可用公积金不足,可选择组合支付', + icon: 'none', + duration: 3000 + }); + return; + } + } + } + + // 组合支付 + if (isComboPay) { + this.payType = 3; + name_mini = "微信 + 物业公积金"; + } + + payParams.name_mini = name_mini; + + if (this.payType == 2) { + uni.showModal({ + title: '提示', + content: '确定使用物业公积金支付?', + success: async function (res) { + if (res.confirm) { + await request(apiArr.createPayOrder, "POST", payParams).then((res) => { + const params = { + order_pay_id: res.id, + } + request(apiArr.tradeQuery, "POST", params).then(res => { + this.getRoomSelect(); + this.getUserGovenmentMoney(); + }) + }); + } else if (res.cancel) { + console.log('用户点击取消'); + } + } + }); + } else { + await request(apiArr.createPayOrder, "POST", payParams).then((res) => { + this.payInfoId = res.id; + this.OrderPay(); + }); + } }, //根据支付订单查询交易信息 async getPayInfo() { @@ -498,6 +555,8 @@ export default { order_pay_id: this.payInfoId, } request(apiArr.tradeQuery, "POST", params).then(res => { + this.getRoomSelect(); + this.getUserGovenmentMoney(); }) }, fail: (payErr) => { @@ -528,7 +587,6 @@ export default { //支付记录 getPayList() { - request(apiArr.getPayOrderList, "POST", { room_id: this.currentRoom.room_id, page_num: this.page_num,