Browse Source

m3-提交

liyongli 3 years ago
parent
commit
fc73e1857c
1 changed files with 86 additions and 86 deletions
  1. 86 86
      src/views/Apply.vue

+ 86 - 86
src/views/Apply.vue

@@ -104,10 +104,10 @@ import "vant/lib/button/style/index";
 import "vant/lib/popup/style/index";
 import "vant/lib/picker/style/index";
 // import { urlSearchData } from "../utils/tool";
-// import { getAPPUser, apply, getAPPToken,getAPPUserDetail,orderList } from "../api/index";
-// import {urlSearchData} from "@/utils/tool.js"
-import { goodsList, apply, applyrang } from "../api/index";
-import { isIphone, isAndroid } from "@/utils/isTerminal.js";
+import { getAPPUser, apply, getAPPToken,getAPPUserDetail,orderList } from "../api/index";
+import {urlSearchData} from "@/utils/tool.js"
+// import { goodsList, apply, applyrang } from "../api/index";
+// import { isIphone, isAndroid } from "@/utils/isTerminal.js";
 
 export default {
   name: "Apply",
@@ -131,90 +131,90 @@ export default {
     };
   },
   mounted() {
-    // let search = urlSearchData(),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();
-    //       });
-    //     });
-    //   });
-    // });
-    window.voteNext = () => {
-      let user = "";
-      var payload = {
-        type: "JSbridge",
-        functionName: "getUserInfo",
-        arguments: {},
-      };
-      if (isAndroid && window.H5Listener && window.H5Listener.getUserInfo)
-        user = window.H5Listener.getUserInfo();
-      if (isIphone) user = window.prompt(JSON.stringify(payload));
-      user && (user = JSON.parse(user || "{}"));
-      this.userphone = user.phone || "";
-      this.username = user.realName || "";
-      goodsList().then(res => {
-        this.goodsLi = (res || []).map(v=>{
-            v.name = v.name + '(' + v.price + '元)'
-            return v
+    let search = urlSearchData(),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 = [], g = {};
+            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 (g[key]) {
+                g[key].push(v);
+              } else {
+                l.push(key);
+                g[key] = [v];
+              }
+            }
+            that.group = g;
+            that.dataList = l;
+          });
         });
-        this.radio = (this.goodsLi[0] || {}).id;
       });
-      applyrang().then(res => {
-        let l = res || [],
-          nl = [],
-          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.replace(/:00$/, "");
-          if (o[key] >= 0) {
-            nl[o[key]].children.push(v);
-          } else {
-            o[key] = nl.length;
-            nl[o[key]] = {
-              startTime: key,
-              children: [v],
-            };
-          }
-        }
-        this.tagList = nl;
-      });
-    };
-    window.voteNext();
+    });
+    // window.voteNext = () => {
+    //   let user = "";
+    //   var payload = {
+    //     type: "JSbridge",
+    //     functionName: "getUserInfo",
+    //     arguments: {},
+    //   };
+    //   if (isAndroid && window.H5Listener && window.H5Listener.getUserInfo)
+    //     user = window.H5Listener.getUserInfo();
+    //   if (isIphone) user = window.prompt(JSON.stringify(payload));
+    //   user && (user = JSON.parse(user || "{}"));
+    //   this.userphone = user.phone || "";
+    //   this.username = user.realName || "";
+    //   goodsList().then(res => {
+    //     this.goodsLi = (res || []).map(v=>{
+    //         v.name = v.name + '(' + v.price + '元)'
+    //         return v
+    //     });
+    //     this.radio = (this.goodsLi[0] || {}).id;
+    //   });
+    //   applyrang().then(res => {
+    //     let l = res || [],
+    //       nl = [],
+    //       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.replace(/:00$/, "");
+    //       if (o[key] >= 0) {
+    //         nl[o[key]].children.push(v);
+    //       } else {
+    //         o[key] = nl.length;
+    //         nl[o[key]] = {
+    //           startTime: key,
+    //           children: [v],
+    //         };
+    //       }
+    //     }
+    //     this.tagList = nl;
+    //   });
+    // };
+    // window.voteNext();
   },
   computed: {
     selectTime() {