liyongli %!s(int64=3) %!d(string=hai) anos
pai
achega
47db704a99
Modificáronse 6 ficheiros con 177 adicións e 34 borrados
  1. 0 6
      public/index.html
  2. 13 6
      src/api/index.js
  3. 5 0
      src/router/index.js
  4. 15 14
      src/views/Apply.vue
  5. 126 0
      src/views/Applyreal.vue
  6. 18 8
      src/views/Queue.vue

+ 0 - 6
public/index.html

@@ -8,12 +8,6 @@
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <script src="//cdn.bootcdn.net/ajax/libs/eruda/2.4.1/eruda.min.js"></script>
     <script>eruda.init();</script>
-    <!--导入原生js库-->
-    <script src="http://cmp/v1.0.0/js/cordova/__CMPSHELL_PLATFORM__/cordova.js"></script>
-    <script src="http://cmp/v1.0.0/js/cordova/cordova-plugins.js"></script>
-    <!--导入cmp.js-->
-    <script src="http://cmp/v/js/cmp-i18n.js"></script>
-    <script src="http://cmp/v/js/cmp.js"></script>
     <title>
         <%= htmlWebpackPlugin.options.title %>
     </title>

+ 13 - 6
src/api/index.js

@@ -29,12 +29,19 @@ export function orderList(data) {
  * @returns {AjaxPromise}
  */
 export function apply(data) {
-  return ajax({
-    url: "/orders/add-app",
-    method: "post",
-    data,
-  });
-}
+    return ajax({
+      url: "/orders/add-app",
+      method: "post",
+      data,
+    });
+  }
+  export function applyreal(data) {
+    return ajax({
+      url: "/orders/add-house",
+      method: "post",
+      data,
+    });
+  }
 
 /**
  * 取消预约

+ 5 - 0
src/router/index.js

@@ -12,6 +12,11 @@ const routes = [
       name: "Apply",
       component: () => import("../views/Apply.vue"),
     },
+    {
+      path: "/applyreal",
+      name: "Applyreal",
+      component: () => import("../views/Applyreal.vue"),
+    },
     {
       path: "/appointment",
       name: "Appointment",

+ 15 - 14
src/views/Apply.vue

@@ -1,6 +1,5 @@
 <template>
   <div class="apply">
-    <van-nav-bar title="预定" v-if="back" @click-left="$router.go(-1)" />
     <van-form @submit="onSubmit">
       <van-field
         v-model="username"
@@ -44,7 +43,7 @@
         </van-button>
       </div>
     </van-form>
-    <div style="margin: 16px" v-if="!back">
+    <div style="margin: 16px">
       <van-button round block type="default" @click="toAppointment">
         查看预约
       </van-button>
@@ -67,7 +66,6 @@
 <script>
 // @ is an alias to /src
 import {
-  NavBar as vanNavBar,
   Form as vanForm,
   Field as vanField,
   Button as vanButton,
@@ -76,7 +74,6 @@ import {
   Radio as vanRadio,
   Picker as vanPicker,
 } from "vant";
-import "vant/lib/nav-bar/style/index";
 import "vant/lib/form/style/index";
 import "vant/lib/field/style/index";
 import "vant/lib/button/style/index";
@@ -98,23 +95,24 @@ export default {
       minDate: new Date(Date.now()),
       maxDate: new Date(Date.now() + 86400000),
       radio: "",
-      back: true,
       finished: false,
       loading: false,
 
       goodsLi: [],
       tagList: [],
+
+      nextSearch: {},
     };
   },
   mounted() {
     this.userphone = this.$route.query.phone || "";
     this.username = this.$route.query.userName || "";
     let search = urlSearchData();
-    this.back = !search.webviewId;
-    document.title = "预定"
-    search.webviewId && getAPPUser({ ticket: search.webviewId }).then(res=>{
-        console.log(res)
-    });
+    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;
@@ -158,10 +156,16 @@ export default {
     toAppointment() {
       this.$router.push({
         name: "Appointment",
-        query: { phone: this.userphone },
+        query: { phone: this.nextSearch.userphone },
       });
     },
     onSubmit() {
+      this.nextSearch = {
+        userName: this.username,
+        userPhone: this.userphone,
+        goodsId: this.radio,
+        orderTime: this.date + ":00",
+      };
       apply({
         userName: this.username,
         userPhone: this.userphone,
@@ -178,7 +182,6 @@ export default {
   },
   beforeUnmount: function () {},
   components: {
-    vanNavBar,
     vanForm,
     vanField,
     vanPopup,
@@ -193,8 +196,6 @@ export default {
 <style>
 .apply {
   height: 100%;
-  max-width: 990px;
-  margin: 0 auto;
   background-color: #fff;
 }
 .apply .van-tag {

+ 126 - 0
src/views/Applyreal.vue

@@ -0,0 +1,126 @@
+<template>
+  <div class="apply">
+    <van-nav-bar title="预定" @click-left="$router.go(-1)" />
+    <van-form @submit="onSubmit">
+      <van-field
+        v-model="username"
+        label="名称"
+        placeholder="名称"
+        :rules="[{ required: true, message: '请填写名称' }]"
+      />
+      <van-field label="套餐">
+        <template #input>
+          <van-radio-group v-model="radio" direction="horizontal">
+            <van-radio v-for="(item, i) in goodsLi" :key="i" :name="item.id">{{
+              item.name
+            }}</van-radio>
+          </van-radio-group>
+        </template>
+      </van-field>
+      <van-field
+        v-model="userphone"
+        type="tel"
+        label="联系电话"
+        placeholder="联系电话"
+        :rules="[{ required: true, message: '请填写联系电话' }]"
+      />
+      <div style="margin: 16px">
+        <van-button
+          color="#2a7ef4"
+          round
+          block
+          type="info"
+          native-type="submit"
+        >
+          提交
+        </van-button>
+      </div>
+    </van-form>
+
+    <!-- #2a7ef4 -->
+  </div>
+</template>
+
+<script>
+// @ is an alias to /src
+import {
+  NavBar as vanNavBar,
+  Form as vanForm,
+  Field as vanField,
+  Button as vanButton,
+  RadioGroup as vanRadioGroup,
+  Radio as vanRadio,
+} from "vant";
+import "vant/lib/nav-bar/style/index";
+import "vant/lib/form/style/index";
+import "vant/lib/field/style/index";
+import "vant/lib/button/style/index";
+
+import { goodsList, applyreal } from "../api/index";
+
+export default {
+  name: "Applyreal",
+  data() {
+    return {
+      username: "",
+      userphone: "",
+      radio: "",
+      finished: false,
+      loading: false,
+
+      goodsLi: [],
+    };
+  },
+  mounted() {
+    this.userphone = this.$route.query.phone || "";
+    this.username = this.$route.query.userName || "";
+    goodsList().then(res => {
+      this.goodsLi = res || [];
+      this.radio = (this.goodsLi[0] || {}).id;
+    });
+   
+  },
+  computed: {
+  },
+  methods: {
+    filter(type, options) {
+      if (type === "minute") {
+        return options.filter(option => option % 5 === 0);
+      }
+      return options;
+    },
+    onSubmit() {
+      applyreal({
+        userName: this.username,
+        userPhone: this.userphone,
+        goodsId: this.radio,
+      }).then(() => {
+        this.$router.go(-1);
+      });
+    },
+  },
+  beforeUnmount: function () {},
+  components: {
+    vanNavBar,
+    vanForm,
+    vanField,
+    vanButton,
+    vanRadioGroup,
+    vanRadio,
+  },
+};
+</script>
+
+<style>
+.apply {
+  height: 100%;
+  max-width: 990px;
+  margin: 0 auto;
+  background-color: #fff;
+}
+.apply .van-tag {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+</style>

+ 18 - 8
src/views/Queue.vue

@@ -11,7 +11,9 @@
     <van-cell-group>
       <van-cell v-for="(item, i) in queueList" :key="i">
         <template #title>
-          {{ [i + 1 + ".", item.orderTime + "  ", item.userName].join(" ") }}
+          <van-tag v-if="item.orderType === 1" type="success">APP</van-tag>
+          <van-tag v-else type="warning ">现场</van-tag>
+          {{ [item.orderTime + " ", item.userName].join(" ") }}
         </template>
         <template #default>
           <van-button
@@ -36,7 +38,7 @@
     </van-cell-group>
 
 
-    <van-popup v-model="open" position="right" class="open">
+    <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-col span="8">
@@ -95,7 +97,7 @@
                 />
               </div>
               <template #reference>
-                <div class="timerange van-hairline--surround">
+                <div class="timerange">
                   {{timerange[i]}}
                 </div>
               </template>
@@ -124,9 +126,11 @@ import {
   CheckboxGroup as vanCheckboxGroup,
   Popover as vanPopover,
   DatetimePicker as vanDatetimePicker,
+  Tag as vanTag,
   Dialog,
   Notify 
 } from "vant";
+import "vant/lib/tag/style/index";
 import "vant/lib/cell/style/index";
 import "vant/lib/cell-group/style/index";
 import "vant/lib/dialog/style/index";
@@ -150,8 +154,8 @@ export default {
       queueList: [],
       showPopover: [],
       open: false,
-      time: ["00:00"],
-      time2: ["00:00"],
+      time: [],
+      time2: [],
       timerange: ["00:00 - 00:00"],
       checkbox: [],
       weeks: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
@@ -163,6 +167,8 @@ export default {
     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.timerange = timerange;
     this.reloadOrder();
   },
@@ -179,7 +185,7 @@ export default {
       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 + " - " + this.time2;
+      this.timerange[t] = this.time[t] + " - " + this.time2[t];
       this.closeTime(t)
     },
     toOpen() {
@@ -191,7 +197,7 @@ export default {
       });
     },
     toAdmin() {
-      this.$router.push({ name: "Apply", params: { a: 0 } });
+      this.$router.push({ name: "Applyreal", params: { a: 0 } });
     },
     skipUser() {
       Dialog.confirm({
@@ -243,6 +249,7 @@ export default {
     vanCheckboxGroup,
     vanPopover,
     vanDatetimePicker,
+    vanTag
   },
 };
 </script>
@@ -257,8 +264,9 @@ export default {
 .queue .open {
   height: 100%;
   min-width: 500px;
-  padding: 1em;
+  padding: 3.5em 1em 1em 2em;
   box-sizing: border-box;
+
 }
 .queue .van-col {
   height: 2.5em;
@@ -269,5 +277,7 @@ export default {
   padding: 3px 5px;
   width: 100%;
   box-sizing: border-box;
+  border: 1px solid #eee;
+  cursor: pointer;
 }
 </style>