diff --git a/packages/community/propertyPayment/index.vue b/packages/community/propertyPayment/index.vue index 02e826a8..3459764f 100644 --- a/packages/community/propertyPayment/index.vue +++ b/packages/community/propertyPayment/index.vue @@ -149,7 +149,7 @@ 缴费金额 - ¥{{ item.money }} + ¥{{ item.money + item.property_housing_fund }} @@ -168,12 +168,12 @@ 应缴费金额 - ¥{{ item.money }} + ¥{{ item.money + item.property_housing_fund }} 物业费公积金抵扣金额 - -¥{{ item.reduction_money }} + -¥{{ item.property_housing_fund }} @@ -301,6 +301,33 @@ export default { this.getRoomSelect(); this.getUserGovenmentMoney(); }, + + // 下拉刷新生命周期函数 + onPullDownRefresh() { + // 根据当前激活的标签页,重新加载对应的数据 + if (this.active === 0) { + // 账单页面,重新获取公积金和账单数据 + Promise.all([ + this.getUserGovenmentMoney(), + this.getRoomSelect() + ]).then(() => { + // 数据加载完成后停止下拉刷新 + uni.stopPullDownRefresh(); + }).catch(() => { + // 加载失败也需要停止下拉刷新 + uni.stopPullDownRefresh(); + }); + } else if (this.active === 1) { + // 缴费记录页面,重新获取缴费记录 + this.getPayList().then(() => { + // 数据加载完成后停止下拉刷新 + uni.stopPullDownRefresh(); + }).catch(() => { + // 加载失败也需要停止下拉刷新 + uni.stopPullDownRefresh(); + }); + } + }, methods: { changeTab(index) { @@ -330,15 +357,23 @@ export default { }, //获取房源 getRoomSelect() { - request(apiArr.getCommunityRoomList, "POST", { - community_id: this.currentCommunity.id, - page_num: 1, - page_size: 50, - }).then((res) => { - this.roomList = res.rows; - this.currentRoom = this.roomList[0]; - this.selectedRoomId = this.currentRoom.room_id; - this.getOrderList(); + return new Promise((resolve, reject) => { + request(apiArr.getCommunityRoomList, "POST", { + community_id: this.currentCommunity.id, + page_num: 1, + page_size: 50, + }).then((res) => { + this.roomList = res.rows; + this.currentRoom = this.roomList[0]; + this.selectedRoomId = this.currentRoom.room_id; + this.getOrderList().then(() => { + resolve(); + }).catch((error) => { + reject(error); + }); + }).catch((error) => { + reject(error); + }); }); }, @@ -354,29 +389,39 @@ export default { }, //获取用户公积金 - async getUserGovenmentMoney() { - request(apiArr.getUserGovenmentMoney, "POST", {}).then((res) => { - console.log(res, "公积金"); - this.balanceMoney = res.balance_after; + getUserGovenmentMoney() { + return new Promise((resolve, reject) => { + request(apiArr.getUserGovenmentMoney, "POST", {}).then((res) => { + console.log(res, "公积金"); + this.balanceMoney = res.balance_after; + resolve(); + }).catch((error) => { + reject(error); + }); }); }, //获取账单 - async getOrderList() { - await request(apiArr.getOrderList, "POST", { - room_id: this.currentRoom.room_id, - page_num: 1, - page_size: 50, - }).then((res) => { - console.log(res, "账单"); - res.rows.forEach((item) => { - item.check = false; - item.more = false; - item.community_order_rows.forEach((ite) => { - ite.check = false; + getOrderList() { + return new Promise((resolve, reject) => { + request(apiArr.getOrderList, "POST", { + room_id: this.currentRoom.room_id, + page_num: 1, + page_size: 50, + }).then((res) => { + console.log(res, "账单"); + res.rows.forEach((item) => { + item.check = false; + item.more = false; + item.community_order_rows.forEach((ite) => { + ite.check = false; + }); }); + this.Bill = res.rows; + resolve(); + }).catch((error) => { + reject(error); }); - this.Bill = res.rows; }); }, //账单详情切换展示显示 @@ -387,10 +432,8 @@ export default { checkChange(e, index) { this.Bill[index].check = !this.Bill[index].check; this.Bill[index].community_order_rows.forEach((item) => { - if (this.Bill[index].check) { - item.check = true; - } else { - item.check = false; + if (item.pay_status == 1) { + item.check = this.Bill[index].check; } }); @@ -490,6 +533,10 @@ export default { const fundAmount = Math.min(Number(this.balanceMoney), Number(this.currentMoney)); payParams.property_housing_fund = fundAmount.toFixed(2); + if (isComboPay && payParams.money == 0) { + this.payType = 2; + } + // 仅公积金支付 公积金不足 if (this.payType == 2 && !isComboPay) { if (Number(this.balanceMoney) < Number(this.currentMoney)) { @@ -504,7 +551,7 @@ export default { } // 组合支付 - if (isComboPay) { + if (isComboPay && (payParams.money != 0.00 ||payParams.money != 0)) { this.payType = 3; name_mini = "微信 + 物业公积金"; } @@ -522,14 +569,15 @@ export default { order_pay_id: res.id, } request(apiArr.tradeQuery, "POST", params).then(res => { - console.log("🚀 ~ createPay ~ res:", res) uni.showToast({ title: '支付成功', icon: 'success', duration: 2000 }); - this.getRoomSelect(); - this.getUserGovenmentMoney(); + setTimeout(() => { + this.getRoomSelect(); + this.getUserGovenmentMoney(); + }, 1500); }) }); } else if (res.cancel) { @@ -602,19 +650,24 @@ export default { //支付记录 getPayList() { - request(apiArr.getPayOrderList, "POST", { - room_id: this.currentRoom.room_id, - page_num: this.page_num, - page_size: this.page_size, - }).then((res) => { - let flag = false; - if (res.rows && (res.rows?.length == this.page_size)) { - flag = true; - } else { - flag = false; - } - this.flag = flag; - this.payOrderList = res.rows + return new Promise((resolve, reject) => { + request(apiArr.getPayOrderList, "POST", { + room_id: this.currentRoom.room_id, + page_num: this.page_num, + page_size: this.page_size, + }).then((res) => { + let flag = false; + if (res.rows && (res.rows?.length == this.page_size)) { + flag = true; + } else { + flag = false; + } + this.flag = flag; + this.payOrderList = res.rows; + resolve(); + }).catch((error) => { + reject(error); + }); }); },