完成物业缴费中的组合支付逻辑
This commit is contained in:
parent
3324598637
commit
0bc9cace0c
@ -83,8 +83,8 @@
|
|||||||
{{ items.community_fee_type ? items.community_fee_type.type_name : '' }}
|
{{ items.community_fee_type ? items.community_fee_type.type_name : '' }}
|
||||||
</view>
|
</view>
|
||||||
<view class="Item_money">¥{{ items.money }}</view>
|
<view class="Item_money">¥{{ items.money }}</view>
|
||||||
<view class="Item_status" v-if="items.status == 0">未付款</view>
|
<view class="Item_status" v-if="items.pay_status == 1">未付款</view>
|
||||||
<view class="Item_status sucess" v-if="items.status == 1">
|
<view class="Item_status sucess" v-if="items.pay_status == 2">
|
||||||
已付款
|
已付款
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -447,7 +447,7 @@ export default {
|
|||||||
} else if (this.payType == 2) {
|
} else if (this.payType == 2) {
|
||||||
name_mini = "物业公积金";
|
name_mini = "物业公积金";
|
||||||
} else {
|
} else {
|
||||||
name_mimi = "微信 + 物业公积金";
|
name_mini = "微信 + 物业公积金";
|
||||||
}
|
}
|
||||||
if (!this.currentMoney) {
|
if (!this.currentMoney) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
@ -455,22 +455,79 @@ export default {
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await request(apiArr.createPayOrder, "POST", {
|
|
||||||
|
// 构建支付参数,根据支付类型决定传递哪些字段
|
||||||
|
const payParams = {
|
||||||
order_ids: order_ids,
|
order_ids: order_ids,
|
||||||
community_id: this.currentCommunity.id,
|
community_id: this.currentCommunity.id,
|
||||||
room_id: this.currentRoom.room_id,
|
room_id: this.currentRoom.room_id,
|
||||||
pay_user_id: uni.getStorageSync("userId"),
|
pay_user_id: uni.getStorageSync("userId"),
|
||||||
user_name: uni.getStorageSync("nickName"),
|
user_name: uni.getStorageSync("nickName"),
|
||||||
pay_user_name: uni.getStorageSync("nickName"),
|
pay_user_name: uni.getStorageSync("nickName"),
|
||||||
//格式化年月日 时分秒
|
|
||||||
pay_time: formatDate(new Date()),
|
pay_time: formatDate(new Date()),
|
||||||
money: this.currentMoney,
|
|
||||||
name_mini,
|
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.payInfoId = res.id;
|
||||||
this.OrderPay();
|
this.OrderPay();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//根据支付订单查询交易信息
|
//根据支付订单查询交易信息
|
||||||
async getPayInfo() {
|
async getPayInfo() {
|
||||||
@ -498,6 +555,8 @@ export default {
|
|||||||
order_pay_id: this.payInfoId,
|
order_pay_id: this.payInfoId,
|
||||||
}
|
}
|
||||||
request(apiArr.tradeQuery, "POST", params).then(res => {
|
request(apiArr.tradeQuery, "POST", params).then(res => {
|
||||||
|
this.getRoomSelect();
|
||||||
|
this.getUserGovenmentMoney();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail: (payErr) => {
|
fail: (payErr) => {
|
||||||
@ -528,7 +587,6 @@ export default {
|
|||||||
|
|
||||||
//支付记录
|
//支付记录
|
||||||
getPayList() {
|
getPayList() {
|
||||||
|
|
||||||
request(apiArr.getPayOrderList, "POST", {
|
request(apiArr.getPayOrderList, "POST", {
|
||||||
room_id: this.currentRoom.room_id,
|
room_id: this.currentRoom.room_id,
|
||||||
page_num: this.page_num,
|
page_num: this.page_num,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user