liyongli 3 yıl önce
ebeveyn
işleme
99cc8bf561
4 değiştirilmiş dosya ile 75 ekleme ve 48 silme
  1. 5 20
      src/views/Apply.vue
  2. 1 1
      src/views/Applyreal.vue
  3. 46 10
      src/views/Appointment.vue
  4. 23 17
      src/views/Queue.vue

+ 5 - 20
src/views/Apply.vue

@@ -43,11 +43,6 @@
         </van-button>
       </div>
     </van-form>
-    <div style="margin: 16px">
-      <van-button round block type="default" @click="toAppointment">
-        查看预约
-      </van-button>
-    </div>
 
     <!-- #2a7ef4 -->
     <van-popup v-model="dateInput" position="bottom">
@@ -80,8 +75,7 @@ import "vant/lib/button/style/index";
 import "vant/lib/popup/style/index";
 import "vant/lib/picker/style/index";
 
-import { goodsList, apply, applyrang, getAPPUser } from "../api/index";
-import { urlSearchData } from "../utils/tool";
+import { goodsList, apply, applyrang } from "../api/index";
 
 export default {
   name: "Apply",
@@ -107,12 +101,6 @@ export default {
   mounted() {
     this.userphone = this.$route.query.phone || "";
     this.username = this.$route.query.userName || "";
-    let search = urlSearchData();
-    document.title = "预定";
-    search.webviewId &&
-      getAPPUser({ ticket: search.webviewId }).then(res => {
-        console.log(res);
-      });
     goodsList().then(res => {
       this.goodsLi = res || [];
       this.radio = (this.goodsLi[0] || {}).id;
@@ -153,12 +141,6 @@ export default {
       }
       return options;
     },
-    toAppointment() {
-      this.$router.push({
-        name: "Appointment",
-        query: { phone: this.nextSearch.userphone },
-      });
-    },
     onSubmit() {
       this.nextSearch = {
         userName: this.username,
@@ -172,7 +154,10 @@ export default {
         goodsId: this.radio,
         orderTime: this.date + ":00",
       }).then(() => {
-        this.toAppointment();
+        this.$router.push({
+          name: "Appointment",
+          query: { phone: this.nextSearch.userphone },
+        });
       });
     },
     onConfirm(date) {

+ 1 - 1
src/views/Applyreal.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="apply">
-    <van-nav-bar title="预定" @click-left="$router.go(-1)" />
+    <van-nav-bar title="预定" left-text="返回列表" left-arrow @click-left="$router.go(-1)" />
     <van-form @submit="onSubmit">
       <van-field
         v-model="username"

+ 46 - 10
src/views/Appointment.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="Appointment">
     <div class="main">
-      <van-cell title="预约时间" />
-      <van-cell v-for="(item, i) in mainList" :key="i" :title="item.orderTime">
+      <van-cell title="预约" />
+      <van-cell v-for="(item, i) in mainList" :key="i" :title="item.userName">
         <template #default>
-          {{ item.userName }}
+          {{ item.orderTime }}
           <van-icon
             name="close"
             color="#fb5f5c"
@@ -17,6 +17,26 @@
     <van-sidebar v-model="activeKey" @change="onChange">
       <van-sidebar-item v-for="(item, i) in dataList" :key="i" :title="item" />
     </van-sidebar>
+
+    <div
+      style="
+        padding: 16px;
+        position: fixed;
+        width: calc(100% - 32px);
+        bottom: 0;
+      "
+    >
+      <van-button
+        color="#2a7ef4"
+        round
+        block
+        type="info"
+        @click="toAppointment"
+        native-type="submit"
+      >
+        去预约
+      </van-button>
+    </div>
   </div>
 </template>
 
@@ -27,23 +47,26 @@ import {
   SidebarItem as vanSidebarItem,
   Cell as vanCell,
   Icon as vanIcon,
+  Button as vanButton,
   Dialog,
 } 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/dialog/style/index";
 import "vant/lib/sidebar-item/style/index";
 
 // import { formatDate } from "../utils/tool";
-import { orderList, cancel } from "../api/index";
+import { orderList, cancel, getAPPUser } from "../api/index";
+import { urlSearchData } from "../utils/tool";
 
 export default {
   name: "Appointment",
   data() {
     return {
-        group: {},
-        phone: "",
+      group: {},
+      phone: "",
       activeKey: 0,
       dataList: [],
       mainList: [],
@@ -51,6 +74,11 @@ export default {
   },
   mounted() {
     this.phone = this.$route.query.phone || "";
+    let search = urlSearchData();
+    document.title = "预定";
+    getAPPUser({ ticket: search.webviewId }).then(res => {
+      console.log(res);
+    });
     orderList({
       userPhone: this.phone,
     }).then(res => {
@@ -76,6 +104,12 @@ export default {
   },
   computed: {},
   methods: {
+    toAppointment() {
+      this.$router.push({
+        name: "Apply",
+        query: { phone: this.nextSearch.userphone },
+      });
+    },
     onChange() {
       this.mainList = this.group[this.dataList[this.activeKey]];
     },
@@ -94,13 +128,13 @@ export default {
       });
     },
   },
-  beforeUnmount: function () {
-  },
+  beforeUnmount: function () {},
   components: {
     vanSidebar,
     vanCell,
     vanSidebarItem,
     vanIcon,
+    vanButton,
   },
 };
 </script>
@@ -108,13 +142,15 @@ export default {
 <style>
 .Appointment {
   height: 100%;
-  background-color: #fff;
+  background-color: #f7f8fa;
 }
 .Appointment .van-sidebar {
   width: 100px;
 }
 .Appointment .main {
-  width: calc(100% - 101px);
+  width: calc(100% - 100px);
+  height: 100%;
+  background-color: #fff;
   box-sizing: border-box;
   padding: 5px;
   float: right;

+ 23 - 17
src/views/Queue.vue

@@ -37,12 +37,13 @@
       </van-cell>
     </van-cell-group>
 
-
     <van-popup closeable v-model="open" position="right" class="open">
       <van-checkbox-group v-model="checkbox" v-if="showPopover.length">
-        <van-row v-for="(item,i) in weeks" :key="i">
+        <van-row v-for="(item, i) in weeks" :key="i">
           <van-col span="8">
-            <van-checkbox name="1" style="height: 2em"> {{item}} </van-checkbox>
+            <van-checkbox name="1" style="height: 2em">
+              {{ item }}
+            </van-checkbox>
           </van-col>
           <van-col span="16">
             <van-popover
@@ -98,7 +99,7 @@
               </div>
               <template #reference>
                 <div class="timerange">
-                  {{timerange[i]}}
+                  {{ timerange[i] }}
                 </div>
               </template>
             </van-popover>
@@ -106,8 +107,8 @@
         </van-row>
       </van-checkbox-group>
       <br />
-      <van-button type="default" block round >打烊</van-button>
-      <van-button type="primary" block round >开始营业</van-button>
+      <van-button type="default" block round>打烊</van-button>
+      <van-button type="primary" block round>开始营业</van-button>
     </van-popup>
   </div>
 </template>
@@ -128,7 +129,7 @@ import {
   DatetimePicker as vanDatetimePicker,
   Tag as vanTag,
   Dialog,
-  Notify 
+  Notify,
 } from "vant";
 import "vant/lib/tag/style/index";
 import "vant/lib/cell/style/index";
@@ -163,14 +164,19 @@ export default {
   },
   mounted() {
     this.showPopover.fil;
-    let showPopover = new Array(this.weeks.length), timerange = new Array(this.weeks.length);
+    let showPopover = new Array(this.weeks.length),
+      timerange = new Array(this.weeks.length);
     showPopover.fill(false);
     timerange.fill("00:00 - 00:00");
     this.showPopover = showPopover;
-    this.time = (new Array(this.weeks.length)).fill("00:00");
-    this.time2 = (new Array(this.weeks.length)).fill("00:00");
+    this.time = new Array(this.weeks.length).fill("00:00");
+    this.time2 = new Array(this.weeks.length).fill("00:00");
     this.timerange = timerange;
     this.reloadOrder();
+    window.setInterval(() => {
+      console.log("---");
+      this.reloadOrder();
+    }, 60000);
   },
   computed: {},
   methods: {
@@ -181,12 +187,13 @@ export default {
       this.showPopover = showP;
     },
     saveTime(t) {
-      let s = this.time[t].split(":"), e = this.time2[t].split(":");
-      let sMin = Number(s[0]*60 || 0) + Number(s[1] || 0);
-      let eMin = Number(e[0]*60 || 0) + Number(e[1] || 0);
-      if(eMin < sMin) return Notify("结束时间应在开始时间之后")
+      let s = this.time[t].split(":"),
+        e = this.time2[t].split(":");
+      let sMin = Number(s[0] * 60 || 0) + Number(s[1] || 0);
+      let eMin = Number(e[0] * 60 || 0) + Number(e[1] || 0);
+      if (eMin < sMin) return Notify("结束时间应在开始时间之后");
       this.timerange[t] = this.time[t] + " - " + this.time2[t];
-      this.closeTime(t)
+      this.closeTime(t);
     },
     toOpen() {
       this.open = true;
@@ -249,7 +256,7 @@ export default {
     vanCheckboxGroup,
     vanPopover,
     vanDatetimePicker,
-    vanTag
+    vanTag,
   },
 };
 </script>
@@ -266,7 +273,6 @@ export default {
   min-width: 500px;
   padding: 3.5em 1em 1em 2em;
   box-sizing: border-box;
-
 }
 .queue .van-col {
   height: 2.5em;