完成物业缴费中的组合支付逻辑

This commit is contained in:
赵毅 2025-09-26 10:11:39 +08:00
parent 3324598637
commit 0bc9cace0c

View File

@ -83,8 +83,8 @@
{{ items.community_fee_type ? items.community_fee_type.type_name : '' }}
</view>
<view class="Item_money">{{ items.money }}</view>
<view class="Item_status" v-if="items.status == 0">未付款</view>
<view class="Item_status sucess" v-if="items.status == 1">
<view class="Item_status" v-if="items.pay_status == 1">未付款</view>
<view class="Item_status sucess" v-if="items.pay_status == 2">
已付款
</view>
</view>
@ -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);
};
//
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,