Browse Source

feat: 新增亦可直接付款

listKer 2 years ago
parent
commit
0bb1c40d69

File diff suppressed because it is too large
+ 21208 - 37
package-lock.json


File diff suppressed because it is too large
+ 1644 - 0
src/pages/confirmOrder/addOrder/index.vue


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

@@ -1,93 +1,100 @@
1
 <template>
1
 <template>
2
   <div class="mine">
2
   <div class="mine">
3
     <div class="qr-code">
3
     <div class="qr-code">
4
-      <div id="qrCode"
5
-           ref="qrCodeDiv"></div>
4
+      <div id="qrCode" ref="qrCodeDiv"></div>
6
     </div>
5
     </div>
7
   </div>
6
   </div>
8
 </template>
7
 </template>
9
 
8
 
10
 <script>
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
 export default {
12
 export default {
14
   components: {},
13
   components: {},
15
-  data () {
14
+  data() {
16
     return {
15
     return {
17
-      qrcode_string: '',
18
-      ticket: '',
16
+      qrcode_string: "",
17
+      ticket: "",
19
       checkCodeInterval: null,
18
       checkCodeInterval: null,
20
-      checkCodeTimeout: null,
19
+      checkCodeTimeout: null
21
     };
20
     };
22
   },
21
   },
23
   computed: {},
22
   computed: {},
24
   watch: {},
23
   watch: {},
25
 
24
 
26
   methods: {
25
   methods: {
27
-    getAuthCode () {
26
+    getAuthCode() {
28
       api.getAuthCode().then(res => {
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
         this.$nextTick(() => {
30
         this.$nextTick(() => {
32
           this.bindQRCode();
31
           this.bindQRCode();
33
-          this.checkCode()
34
-        })
35
-      })
32
+          this.checkCode();
33
+        });
34
+      });
36
     },
35
     },
37
-    checkCode () {
36
+    checkCode() {
38
       this.checkCodeInterval = setInterval(e => {
37
       this.checkCodeInterval = setInterval(e => {
39
         api.checkCode({ ticket: this.ticket }).then(res => {
38
         api.checkCode({ ticket: this.ticket }).then(res => {
40
           if (res.data.status == 1) {
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
       this.checkCodeTimeout = setTimeout(() => {
46
       this.checkCodeTimeout = setTimeout(() => {
48
-        clearTimeout(this.checkCodeTimeout)
49
-      }, 360000)
47
+        clearTimeout(this.checkCodeTimeout);
48
+      }, 360000);
50
     },
49
     },
51
-    getOrderByCode () {
50
+    getOrderByCode() {
52
       api.getOrderByCode({ ticket: this.ticket }).then(res => {
51
       api.getOrderByCode({ ticket: this.ticket }).then(res => {
53
         if (res.code == 200) {
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
           this.$router.push({
65
           this.$router.push({
55
-            path: '/confirmOrder/details',
66
+            path: "/confirmOrder/details",
56
             query: {
67
             query: {
57
               id: res.data.order_id
68
               id: res.data.order_id
58
             }
69
             }
59
-          })
70
+          });
60
         }
71
         }
61
-      })
72
+      });
62
     },
73
     },
63
-    bindQRCode () {
74
+    bindQRCode() {
64
       new QRCode(this.$refs.qrCodeDiv, {
75
       new QRCode(this.$refs.qrCodeDiv, {
65
         text: this.qrcode_string,
76
         text: this.qrcode_string,
66
         width: 200,
77
         width: 200,
67
         height: 200,
78
         height: 200,
68
         colorDark: "#333333", //二维码颜色
79
         colorDark: "#333333", //二维码颜色
69
         colorLight: "#ffffff", //二维码背景色
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
     if (this.checkCodeInterval) {
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
 </script>
98
 </script>
92
 
99
 
93
 <style lang='less' scoped>
100
 <style lang='less' scoped>

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

@@ -11,6 +11,7 @@ import HistoricalOrder from '@/pages/historicalOrder/index'
11
 import HistoricalOrderDetails from '@/pages/historicalOrder/details'
11
 import HistoricalOrderDetails from '@/pages/historicalOrder/details'
12
 import ConfirmOrder from '@/pages/confirmOrder/index'
12
 import ConfirmOrder from '@/pages/confirmOrder/index'
13
 import ConfirmOrderDetails from '@/pages/confirmOrder/details'
13
 import ConfirmOrderDetails from '@/pages/confirmOrder/details'
14
+import ConfirmOrderAddOrder from '@/pages/confirmOrder/addOrder'
14
 import StoreDetection from '@/pages/storeDetection/index'
15
 import StoreDetection from '@/pages/storeDetection/index'
15
 import Coupon from '@/pages/coupon/index'
16
 import Coupon from '@/pages/coupon/index'
16
 import projectOrder from '@/pages/customerMan/myOrder'
17
 import projectOrder from '@/pages/customerMan/myOrder'
@@ -19,9 +20,14 @@ export default {
19
   path: '/layout',
20
   path: '/layout',
20
   name: '首页',
21
   name: '首页',
21
   component: layout,
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
       path: '/testSkin/details',
32
       path: '/testSkin/details',
27
       meta: {
33
       meta: {
@@ -29,7 +35,10 @@ export default {
29
       },
35
       },
30
       component: TestSkinDetails
36
       component: TestSkinDetails
31
     },
37
     },
32
-    { path: '/customerMan', component: CustomerMan },
38
+    {
39
+      path: '/customerMan',
40
+      component: CustomerMan
41
+    },
33
     {
42
     {
34
       path: '/customerMan/details',
43
       path: '/customerMan/details',
35
       meta: {
44
       meta: {
@@ -44,7 +53,10 @@ export default {
44
       },
53
       },
45
       component: projectOrder
54
       component: projectOrder
46
     },
55
     },
47
-    { path: '/historicalOrder', component: HistoricalOrder },
56
+    {
57
+      path: '/historicalOrder',
58
+      component: HistoricalOrder
59
+    },
48
     {
60
     {
49
       path: '/historicalOrder/details',
61
       path: '/historicalOrder/details',
50
       meta: {
62
       meta: {
@@ -52,7 +64,10 @@ export default {
52
       },
64
       },
53
       component: HistoricalOrderDetails
65
       component: HistoricalOrderDetails
54
     },
66
     },
55
-    { path: '/confirmOrder', component: ConfirmOrder },
67
+    {
68
+      path: '/confirmOrder',
69
+      component: ConfirmOrder
70
+    },
56
     {
71
     {
57
       path: '/confirmOrder/details',
72
       path: '/confirmOrder/details',
58
       meta: {
73
       meta: {
@@ -60,8 +75,22 @@ export default {
60
       },
75
       },
61
       component: ConfirmOrderDetails
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
     return $http.get(url.getUserProject, parms);
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
   getUserCoupon: '/v2/pad/user/coupon',
75
   getUserCoupon: '/v2/pad/user/coupon',
76
 
76
 
77
+  // 获取优惠券订单
78
+  padOrderAdd: '/v2/pad/order/add',
77
 
79
 
78
 }
80
 }