wangyx 1 week ago
parent
commit
f7702aa0af
  1. 216
      pagesA/kfPage/list.vue

216
pagesA/kfPage/list.vue

@ -3,11 +3,7 @@
<!-- 搜索框 -->
<view class="search-container">
<u-search
<<<<<<< HEAD
v-model="searchPhone"
=======
v-model="queryParams.telephone"
>>>>>>> 815
placeholder="请输入手机号"
:show-action="false"
:clearabled="true"
@ -24,18 +20,7 @@
<!-- 预约列表 -->
<view class="appointment-list">
<<<<<<< HEAD
<scroll-view scroll-y="true">
=======
<scroll-view
scroll-y="true"
:lower-threshold="80"
@scrolltolower="handleLoadMore"
:refresher-enabled="true"
:refresher-triggered="refreshing"
@refresherrefresh="handleRefresh"
>
>>>>>>> 815
<view
class="appointment-card"
v-for="item in filteredAppointmentList"
@ -45,11 +30,7 @@
<view class="card-header">
<u-icon name="home" size="16" color="#08B3B3"></u-icon>
<text class="community-info"
<<<<<<< HEAD
>{{ item.community }} | {{ item.houseType }}</text
=======
>{{ item.apartmentName }} | {{ item.houseTypeName }}</text
>>>>>>> 815
>
</view>
@ -57,7 +38,6 @@
<view class="card-content">
<view class="info-row">
<text class="label">预约人</text>
<<<<<<< HEAD
<text class="value">{{ item.appointee }}</text>
</view>
<view class="info-row">
@ -67,40 +47,16 @@
<view class="info-row">
<text class="label">预约时间</text>
<text class="value">{{ item.appointmentTime }}</text>
=======
<text class="value">{{ item.graduateName }}</text>
</view>
<view class="info-row">
<text class="label">预约人电话</text>
<text class="value">{{ item.telephone }}</text>
</view>
<view class="info-row">
<text class="label">预约时间</text>
<text class="value">{{ formatCheckInTime(
item.reservationTimeFrom,
item.reservationTimeTo
) }}</text>
>>>>>>> 815
</view>
</view>
<!-- 操作按钮 -->
<<<<<<< HEAD
<view class="actionButtons">
=======
<view class="actionButtons" v-if="item.state == 0">
>>>>>>> 815
<button class="btn process" @click="handleViewHouse(item)">
看房登记
</button>
</view>
</view>
<<<<<<< HEAD
=======
<!-- 底部加载与无更多提示 -->
<view class="list-footer" v-if="loadingMore">加载中...</view>
<view class="list-footer" v-else-if="!hasMore && appointmentList.length > 0">没有更多了</view>
>>>>>>> 815
</scroll-view>
</view>
@ -223,10 +179,6 @@
</template>
<script>
<<<<<<< HEAD
=======
import { listViewing, viewingRegister,viewingDetail } from "@/pages/api";
>>>>>>> 815
export default {
data() {
return {
@ -252,23 +204,9 @@ export default {
idCard: "370832199606062002",
},
],
<<<<<<< HEAD
showRegisterPopup: false, //
currentAppointment: {}, //
viewingStatus: "1", // (1: , 2: )
=======
queryParams: {
pageNum: 1,
pageSize: 10,
},
total: 0,
hasMore: true,
refreshing: false,
loadingMore: false,
showRegisterPopup: false, //
currentAppointment: {}, //
viewingStatus: "1", // (1: , 0: ,2: )
>>>>>>> 815
viewingStatusText: "已看房", //
viewingDescription: "", //
showStatusDropdown: false, //
@ -294,7 +232,6 @@ export default {
},
},
onLoad() {
<<<<<<< HEAD
this.loadAppointmentList();
},
//
@ -313,136 +250,17 @@ export default {
//
uni.stopPullDownRefresh();
}, 1000);
=======
this.resetAndLoad();
},
//
onPullDownRefresh() {
this.handleRefresh();
},
//
onReachBottom() {
this.handleLoadMore();
},
methods: {
formatCheckInTime(fromTime, toTime) {
if (!fromTime || !toTime) {
return "";
}
try {
//
const fromDate = new Date(fromTime);
const fromDateStr = fromDate.toISOString().split("T")[0]; // YYYY-MM-DD
const fromTimeStr = fromDate.toTimeString().substring(0, 5); // HH:MM
//
const toDate = new Date(toTime);
const toTimeStr = toDate.toTimeString().substring(0, 5); // HH:MM
//
if (fromDateStr === toDate.toISOString().split("T")[0]) {
return `${fromDateStr} ${fromTimeStr}-${toTimeStr}`;
} else {
//
const toDateStr = toDate.toISOString().split("T")[0];
return `${fromDateStr} ${fromTimeStr}-${toDateStr} ${toTimeStr}`;
}
} catch (error) {
console.error("日期格式化错误:", error);
return "";
}
},
//
resetAndLoad() {
this.appointmentList = [];
this.queryParams.pageNum = 1;
this.hasMore = true;
this.refreshing = false;
this.loadingMore = false;
this.loadAppointmentList();
},
//
handleRefresh() {
if (this.loading || this.refreshing) return;
this.refreshing = true;
this.queryParams.pageNum = 1;
this.hasMore = true;
this.loadAppointmentList();
},
//
handleLoadMore() {
if (this.loading || this.loadingMore || !this.hasMore) return;
this.loadingMore = true;
this.loadAppointmentList();
},
//
loadAppointmentList() {
if (this.loading || this.refreshing || this.loadingMore) {
//
}
// loading
if (this.queryParams.pageNum === 1 && !this.refreshing) {
this.loading = true;
}
listViewing(this.queryParams)
.then((response) => {
const rows = Array.isArray(response?.rows) ? response.rows : [];
if (this.queryParams.pageNum === 1) {
this.appointmentList = rows;
} else if (rows.length) {
this.appointmentList = [...this.appointmentList, ...rows];
}
this.total = Number(response?.total || 0);
// pageSize total
const pageHasMore = rows.length >= this.queryParams.pageSize;
const totalHasMore = this.appointmentList.length < this.total;
this.hasMore = pageHasMore && (this.total ? totalHasMore : true);
if (this.hasMore) {
this.queryParams.pageNum++;
}
})
.catch((err) => {
//
})
.finally(() => {
//
if (this.refreshing) {
uni.stopPullDownRefresh();
this.refreshing = false;
}
this.loading = false;
this.loadingMore = false;
});
>>>>>>> 815
},
//
handleSearch(value) {
<<<<<<< HEAD
console.log("搜索:", value);
// computed
=======
this.queryParams.pageNum = 1;
this.loadAppointmentList();
>>>>>>> 815
},
//
handleClear() {
<<<<<<< HEAD
this.searchPhone = "";
=======
this.queryParams = {
pageNum: 1,
pageSize: 10,
telephone: "",
};
this.loadAppointmentList();
>>>>>>> 815
},
//
@ -485,30 +303,6 @@ export default {
});
return;
}
<<<<<<< HEAD
=======
const params = {
id: this.currentAppointment.id,
state: this.viewingStatus,
remark: this.viewingDescription,
};
viewingRegister(params)
.then((res) => {
if (res.code === 200) {
// toast
this.handleClosePopup();
this.$nextTick(() => {
uni.showToast({
title: '提交成功',
icon: 'none',
});
//
this.resetAndLoad();
});
}
})
.catch(() => {})
>>>>>>> 815
},
//
@ -774,14 +568,4 @@ export default {
}
}
}
<<<<<<< HEAD
=======
.list-footer {
text-align: center;
color: #999;
font-size: 26rpx;
padding: 20rpx 0;
}
>>>>>>> 815
</style>

Loading…
Cancel
Save