liyongli 3 жил өмнө
parent
commit
24a439305e

+ 11 - 8
src/views/Apply.vue

@@ -4,9 +4,9 @@
     <van-form @submit="onSubmit">
       <van-field
         v-model="username"
-        label="用户名"
-        placeholder="用户名"
-        :rules="[{ required: true, message: '请填写用户名' }]"
+        label="名"
+        placeholder="名"
+        :rules="[{ required: true, message: '请填写名' }]"
       />
       <van-field label="套餐">
         <template #input>
@@ -44,8 +44,7 @@
         </van-button>
       </div>
     </van-form>
-    <div style="margin: 16px">
-      <!-- <div style="margin: 16px" v-if="!back"> -->
+      <div style="margin: 16px" v-if="!back">
       <van-button round block type="default" @click="toAppointment">
         查看预约
       </van-button>
@@ -120,10 +119,11 @@ export default {
         o = {};
       for (let i = 0; i < l.length; i++) {
         const v = l[i];
+        if (v.isOrder === 1) continue;
         let keys = v.startTime.split(" "),
           key = keys[0],
           val = keys[1];
-        v.startTime = val;
+        v.startTime = val.replace(/:00$/, "");
         if (o[key] >= 0) {
           nl[o[key]].children.push(v);
         } else {
@@ -150,14 +150,17 @@ export default {
       return options;
     },
     toAppointment() {
-      this.$router.push({ name: "Appointment", query: { phone: this.userphone } });
+      this.$router.push({
+        name: "Appointment",
+        query: { phone: this.userphone },
+      });
     },
     onSubmit() {
       apply({
         userName: this.username,
         userPhone: this.userphone,
         goodsId: this.radio,
-        orderTime: this.date,
+        orderTime: this.date + ":00",
       }).then(() => {
         this.toAppointment();
       });

+ 12 - 11
src/views/Appointment.vue

@@ -2,7 +2,7 @@
   <div class="Appointment">
     <van-nav-bar title="预约信息" left-arrow @click-left="$router.go(-1)" />
     <div class="main">
-      <van-cell title="预约时间" value="姓名" />
+      <van-cell title="预约时间" />
       <van-cell v-for="(item, i) in mainList" :key="i" :title="item.orderTime">
         <template #default>
           {{ item.userName }}
@@ -41,21 +41,21 @@ import "vant/lib/sidebar-item/style/index";
 // import { formatDate } from "../utils/tool";
 import { orderList, cancel } from "../api/index";
 
-let group = {},
-  phone = "";
 export default {
   name: "Appointment",
   data() {
     return {
+        group: {},
+        phone: "",
       activeKey: 0,
       dataList: [],
       mainList: [],
     };
   },
   mounted() {
-    phone = this.$route.query.phone || "";
+    this.phone = this.$route.query.phone || "";
     orderList({
-      userPhone: phone,
+      userPhone: this.phone,
     }).then(res => {
       const li = res || [];
       let l = [];
@@ -66,11 +66,11 @@ export default {
         const v = li[i];
         v.orderTime = v.orderTime.replace(/:00$/, "");
         let key = v.orderTime.split(" ")[0];
-        if (group[key]) {
-          group[key].push(v);
+        if (this.group[key]) {
+          this.group[key].push(v);
         } else {
           l.push(key);
-          group[key] = [v];
+          this.group[key] = [v];
         }
       }
       this.dataList = l;
@@ -80,7 +80,7 @@ export default {
   computed: {},
   methods: {
     onChange() {
-      this.mainList = group[this.dataList[this.activeKey]];
+      this.mainList = this.group[this.dataList[this.activeKey]];
     },
     removequeue(id, i) {
       Dialog.confirm({
@@ -92,12 +92,13 @@ export default {
         cancel({
           id,
         }).then(() => {
-          group[this.dataList[this.activeKey]].splice(i, 1);
+          this.group[this.dataList[this.activeKey]].splice(i, 1);
         });
       });
     },
   },
-  beforeUnmount: function () {},
+  beforeUnmount: function () {
+  },
   components: {
     vanSidebar,
     vanCell,

+ 97 - 7
src/views/Queue.vue

@@ -2,7 +2,9 @@
   <div class="queue">
     <van-nav-bar
       title="当前队列"
+      right-text="打样"
       @click-left="toAdmin"
+      @click-right="toOpen"
       left-text="添加预定"
       left-arrow
     />
@@ -20,12 +22,7 @@
           >
             跳过
           </van-button>
-          <van-button
-            v-if="i === 0"
-            type="info"
-            size="small"
-            @click="nextItem"
-          >
+          <van-button v-if="i === 0" type="info" size="small" @click="nextItem">
             完成
           </van-button>
           <van-button
@@ -37,6 +34,63 @@
         </template>
       </van-cell>
     </van-cell-group>
+
+    <van-popup v-model="open" position="right" class="open">
+      <van-radio-group v-model="radio">
+        <van-row>
+          <van-col span="8">周一</van-col>
+          <van-col span="8">
+              <van-stepper v-model="sH" />
+              <van-stepper v-model="sM" />
+          </van-col>
+          <van-col span="8">
+            <van-radio name="1">单选框 2</van-radio>
+          </van-col>
+        </van-row>
+        <van-row>
+          <van-col span="8">周二</van-col>
+          <van-col span="8">span: 8</van-col>
+          <van-col span="8">
+            <van-radio name="2">单选框 2</van-radio>
+          </van-col>
+        </van-row>
+        <van-row>
+          <van-col span="8">周三</van-col>
+          <van-col span="8">span: 8</van-col>
+          <van-col span="8">
+            <van-radio name="3">单选框 2</van-radio>
+          </van-col>
+        </van-row>
+        <van-row>
+          <van-col span="8">周四</van-col>
+          <van-col span="8">span: 8</van-col>
+          <van-col span="8">
+            <van-radio name="4">单选框 2</van-radio>
+          </van-col>
+        </van-row>
+        <van-row>
+          <van-col span="8">周五</van-col>
+          <van-col span="8">span: 8</van-col>
+          <van-col span="8">
+            <van-radio name="5">单选框 2</van-radio>
+          </van-col>
+        </van-row>
+        <van-row>
+          <van-col span="8">周六</van-col>
+          <van-col span="8">span: 8</van-col>
+          <van-col span="8">
+            <van-radio name="6">单选框 2</van-radio>
+          </van-col>
+        </van-row>
+        <van-row>
+          <van-col span="8">周日</van-col>
+          <van-col span="8">span: 8</van-col>
+          <van-col span="8">
+            <van-radio name="7">单选框 2</van-radio>
+          </van-col>
+        </van-row>
+      </van-radio-group>
+    </van-popup>
   </div>
 </template>
 
@@ -47,21 +101,38 @@ import {
   CellGroup as vanCellGroup,
   Button as vanButton,
   NavBar as vanNavBar,
+  Popup as vanPopup,
+  Col as vanCol,
+  Row as vanRow,
+  Radio as vanRadio,
+  RadioGroup as vanRadioGroup,
+  Stepper as vanStepper,
   Dialog,
 } from "vant";
 import "vant/lib/cell/style/index";
 import "vant/lib/cell-group/style/index";
 import "vant/lib/dialog/style/index";
 import "vant/lib/button/style/index";
+import "vant/lib/popup/style/index";
+import "vant/lib/col/style/index";
+import "vant/lib/row/style/index";
+import "vant/lib/radio/style/index";
+import "vant/lib/stepper/style/index";
+import "vant/lib/radio-group/style/index";
 import "vant/lib/nav-bar/style/index";
 
 import { orderList, skip, nextone, cancel } from "../api/index";
-
 export default {
   name: "Queue",
   data() {
     return {
       queueList: [],
+      sH: 0,
+      sM: 0,
+      eH: 0,
+      eM: 0,
+      open: false,
+      radio: "",
     };
   },
   mounted() {
@@ -69,6 +140,9 @@ export default {
   },
   computed: {},
   methods: {
+    toOpen() {
+      this.open = true;
+    },
     reloadOrder() {
       orderList().then(res => {
         this.queueList = res || [];
@@ -120,6 +194,12 @@ export default {
     vanCellGroup,
     vanButton,
     vanNavBar,
+    vanPopup,
+    vanCol,
+    vanRow,
+    vanRadio,
+    vanRadioGroup,
+    vanStepper
   },
 };
 </script>
@@ -131,4 +211,14 @@ export default {
   margin: 0 auto;
   background-color: #fff;
 }
+.queue .open {
+  height: 100%;
+  min-width: 500px;
+  padding: 1em;
+  box-sizing: border-box;
+}
+.queue .van-col {
+  height: 2em;
+  line-height: 2em;
+}
 </style>