暂时提交

This commit is contained in:
2026-07-24 10:46:00 +08:00
parent 070f3bab4f
commit 9bf70e785e
15 changed files with 1133 additions and 630 deletions

View File

@@ -5,7 +5,7 @@
<!-- Tabs -->
<view class="tab-wrapper">
<u-tabs :list="tabList" :current="currentTab" @change="onTabChange" lineColor="#EA4D3E" activeColor="#EA4D3E"
<u-tabs :list="tabList" :current="currentTab" @change="onTabChange" lineColor="#0088FE" activeColor="#0088FE"
itemStyle="padding: 0 30rpx;"></u-tabs>
</view>
@@ -16,20 +16,36 @@
<scroll-view scroll-y class="scroll-content" @scrolltolower="loadMore" :refresher-enabled="true"
:refresher-triggered="isRefreshing" @refresherrefresh="refresh">
<view v-if="contracts.length > 0" class="contract-list">
<view class="contract-card" v-for="item in contracts" :key="item.contractNo" @click="goDetail(item)">
<image class="contract-cover" :src="staticHost + (item.coverImgUrl || defaultCover)" mode="aspectFill" />
<view class="contract-info">
<view class="top-row">
<text class="asset-name">{{ $ellipsis(item.contractName,12) }}</text>
<u-icon name="arrow-right" size="28" color="#ccc" />
</view>
<view class="date-range">{{ item.startDate }} ~ {{ item.endDate }}</view>
<view :class="['contract-card', { 'is-expired': item.signStatus === 'expired' }]" v-for="item in contracts" :key="item.contractNo" @click="goDetail(item)">
<view class="card-header">
<text class="contract-name">{{ $ellipsis(item.contractName, 12) }}</text>
<view :class="['status-tag', item.signStatus]">
{{ getStatusText(item.signStatus) }}
</view>
</view>
<view class="card-divider"></view>
<view class="card-body">
<view class="info-row">
<view class="info-item">
<text class="info-label">合同类型</text>
<text class="info-value">电子合同</text>
</view>
<view class="info-item">
<text class="info-label">租金</text>
<text class="info-value">{{ item.contractNo }}</text>
</view>
</view>
<view class="info-row">
<view class="info-item">
<text class="info-label">开始日期</text>
<text class="info-value">{{ item.startDate }}</text>
</view>
<view class="info-item">
<text class="info-label">结束日期</text>
<text class="info-value">{{ item.endDate }}</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="loadStatus" />
@@ -74,9 +90,9 @@ export default {
},
async onShow() {
try {
await this.$checkToken(this.$getToken())
// await this.$checkToken(this.$getToken())
// token 有效,继续执行
this.checkOaAuth()
// this.checkOaAuth()
this.loadContracts()
} catch (e) {
// token 无效,$checkToken 内部已处理跳转登录页
@@ -127,41 +143,68 @@ export default {
this.loadContracts();
},
loadContracts() {
// ✅ 正确判断加载状态
if (this.loadStatus !== 'more') return;
this.loadStatus = 'loading';
this.$u.post('/contract/queryPage', {
pageNo: this.pageNo,
pageSize: this.pageSize,
startDate: this.startDate,
endDate: this.endDate,
signStatus: this.statusFilter
}, {
WT: this.$getToken()
}).then(result => {
const rows = result.data.result || [];
// TODO: 接口联调时取消注释,删除 mock 数据
// this.$u.post('/contract/queryPage', {
// pageNo: this.pageNo,
// pageSize: this.pageSize,
// startDate: this.startDate,
// endDate: this.endDate,
// signStatus: this.statusFilter
// }, {
// WT: this.$getToken()
// }).then(result => {
// const rows = result.data.result || [];
// if (this.pageNo === 1 && rows.length === 0) {
// this.contracts = [];
// this.loadStatus = 'nomore';
// return;
// }
// this.contracts = this.contracts.concat(rows);
// if (rows.length < this.pageSize) {
// this.loadStatus = 'nomore';
// } else {
// this.pageNo++;
// this.loadStatus = 'more';
// }
// }).catch(err => {
// console.log("获取合同信息失败:", err);
// this.loadStatus = 'more';
// }).finally(() => {
// this.isRefreshing = false;
// });
if (this.pageNo === 1 && rows.length === 0) {
this.contracts = [];
this.loadStatus = 'nomore';
return;
// Mock 静态数据
const mockData = [
{
contractNo: 'HT-2026-001',
contractName: '东山大道435-2-1-104号房屋租赁合同',
startDate: '2026-01-01',
endDate: '2026-12-31',
signStatus: 'signed'
},
{
contractNo: 'HT-2026-002',
contractName: '夷陵大道418号房屋租赁合同',
startDate: '2026-03-01',
endDate: '2027-02-28',
signStatus: 'pending'
},
{
contractNo: 'HT-2025-003',
contractName: '解放路88-1-502号房屋租赁合同',
startDate: '2025-01-01',
endDate: '2025-12-31',
signStatus: 'expired'
}
];
this.contracts = this.contracts.concat(rows);
if (rows.length < this.pageSize) {
this.loadStatus = 'nomore';
} else {
this.pageNo++;
this.loadStatus = 'more'; // ✅ 修复
}
}).catch(err => {
console.log("获取合同信息失败:", err);
this.loadStatus = 'more'; // ✅ 异常恢复
}).finally(() => {
this.isRefreshing = false;
});
if (this.pageNo === 1) this.contracts = [];
this.contracts = this.contracts.concat(mockData);
this.loadStatus = 'nomore';
this.isRefreshing = false;
},
refresh() {
this.isRefreshing = true;
@@ -205,79 +248,108 @@ export default {
.contract-list {
padding: 20rpx;
}
.card-info {
flex: 1;
margin-left: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20rpx;
}
.card-divider {
height: 1rpx;
background-color: #f0f0f0;
}
.contract-card {
display: flex;
background: #fff;
border-radius: 16rpx;
margin-bottom: 24rpx;
padding: 20rpx;
padding: 24rpx;
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
position: relative;
}
.contract-cover {
width: 193rpx;
height: 145rpx;
border-radius: 10rpx;
background-color: #FCE5E0;
flex-shrink: 0;
}
.contract-info {
flex: 1;
margin-left: 20rpx;
display: flex;
flex-direction: column;
position: relative;
}
.top-row {
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
.asset-name {
font-size: 30rpx;
font-weight: bold;
color: #333;
flex: 1;
}
padding-bottom: 20rpx;
}
.asset-room {
font-size: 26rpx;
color: #555;
margin-top: 18rpx;
}
.date-range {
font-size: 24rpx;
color: #888;
margin-top: 20rpx;
.contract-name {
font-size: 30rpx;
font-weight: 600;
color: #333;
flex: 1;
}
.status-tag {
position: absolute;
bottom: 20rpx;
right: 0rpx;
padding: 12rpx 15rpx;
border-radius: 6rpx;
font-size: 26rpx;
font-size: 24rpx;
padding: 6rpx 16rpx;
border-radius: 8rpx;
flex-shrink: 0;
&.pending {
background: #FEEDDD;
color: #EFA049;
background: #FF8D1A;
color: #fff;
}
&.signed {
background: #FCE5E0;
color: #ED7748;
background: #0088FE;
color: #fff;
}
&.expired {
background: #CDCDCD;
color: #969696;
background: #A6A6A6;
color: #fff;
}
}
.card-divider {
height: 1rpx;
background-color: #f0f0f0;
}
.card-body {
padding-top: 20rpx;
}
.info-row {
display: flex;
margin-bottom: 16rpx;
padding: 20rpx 0;
&:last-child {
margin-bottom: 0;
}
}
.info-item {
flex: 1;
display: flex;
}
.info-label {
font-size: 24rpx;
color: #999;
margin-right: 8rpx;
flex-shrink: 0;
}
.info-value {
font-size: 24rpx;
color: #333;
}
.is-expired {
.contract-name,
.info-label,
.info-value {
color: #A6A6A6 !important;
}
}