fix(workOrderDashboard): 修复图片URL处理逻辑并优化钱包页面代码

修复社区列表图片URL处理逻辑,当pic为空时返回空字符串而非拼接无效URL。优化钱包页面代码格式,调整onLoad和onShow生命周期方法顺序,保持代码逻辑清晰。
This commit is contained in:
赵毅 2025-11-01 09:54:46 +08:00
parent fbc48066f6
commit f697ec362c
2 changed files with 21 additions and 18 deletions

View File

@ -17,15 +17,18 @@
<view class="walletBox"> <view class="walletBox">
<view class="walletBox_top">钱包</view> <view class="walletBox_top">钱包</view>
<view class="walletBox_content"> <view class="walletBox_content">
<view class="walletBox_item" @click="goWallet(1, walletInfo.receivable ? walletInfo.receivable.toFixed(2) : '0.00')"> <view class="walletBox_item"
@click="goWallet(1, walletInfo.receivable ? walletInfo.receivable.toFixed(2) : '0.00')">
<view>{{ walletInfo.receivable ? walletInfo.receivable.toFixed(2) : "0.00" }}</view> <view>{{ walletInfo.receivable ? walletInfo.receivable.toFixed(2) : "0.00" }}</view>
<view class="walletBox_item_text">应收</view> <view class="walletBox_item_text">应收</view>
</view> </view>
<view class="walletBox_item" @click="goWallet(2, walletInfo.received ? walletInfo.received.toFixed(2) : '0.00')"> <view class="walletBox_item"
@click="goWallet(2, walletInfo.received ? walletInfo.received.toFixed(2) : '0.00')">
<view>{{ walletInfo.received ? walletInfo.received.toFixed(2) : "0.00" }}</view> <view>{{ walletInfo.received ? walletInfo.received.toFixed(2) : "0.00" }}</view>
<view class="walletBox_item_text">已收</view> <view class="walletBox_item_text">已收</view>
</view> </view>
<view class="walletBox_item" @click="goWallet(3, walletInfo.pending ? walletInfo.pending.toFixed(2) : '0.00')"> <view class="walletBox_item"
@click="goWallet(3, walletInfo.pending ? walletInfo.pending.toFixed(2) : '0.00')">
<view>{{ walletInfo.pending ? walletInfo.pending.toFixed(2) : "0.00" }}</view> <view>{{ walletInfo.pending ? walletInfo.pending.toFixed(2) : "0.00" }}</view>
<view class="walletBox_item_text">待收物业费</view> <view class="walletBox_item_text">待收物业费</view>
</view> </view>
@ -76,6 +79,18 @@ export default {
} }
}, },
async onLoad() { async onLoad() {
},
async onShow() {
const changeCommData = uni.getStorageSync('changeWorkOrderData');
this.communityVal = changeCommData ? changeCommData.name : "切换小区";
if (changeCommData) {
const params = {
community_id: changeCommData.id,
}
const res = await request(apiArr.communityInfo, "POST", params);
uni.setStorageSync('allow_grab_order', res.allow_grab_order == 1 ? true : false);
}
const workOrderPermission = uni.getStorageSync('work_order_permission'); const workOrderPermission = uni.getStorageSync('work_order_permission');
const orderDispatchPermission = uni.getStorageSync('order_dispatch_permission'); const orderDispatchPermission = uni.getStorageSync('order_dispatch_permission');
this.showWorkOrderSection = !(workOrderPermission === false && orderDispatchPermission === false); this.showWorkOrderSection = !(workOrderPermission === false && orderDispatchPermission === false);
@ -111,18 +126,6 @@ export default {
this.getWalletInfo(); this.getWalletInfo();
}); });
}, },
async onShow() {
const changeCommData = uni.getStorageSync('changeWorkOrderData');
this.communityVal = changeCommData ? changeCommData.name : "切换小区";
if (changeCommData) {
const params = {
community_id: changeCommData.id,
}
const res = await request(apiArr.communityInfo, "POST", params);
uni.setStorageSync('allow_grab_order', res.allow_grab_order == 1 ? true : false);
}
},
methods: { methods: {
// //
getWalletInfo() { getWalletInfo() {
@ -149,8 +152,8 @@ export default {
// if (type == 2) { // if (type == 2) {
// return // return
// } // }
NavgateTo('/packages/workOrderDashboard/wallet/index?type=' + type + '&community_id=' + changeCommData.id + '&amount=' + amount); NavgateTo('/packages/workOrderDashboard/wallet/index?type=' + type + '&community_id=' + changeCommData.id + '&amount=' + amount);
}, },
addCommunity() { addCommunity() {
NavgateTo("/packages/workOrderDashboard/myCommunity/index"); NavgateTo("/packages/workOrderDashboard/myCommunity/index");
}, },

View File

@ -60,7 +60,7 @@ export default {
user_id: uni.getStorageSync('userId'), user_id: uni.getStorageSync('userId'),
}).then(res => { }).then(res => {
res.rows.forEach(item => { res.rows.forEach(item => {
item.pic = item.pic.startsWith('http') ? item.pic : picUrl + item.pic item.pic = item.pic ? (item.pic.startsWith('http') ? item.pic : picUrl + item.pic) : ''
}); });
this.communityList = res.rows this.communityList = res.rows
}) })