liyongli 3 years ago
parent
commit
f82fd07ff1
2 changed files with 32 additions and 31 deletions
  1. 0 1
      src/utils/requestOrther.js
  2. 32 30
      src/views/Appointment.vue

+ 0 - 1
src/utils/requestOrther.js

@@ -29,7 +29,6 @@ export default function (ori) {
         ? ori.header.contentType || "application/json"
         : "application/json"
     );
-    console.log(localStorage.token)
     localStorage.token && xhttp.setRequestHeader("token", localStorage.token) 
     method === "GET" ? xhttp.send() : xhttp.send(JSON.stringify(ori.data));
     xhttp.onreadystatechange = function () {

+ 32 - 30
src/views/Appointment.vue

@@ -74,6 +74,7 @@ export default {
     return {
       group: {},
       phone: "",
+      name: "",
       activeKey: 0,
       dataList: [],
       mainList: [],
@@ -83,44 +84,44 @@ export default {
     localStorage.token = "";
     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,
-          },
-          res.id
-        ).then(detail => {
-          console.log(detail);
+        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();
+          });
         });
       });
-      this.phone = this.$route.query.phone || "";
-    });
-    orderList({
-      userPhone: this.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 (this.group[key]) {
-          this.group[key].push(v);
-        } else {
-          l.push(key);
-          this.group[key] = [v];
-        }
-      }
-      this.dataList = l;
-      this.onChange();
     });
   },
   computed: {},
@@ -128,6 +129,7 @@ export default {
     toAppointment() {
       this.$router.push({
         name: "Apply",
+        params: { name: this.name, phone: this.phone } 
       });
     },
     onChange() {