Yansen 5 jaren geleden
bovenliggende
commit
4b7ae3926a

+ 17
- 5
src/pages/activity/drainage/components/CustomerData.jsx Bestand weergeven

@@ -5,9 +5,17 @@ import moment from 'moment';
5 5
 import apis from '../../../../services/apis';
6 6
 import request from '../../../../utils/request';
7 7
 
8
+const formateValue = v => {
9
+    return {
10
+        ...v,
11
+        startTime: v.startTime ? `${v.startTime.format('YYYY-MM-DDT00:00:00')}Z` : undefined,
12
+        endTime: v.endTime ? `${v.endTime.format('YYYY-MM-DDT23:59:59')}Z` : undefined,
13
+    }
14
+}
15
+
8 16
 function CustomerData(props) {
9 17
 
10
-    const { id } = props
18
+    const { id, drainageId } = props
11 19
     // const [taNoticeList, setTaNoticeList] = useState([])
12 20
     const [data, setData] = useState({})
13 21
 
@@ -17,7 +25,7 @@ function CustomerData(props) {
17 25
     // 查询列表
18 26
 
19 27
     const getList = params => {
20
-        request({ ...apis.redPacket.getRecordByConditionList, params: { ...params, activityId: id } }).then(data => {
28
+        request({ ...apis.redPacket.getRecordByConditionList, params: { ...params, activityId: id, drainageId } }).then(data => {
21 29
             setData(data)
22 30
         })
23 31
     }
@@ -25,7 +33,7 @@ function CustomerData(props) {
25 33
     const changePageNum = pageNumber => {
26 34
         props.form.validateFields((err, values) => {
27 35
             if (!err) {
28
-                getList({ pageNum: pageNumber, pageSize: 10, ...values })
36
+                getList({ pageNum: pageNumber, pageSize: 10, ...formateValue(values) })
29 37
             }
30 38
         });
31 39
     }
@@ -36,7 +44,11 @@ function CustomerData(props) {
36 44
             if (!err) {
37 45
                 // eslint-disable-next-line no-console
38 46
                 console.log('提交数据: ', values)
39
-                getList({ pageNum: 1, pageSize: 10 }, ...values)
47
+                getList({
48
+                    pageNum: 1,
49
+                    pageSize: 10,
50
+                    ...formateValue(values),
51
+                })
40 52
             }
41 53
         });
42 54
     }
@@ -110,7 +122,7 @@ function CustomerData(props) {
110 122
 
111 123
     const exportReport = () => {
112 124
 
113
-        request({ ...apis.redPacket.exportVisitRecordByCondition, responseType: 'blob', params: { ...props.form.getFieldsValue(), activityId: id } }).then(data => {
125
+        request({ ...apis.redPacket.exportVisitRecordByCondition, responseType: 'blob', params: { ...props.form.getFieldsValue(), activityId: id, drainageId } }).then(data => {
114 126
             download(data)
115 127
         }).catch()
116 128
     }

+ 44
- 3
src/pages/activity/drainage/components/Help.jsx Bestand weergeven

@@ -7,6 +7,10 @@ import request from '../../../../utils/request';
7 7
 
8 8
 const { RangePicker } = DatePicker;
9 9
 
10
+function validatorNum (rule, value, callback) {
11
+    callback(value < 1 || value > 1000 ? '人数必须大于0 小于 1000' : undefined);
12
+}
13
+
10 14
 function Help(props) {
11 15
 
12 16
     const { id, name } = props
@@ -61,14 +65,22 @@ function Help(props) {
61 65
                 <Form.Item label="助力成功需要人数">
62 66
                     {getFieldDecorator('helpSuccesPersons', {
63 67
                         initialValue: data.helpSuccesPersons || 3,
68
+                        rules: [
69
+                            { required: true, message: '请设置 助力成功需要人数' },
70
+                            { validator: validatorNum },
71
+                        ],
64 72
                     },
65 73
                     )(
66 74
                         <InputNumber min={1} max={1000} />,
67 75
                     )}
68 76
                 </Form.Item>
69
-                <Form.Item label="单人每助力次数限制">
77
+                <Form.Item label="单人每助力次数限制">
70 78
                     {getFieldDecorator('limitNumPerDay', {
71 79
                         initialValue: data.limitNumPerDay || 3,
80
+                        rules: [
81
+                            { required: true, message: '请设置 单人每日助力次数限制' },
82
+                            { validator: validatorNum },
83
+                        ],
72 84
                     })(
73 85
                         <InputNumber min={1} max={1000} />,
74 86
                     )}
@@ -76,6 +88,9 @@ function Help(props) {
76 88
                 <Form.Item label="超出时提示文案">
77 89
                     {getFieldDecorator('limitPerDayIllegalTip', {
78 90
                         initialValue: data.limitPerDayIllegalTip || '每人每天最多只能助力3次',
91
+                        rules: [
92
+                            { required: true, message: '请设置 超出时提示文案' },
93
+                        ],
79 94
                     })(
80 95
                         <Input placeholder="每人每天最多只能助力3次" />,
81 96
                     )}
@@ -83,6 +98,10 @@ function Help(props) {
83 98
                 <Form.Item label="单人总助力次数限制">
84 99
                     {getFieldDecorator('limitNumPerPerson', {
85 100
                         initialValue: data.limitNumPerPerson || 3,
101
+                        rules: [
102
+                            { required: true, message: '请设置 单人总助力次数限制' },
103
+                            { validator: validatorNum },
104
+                        ],
86 105
                     })(
87 106
                         <InputNumber min={1} max={1000} />,
88 107
                     )}
@@ -90,13 +109,20 @@ function Help(props) {
90 109
                 <Form.Item label="超出时提示文案">
91 110
                     {getFieldDecorator('limitPerPersonIllegalTip', {
92 111
                         initialValue: data.limitPerPersonIllegalTip || '每人最多只能为他人助力3次',
112
+                        rules: [
113
+                            { required: true, message: '请设置 超出时提示文案' },
114
+                        ],
93 115
                     })(
94 116
                         <Input placeholder="每人最多只能为他人助力3次" />,
95 117
                     )}
96 118
                 </Form.Item>
97 119
                 <Form.Item label="为同一人助力次数限制">
98 120
                     {getFieldDecorator('limitNumForEachPerson', {
99
-                        initialValue: data.limitNumForEachPerson || 3,
121
+                        initialValue: data.limitNumForEachPerson || 1,
122
+                        rules: [
123
+                            { required: true, message: '请设置 为同一人助力次数限制' },
124
+                            { validator: validatorNum },
125
+                        ],
100 126
                     })(
101 127
                         <InputNumber min={1} max={1000} />,
102 128
                     )}
@@ -104,6 +130,9 @@ function Help(props) {
104 130
                 <Form.Item label="超出时提示文案">
105 131
                     {getFieldDecorator('limitForEachPersonIllegalTip', {
106 132
                         initialValue: data.limitForEachPersonIllegalTip || '只能为同一人助力1次',
133
+                        rules: [
134
+                            { required: true, message: '请设置 超出时提示文案' },
135
+                        ],
107 136
                     })(
108 137
                         <Input placeholder="只能为同一人助力1次" />,
109 138
                     )}
@@ -111,6 +140,9 @@ function Help(props) {
111 140
                 <Form.Item label="助力成功时提示文案">
112 141
                     {getFieldDecorator('successTip', {
113 142
                         initialValue: data.successTip || '助力成功!快去告诉你的好友吧',
143
+                        rules: [
144
+                            { required: true, message: '请设置 助力成功时提示文案' },
145
+                        ],
114 146
                     })(
115 147
                         <Input placeholder="助力成功!快去告诉你的好友吧" />,
116 148
                     )}
@@ -118,6 +150,9 @@ function Help(props) {
118 150
                 <Form.Item label="其他无法助力时提示文案">
119 151
                     {getFieldDecorator('warnningTip', {
120 152
                         initialValue: data.warnningTip || '无法助力!具体原因请看活动规则',
153
+                        rules: [
154
+                            { required: true, message: '请设置 其他无法助力时提示文案' },
155
+                        ],
121 156
                     })(
122 157
                         <Input placeholder="无法助力!具体原因请看活动规则" />,
123 158
                     )}
@@ -125,13 +160,19 @@ function Help(props) {
125 160
                 <Form.Item label="活动开始~结束时间">
126 161
                     {getFieldDecorator('date', {
127 162
                         initialValue: data.date || [],
163
+                        rules: [
164
+                            { required: true, message: '请设置 活动开始~结束时间' },
165
+                        ],
128 166
                     })(
129 167
                         <RangePicker />,
130 168
                     )}
131 169
                 </Form.Item>
132
-                <Form.Item label="超出时提示文案">
170
+                <Form.Item label="活动结束提示文案">
133 171
                     {getFieldDecorator('activityEndTip', {
134 172
                         initialValue: data.activityEndTip,
173
+                        rules: [
174
+                            { required: true, message: '请设置 活动结束提示文案' },
175
+                        ],
135 176
                     })(
136 177
                         <Input placeholder="活动已经结束啦" />,
137 178
                     )}

+ 2
- 2
src/pages/activity/drainage/components/Ranking.jsx Bestand weergeven

@@ -81,8 +81,8 @@ function Ranking(props) {
81 81
         },
82 82
         {
83 83
             title: '助力人数',
84
-            dataIndex: 'num',
85
-            key: 'num',
84
+            dataIndex: 'votes',
85
+            key: 'votes',
86 86
             align: 'center',
87 87
         },
88 88
     ]

+ 24
- 14
src/pages/activity/drainage/components/RedPacketRecord.jsx Bestand weergeven

@@ -5,6 +5,12 @@ import moment from 'moment';
5 5
 import apis from '../../../../services/apis';
6 6
 import request from '../../../../utils/request';
7 7
 
8
+const TradingStatus = {
9
+    processing: '进行中',
10
+    success: '成功',
11
+    fail: '失败',
12
+}
13
+
8 14
 function RedPacketRecord(props) {
9 15
 
10 16
     // const [taNoticeList, setTaNoticeList] = useState([])
@@ -15,8 +21,8 @@ function RedPacketRecord(props) {
15 21
     useEffect(() => {
16 22
         console.log(toRedPacketRecord, 'toRedPacketRecord')
17 23
         if (toRedPacketRecord === 1) {
18
-            props.form.setFieldsValue({ packetStatus: '1' })
19
-            getList({ pageNum: 1, pageSize: 10, packetStatus: '1' });
24
+            props.form.setFieldsValue({ tradingStatus: 'success' })
25
+            getList({ pageNum: 1, pageSize: 10, tradingStatus: 'success' });
20 26
         } else { getList({ pageNum: 1, pageSize: 10 }); }
21 27
 
22 28
     }, [])
@@ -55,9 +61,9 @@ function RedPacketRecord(props) {
55 61
 
56 62
     const columns = [
57 63
         {
58
-            title: '微信订单号',
59
-            dataIndex: 'wxOrderId',
60
-            key: 'wxOrderId',
64
+            title: '订单号',
65
+            dataIndex: 'tradeNo',
66
+            key: 'tradeNo',
61 67
             align: 'center',
62 68
         },
63 69
         {
@@ -81,10 +87,9 @@ function RedPacketRecord(props) {
81 87
         },
82 88
         {
83 89
             title: '发放时间',
84
-            dataIndex: 'targetName',
85
-            key: 'targetName',
90
+            key: 'createDate',
86 91
             align: 'center',
87
-            render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
92
+            render: (x, row) => <span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>,
88 93
         },
89 94
         {
90 95
             title: '金额(元)',
@@ -94,9 +99,10 @@ function RedPacketRecord(props) {
94 99
         },
95 100
         {
96 101
             title: '发送状态',
97
-            dataIndex: 'packetStatus',
98
-            key: 'packetStatus',
102
+            dataIndex: 'tradingStatus',
103
+            key: 'tradingStatus',
99 104
             align: 'center',
105
+            render: x => <span>{ TradingStatus[x] || ''}</span>,
100 106
         },
101 107
     ]
102 108
 
@@ -107,7 +113,7 @@ function RedPacketRecord(props) {
107 113
         <>
108 114
             <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
109 115
                 <Form.Item>
110
-                    {getFieldDecorator('wxOrderId')(
116
+                    {getFieldDecorator('tradeNo')(
111 117
                         <Input
112 118
                             placeholder="订单号"
113 119
                         />,
@@ -121,11 +127,15 @@ function RedPacketRecord(props) {
121 127
                     )}
122 128
                 </Form.Item>
123 129
                 <Form.Item>
124
-                    {getFieldDecorator('packetStatus')(
130
+                    {getFieldDecorator('tradingStatus')(
125 131
                         <Select style={{ width: '180px' }} placeholder="发送状态">
126 132
                             <option value="">全部</option>
127
-                            <option value="1">成功</option>
128
-                            <option value="0">失败</option>
133
+                            {
134
+                                Object.keys(TradingStatus).map(k => {
135
+                                    const key = `tds-${k}`;
136
+                                    return (<option key={key} value={k}>{TradingStatus[k]}</option>);
137
+                                })
138
+                            }
129 139
                         </Select>,
130 140
                     )}
131 141
                 </Form.Item>

+ 1
- 0
src/pages/activity/drainage/detailDrainage.jsx Bestand weergeven

@@ -28,6 +28,7 @@ const BasicForm = props => {
28 28
       query: {
29 29
         id: data.activityId,
30 30
         name: data.name,
31
+        drainageId,
31 32
       },
32 33
     });
33 34
   }

+ 2
- 2
src/pages/activity/drainage/h5edit.jsx Bestand weergeven

@@ -18,7 +18,7 @@ const H5configuration = props => {
18 18
     const [data, setData] = useState({})
19 19
     const [toRedPacketRecord, setToRedPacketRecord] = useState()
20 20
 
21
-    const { id, name } = props.location.query
21
+    const { id, name, drainageId } = props.location.query
22 22
     // const type = props.activeType
23 23
 
24 24
 
@@ -78,7 +78,7 @@ const H5configuration = props => {
78 78
                 {/* 红包记录 */}
79 79
                 {(tab === '4' && <RedPacketRecord id={id} toRedPacketRecord={toRedPacketRecord} />)}
80 80
                 {/* 客户数据 */}
81
-                {(tab === '5' && <CustomerData id={id} />)}
81
+                {(tab === '5' && <CustomerData id={id} drainageId={drainageId} />)}
82 82
                 {/* 排行榜 */}
83 83
                 {(tab === '6' && <Ranking id={id} />)}
84 84
             </div>