Procházet zdrojové kódy

订单列表逻辑有误

李志伟 před 2 roky
rodič
revize
c243d31343

+ 1
- 1
config/dev.js Zobrazit soubor

@@ -4,7 +4,7 @@ module.exports = {
4 4
   },
5 5
   defineConstants: {
6 6
     // HOST: '"https://machine.njyunzhi.com"',
7
-    HOST: '"http://192.168.89.147:7080"',
7
+    HOST: '"http://192.168.89.25:7080"',
8 8
     OSS: '""',
9 9
     // VERSION: '"2.0.33"',
10 10
   },

+ 14
- 2
project.config.json Zobrazit soubor

@@ -39,8 +39,20 @@
39 39
         "disableUseStrict": false,
40 40
         "showES6CompileOption": false,
41 41
         "useCompilerPlugins": false,
42
-        "minifyWXML": true
42
+        "minifyWXML": true,
43
+        "ignoreDevUnusedFiles": false,
44
+        "ignoreUploadUnusedFiles": false
43 45
     },
44 46
     "compileType": "miniprogram",
45
-    "condition": {}
47
+    "condition": {},
48
+    "libVersion": "2.25.0",
49
+    "srcMiniprogramRoot": "dist/",
50
+    "packOptions": {
51
+        "ignore": [],
52
+        "include": []
53
+    },
54
+    "editorSetting": {
55
+        "tabIndent": "insertSpaces",
56
+        "tabSize": 4
57
+    }
46 58
 }

+ 9
- 0
project.private.config.json Zobrazit soubor

@@ -0,0 +1,9 @@
1
+{
2
+    "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
+    "projectname": "machinery-miniapp",
4
+    "setting": {
5
+        "compileHotReLoad": true,
6
+        "urlCheck": false,
7
+        "preloadBackgroundData": false
8
+    }
9
+}

+ 54
- 47
src/utils/hooks/useProcessStatus.js Zobrazit soubor

@@ -1,102 +1,109 @@
1 1
 import { useState, useEffect } from "react";
2 2
 
3 3
 export default function useProcessStatus(orderInfo) {
4
-/**
5
- * 业务流程如下:
6
- * 1、农户下单 - 未支付 (管理端待分配订单)
7
- * 2、农机手待接单
8
- * 3、农机手接单干活
9
- * 4、农机手结单 - 确定亩数 (农户待支付)
10
- * 5、农户待评价
11
- * 6、结单(订单完成)
12
- */
4
+  /**
5
+   * 业务流程如下:
6
+   * 1、农户下单 - 未支付 (管理端待分配订单)
7
+   * 2、农机手待接单
8
+   * 3、农机手接单干活
9
+   * 4、农机手结单 - 确定亩数 (农户待支付)
10
+   * 5、农户待评价
11
+   * 6、结单(订单完成)
12
+   */
13 13
 
14
-  const [processStatus, setProcessStatus] = useState()
14
+  const [processStatus, setProcessStatus] = useState();
15 15
 
16 16
   useEffect(() => {
17 17
     if (!orderInfo || !orderInfo.orderId) return;
18 18
 
19 19
     setProcessStatus(getProcessStatus(orderInfo));
20
-  }, [orderInfo])
20
+  }, [orderInfo]);
21 21
 
22
-  return { processStatus }
22
+  return { processStatus };
23 23
 }
24 24
 
25 25
 export function getProcessStatus(orderInfo) {
26
-  
27 26
   if (!orderInfo || !orderInfo.orderId) return;
28 27
 
29 28
   // 订单完成
30 29
   if (orderInfo.isEvaluated) {
31
-    return 6
30
+    return 6;
32 31
   }
33
-  
32
+
34 33
   // 待支付
35
-  if (orderInfo.workStatus === 3 && orderInfo.charges > 0 && orderInfo.payStatus !== 1) {
36
-    return 4
34
+  if (
35
+    orderInfo.workStatus === 3 &&
36
+    orderInfo.charges > 0 &&
37
+    orderInfo.payStatus !== 1
38
+  ) {
39
+    return 4;
37 40
   }
38 41
 
39 42
   // 待评价
40 43
   if (orderInfo.workStatus === 3 && !orderInfo.isEvaluated) {
41
-    return 5
44
+    return 5;
42 45
   }
43 46
 
44 47
   // 工作中
45
-  if (orderInfo.workStatus !== 3 && orderInfo.dispatchStatus) {
46
-    return 3
48
+  if (
49
+    orderInfo.workStatus > 0 &&
50
+    orderInfo.workStatus < 3 &&
51
+    orderInfo.dispatchStatus
52
+  ) {
53
+    return 3;
47 54
   }
48 55
 
49 56
   // 待接单
50 57
   if (!orderInfo.workStatus && orderInfo.dispatchStatus) {
51
-    return 2
58
+    return 2;
52 59
   }
53 60
 
54 61
   // 待分配
55 62
   if (orderInfo.status === 1 && !orderInfo.dispatchStatus) {
56
-    return 1
63
+    return 1;
57 64
   }
58
-  
59
-  return -1
65
+
66
+  return -1;
60 67
 }
61 68
 
62 69
 export function getProcessSignBy(status) {
63
-  if (status === undefined || status === null) return {}
64
-  
70
+  if (status === undefined || status === null) return {};
71
+
65 72
   switch (status) {
66 73
     case 1:
67 74
       return {
68
-        label: '待分配',
69
-        color: '#FF703B'
70
-      }
75
+        label: "待分配",
76
+        color: "#FF703B",
77
+      };
71 78
     case 2:
72 79
       return {
73
-        label: '待作业',
74
-        color: '#FF703B'
75
-      }
80
+        label: "待作业",
81
+        color: "#FF703B",
82
+      };
76 83
     case 3:
77 84
       return {
78
-        label: '进行中',
79
-        color: '#44F68B'
80
-      }
85
+        label: "进行中",
86
+        color: "#44F68B",
87
+      };
81 88
     case 4:
82 89
       return {
83
-        label: '待付款',
84
-        color: '#51D4FF'
85
-      }
90
+        label: "待付款",
91
+        color: "#51D4FF",
92
+      };
86 93
     case 5:
87 94
       return {
88
-        label: '待评价',
89
-        color: '#51D4FF'
90
-      }
95
+        label: "待评价",
96
+        color: "#51D4FF",
97
+      };
91 98
     case 6:
92 99
       return {
93
-        label: '已完成',
94
-        color: '#FF703B'
95
-      }
100
+        label: "已完成",
101
+        color: "#FF703B",
102
+      };
96 103
     default:
97 104
       return {
98
-        label: '异常',
99
-        color: '#FF0000'
100
-      }
105
+        label: "异常",
106
+        color: "#FF0000",
107
+      };
101 108
   }
102 109
 }