Procházet zdrojové kódy

feat: 新增亦可直接付款

listKer před 2 roky
rodič
revize
0bb1c40d69

Diff nebyl zobrazen, protože je příliš veliký
+ 21208 - 37
package-lock.json


Diff nebyl zobrazen, protože je příliš veliký
+ 1644 - 0
src/pages/confirmOrder/addOrder/index.vue


+ 46 - 39
src/pages/confirmOrder/index.vue

@@ -1,93 +1,100 @@
1 1
 <template>
2 2
   <div class="mine">
3 3
     <div class="qr-code">
4
-      <div id="qrCode"
5
-           ref="qrCodeDiv"></div>
4
+      <div id="qrCode" ref="qrCodeDiv"></div>
6 5
     </div>
7 6
   </div>
8 7
 </template>
9 8
 
10 9
 <script>
11
-import QRCode from 'qrcodejs2'
12
-import api from '../../server/home'
10
+import QRCode from "qrcodejs2";
11
+import api from "../../server/home";
13 12
 export default {
14 13
   components: {},
15
-  data () {
14
+  data() {
16 15
     return {
17
-      qrcode_string: '',
18
-      ticket: '',
16
+      qrcode_string: "",
17
+      ticket: "",
19 18
       checkCodeInterval: null,
20
-      checkCodeTimeout: null,
19
+      checkCodeTimeout: null
21 20
     };
22 21
   },
23 22
   computed: {},
24 23
   watch: {},
25 24
 
26 25
   methods: {
27
-    getAuthCode () {
26
+    getAuthCode() {
28 27
       api.getAuthCode().then(res => {
29
-        this.qrcode_string = res.data.qrcode_string
30
-        this.ticket = res.data.ticket
28
+        this.qrcode_string = res.data.qrcode_string;
29
+        this.ticket = res.data.ticket;
31 30
         this.$nextTick(() => {
32 31
           this.bindQRCode();
33
-          this.checkCode()
34
-        })
35
-      })
32
+          this.checkCode();
33
+        });
34
+      });
36 35
     },
37
-    checkCode () {
36
+    checkCode() {
38 37
       this.checkCodeInterval = setInterval(e => {
39 38
         api.checkCode({ ticket: this.ticket }).then(res => {
40 39
           if (res.data.status == 1) {
41
-            clearInterval(this.checkCodeInterval)
42
-            this.getOrderByCode()
40
+            clearInterval(this.checkCodeInterval);
41
+            this.getOrderByCode();
43 42
           }
44
-        })
45
-      }, 1000)
43
+        });
44
+      }, 1000);
46 45
       //十分钟强制清除,防止页面崩溃
47 46
       this.checkCodeTimeout = setTimeout(() => {
48
-        clearTimeout(this.checkCodeTimeout)
49
-      }, 360000)
47
+        clearTimeout(this.checkCodeTimeout);
48
+      }, 360000);
50 49
     },
51
-    getOrderByCode () {
50
+    getOrderByCode() {
52 51
       api.getOrderByCode({ ticket: this.ticket }).then(res => {
53 52
         if (res.code == 200) {
53
+          // 无订单入口
54
+          if (res.data.order_id == 0) {
55
+            this.$router.push({
56
+              path: "/confirmOrder/addOrder",
57
+              query: {   //user_id
58
+                data: JSON.stringify(res.data),
59
+                // user_id:res.data.user.user_id
60
+              }
61
+            });
62
+          return
63
+          }
64
+
54 65
           this.$router.push({
55
-            path: '/confirmOrder/details',
66
+            path: "/confirmOrder/details",
56 67
             query: {
57 68
               id: res.data.order_id
58 69
             }
59
-          })
70
+          });
60 71
         }
61
-      })
72
+      });
62 73
     },
63
-    bindQRCode () {
74
+    bindQRCode() {
64 75
       new QRCode(this.$refs.qrCodeDiv, {
65 76
         text: this.qrcode_string,
66 77
         width: 200,
67 78
         height: 200,
68 79
         colorDark: "#333333", //二维码颜色
69 80
         colorLight: "#ffffff", //二维码背景色
70
-        correctLevel: QRCode.CorrectLevel.L//容错率,L/M/H
71
-      })
81
+        correctLevel: QRCode.CorrectLevel.L //容错率,L/M/H
82
+      });
72 83
     }
73 84
   },
74 85
 
75
-  created () {
76
-    this.getAuthCode()
77
-
86
+  created() {
87
+    this.getAuthCode();
78 88
   },
79 89
 
80
-  mounted () {
81
-
82
-  },
83
-  destroyed () {
90
+  mounted() {},
91
+  destroyed() {
84 92
     if (this.checkCodeInterval) {
85
-      clearInterval(this.checkCodeInterval)
86
-      clearTimeout(this.checkCodeTimeout)
93
+      clearInterval(this.checkCodeInterval);
94
+      clearTimeout(this.checkCodeTimeout);
87 95
     }
88 96
   }
89
-}
90
-
97
+};
91 98
 </script>
92 99
 
93 100
 <style lang='less' scoped>

+ 37 - 8
src/router/map/home.js

@@ -11,6 +11,7 @@ import HistoricalOrder from '@/pages/historicalOrder/index'
11 11
 import HistoricalOrderDetails from '@/pages/historicalOrder/details'
12 12
 import ConfirmOrder from '@/pages/confirmOrder/index'
13 13
 import ConfirmOrderDetails from '@/pages/confirmOrder/details'
14
+import ConfirmOrderAddOrder from '@/pages/confirmOrder/addOrder'
14 15
 import StoreDetection from '@/pages/storeDetection/index'
15 16
 import Coupon from '@/pages/coupon/index'
16 17
 import projectOrder from '@/pages/customerMan/myOrder'
@@ -19,9 +20,14 @@ export default {
19 20
   path: '/layout',
20 21
   name: '首页',
21 22
   component: layout,
22
-  children: [
23
-    { path: '/home', component: Home },
24
-    { path: '/testSkin', component: TestSkin },
23
+  children: [{
24
+      path: '/home',
25
+      component: Home
26
+    },
27
+    {
28
+      path: '/testSkin',
29
+      component: TestSkin
30
+    },
25 31
     {
26 32
       path: '/testSkin/details',
27 33
       meta: {
@@ -29,7 +35,10 @@ export default {
29 35
       },
30 36
       component: TestSkinDetails
31 37
     },
32
-    { path: '/customerMan', component: CustomerMan },
38
+    {
39
+      path: '/customerMan',
40
+      component: CustomerMan
41
+    },
33 42
     {
34 43
       path: '/customerMan/details',
35 44
       meta: {
@@ -44,7 +53,10 @@ export default {
44 53
       },
45 54
       component: projectOrder
46 55
     },
47
-    { path: '/historicalOrder', component: HistoricalOrder },
56
+    {
57
+      path: '/historicalOrder',
58
+      component: HistoricalOrder
59
+    },
48 60
     {
49 61
       path: '/historicalOrder/details',
50 62
       meta: {
@@ -52,7 +64,10 @@ export default {
52 64
       },
53 65
       component: HistoricalOrderDetails
54 66
     },
55
-    { path: '/confirmOrder', component: ConfirmOrder },
67
+    {
68
+      path: '/confirmOrder',
69
+      component: ConfirmOrder
70
+    },
56 71
     {
57 72
       path: '/confirmOrder/details',
58 73
       meta: {
@@ -60,8 +75,22 @@ export default {
60 75
       },
61 76
       component: ConfirmOrderDetails
62 77
     },
63
-    { path: '/storeDetection', component: StoreDetection },
64
-    { path: '/coupon', component: Coupon },
78
+    {
79
+      path: '/confirmOrder/addOrder',
80
+      meta: {
81
+        isback: true,
82
+      },
83
+      component: ConfirmOrderAddOrder
84
+    },
85
+
86
+    {
87
+      path: '/storeDetection',
88
+      component: StoreDetection
89
+    },
90
+    {
91
+      path: '/coupon',
92
+      component: Coupon
93
+    },
65 94
 
66 95
   ]
67 96
 }

+ 5 - 0
src/server/home.js

@@ -120,6 +120,11 @@ export default class Home {
120 120
     return $http.get(url.getUserProject, parms);
121 121
   }
122 122
 
123
+  // 新增项目订单
124
+  static padOrderAdd (parms) {
125
+    return $http.post(url.padOrderAdd, parms);
126
+  }
127
+
123 128
 }
124 129
 
125 130
 

+ 2 - 0
src/server/urls.js

@@ -74,5 +74,7 @@ export default {
74 74
   // 获取优惠券订单
75 75
   getUserCoupon: '/v2/pad/user/coupon',
76 76
 
77
+  // 获取优惠券订单
78
+  padOrderAdd: '/v2/pad/order/add',
77 79
 
78 80
 }