|
@@ -4,13 +4,19 @@
|
|
|
<van-cell title="已预约" />
|
|
|
<van-cell v-for="(item, i) in mainList" :key="i" :title="item.userName">
|
|
|
<template #default>
|
|
|
- {{ item.orderTime }}
|
|
|
- <van-icon
|
|
|
- name="close"
|
|
|
- color="#fb5f5c"
|
|
|
- @click="() => removequeue(item.id, i)"
|
|
|
+ <div>
|
|
|
+ {{ item.orderTime }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #label>
|
|
|
+ <van-button
|
|
|
v-if="item.self"
|
|
|
- />
|
|
|
+ @click="() => removequeue(item.id)"
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ >
|
|
|
+ 取消预约
|
|
|
+ </van-button>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
</div>
|
|
@@ -48,25 +54,26 @@ import {
|
|
|
Sidebar as vanSidebar,
|
|
|
SidebarItem as vanSidebarItem,
|
|
|
Cell as vanCell,
|
|
|
- Icon as vanIcon,
|
|
|
Button as vanButton,
|
|
|
Dialog,
|
|
|
+ Toast,
|
|
|
} from "vant";
|
|
|
import "vant/lib/sidebar/style/index";
|
|
|
import "vant/lib/button/style/index";
|
|
|
import "vant/lib/cell/style/index";
|
|
|
import "vant/lib/icon/style/index";
|
|
|
+import "vant/lib/toast/style/index";
|
|
|
import "vant/lib/dialog/style/index";
|
|
|
import "vant/lib/sidebar-item/style/index";
|
|
|
|
|
|
import {
|
|
|
orderList,
|
|
|
cancel,
|
|
|
- getAPPUser,
|
|
|
- getAPPToken,
|
|
|
- getAPPUserDetail,
|
|
|
+ // getAPPUser,
|
|
|
+ // getAPPToken,
|
|
|
+ // getAPPUserDetail,
|
|
|
} from "../api/index";
|
|
|
-import { urlSearchData } from "../utils/tool";
|
|
|
+// import { urlSearchData } from "../utils/tool";
|
|
|
|
|
|
export default {
|
|
|
name: "Appointment",
|
|
@@ -81,61 +88,86 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.phone = this.$route.query.phone || "";
|
|
|
+ this.name = this.$route.query.userName || "";
|
|
|
localStorage.token = "";
|
|
|
- let search = urlSearchData();
|
|
|
+ // let search = urlSearchData();
|
|
|
document.title = "美发预约系统";
|
|
|
const that = this;
|
|
|
- getAPPUser({
|
|
|
- ticket: search.ticket,
|
|
|
- }).then(r => {
|
|
|
- getAPPToken("rest/63bada00-7d01-4acc-ab2b-df8061eeeb8f").then(res => {
|
|
|
- const t = JSON.parse(res || "{}");
|
|
|
- localStorage.token = t.id;
|
|
|
- getAPPUserDetail({
|
|
|
- loginName: r,
|
|
|
- }).then(detail => {
|
|
|
- const obj = JSON.parse(detail || "{}");
|
|
|
- console.log(obj);
|
|
|
- that.phone = obj.telNumber;
|
|
|
- that.name = obj.name;
|
|
|
- orderList({
|
|
|
- userPhone: that.phone || "",
|
|
|
- }).then(res => {
|
|
|
- const li = res || [];
|
|
|
- let l = [];
|
|
|
- li.sort((a, b) => {
|
|
|
- return new Date(a.orderTime) - new Date(b.orderTime);
|
|
|
- });
|
|
|
- for (let i = 0; i < li.length; i++) {
|
|
|
- const v = li[i];
|
|
|
- v.orderTime = v.orderTime.replace(/:00$/, "");
|
|
|
- let key = v.orderTime.split(" ")[0];
|
|
|
- if (that.group[key]) {
|
|
|
- that.group[key].push(v);
|
|
|
- } else {
|
|
|
- l.push(key);
|
|
|
- that.group[key] = [v];
|
|
|
- }
|
|
|
- }
|
|
|
- that.dataList = l;
|
|
|
- that.onChange();
|
|
|
- });
|
|
|
- });
|
|
|
+ orderList({
|
|
|
+ userPhone: that.phone || "",
|
|
|
+ }).then(res => {
|
|
|
+ const li = res || [];
|
|
|
+ let l = [];
|
|
|
+ li.sort((a, b) => {
|
|
|
+ return new Date(a.orderTime) - new Date(b.orderTime);
|
|
|
});
|
|
|
+ for (let i = 0; i < li.length; i++) {
|
|
|
+ const v = li[i];
|
|
|
+ v.orderTime = v.orderTime.replace(/:00$/, "");
|
|
|
+ let key = v.orderTime.split(" ")[0];
|
|
|
+ if (that.group[key]) {
|
|
|
+ that.group[key].push(v);
|
|
|
+ } else {
|
|
|
+ l.push(key);
|
|
|
+ that.group[key] = [v];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ that.dataList = l;
|
|
|
+ that.onChange();
|
|
|
});
|
|
|
+ // getAPPUser({
|
|
|
+ // ticket: search.ticket,
|
|
|
+ // }).then(r => {
|
|
|
+ // getAPPToken("rest/63bada00-7d01-4acc-ab2b-df8061eeeb8f").then(res => {
|
|
|
+ // const t = JSON.parse(res || "{}");
|
|
|
+ // localStorage.token = t.id;
|
|
|
+ // getAPPUserDetail({
|
|
|
+ // loginName: r,
|
|
|
+ // }).then(detail => {
|
|
|
+ // const obj = JSON.parse(detail || "{}");
|
|
|
+ // console.log(obj);
|
|
|
+ // that.phone = obj.telNumber;
|
|
|
+ // that.name = obj.name;
|
|
|
+ // orderList({
|
|
|
+ // userPhone: that.phone || "",
|
|
|
+ // }).then(res => {
|
|
|
+ // const li = res || [];
|
|
|
+ // let l = [];
|
|
|
+ // li.sort((a, b) => {
|
|
|
+ // return new Date(a.orderTime) - new Date(b.orderTime);
|
|
|
+ // });
|
|
|
+ // for (let i = 0; i < li.length; i++) {
|
|
|
+ // const v = li[i];
|
|
|
+ // v.orderTime = v.orderTime.replace(/:00$/, "");
|
|
|
+ // let key = v.orderTime.split(" ")[0];
|
|
|
+ // if (that.group[key]) {
|
|
|
+ // that.group[key].push(v);
|
|
|
+ // } else {
|
|
|
+ // l.push(key);
|
|
|
+ // that.group[key] = [v];
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // that.dataList = l;
|
|
|
+ // that.onChange();
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // });
|
|
|
},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
toAppointment() {
|
|
|
this.$router.push({
|
|
|
name: "Apply",
|
|
|
- params: { name: this.name, phone: this.phone }
|
|
|
+ params: { name: this.name, phone: this.phone },
|
|
|
});
|
|
|
},
|
|
|
onChange() {
|
|
|
this.mainList = this.group[this.dataList[this.activeKey]];
|
|
|
},
|
|
|
- removequeue(id, i) {
|
|
|
+ removequeue(id) {
|
|
|
+ let that = this;
|
|
|
Dialog.confirm({
|
|
|
title: "取消预约",
|
|
|
message: "确定要取消该预约?",
|
|
@@ -145,7 +177,31 @@ export default {
|
|
|
cancel({
|
|
|
id,
|
|
|
}).then(() => {
|
|
|
- this.group[this.dataList[this.activeKey]].splice(i, 1);
|
|
|
+ orderList({
|
|
|
+ userPhone: that.phone || "",
|
|
|
+ }).then(res => {
|
|
|
+ Toast("已取消预约");
|
|
|
+ const li = res || [];
|
|
|
+ let l = [],
|
|
|
+ group = {};
|
|
|
+ li.sort((a, b) => {
|
|
|
+ return new Date(a.orderTime) - new Date(b.orderTime);
|
|
|
+ });
|
|
|
+ for (let i = 0; i < li.length; i++) {
|
|
|
+ const v = li[i];
|
|
|
+ v.orderTime = v.orderTime.replace(/:00$/, "");
|
|
|
+ let key = v.orderTime.split(" ")[0];
|
|
|
+ if (group[key]) {
|
|
|
+ group[key].push(v);
|
|
|
+ } else {
|
|
|
+ l.push(key);
|
|
|
+ group[key] = [v];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ that.dataList = l;
|
|
|
+ that.group = group;
|
|
|
+ that.onChange();
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
},
|
|
@@ -157,7 +213,6 @@ export default {
|
|
|
vanSidebar,
|
|
|
vanCell,
|
|
|
vanSidebarItem,
|
|
|
- vanIcon,
|
|
|
vanButton,
|
|
|
},
|
|
|
};
|
|
@@ -165,7 +220,7 @@ export default {
|
|
|
|
|
|
<style>
|
|
|
.Appointment {
|
|
|
- height: 120%;
|
|
|
+ height: 100%;
|
|
|
box-sizing: border-box;
|
|
|
background-color: #f7f8fa;
|
|
|
}
|