Browse Source

预约看房

815
wangyx 1 week ago
parent
commit
181ad3cc0a
  1. 30
      pages/api.js
  2. 44
      pages/tabBar/work/index.vue
  3. 182
      pagesA/kfPage/list.vue

30
pages/api.js

@ -231,4 +231,34 @@ export function updateForceEvictionRecord(data) {
method: "put", method: "put",
params: data, params: data,
}); });
}
// 看房列表
export function listViewing(data) {
return request({
url: "/mz/showings/list",
method: "get",
params: data,
});
}
// 看房详情
export function viewingDetail(data) {
return request({
url: `/mz/showings/${data.id}`,
method: "get",
});
}
// 看房登记
export function viewingRegister(data) {
return request({
url: "/mz/showings/registration",
method: "post",
data: data,
});
}
// 预约看房提醒数量
export function getViewingCount() {
return request({
url: "/mz/showings/getReminderQuantity",
method: "get",
});
} }

44
pages/tabBar/work/index.vue

@ -14,6 +14,14 @@
> >
<image :src="item.image" class="itemImg"></image> <image :src="item.image" class="itemImg"></image>
<text class="itemText">{{ item.text }}</text> <text class="itemText">{{ item.text }}</text>
<u-badge
v-if="(item.count || 0) > 0"
:value="item.count"
type="error"
max="99"
absolute
:offset="[0, 4]"
/>
</view> </view>
</view> </view>
</view> </view>
@ -86,7 +94,7 @@
</template> </template>
<script> <script>
import { getRouters } from "../../../pages/api"; import { getRouters, getViewingCount } from "@/pages/api";
export default { export default {
data() { data() {
return { return {
@ -100,7 +108,7 @@ export default {
// { image: '/static/img/.png', text: '' }, // { image: '/static/img/.png', text: '' },
{ image: "/static/img/退房检查.png", text: "退房检查" }, { image: "/static/img/退房检查.png", text: "退房检查" },
{ image: "/static/img/释放.png", text: "释放房源检查" }, { image: "/static/img/释放.png", text: "释放房源检查" },
{ image: '/static/img/预约.png', text: '预约看房' }, { image: "/static/img/预约.png", text: "预约看房", count: 0 },
{ image: "/static/img/强制清退.png", text: "强制清退" }, { image: "/static/img/强制清退.png", text: "强制清退" },
], ],
xjList: [ xjList: [
@ -112,12 +120,12 @@ export default {
{ image: "/static/img/电费.png", text: "电量上报" }, { image: "/static/img/电费.png", text: "电量上报" },
], ],
bxList: [ bxList: [
{ image: '/static/img/上报.png', text: '上报' }, { image: "/static/img/上报.png", text: "上报" },
{ image: '/static/img/处理.png', text: '处理' }, { image: "/static/img/处理.png", text: "处理" },
], ],
bsList: [ bsList: [
{ image: '/static/img/上报.png', text: '上报' }, { image: "/static/img/上报.png", text: "上报" },
{ image: '/static/img/处理.png', text: '处理' }, { image: "/static/img/处理.png", text: "处理" },
], ],
}; };
}, },
@ -129,7 +137,18 @@ export default {
}); });
} }
}, },
onShow() {
this.getViewingCount();
},
methods: { methods: {
async getViewingCount() {
const res = await getViewingCount();
this.fyList.forEach((item) => {
if (item.text == "预约看房") {
item.count = res.data;
}
});
},
// //
async getRouter() { async getRouter() {
const res = await getRouters(); const res = await getRouters();
@ -143,7 +162,7 @@ export default {
if (menu.children) return hasMenu(menu.children, name); if (menu.children) return hasMenu(menu.children, name);
return false; return false;
} }
console.log('resdata',res.data) console.log("resdata", res.data);
this.showCheckOut = hasMenu(res.data || res, "Check_out"); this.showCheckOut = hasMenu(res.data || res, "Check_out");
this.showInspection = hasMenu(res.data || res, "Inspection"); this.showInspection = hasMenu(res.data || res, "Inspection");
this.showElectric = hasMenu(res.data || res, "ElectricMeterRecord"); this.showElectric = hasMenu(res.data || res, "ElectricMeterRecord");
@ -170,10 +189,10 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: "/pagesA/force/list/list", url: "/pagesA/force/list/list",
}); });
}else if (item.text == "预约看房"){ } else if (item.text == "预约看房") {
uni.navigateTo({ uni.navigateTo({
url: "/pagesA/kfPage/list" url: "/pagesA/kfPage/list",
}) });
} }
}, },
handleBxClick(item) { handleBxClick(item) {
@ -183,8 +202,8 @@ export default {
}); });
} else { } else {
uni.navigateTo({ uni.navigateTo({
url:"/pagesA/bxPage/bxReport" url: "/pagesA/bxPage/bxReport",
}) });
} }
}, },
handleBsClick(item) { handleBsClick(item) {
@ -260,6 +279,7 @@ export default {
} }
.conItem-cont-item { .conItem-cont-item {
position: relative;
width: 23%; width: 23%;
display: flex; display: flex;
justify-content: center; justify-content: center;

182
pagesA/kfPage/list.vue

@ -3,7 +3,7 @@
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="search-container"> <view class="search-container">
<u-search <u-search
v-model="searchPhone" v-model="queryParams.telephone"
placeholder="请输入手机号" placeholder="请输入手机号"
:show-action="false" :show-action="false"
:clearabled="true" :clearabled="true"
@ -20,7 +20,14 @@
<!-- 预约列表 --> <!-- 预约列表 -->
<view class="appointment-list"> <view class="appointment-list">
<scroll-view scroll-y="true"> <scroll-view
scroll-y="true"
:lower-threshold="80"
@scrolltolower="handleLoadMore"
:refresher-enabled="true"
:refresher-triggered="refreshing"
@refresherrefresh="handleRefresh"
>
<view <view
class="appointment-card" class="appointment-card"
v-for="item in filteredAppointmentList" v-for="item in filteredAppointmentList"
@ -30,7 +37,7 @@
<view class="card-header"> <view class="card-header">
<u-icon name="home" size="16" color="#08B3B3"></u-icon> <u-icon name="home" size="16" color="#08B3B3"></u-icon>
<text class="community-info" <text class="community-info"
>{{ item.community }} | {{ item.houseType }}</text >{{ item.apartmentName }} | {{ item.houseTypeName }}</text
> >
</view> </view>
@ -38,25 +45,31 @@
<view class="card-content"> <view class="card-content">
<view class="info-row"> <view class="info-row">
<text class="label">预约人</text> <text class="label">预约人</text>
<text class="value">{{ item.appointee }}</text> <text class="value">{{ item.graduateName }}</text>
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="label">预约人电话</text> <text class="label">预约人电话</text>
<text class="value">{{ item.phone }}</text> <text class="value">{{ item.telephone }}</text>
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="label">预约时间</text> <text class="label">预约时间</text>
<text class="value">{{ item.appointmentTime }}</text> <text class="value">{{ formatCheckInTime(
item.reservationTimeFrom,
item.reservationTimeTo
) }}</text>
</view> </view>
</view> </view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<view class="actionButtons"> <view class="actionButtons" v-if="item.state == 0">
<button class="btn process" @click="handleViewHouse(item)"> <button class="btn process" @click="handleViewHouse(item)">
看房登记 看房登记
</button> </button>
</view> </view>
</view> </view>
<!-- 底部加载与无更多提示 -->
<view class="list-footer" v-if="loadingMore">加载中...</view>
<view class="list-footer" v-else-if="!hasMore && appointmentList.length > 0">没有更多了</view>
</scroll-view> </scroll-view>
</view> </view>
@ -179,6 +192,7 @@
</template> </template>
<script> <script>
import { listViewing, viewingRegister,viewingDetail } from "@/pages/api";
export default { export default {
data() { data() {
return { return {
@ -204,9 +218,17 @@ export default {
idCard: "370832199606062002", idCard: "370832199606062002",
}, },
], ],
queryParams: {
pageNum: 1,
pageSize: 10,
},
total: 0,
hasMore: true,
refreshing: false,
loadingMore: false,
showRegisterPopup: false, // showRegisterPopup: false, //
currentAppointment: {}, // currentAppointment: {}, //
viewingStatus: "1", // (1: , 2: ) viewingStatus: "1", // (1: , 0: ,2: )
viewingStatusText: "已看房", // viewingStatusText: "已看房", //
viewingDescription: "", // viewingDescription: "", //
showStatusDropdown: false, // showStatusDropdown: false, //
@ -232,35 +254,125 @@ export default {
}, },
}, },
onLoad() { onLoad() {
this.loadAppointmentList(); this.resetAndLoad();
}, },
// //
onPullDownRefresh() { onPullDownRefresh() {
this.loadAppointmentList(); this.handleRefresh();
}, },
// //
onReachBottom() {}, onReachBottom() {
this.handleLoadMore();
},
methods: { 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() { loadAppointmentList() {
this.loading = true; if (this.loading || this.refreshing || this.loadingMore) {
// API //
setTimeout(() => { }
this.loading = false; // loading
// if (this.queryParams.pageNum === 1 && !this.refreshing) {
uni.stopPullDownRefresh(); this.loading = true;
}, 1000); }
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;
});
}, },
// //
handleSearch(value) { handleSearch(value) {
console.log("搜索:", value); this.queryParams.pageNum = 1;
// computed this.loadAppointmentList();
}, },
// //
handleClear() { handleClear() {
this.searchPhone = ""; this.queryParams = {
pageNum: 1,
pageSize: 10,
telephone: "",
};
this.loadAppointmentList();
}, },
// //
@ -303,6 +415,27 @@ export default {
}); });
return; return;
} }
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(() => {})
}, },
// //
@ -568,4 +701,11 @@ export default {
} }
} }
} }
.list-footer {
text-align: center;
color: #999;
font-size: 26rpx;
padding: 20rpx 0;
}
</style> </style>

Loading…
Cancel
Save