Commit 2be9df522bc873cd2c0c7012d5989ac1cfa70db1
1 parent
50d3e44c
优惠券变更调整为支持编辑和删除
Showing
5 changed files
with
24 additions
and
58 deletions
src/pages/coupon/CouponConfig/components/FullReduce.tsx
... | ... | @@ -174,7 +174,7 @@ export default function FullReduce({ |
174 | 174 | {/* 实物兑换券选择兑换物品 */} |
175 | 175 | {classifyInfo.code === "dhyhq" && ( |
176 | 176 | <Form.Item label="兑换物品" name="amsCode" extra={<span style={{ fontSize: 12 }}>*兑换物品仅限一个</span>} rules={[{ required: true, message: '请选择' }]}> |
177 | - <RenderSelectGoos multiple={false} disabled={readonly} /> | |
177 | + <RenderSelectGoos multiple={false} disabled={readonly || !!confNo} /> | |
178 | 178 | </Form.Item> |
179 | 179 | )} |
180 | 180 | <Form.Item | ... | ... |
src/pages/mkt/ActivityCreate/ExternalPromotion/api.ts
... | ... | @@ -146,12 +146,6 @@ export function saveChangeCoupon(params: MktConponSpace.ConListParams): http.Pro |
146 | 146 | export function getCouponChangeDetails(params: { activityNo?: string, confNo?: string }): http.PromiseResp<MktConponSpace.ConListParams> { |
147 | 147 | return request.get(`${MKT_HOST}/erp/activity/change/coupon/info`, { params }); |
148 | 148 | } |
149 | -/** | |
150 | - * 保存奖品变更信息(优惠券) | |
151 | - */ | |
152 | -export function saveChangeGift(params: MktConponSpace.ConListParams): http.PromiseResp<MktConponSpace.ConListParams> { | |
153 | - return request.post(`${MKT_HOST}/erp/activity/change/gift/save`, params); | |
154 | -} | |
155 | 149 | |
156 | 150 | /** |
157 | 151 | * 变更奖项名称(礼包奖品名称) | ... | ... |
src/pages/mkt/ActivityCreate/ExternalPromotion/components/ActivityFlow/Coupons.tsx
... | ... | @@ -17,7 +17,7 @@ import { |
17 | 17 | deleteConfigList, |
18 | 18 | batchDeleteCoupon, |
19 | 19 | } from "@/pages/coupon/CouponConfig/api"; //删除优惠券配置 |
20 | -import { getCouponChangeDetails, saveChangeCoupon, saveChangeGift, saveChangeAwardName } from '../../api'; | |
20 | +import { getCouponChangeDetails, saveChangeCoupon, saveChangeAwardName } from '../../api'; | |
21 | 21 | import { useStore } from "@/pages/mkt/ActivityCreate/index"; |
22 | 22 | |
23 | 23 | const { Column } = Table; |
... | ... | @@ -174,22 +174,7 @@ export default function Coupons({ |
174 | 174 | if (!(coupon.index === undefined || coupon.itemIndex === undefined)) { |
175 | 175 | _savaList[coupon.index].giftItems[coupon.itemIndex] = pa; |
176 | 176 | } |
177 | - } | |
178 | - /**优惠券变更 */ | |
179 | - if (coupon.giftItemId) { | |
180 | - //@ts-ignore | |
181 | - saveChangeGift({ ...pa, giftItemId: coupon.giftItemId, activityNo, giftId: value[0] && value[0].giftId }).then(res => { | |
182 | - message.success("奖品变更成功"); | |
183 | - if (!(coupon.index === undefined || coupon.itemIndex === undefined)) { | |
184 | - _savaList[coupon.index].giftItems[coupon.itemIndex] = { ...pa, giftItemId: coupon.giftItemId }; | |
185 | - } | |
186 | - onChange && onChange([..._savaList]); | |
187 | - }).catch(err => { | |
188 | - message.error(err); | |
189 | - }); | |
190 | - } | |
191 | - if (!coupon.giftItemId && !coupon.confNo) { | |
192 | - //新增 | |
177 | + } else { | |
193 | 178 | if (coupon.index !== undefined) { |
194 | 179 | _savaList[coupon.index].giftItems.push(pa); |
195 | 180 | setSaveList([..._savaList]); |
... | ... | @@ -372,21 +357,21 @@ export default function Coupons({ |
372 | 357 | }); |
373 | 358 | }} |
374 | 359 | > |
375 | - {itemIndex + 1}.{item.aliasName} | |
360 | + <span style={{whiteSpace: 'pre-wrap'}}>{itemIndex + 1}.{item.aliasName}</span> | |
376 | 361 | </Button> |
377 | - {item.aliasName && !readOnly && ( | |
362 | + {((item.aliasName && !readOnly) || changeEnable) && ( | |
378 | 363 | <Popconfirm |
379 | 364 | title="删除将丢失优惠券信息,确定删除?" |
380 | 365 | okText="确定" |
381 | 366 | cancelText="取消" |
382 | 367 | onConfirm={() => _onDelete(index, itemIndex)} |
383 | 368 | > |
384 | - <Button type="link" disabled={readOnly}> | |
369 | + <Button type="link" danger disabled={readOnly && !changeEnable}> | |
385 | 370 | 删除 |
386 | 371 | </Button> |
387 | 372 | </Popconfirm> |
388 | 373 | )} |
389 | - {item.aliasName && changeEnable && item.giftItemId && ( | |
374 | + {/* {item.aliasName && changeEnable && item.giftItemId && ( | |
390 | 375 | <Popconfirm |
391 | 376 | title="是否确定替换该优惠券,已发放优惠券不受影响" |
392 | 377 | okText="确定" |
... | ... | @@ -406,7 +391,7 @@ export default function Coupons({ |
406 | 391 | 替换后续发放优惠券 |
407 | 392 | </Button> |
408 | 393 | </Popconfirm> |
409 | - )} | |
394 | + )} */} | |
410 | 395 | </Space> |
411 | 396 | </div> |
412 | 397 | ))} |
... | ... | @@ -418,8 +403,8 @@ export default function Coupons({ |
418 | 403 | <Space> |
419 | 404 | {!record.awardName.includes("谢谢惠顾") && ( |
420 | 405 | <Button |
421 | - disabled={disabled} | |
422 | - hidden={disabled} | |
406 | + disabled={disabled && !changeEnable} | |
407 | + hidden={disabled && !changeEnable} | |
423 | 408 | style={{ padding: 0 }} |
424 | 409 | type="link" |
425 | 410 | onClick={() => setCoupon({ |
... | ... | @@ -538,7 +523,7 @@ export default function Coupons({ |
538 | 523 | {/* 优惠券配置 */} |
539 | 524 | <UpsertCoupon |
540 | 525 | visible={coupon.visible} |
541 | - disabled={coupon.giftItemId ? false : disabled} | |
526 | + disabled={coupon.giftItemId ? false : disabled && !changeEnable} | |
542 | 527 | onCancel={() => setCoupon({ ...coupon, visible: false, confNo: undefined })} |
543 | 528 | onSave={_onSava} |
544 | 529 | remark="市场活动" | ... | ... |
src/pages/mkt/ActivityCreate/ExternalPromotion/components/ActivityFlow/SignIn.tsx
... | ... | @@ -47,13 +47,13 @@ export default function index() { |
47 | 47 | gifts: fileds.gifts, |
48 | 48 | }, |
49 | 49 | }; |
50 | - if (changeEnable && pa.endTime == data.endTime) { | |
51 | - message.info("暂无变更项"); | |
52 | - return; | |
53 | - } | |
50 | + // if (changeEnable && pa.endTime == data.endTime) { | |
51 | + // message.info("暂无变更项"); | |
52 | + // return; | |
53 | + // } | |
54 | 54 | setSaveLoading(true); |
55 | 55 | const api = changeEnable ? saveChangeSignInApi : saveSignInApi; |
56 | - api(changeEnable ? { endTime, activityNo } : pa).then((res) => { | |
56 | + api(pa).then((res) => { | |
57 | 57 | message.success("签到有礼保存成功"); |
58 | 58 | getFlowConfig(activityNo); |
59 | 59 | }) | ... | ... |
src/pages/mkt/ActivityCreate/ExternalPromotion/components/ActivityFlow/SignupGifts.tsx
... | ... | @@ -56,20 +56,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { |
56 | 56 | const _tempDataSource = currentData.map((item) => (item.couponCode === tempObj.couponCode ? tempObj : item)); |
57 | 57 | setGiftList(_tempDataSource); |
58 | 58 | onChange && onChange([{ ...value && value[0], giftItems: _tempDataSource }]); |
59 | - } | |
60 | - /**优惠券变更 */ | |
61 | - if (coupon.giftItemId) { | |
62 | - //@ts-ignore | |
63 | - saveChangeGift({ ...pa, giftItemId: coupon.giftItemId, activityNo, giftId: value[0] && value[0].giftId }).then(res => { | |
64 | - message.success("奖品变更成功"); | |
65 | - const _tempDataSource = currentData.map((item) => (item.giftItemId === coupon.giftItemId ? { ...pa, giftItemId: coupon.giftItemId } : item)); | |
66 | - setGiftList(_tempDataSource); | |
67 | - onChange && onChange([{ ...value && value[0], giftItems: _tempDataSource }]); | |
68 | - }).catch(err => { | |
69 | - message.error(err); | |
70 | - }); | |
71 | - } | |
72 | - if (!coupon.confNo && !coupon.giftItemId) { | |
59 | + } else { | |
73 | 60 | // 新增优惠券 |
74 | 61 | currentData.push(pa); |
75 | 62 | setGiftList(currentData); |
... | ... | @@ -89,7 +76,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { |
89 | 76 | <Card |
90 | 77 | style={{ display: "block" }} |
91 | 78 | extra={ |
92 | - !disabled && ( | |
79 | + (!disabled || changeEnable) && ( | |
93 | 80 | <div |
94 | 81 | style={{ |
95 | 82 | flex: 1, |
... | ... | @@ -101,7 +88,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { |
101 | 88 | <Button |
102 | 89 | type="link" |
103 | 90 | icon={<PlusOutlined />} |
104 | - disabled={disabled} | |
91 | + disabled={disabled && !changeEnable} | |
105 | 92 | onClick={() => setCoupon({ |
106 | 93 | ...coupon, |
107 | 94 | visible: true, |
... | ... | @@ -156,14 +143,14 @@ function SignupGifts({ value, onChange, disabled }: Props) { |
156 | 143 | record: ExternalPromotion.giftItems, |
157 | 144 | index: number |
158 | 145 | ) => ( |
159 | - disabled ? ( | |
146 | + disabled && !changeEnable ? ( | |
160 | 147 | <> |
161 | - <Button type="link" onClick={() => setCoupon({ ...coupon, visible: true, confNo: record.couponCode })}>{changeEnable ? "编辑" : "查看"}</Button> | |
162 | - {record.giftItemId && ( | |
148 | + <Button type="link" onClick={() => setCoupon({ ...coupon, visible: true, confNo: record.couponCode })}>查看</Button> | |
149 | + {/* {record.giftItemId && ( | |
163 | 150 | <Popconfirm title="是否确定替换该优惠券,已发放优惠券不受影响,将在审批通过后生效" onConfirm={() => setCoupon({ ...coupon, visible: true, giftItemId: record.giftItemId })}> |
164 | 151 | {!!changeEnable && <Button type="link" style={{ margin: 0, fontSize: 12 }} danger>替换后续发放优惠券</Button>} |
165 | 152 | </Popconfirm> |
166 | - )} | |
153 | + )} */} | |
167 | 154 | </> |
168 | 155 | ) : ( |
169 | 156 | <Space> |
... | ... | @@ -199,7 +186,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { |
199 | 186 | <UpsertCoupon |
200 | 187 | visible={coupon.visible} |
201 | 188 | onCancel={() => setCoupon({ ...coupon, visible: false, confNo: undefined, giftItemId: undefined })} |
202 | - disabled={coupon.giftItemId ? false : disabled} | |
189 | + disabled={coupon.giftItemId ? false : disabled && !changeEnable} | |
203 | 190 | onSave={onSave} |
204 | 191 | remark="市场活动" |
205 | 192 | confNo={coupon.confNo} | ... | ... |