暂时提交

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

@@ -20,51 +20,37 @@
:key="item.id"
class="record-card"
>
<!-- 资产名称和状态 -->
<!-- 预约时间 + 状态 -->
<view class="card-header">
<text class="asset-name">{{ item.assetName }}</text>
<text
:class="['record-status', item.status]"
>
<text class="reserve-time">{{ formatDate(item.date) }} 看房</text>
<text :class="['record-status', item.status]">
{{ statusText(item.status) }}
</text>
</view>
<!-- 内容部 -->
<view class="card-content">
<!-- 预约时间 -->
<view class="info-item">
<text class="info-label">预约时间</text>
<text class="info-value">{{ formatDate(item.date) }}</text>
</view>
<!-- 割线 -->
<view class="card-divider"></view>
<!-- 地址 -->
<view class="info-item">
<text class="info-label">地址</text>
<text class="info-value">{{ item.assetAddress }}</text>
</view>
<!-- 管家 -->
<view class="info-item">
<text class="info-label">管家</text>
<text class="info-value">{{ item.managerName || '未知'}}{{ item.managerPhone || '未知'}}</text>
<!-- 内容区左图右信息 -->
<view class="card-body">
<image class="cover-img" :src="staticHost + (item.coverImg || '/public/static/index/assets.jpg')" mode="aspectFill"></image>
<view class="card-info">
<text class="asset-name">{{ item.assetName }}</text>
<view class="info-row">
<u-icon name="map" size="26" color="#999"></u-icon>
<text class="info-text">{{ item.assetAddress }}</text>
</view>
<view class="info-row">
<u-icon name="account" size="26" color="#999"></u-icon>
<text class="info-text">{{ item.managerName || '未知' }}{{ item.managerPhone || '未知' }}</text>
</view>
</view>
</view>
<!-- 操作按钮 -->
<view class="action-buttons">
<button
class="location-btn"
@click="viewLocation(item)"
>
查看位置
</button>
<button
class="call-btn"
@click="callManager(item.managerPhone)"
>
拨打电话
</button>
<button class="location-btn" @click="viewLocation(item)">查看位置</button>
<button class="call-btn" @click="callManager(item.managerPhone)">拨打电话</button>
</view>
</view>
@@ -100,13 +86,18 @@ export default {
},
async onShow() {
try {
await this.$checkToken(this.$getToken())
// await this.$checkToken(this.$getToken())
this.fetchReserve()
} catch (e) {
return
}
},
// ✅ 删除 scroll-view 冲突的 onReachBottom
computed: {
staticHost() {
return this.$config.staticUrl
}
},
methods: {
statusText(status) {
switch (status) {
@@ -132,31 +123,62 @@ export default {
return `${year}-${month}-${day} ${weekday} ${hours}:${minutes}`;
},
fetchReserve(){
// ✅ 正确判断加载状态
if (this.loadStatus !== 'more') return;
this.loadStatus = 'loading';
let url = '/reservate/queryPage'
this.$u.post(url, {
pageNo: this.pageNo,
pageSize: this.pageSize
},{
WT: this.$getToken()
}).then(res => {
const rows = res.data.result || [];
if (this.pageNo === 1) this.flowList = [];
this.flowList = this.flowList.concat(rows);
// ✅ 判断是否还有更多数据
if (rows.length < this.pageSize) {
this.loadStatus = 'nomore';
} else {
this.pageNo++;
this.loadStatus = 'more';
this.loadStatus = 'loading';
// TODO: 接口联调时取消注释,删除 mock 数据
// let url = '/reservate/queryPage'
// this.$u.post(url, {
// pageNo: this.pageNo,
// pageSize: this.pageSize
// },{
// WT: this.$getToken()
// }).then(res => {
// const rows = res.data.result || [];
// if (this.pageNo === 1) this.flowList = [];
// this.flowList = this.flowList.concat(rows);
// if (rows.length < this.pageSize) {
// this.loadStatus = 'nomore';
// } else {
// this.pageNo++;
// this.loadStatus = 'more';
// }
// }).catch(err => {
// console.log("获取预约记录失败:", err)
// this.loadStatus = 'more';
// })
// Mock 静态数据
const mockData = [
{
id: '1',
assetName: '东山大道435-2-1-104号',
status: 'pending',
date: '2026-06-28 14:00:00',
assetAddress: '宜昌市西陵区东山大道435号',
managerName: '张管家',
managerPhone: '13800138001',
lat: 30.7086,
lng: 111.2842,
coverImg: '/public/static/index/assets.jpg'
},
{
id: '2',
assetName: '夷陵大道418号',
status: 'done',
date: '2026-06-20 10:30:00',
assetAddress: '宜昌市西陵区夷陵大道418号',
managerName: '李管家',
managerPhone: '13800138002',
lat: 30.7120,
lng: 111.2900,
coverImg: '/public/static/index/assets.jpg'
}
}).catch(err => {
console.log("获取预约记录失败:", err)
this.loadStatus = 'more'; // ✅ 异常恢复
})
];
if (this.pageNo === 1) this.flowList = [];
this.flowList = this.flowList.concat(mockData);
this.loadStatus = 'nomore';
},
viewLocation(item) {
uni.openLocation({
@@ -198,7 +220,6 @@ export default {
.reserve-records {
min-height: 100vh;
padding-top: 175rpx;
background: linear-gradient(0deg, #F3F1ED 43%, #F5E9DB 100%);
box-sizing: border-box;
}
@@ -209,13 +230,13 @@ export default {
}
.record-list {
padding: 30rpx 40rpx;
padding: 30rpx 20rpx;
}
.record-card {
background: #fff;
border-radius: 12rpx;
padding: 32rpx;
padding: 25rpx;
margin-bottom: 30rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
}
@@ -224,63 +245,79 @@ export default {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
padding-bottom: 20rpx;
}
.asset-name {
font-size: 32rpx;
.reserve-time {
font-size: 30rpx;
font-weight: 500;
color: #2D2B2C;
color: #333;
}
.record-status {
font-size: 26rpx;
padding: 10rpx 15rpx;
font-size: 28rpx;
padding: 6rpx 16rpx;
border-radius: 4rpx;
&.done {
background: #FCE5E0;
color: #ED7748;
background: #fff;
color: #0088FE;
}
&.pending {
background: #F2F3F7;
color: #86868C;
background: #fff;
color: #FF8D1A;
}
}
.card-content {
margin-bottom: 32rpx;
.card-divider {
height: 1rpx;
background-color: #f0f0f0;
}
.info-item {
.card-body {
display: flex;
align-items: flex-start;
padding: 24rpx 0;
}
.info-item:last-child {
margin-bottom: 0;
}
.info-label {
font-size: 24rpx;
color: #666;
width: 120rpx;
.cover-img {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
flex-shrink: 0;
line-height: 44rpx;
background-color: #f5f5f5;
}
.info-value {
font-size: 24rpx;
color: #333;
.card-info {
flex: 1;
line-height: 44rpx;
margin-left: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.asset-name {
font-size: 30rpx;
font-weight: 600;
color: #2D2B2C;
margin-bottom: 12rpx;
}
.info-row {
display: flex;
align-items: center;
margin-bottom: 8rpx;
}
.info-text {
font-size: 24rpx;
color: #999;
margin-left: 8rpx;
}
.action-buttons {
display: flex;
justify-content: flex-end;
gap: 20rpx;
margin-top: 32rpx;
padding-top: 32rpx;
padding-top: 20rpx;
border-top: 1rpx solid #f0f0f0;
}
@@ -288,20 +325,20 @@ export default {
width: 220rpx;
height: 72rpx;
background: #fff;
color: #2D2B2C;
color: #0088FE;
font-size: 28rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
border: 1px solid #222222;
border: 1px solid #0088FE;
}
.call-btn {
width: 220rpx;
height: 72rpx;
background: #ff3b30;
background: #0088FE;
color: #fff;
font-size: 28rpx;
border-radius: 8rpx;