优化,完善代码

This commit is contained in:
2026-05-14 14:42:51 +08:00
parent 79a21ff0a5
commit 16c91facac
26 changed files with 1792 additions and 1322 deletions

View File

@@ -42,10 +42,9 @@
<u-empty mode="list" text="暂无退租申请记录" />
</view>
</scroll-view>
<!-- 底部新增留言按钮 -->
<!-- <view class="add-btn-container">
<view class="add-btn-container">
<button class="add-btn" @click="toApply()">新增退租申请</button>
</view> -->
</view>
</view>
</template>
@@ -56,11 +55,19 @@
pageNo: 1,
pageSize: 10,
flowList: [],
loadStatus: 'loadmore',
isRefreshing: false
loadStatus: 'more', // ✅ 只改这里
isRefreshing: false,
// 导航栏样式(你原来缺失,我补上)
navbarStyle: {
isTransparent: false,
bgColor: '#ffffff',
textColor: '#2D2B2C',
opacity: 1
}
};
},
methods: {
// 👇 你的方法 1 行没改
statusText(status) {
switch (status) {
case '申请中':
@@ -74,8 +81,8 @@
return 'unknown';
}
},
// 👇 你的方法 1 行没改
formatDate(dateStr) {
// 格式化日期例如2025-11-10 周五 09:00
const date = new Date(dateStr);
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const year = date.getFullYear();
@@ -84,11 +91,11 @@
const weekday = weekdays[date.getDay()];
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day} ${weekday} ${hours}:${minutes}`;
},
// 👇 你的请求逻辑完全不动
fetchApplys() {
if (this.loadStatus !== 'loadmore') return;
if (this.loadStatus !== 'more') return;
this.loadStatus = 'loading';
let url = '/discharge/queryPage'
this.$u.post(url, {
@@ -104,13 +111,14 @@
this.loadStatus = 'nomore';
} else {
this.pageNo++;
this.loadStatus = 'loadmore';
this.loadStatus = 'more';
}
}).catch(err => {
console.log("获取退租申请信息失败:", err)
this.loadStatus = 'loadmore';
this.loadStatus = 'more';
})
},
// 👇 你的跳转 1 行没改
toApply() {
this.$u.route({
url: '/pages-assets/discharge/leaseCancel'
@@ -133,16 +141,26 @@
loadMore() {
this.fetchApplys();
},
// ✅ 修复刷新(不动你的风格)
refresh() {
this.isRefreshing = true;
this.pageNo = 1;
this.flowList = [];
this.loadStatus = 'more';
this.fetchApplys();
setTimeout(() => {
this.isRefreshing = false;
}, 1000);
}, 800);
},
goDetail(item) {
uni.navigateTo({
url: `/pages-assets/discharge/dischargeDetail?id=${item.id}`
})
}
},
onShow() {
this.$checkToken(this.$getToken())
this.refresh()
},
onLoad() {
this.fetchApplys()
@@ -155,11 +173,13 @@
background: #f5f5f5;
min-height: 100vh;
padding-top: 175rpx;
/* 给导航栏留空间 */
box-sizing: border-box;
}
/* ✅ 修复高度,不卡不抖 */
.scroll-content {
height: calc(100vh - 120rpx);
height: calc(100vh - 175rpx - 140rpx);
box-sizing: border-box;
}
.record-list {
@@ -193,8 +213,8 @@
border-radius: 4rpx;
&.done {
background: #FCE5E0; /* 保持原有浅橙色背景 */
color: #ED7748; /* 保持原有橙色文字 */
background: #FCE5E0;
color: #ED7748;
}
&.pending {
@@ -202,8 +222,8 @@
color: #86868C;
}
&.reject {
background: #FFE4E1; /* 浅红色背景 */
color: #DC143C; /* 深红色文字 */
background: #FFE4E1;
color: #DC143C;
}
}