|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <div class="reservation tab-page position-relative">
|
|
|
|
|
|
+ <div class="reservation tab-page position-relative p-16">
|
|
<van-cell-group inset>
|
|
<van-cell-group inset>
|
|
<van-field
|
|
<van-field
|
|
v-model="params.aaa.text"
|
|
v-model="params.aaa.text"
|
|
@@ -74,25 +74,48 @@
|
|
/>
|
|
/>
|
|
</van-popup>
|
|
</van-popup>
|
|
|
|
|
|
|
|
+ <van-popup
|
|
|
|
+ v-model:show="showSites"
|
|
|
|
+ round
|
|
|
|
+ position="bottom"
|
|
|
|
+ safe-area-inset-bottom
|
|
|
|
+ >
|
|
|
|
+ <ChooseSite
|
|
|
|
+ :site-list="siteList"
|
|
|
|
+ @site-confirm="siteConfirm"
|
|
|
|
+ ></ChooseSite>
|
|
|
|
+ </van-popup>
|
|
|
|
+
|
|
<div class="result-box" v-if="resultList.length">
|
|
<div class="result-box" v-if="resultList.length">
|
|
- <div>我的剩余可约时段:{{ unApplyNumber }}</div>
|
|
|
|
|
|
+ <div class="tip">选择预约时段</div>
|
|
|
|
+ <div class="sub-tip">
|
|
|
|
+ <van-icon name="warning" color="#FF7D00" size="20" />
|
|
|
|
+ <span class="txt">我的剩余可约时段:{{ unApplyNumber }}</span>
|
|
|
|
+ </div>
|
|
<div class="list-box">
|
|
<div class="list-box">
|
|
- <div v-for="item in resultList" :key="item.timePeriodId">
|
|
|
|
- <div class="flex-h-between">
|
|
|
|
- <div>
|
|
|
|
- {{ $filters.dateFormat(item.timePeriodStart, "HH:mm") }}-{{
|
|
|
|
|
|
+ <div
|
|
|
|
+ v-for="item in resultList"
|
|
|
|
+ :key="item.timePeriodId"
|
|
|
|
+ class="flex-h-between list-item"
|
|
|
|
+ >
|
|
|
|
+ <div class="left d-flex align-items-center">
|
|
|
|
+ <span class="s1"
|
|
|
|
+ >{{ $filters.dateFormat(item.timePeriodStart, "HH:mm") }}-{{
|
|
$filters.dateFormat(item.timePeriodEnd, "HH:mm")
|
|
$filters.dateFormat(item.timePeriodEnd, "HH:mm")
|
|
- }}
|
|
|
|
- </div>
|
|
|
|
- <div>剩余{{ item.availableCount }}</div>
|
|
|
|
- <van-button
|
|
|
|
- type="primary"
|
|
|
|
- size="small"
|
|
|
|
- :disabled="item.status != '可约'"
|
|
|
|
- @click="reservation(item)"
|
|
|
|
- >{{ item.status }}</van-button
|
|
|
|
|
|
+ }}</span
|
|
>
|
|
>
|
|
|
|
+ <span class="s2">|</span>
|
|
|
|
+ <span class="s3">剩余{{ item.availableCount }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
+ <van-button
|
|
|
|
+ v-if="item.status === 'AVAILABLE'"
|
|
|
|
+ type="success"
|
|
|
|
+ size="small"
|
|
|
|
+ @click="reservationHandle(item)"
|
|
|
|
+ >预约</van-button
|
|
|
|
+ >
|
|
|
|
+ <span class="full" v-else-if="item.status === 'FULL'">约满</span>
|
|
|
|
+ <span class="stop" v-else>停止</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -112,12 +135,19 @@ import {
|
|
getDateList,
|
|
getDateList,
|
|
getReservationList,
|
|
getReservationList,
|
|
reservationSave,
|
|
reservationSave,
|
|
|
|
+ getSiteList,
|
|
} from "@/api/user";
|
|
} from "@/api/user";
|
|
import { useRouter } from "vue-router";
|
|
import { useRouter } from "vue-router";
|
|
import bus from "@/utils/bus";
|
|
import bus from "@/utils/bus";
|
|
|
|
+import { APPLY_STATUS } from "@/constants/dicts";
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
-
|
|
|
|
|
|
+const siteList = ref([]);
|
|
|
|
+function _getSiteList() {
|
|
|
|
+ getSiteList({ categoryId: params.bbb.value }).then((res) => {
|
|
|
|
+ siteList.value = res || [];
|
|
|
|
+ });
|
|
|
|
+}
|
|
const resultList = ref([]);
|
|
const resultList = ref([]);
|
|
const params = reactive({
|
|
const params = reactive({
|
|
aaa: { value: "", text: "" },
|
|
aaa: { value: "", text: "" },
|
|
@@ -126,6 +156,7 @@ const params = reactive({
|
|
date: { value: "", text: "" },
|
|
date: { value: "", text: "" },
|
|
});
|
|
});
|
|
const treeData = ref([]);
|
|
const treeData = ref([]);
|
|
|
|
+const showSites = ref(false);
|
|
const cityStates = reactive({
|
|
const cityStates = reactive({
|
|
show: false,
|
|
show: false,
|
|
value: [],
|
|
value: [],
|
|
@@ -155,6 +186,7 @@ const teachStates = reactive({
|
|
params.examSiteId = { value: "", text: "" };
|
|
params.examSiteId = { value: "", text: "" };
|
|
}
|
|
}
|
|
teachStates.show = false;
|
|
teachStates.show = false;
|
|
|
|
+ _getSiteList();
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
@@ -172,7 +204,8 @@ const dateStates = reactive({
|
|
});
|
|
});
|
|
|
|
|
|
const toChooseSite = () => {
|
|
const toChooseSite = () => {
|
|
- router.push({ name: "ChooseSite", params: { id: params.bbb.value } });
|
|
|
|
|
|
+ // router.push({ name: "ChooseSite", params: { id: params.bbb.value } });
|
|
|
|
+ showSites.value = true;
|
|
};
|
|
};
|
|
|
|
|
|
function _getCategoryList() {
|
|
function _getCategoryList() {
|
|
@@ -208,13 +241,13 @@ function _getReservationList() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-function reservation(item) {
|
|
|
|
|
|
+function reservationHandle(item) {
|
|
showConfirmDialog({
|
|
showConfirmDialog({
|
|
// title: '标题',
|
|
// title: '标题',
|
|
message: `${params.date.text} ${filters.dateFormat(
|
|
message: `${params.date.text} ${filters.dateFormat(
|
|
item.timePeriodStart,
|
|
item.timePeriodStart,
|
|
- "mm:ss"
|
|
|
|
- )}-${filters.dateFormat(item.timePeriodEnd, "mm:ss")}`,
|
|
|
|
|
|
+ "HH:mm"
|
|
|
|
+ )}-${filters.dateFormat(item.timePeriodEnd, "HH:mm")}`,
|
|
}).then(() => {
|
|
}).then(() => {
|
|
reservationSave({
|
|
reservationSave({
|
|
examSiteId: params.examSiteId.value,
|
|
examSiteId: params.examSiteId.value,
|
|
@@ -231,8 +264,77 @@ watch([() => params.examSiteId, () => params.date], ([examSiteId, date]) => {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
-bus.on("site-confirm", (obj) => {
|
|
|
|
|
|
+function siteConfirm(obj) {
|
|
params.examSiteId = { text: obj.examSiteName, value: obj.examSiteId };
|
|
params.examSiteId = { text: obj.examSiteName, value: obj.examSiteId };
|
|
-});
|
|
|
|
|
|
+ showSites.value = false;
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
-<style lang="less" scoped></style>
|
|
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
+.reservation {
|
|
|
|
+ .result-box {
|
|
|
|
+ .tip {
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ color: #8c8c8c;
|
|
|
|
+ margin-top: 16px;
|
|
|
|
+ }
|
|
|
|
+ .sub-tip {
|
|
|
|
+ height: 32px;
|
|
|
|
+ background: #fff7eb;
|
|
|
|
+ border-radius: 6px;
|
|
|
|
+ padding-left: 8px;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ margin-top: 12px;
|
|
|
|
+ .txt {
|
|
|
|
+ color: #262626;
|
|
|
|
+ margin-left: 4px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .list-box {
|
|
|
|
+ border-radius: var(--van-cell-group-inset-radius);
|
|
|
|
+ background: #fff;
|
|
|
|
+ padding: 0 var(--van-cell-horizontal-padding);
|
|
|
|
+ margin-top: 8px;
|
|
|
|
+ .list-item {
|
|
|
|
+ padding: var(--van-cell-vertical-padding) 0;
|
|
|
|
+ position: relative;
|
|
|
|
+ &:after {
|
|
|
|
+ position: absolute;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ content: " ";
|
|
|
|
+ pointer-events: none;
|
|
|
|
+ right: 0;
|
|
|
|
+ bottom: 0;
|
|
|
|
+ left: 0;
|
|
|
|
+ border-bottom: 0.02667rem solid var(--van-cell-border-color);
|
|
|
|
+ -webkit-transform: scaleY(0.5);
|
|
|
|
+ -ms-transform: scaleY(0.5);
|
|
|
|
+ transform: scaleY(0.5);
|
|
|
|
+ }
|
|
|
|
+ span.full {
|
|
|
|
+ color: #00b42a;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ }
|
|
|
|
+ span.stop {
|
|
|
|
+ color: #bfbfbf;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ }
|
|
|
|
+ .left {
|
|
|
|
+ .s1 {
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ color: #262626;
|
|
|
|
+ }
|
|
|
|
+ .s2 {
|
|
|
|
+ color: #bfbfbf;
|
|
|
|
+ margin: 0 7px;
|
|
|
|
+ }
|
|
|
|
+ .s3 {
|
|
|
|
+ color: #165dff;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</style>
|