魏超 5 years ago
parent
commit
81f5271a15

+ 1
- 1
src/pages/activity/ActivityList.jsx View File

147
             {row.activityStatus === 0 && <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={finishDynamic.bind(this, row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
147
             {row.activityStatus === 0 && <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={finishDynamic.bind(this, row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
148
           </AuthButton>
148
           </AuthButton>
149
           <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
149
           <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
150
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row)}>{row.weight === 1 ? '取消添加标签' : '添加标签'}<Icon type="vertical-align-top" className={styles.edit} /></span>
150
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row)}>{row.weight === 1 ? '取消标签' : '添加标签'}<Icon type="vertical-align-top" className={styles.edit} /></span>
151
             {(row.activityStatus === 0 || row.activityStatus === 1) && <span style={{ color: '#FF925C',marginRight: '20px', cursor: 'pointer' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>}
151
             {(row.activityStatus === 0 || row.activityStatus === 1) && <span style={{ color: '#FF925C',marginRight: '20px', cursor: 'pointer' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>}
152
           </AuthButton>
152
           </AuthButton>
153
       {(row.activityStatus === 0 || row.activityStatus === 2) &&<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={newQrcode.bind(this, row)}>{row.isEnlist === 1 && '下载二维码'} {row.isEnlist === 1 && <Icon type="qrcode" className={styles.shoppingCart} />}</span>}
153
       {(row.activityStatus === 0 || row.activityStatus === 2) &&<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={newQrcode.bind(this, row)}>{row.isEnlist === 1 && '下载二维码'} {row.isEnlist === 1 && <Icon type="qrcode" className={styles.shoppingCart} />}</span>}

+ 19
- 2
src/pages/activity/groupActivity/editGroupActivity.jsx View File

32
   const { groupActivityId } = props.location.query
32
   const { groupActivityId } = props.location.query
33
   const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
33
   const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
34
   const [scoreData, setScoreData] = useState({})
34
   const [scoreData, setScoreData] = useState({})
35
+  const [activityStatus, setActivityStatus] = useState({})
36
+  const [disable, setDisable] = useState(false)
37
+
35
   useEffect(() => {
38
   useEffect(() => {
36
     request(apis.groupActivity.avgScore).then((data) => {
39
     request(apis.groupActivity.avgScore).then((data) => {
37
       setScoreData(data);
40
       setScoreData(data);
46
     const getDynamicData = (groupActivityId) => {
49
     const getDynamicData = (groupActivityId) => {
47
       request({ ...apis.groupActivity.details, urlData: { id: groupActivityId } }).then((data) => {
50
       request({ ...apis.groupActivity.details, urlData: { id: groupActivityId } }).then((data) => {
48
         setDynamicData(data)
51
         setDynamicData(data)
52
+        setActivityStatus(data.activityStatus)
53
+        setDisable(data.activityStatus === 0 ? true : false)
49
       })
54
       })
50
     }
55
     }
51
   }
56
   }
65
       {
70
       {
66
         label: '选择项目',
71
         label: '选择项目',
67
         name: 'buildingId',
72
         name: 'buildingId',
68
-        render: <BuildSelect />,
73
+        render: <BuildSelect disabled={disable}/>,
69
         value: dynamicData.buildingId,
74
         value: dynamicData.buildingId,
70
         rules: [
75
         rules: [
71
           { required: true, message: '请选择项目' },
76
           { required: true, message: '请选择项目' },
90
         ],
95
         ],
91
         help: '建议尺寸375*312px',
96
         help: '建议尺寸375*312px',
92
       },
97
       },
98
+      {
99
+        label: '活动列表图',
100
+        name: 'detailImg',
101
+        type: FieldTypes.ImageUploader,
102
+        value: dynamicData.detailImg,
103
+        rules: [
104
+          { required: true, message: '请输入活动列表图' },
105
+        ],
106
+        help: '建议尺寸375*312px',
107
+      },
93
       {
108
       {
94
         label: '活动时间',
109
         label: '活动时间',
95
         name: 'activityTime',
110
         name: 'activityTime',
96
         type: FieldTypes.RangePicker,
111
         type: FieldTypes.RangePicker,
97
         value: dynamicData.startTime != null ? [moment(dynamicData.startTime, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endTime, 'YYYY-MM-DD HH:mm')] : null,
112
         value: dynamicData.startTime != null ? [moment(dynamicData.startTime, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endTime, 'YYYY-MM-DD HH:mm')] : null,
98
-        props: { showTime: { format: 'HH:mm' } },
113
+        props: { showTime: { format: 'HH:mm' }, disabled: activityStatus === 0 ? true : false },
99
         rules: [
114
         rules: [
100
           { required: true, message: '请选择活动时间' },
115
           { required: true, message: '请选择活动时间' },
101
         ],
116
         ],
105
         name: 'groupBuyPeople',
120
         name: 'groupBuyPeople',
106
         type: FieldTypes.Text,
121
         type: FieldTypes.Text,
107
         value: dynamicData.groupBuyPeople,
122
         value: dynamicData.groupBuyPeople,
123
+        props: {disabled: activityStatus === 0 ? true : false },
108
         help: '注:成团所需人数',
124
         help: '注:成团所需人数',
109
         rules: [
125
         rules: [
110
           { required: true, message: '请输入成团人数' },
126
           { required: true, message: '请输入成团人数' },
115
         name: 'integral',
131
         name: 'integral',
116
         type: FieldTypes.Text,
132
         type: FieldTypes.Text,
117
         value: dynamicData.integral,
133
         value: dynamicData.integral,
134
+        props: {disabled: activityStatus === 0 ? true : false },
118
         help: '注:用户平均积分' + scoreData.averageScore,
135
         help: '注:用户平均积分' + scoreData.averageScore,
119
         rules: [
136
         rules: [
120
           { required: true, message: '请输入所需积分' },
137
           { required: true, message: '请输入所需积分' },

+ 36
- 12
src/pages/activity/groupActivity/list.jsx View File

101
           {row.activityStatus === 0 &&
101
           {row.activityStatus === 0 &&
102
             <AuthButton name="admin.taShareActivity.finish.put" noRight={null}><span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span></AuthButton>
102
             <AuthButton name="admin.taShareActivity.finish.put" noRight={null}><span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span></AuthButton>
103
           }
103
           }
104
-          {row.activityStatus === 0 &&
104
+          {(row.activityStatus === 0 || row.activityStatus === 2)&&
105
             <AuthButton name="admin.taShareSuccessRecord.get" noRight={null}>
105
             <AuthButton name="admin.taShareSuccessRecord.get" noRight={null}>
106
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
106
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
107
             </AuthButton>
107
             </AuthButton>
108
           }
108
           }
109
+          {row.activityStatus === 0 &&
110
+            <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
111
+              <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this, row)}>{row.status === 1 ? '取消发布' : '发布'}<Icon type="close-circle" className={styles.edit} /></span>
112
+            </AuthButton>
113
+          }
109
           {row.activityStatus === 0 &&
114
           {row.activityStatus === 0 &&
110
             <AuthButton name="admin.taShareActivity.list.get" noRight={null}>
115
             <AuthButton name="admin.taShareActivity.list.get" noRight={null}>
111
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{row.weight === 1 ? '取消置顶' : '置顶'}<Icon type="vertical-align-top" className={styles.edit} /></span>
116
+              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{row.weight === 1 ? '取消标签' : '添加标签'}<Icon type="vertical-align-top" className={styles.edit} /></span>
112
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
117
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
113
             </AuthButton>}
118
             </AuthButton>}
114
 
119
 
115
-          {row.activityStatus === 1 &&
120
+          {(row.activityStatus === 0 || row.activityStatus === 1) &&
116
             <AuthButton name="admin.taShareActivity.update.put" noRight={null}>
121
             <AuthButton name="admin.taShareActivity.update.put" noRight={null}>
117
               <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
122
               <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
118
             </AuthButton>
123
             </AuthButton>
193
     })
198
     })
194
   }
199
   }
195
 
200
 
196
-  //首页推荐
197
-  const recommendGroupActivity = (row, code) => () => {
198
-    request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, sort: row.sort } }).then((data) => {
199
-      console.log(data)
201
+  const sendOrPublicDynamic = row => {
202
+    if (row.status === 1) {
203
+      cancelDynamic(row)
204
+    } else {
205
+      sendDynamic(row)
206
+    }
207
+  }
208
+
209
+  // 取消活动
210
+  const cancelDynamic = row => {
211
+    request({ ...apis.groupActivity.cancel, urlData: { id: row.groupActivityId } }).then(data => {
200
       message.info('操作成功!')
212
       message.info('操作成功!')
201
-      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
202
-    }).catch((err) => {
213
+      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue()  })
214
+    }).catch(err => {
203
       console.log(err)
215
       console.log(err)
204
       message.info(err.msg || err.message)
216
       message.info(err.msg || err.message)
205
     })
217
     })
206
   }
218
   }
207
 
219
 
208
-  //发布活动
209
-  const sendDynamic = (row) => {
210
-    request({ ...apis.activity.send, urlData: { id: row.dynamicId } }).then((data) => {
220
+  // 发布活动
221
+  const sendDynamic = row => {
222
+    request({ ...apis.groupActivity.send, urlData: { id: row.groupActivityId } }).then(data => {
211
       message.info('操作成功!')
223
       message.info('操作成功!')
212
       getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
224
       getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
213
     }).catch(err => {
225
     }).catch(err => {
216
     })
228
     })
217
   }
229
   }
218
 
230
 
231
+  //首页推荐
232
+  const recommendGroupActivity = (row, code) => () => {
233
+    request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, sort: row.sort } }).then((data) => {
234
+      console.log(data)
235
+      message.info('操作成功!')
236
+      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
237
+    }).catch((err) => {
238
+      console.log(err)
239
+      message.info(err.msg || err.message)
240
+    })
241
+  }
242
+
219
   const changePageNum = pageNumber => {
243
   const changePageNum = pageNumber => {
220
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
244
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
221
   }
245
   }

+ 10
- 0
src/services/apis.js View File

832
     method: 'put',
832
     method: 'put',
833
     action: 'admin.taShareActivity.finish.put',
833
     action: 'admin.taShareActivity.finish.put',
834
   },
834
   },
835
+  send: {
836
+    url: `${prefix}/taShareActivity/send/:id`,
837
+    method: 'PUT',
838
+    action: 'admin.taShareActivity.finish.put',
839
+  },
840
+  cancel: {
841
+    method: 'PUT',
842
+    url: `${prefix}/taShareActivity/cancel/:id`,
843
+    action: 'admin.taShareActivity.finish.put',
844
+  },
835
   top: {
845
   top: {
836
     url: `${prefix}/taShareActivity/weight`,
846
     url: `${prefix}/taShareActivity/weight`,
837
     method: 'put',
847
     method: 'put',