魏超 5 年前
父节点
当前提交
81f5271a15

+ 1
- 1
src/pages/activity/ActivityList.jsx 查看文件

@@ -147,7 +147,7 @@ const header = props => {
147 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 148
           </AuthButton>
149 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 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 152
           </AuthButton>
153 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 查看文件

@@ -32,6 +32,9 @@ const Edit = props => {
32 32
   const { groupActivityId } = props.location.query
33 33
   const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
34 34
   const [scoreData, setScoreData] = useState({})
35
+  const [activityStatus, setActivityStatus] = useState({})
36
+  const [disable, setDisable] = useState(false)
37
+
35 38
   useEffect(() => {
36 39
     request(apis.groupActivity.avgScore).then((data) => {
37 40
       setScoreData(data);
@@ -46,6 +49,8 @@ const Edit = props => {
46 49
     const getDynamicData = (groupActivityId) => {
47 50
       request({ ...apis.groupActivity.details, urlData: { id: groupActivityId } }).then((data) => {
48 51
         setDynamicData(data)
52
+        setActivityStatus(data.activityStatus)
53
+        setDisable(data.activityStatus === 0 ? true : false)
49 54
       })
50 55
     }
51 56
   }
@@ -65,7 +70,7 @@ const Edit = props => {
65 70
       {
66 71
         label: '选择项目',
67 72
         name: 'buildingId',
68
-        render: <BuildSelect />,
73
+        render: <BuildSelect disabled={disable}/>,
69 74
         value: dynamicData.buildingId,
70 75
         rules: [
71 76
           { required: true, message: '请选择项目' },
@@ -90,12 +95,22 @@ const Edit = props => {
90 95
         ],
91 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 109
         label: '活动时间',
95 110
         name: 'activityTime',
96 111
         type: FieldTypes.RangePicker,
97 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 114
         rules: [
100 115
           { required: true, message: '请选择活动时间' },
101 116
         ],
@@ -105,6 +120,7 @@ const Edit = props => {
105 120
         name: 'groupBuyPeople',
106 121
         type: FieldTypes.Text,
107 122
         value: dynamicData.groupBuyPeople,
123
+        props: {disabled: activityStatus === 0 ? true : false },
108 124
         help: '注:成团所需人数',
109 125
         rules: [
110 126
           { required: true, message: '请输入成团人数' },
@@ -115,6 +131,7 @@ const Edit = props => {
115 131
         name: 'integral',
116 132
         type: FieldTypes.Text,
117 133
         value: dynamicData.integral,
134
+        props: {disabled: activityStatus === 0 ? true : false },
118 135
         help: '注:用户平均积分' + scoreData.averageScore,
119 136
         rules: [
120 137
           { required: true, message: '请输入所需积分' },

+ 36
- 12
src/pages/activity/groupActivity/list.jsx 查看文件

@@ -101,18 +101,23 @@ const header = props => {
101 101
           {row.activityStatus === 0 &&
102 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 105
             <AuthButton name="admin.taShareSuccessRecord.get" noRight={null}>
106 106
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
107 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 114
           {row.activityStatus === 0 &&
110 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 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 118
             </AuthButton>}
114 119
 
115
-          {row.activityStatus === 1 &&
120
+          {(row.activityStatus === 0 || row.activityStatus === 1) &&
116 121
             <AuthButton name="admin.taShareActivity.update.put" noRight={null}>
117 122
               <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
118 123
             </AuthButton>
@@ -193,21 +198,28 @@ const header = props => {
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 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 215
       console.log(err)
204 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 223
       message.info('操作成功!')
212 224
       getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
213 225
     }).catch(err => {
@@ -216,6 +228,18 @@ const header = props => {
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 243
   const changePageNum = pageNumber => {
220 244
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
221 245
   }

+ 10
- 0
src/services/apis.js 查看文件

@@ -832,6 +832,16 @@ export default {
832 832
     method: 'put',
833 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 845
   top: {
836 846
     url: `${prefix}/taShareActivity/weight`,
837 847
     method: 'put',