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,7 +174,7 @@ export default function FullReduce({ | ||
174 | {/* 实物兑换券选择兑换物品 */} | 174 | {/* 实物兑换券选择兑换物品 */} |
175 | {classifyInfo.code === "dhyhq" && ( | 175 | {classifyInfo.code === "dhyhq" && ( |
176 | <Form.Item label="兑换物品" name="amsCode" extra={<span style={{ fontSize: 12 }}>*兑换物品仅限一个</span>} rules={[{ required: true, message: '请选择' }]}> | 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 | </Form.Item> | 178 | </Form.Item> |
179 | )} | 179 | )} |
180 | <Form.Item | 180 | <Form.Item |
src/pages/mkt/ActivityCreate/ExternalPromotion/api.ts
@@ -146,12 +146,6 @@ export function saveChangeCoupon(params: MktConponSpace.ConListParams): http.Pro | @@ -146,12 +146,6 @@ export function saveChangeCoupon(params: MktConponSpace.ConListParams): http.Pro | ||
146 | export function getCouponChangeDetails(params: { activityNo?: string, confNo?: string }): http.PromiseResp<MktConponSpace.ConListParams> { | 146 | export function getCouponChangeDetails(params: { activityNo?: string, confNo?: string }): http.PromiseResp<MktConponSpace.ConListParams> { |
147 | return request.get(`${MKT_HOST}/erp/activity/change/coupon/info`, { params }); | 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,7 +17,7 @@ import { | ||
17 | deleteConfigList, | 17 | deleteConfigList, |
18 | batchDeleteCoupon, | 18 | batchDeleteCoupon, |
19 | } from "@/pages/coupon/CouponConfig/api"; //删除优惠券配置 | 19 | } from "@/pages/coupon/CouponConfig/api"; //删除优惠券配置 |
20 | -import { getCouponChangeDetails, saveChangeCoupon, saveChangeGift, saveChangeAwardName } from '../../api'; | 20 | +import { getCouponChangeDetails, saveChangeCoupon, saveChangeAwardName } from '../../api'; |
21 | import { useStore } from "@/pages/mkt/ActivityCreate/index"; | 21 | import { useStore } from "@/pages/mkt/ActivityCreate/index"; |
22 | 22 | ||
23 | const { Column } = Table; | 23 | const { Column } = Table; |
@@ -174,22 +174,7 @@ export default function Coupons({ | @@ -174,22 +174,7 @@ export default function Coupons({ | ||
174 | if (!(coupon.index === undefined || coupon.itemIndex === undefined)) { | 174 | if (!(coupon.index === undefined || coupon.itemIndex === undefined)) { |
175 | _savaList[coupon.index].giftItems[coupon.itemIndex] = pa; | 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 | if (coupon.index !== undefined) { | 178 | if (coupon.index !== undefined) { |
194 | _savaList[coupon.index].giftItems.push(pa); | 179 | _savaList[coupon.index].giftItems.push(pa); |
195 | setSaveList([..._savaList]); | 180 | setSaveList([..._savaList]); |
@@ -372,21 +357,21 @@ export default function Coupons({ | @@ -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 | </Button> | 361 | </Button> |
377 | - {item.aliasName && !readOnly && ( | 362 | + {((item.aliasName && !readOnly) || changeEnable) && ( |
378 | <Popconfirm | 363 | <Popconfirm |
379 | title="删除将丢失优惠券信息,确定删除?" | 364 | title="删除将丢失优惠券信息,确定删除?" |
380 | okText="确定" | 365 | okText="确定" |
381 | cancelText="取消" | 366 | cancelText="取消" |
382 | onConfirm={() => _onDelete(index, itemIndex)} | 367 | onConfirm={() => _onDelete(index, itemIndex)} |
383 | > | 368 | > |
384 | - <Button type="link" disabled={readOnly}> | 369 | + <Button type="link" danger disabled={readOnly && !changeEnable}> |
385 | 删除 | 370 | 删除 |
386 | </Button> | 371 | </Button> |
387 | </Popconfirm> | 372 | </Popconfirm> |
388 | )} | 373 | )} |
389 | - {item.aliasName && changeEnable && item.giftItemId && ( | 374 | + {/* {item.aliasName && changeEnable && item.giftItemId && ( |
390 | <Popconfirm | 375 | <Popconfirm |
391 | title="是否确定替换该优惠券,已发放优惠券不受影响" | 376 | title="是否确定替换该优惠券,已发放优惠券不受影响" |
392 | okText="确定" | 377 | okText="确定" |
@@ -406,7 +391,7 @@ export default function Coupons({ | @@ -406,7 +391,7 @@ export default function Coupons({ | ||
406 | 替换后续发放优惠券 | 391 | 替换后续发放优惠券 |
407 | </Button> | 392 | </Button> |
408 | </Popconfirm> | 393 | </Popconfirm> |
409 | - )} | 394 | + )} */} |
410 | </Space> | 395 | </Space> |
411 | </div> | 396 | </div> |
412 | ))} | 397 | ))} |
@@ -418,8 +403,8 @@ export default function Coupons({ | @@ -418,8 +403,8 @@ export default function Coupons({ | ||
418 | <Space> | 403 | <Space> |
419 | {!record.awardName.includes("谢谢惠顾") && ( | 404 | {!record.awardName.includes("谢谢惠顾") && ( |
420 | <Button | 405 | <Button |
421 | - disabled={disabled} | ||
422 | - hidden={disabled} | 406 | + disabled={disabled && !changeEnable} |
407 | + hidden={disabled && !changeEnable} | ||
423 | style={{ padding: 0 }} | 408 | style={{ padding: 0 }} |
424 | type="link" | 409 | type="link" |
425 | onClick={() => setCoupon({ | 410 | onClick={() => setCoupon({ |
@@ -538,7 +523,7 @@ export default function Coupons({ | @@ -538,7 +523,7 @@ export default function Coupons({ | ||
538 | {/* 优惠券配置 */} | 523 | {/* 优惠券配置 */} |
539 | <UpsertCoupon | 524 | <UpsertCoupon |
540 | visible={coupon.visible} | 525 | visible={coupon.visible} |
541 | - disabled={coupon.giftItemId ? false : disabled} | 526 | + disabled={coupon.giftItemId ? false : disabled && !changeEnable} |
542 | onCancel={() => setCoupon({ ...coupon, visible: false, confNo: undefined })} | 527 | onCancel={() => setCoupon({ ...coupon, visible: false, confNo: undefined })} |
543 | onSave={_onSava} | 528 | onSave={_onSava} |
544 | remark="市场活动" | 529 | remark="市场活动" |
src/pages/mkt/ActivityCreate/ExternalPromotion/components/ActivityFlow/SignIn.tsx
@@ -47,13 +47,13 @@ export default function index() { | @@ -47,13 +47,13 @@ export default function index() { | ||
47 | gifts: fileds.gifts, | 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 | setSaveLoading(true); | 54 | setSaveLoading(true); |
55 | const api = changeEnable ? saveChangeSignInApi : saveSignInApi; | 55 | const api = changeEnable ? saveChangeSignInApi : saveSignInApi; |
56 | - api(changeEnable ? { endTime, activityNo } : pa).then((res) => { | 56 | + api(pa).then((res) => { |
57 | message.success("签到有礼保存成功"); | 57 | message.success("签到有礼保存成功"); |
58 | getFlowConfig(activityNo); | 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,20 +56,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { | ||
56 | const _tempDataSource = currentData.map((item) => (item.couponCode === tempObj.couponCode ? tempObj : item)); | 56 | const _tempDataSource = currentData.map((item) => (item.couponCode === tempObj.couponCode ? tempObj : item)); |
57 | setGiftList(_tempDataSource); | 57 | setGiftList(_tempDataSource); |
58 | onChange && onChange([{ ...value && value[0], giftItems: _tempDataSource }]); | 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 | currentData.push(pa); | 61 | currentData.push(pa); |
75 | setGiftList(currentData); | 62 | setGiftList(currentData); |
@@ -89,7 +76,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { | @@ -89,7 +76,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { | ||
89 | <Card | 76 | <Card |
90 | style={{ display: "block" }} | 77 | style={{ display: "block" }} |
91 | extra={ | 78 | extra={ |
92 | - !disabled && ( | 79 | + (!disabled || changeEnable) && ( |
93 | <div | 80 | <div |
94 | style={{ | 81 | style={{ |
95 | flex: 1, | 82 | flex: 1, |
@@ -101,7 +88,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { | @@ -101,7 +88,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { | ||
101 | <Button | 88 | <Button |
102 | type="link" | 89 | type="link" |
103 | icon={<PlusOutlined />} | 90 | icon={<PlusOutlined />} |
104 | - disabled={disabled} | 91 | + disabled={disabled && !changeEnable} |
105 | onClick={() => setCoupon({ | 92 | onClick={() => setCoupon({ |
106 | ...coupon, | 93 | ...coupon, |
107 | visible: true, | 94 | visible: true, |
@@ -156,14 +143,14 @@ function SignupGifts({ value, onChange, disabled }: Props) { | @@ -156,14 +143,14 @@ function SignupGifts({ value, onChange, disabled }: Props) { | ||
156 | record: ExternalPromotion.giftItems, | 143 | record: ExternalPromotion.giftItems, |
157 | index: number | 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 | <Popconfirm title="是否确定替换该优惠券,已发放优惠券不受影响,将在审批通过后生效" onConfirm={() => setCoupon({ ...coupon, visible: true, giftItemId: record.giftItemId })}> | 150 | <Popconfirm title="是否确定替换该优惠券,已发放优惠券不受影响,将在审批通过后生效" onConfirm={() => setCoupon({ ...coupon, visible: true, giftItemId: record.giftItemId })}> |
164 | {!!changeEnable && <Button type="link" style={{ margin: 0, fontSize: 12 }} danger>替换后续发放优惠券</Button>} | 151 | {!!changeEnable && <Button type="link" style={{ margin: 0, fontSize: 12 }} danger>替换后续发放优惠券</Button>} |
165 | </Popconfirm> | 152 | </Popconfirm> |
166 | - )} | 153 | + )} */} |
167 | </> | 154 | </> |
168 | ) : ( | 155 | ) : ( |
169 | <Space> | 156 | <Space> |
@@ -199,7 +186,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { | @@ -199,7 +186,7 @@ function SignupGifts({ value, onChange, disabled }: Props) { | ||
199 | <UpsertCoupon | 186 | <UpsertCoupon |
200 | visible={coupon.visible} | 187 | visible={coupon.visible} |
201 | onCancel={() => setCoupon({ ...coupon, visible: false, confNo: undefined, giftItemId: undefined })} | 188 | onCancel={() => setCoupon({ ...coupon, visible: false, confNo: undefined, giftItemId: undefined })} |
202 | - disabled={coupon.giftItemId ? false : disabled} | 189 | + disabled={coupon.giftItemId ? false : disabled && !changeEnable} |
203 | onSave={onSave} | 190 | onSave={onSave} |
204 | remark="市场活动" | 191 | remark="市场活动" |
205 | confNo={coupon.confNo} | 192 | confNo={coupon.confNo} |