浏览代码

订单列表逻辑有误

李志伟 2 年前
父节点
当前提交
c243d31343
共有 4 个文件被更改,包括 78 次插入50 次删除
  1. 1
    1
      config/dev.js
  2. 14
    2
      project.config.json
  3. 9
    0
      project.private.config.json
  4. 54
    47
      src/utils/hooks/useProcessStatus.js

+ 1
- 1
config/dev.js 查看文件

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

+ 14
- 2
project.config.json 查看文件

39
         "disableUseStrict": false,
39
         "disableUseStrict": false,
40
         "showES6CompileOption": false,
40
         "showES6CompileOption": false,
41
         "useCompilerPlugins": false,
41
         "useCompilerPlugins": false,
42
-        "minifyWXML": true
42
+        "minifyWXML": true,
43
+        "ignoreDevUnusedFiles": false,
44
+        "ignoreUploadUnusedFiles": false
43
     },
45
     },
44
     "compileType": "miniprogram",
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 查看文件

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 查看文件

1
 import { useState, useEffect } from "react";
1
 import { useState, useEffect } from "react";
2
 
2
 
3
 export default function useProcessStatus(orderInfo) {
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
   useEffect(() => {
16
   useEffect(() => {
17
     if (!orderInfo || !orderInfo.orderId) return;
17
     if (!orderInfo || !orderInfo.orderId) return;
18
 
18
 
19
     setProcessStatus(getProcessStatus(orderInfo));
19
     setProcessStatus(getProcessStatus(orderInfo));
20
-  }, [orderInfo])
20
+  }, [orderInfo]);
21
 
21
 
22
-  return { processStatus }
22
+  return { processStatus };
23
 }
23
 }
24
 
24
 
25
 export function getProcessStatus(orderInfo) {
25
 export function getProcessStatus(orderInfo) {
26
-  
27
   if (!orderInfo || !orderInfo.orderId) return;
26
   if (!orderInfo || !orderInfo.orderId) return;
28
 
27
 
29
   // 订单完成
28
   // 订单完成
30
   if (orderInfo.isEvaluated) {
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
   if (orderInfo.workStatus === 3 && !orderInfo.isEvaluated) {
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
   if (!orderInfo.workStatus && orderInfo.dispatchStatus) {
57
   if (!orderInfo.workStatus && orderInfo.dispatchStatus) {
51
-    return 2
58
+    return 2;
52
   }
59
   }
53
 
60
 
54
   // 待分配
61
   // 待分配
55
   if (orderInfo.status === 1 && !orderInfo.dispatchStatus) {
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
 export function getProcessSignBy(status) {
69
 export function getProcessSignBy(status) {
63
-  if (status === undefined || status === null) return {}
64
-  
70
+  if (status === undefined || status === null) return {};
71
+
65
   switch (status) {
72
   switch (status) {
66
     case 1:
73
     case 1:
67
       return {
74
       return {
68
-        label: '待分配',
69
-        color: '#FF703B'
70
-      }
75
+        label: "待分配",
76
+        color: "#FF703B",
77
+      };
71
     case 2:
78
     case 2:
72
       return {
79
       return {
73
-        label: '待作业',
74
-        color: '#FF703B'
75
-      }
80
+        label: "待作业",
81
+        color: "#FF703B",
82
+      };
76
     case 3:
83
     case 3:
77
       return {
84
       return {
78
-        label: '进行中',
79
-        color: '#44F68B'
80
-      }
85
+        label: "进行中",
86
+        color: "#44F68B",
87
+      };
81
     case 4:
88
     case 4:
82
       return {
89
       return {
83
-        label: '待付款',
84
-        color: '#51D4FF'
85
-      }
90
+        label: "待付款",
91
+        color: "#51D4FF",
92
+      };
86
     case 5:
93
     case 5:
87
       return {
94
       return {
88
-        label: '待评价',
89
-        color: '#51D4FF'
90
-      }
95
+        label: "待评价",
96
+        color: "#51D4FF",
97
+      };
91
     case 6:
98
     case 6:
92
       return {
99
       return {
93
-        label: '已完成',
94
-        color: '#FF703B'
95
-      }
100
+        label: "已完成",
101
+        color: "#FF703B",
102
+      };
96
     default:
103
     default:
97
       return {
104
       return {
98
-        label: '异常',
99
-        color: '#FF0000'
100
-      }
105
+        label: "异常",
106
+        color: "#FF0000",
107
+      };
101
   }
108
   }
102
 }
109
 }