Commit 079a65245fbc073bf15ed638f14abf6fe98ed6ff

Authored by 莫红玲
2 parents 36f42c23 14be4f5e

Merge remote-tracking branch 'origin/master' into mkt-change

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
... ... @@ -63,8 +63,8 @@ export function getSignUpDetail(params: { activityNo?: string, change?: boolean
63 63 /**
64 64 * 查询签到有礼配置信息
65 65 */
66   -export function getSignInDetail(activityNo?: string): http.PromiseResp<ExternalPromotion.SignInParams> {
67   - return request.get(`${MKT_HOST}/erp/activity/flow/sign/in/detail`, { params: { activityNo } });
  66 +export function getSignInDetail(params: { activityNo?: string, change?: boolean }): http.PromiseResp<ExternalPromotion.SignInParams> {
  67 + return request.get(`${MKT_HOST}/erp/activity/flow/sign/in/detail`, { params });
68 68 }
69 69  
70 70 /**
... ... @@ -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
... ... @@ -14,7 +14,7 @@ export default function index() {
14 14 const { baseInfo, readOnly, getFlowConfig, externalInfo } = useStore();
15 15 const { activityNo, changeEnable } = baseInfo;
16 16 const { flowDisable } = externalInfo;
17   - const { data, errMsg, loading, params, setParams } = useInitial(getSignInDetail, {}, activityNo);
  17 + const { data, errMsg, loading, params, setParams } = useInitial(getSignInDetail, {}, {activityNo, change: changeEnable});
18 18 const [form] = Form.useForm();
19 19 const [saveLoading, setSaveLoading] = useState<boolean>(false);
20 20  
... ... @@ -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}
... ...
src/pages/mkt/ActivityManage/components/Operation.tsx
... ... @@ -105,7 +105,7 @@ export default function Oparetion(props: Props) {
105 105 if ([4, 5].includes(status) && record.changeStatus !== 2) {
106 106 menus = [
107 107 <Button type="primary" ghost size="small" onClick={changeBaseInfo}>变更信息</Button>,
108   - <Button danger ghost size="small" onClick={endActivity}>终止</Button>,
  108 + // <Button danger ghost size="small" onClick={endActivity}>终止</Button>,
109 109 ];
110 110 }
111 111 return (
... ...
src/pages/pms/storage/partShop/components/PartShopModal.tsx
... ... @@ -18,31 +18,10 @@ export default function PartShopModal() {
18 18 } else {
19 19 setIsadd(false);
20 20 setIsprice(false);
21   - form.setFieldsValue({
22   - costPrice: "",
23   - stock: 0,
24   - lockStock: 0,
25   - shopId: "",
26   - part: "",
27   - user: "",
28   - fixRemark: ""
29   - });
30   - }
31   - }, [visible]);
32   -
33   - useEffect(() => {
34   - if (isadd) {
35 21 setItem({});
36   - console.log(isadd, item);
37   - form.setFieldsValue({
38   - costPrice: "",
39   - stock: 0,
40   - lockStock: 0,
41   - shopId: "",
42   - part: ""
43   - });
  22 + form.resetFields();
44 23 }
45   - }, [isadd]);
  24 + }, [visible]);
46 25  
47 26 const handleSubmit = () => {
48 27 form.validateFields().then(values => {
... ... @@ -50,11 +29,12 @@ export default function PartShopModal() {
50 29 ...item,
51 30 partId: values.part.partId,
52 31 costPrice: values.costPrice,
53   - stock: values.stock,
54   - lockStock: values.lockStock,
  32 + stock: values.stock || 0,
  33 + lockStock: values.lockStock || 0,
55 34 shopId: values.shopId,
56 35 user: values.user,
57   - fixRemark: values.fixRemark
  36 + fixRemark: values.fixRemark,
  37 + type: isadd ? 1 : isprice ? 3 : 2
58 38 };
59 39 setConfirmLoading(true);
60 40 savePartShopApi(params).then(res => {
... ... @@ -76,8 +56,7 @@ export default function PartShopModal() {
76 56  
77 57 const validatorLockStock = (rule: any, value: number) => {
78 58 if (value > form.getFieldsValue(['stock']).stock) {
79   - // eslint-disable-next-line prefer-promise-reject-errors
80   - return Promise.reject('锁定库存不能超过总库存数量!');
  59 + return Promise.reject(new Error('锁定库存不能超过总库存数量!'));
81 60 } else return Promise.resolve();
82 61 };
83 62  
... ... @@ -113,13 +92,13 @@ export default function PartShopModal() {
113 92 <ChoosePart disabled={!!item.id} />
114 93 </Item>
115 94 <Item label="加权成本价(元)" name="costPrice" rules={[{ required: true, message: "请输入加权成本价" }]}>
116   - <InputNumber style={{ width: "100%" }} min={0} step={0.1} placeholder="加权成本价(元)" />
  95 + <InputNumber style={{ width: "100%" }} min={0} step={0.1} placeholder="加权成本价(元)" disabled={!(isadd || isprice)} />
117 96 </Item>
118   - <Item label="总库存数量" name="stock" rules={[{ required: true, message: "请输入总库存数量" }]}>
119   - <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="总库存数量" disabled={isprice || isadd} />
  97 + <Item label="总库存数量" name="stock">
  98 + <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="总库存数量" disabled={isprice || isadd} defaultValue={0} />
120 99 </Item>
121   - <Item label="锁定库存" name="lockStock" rules={[{ required: true, message: "请输入锁定库存" }, { validator: validatorLockStock }]}>
122   - <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="锁定库存" disabled />
  100 + <Item label="锁定库存" name="lockStock" rules={[{ validator: validatorLockStock }]}>
  101 + <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="锁定库存" disabled defaultValue={0} />
123 102 </Item>
124 103 {!!fw && !isprice && !isadd && (
125 104 <Item label="修改人" name="user" rules={[{ required: true, message: "请输入修改人" }]}>
... ...
src/pages/pms/storage/partShop/interface.d.ts
... ... @@ -34,6 +34,7 @@ declare namespace PmsStoragePartShop {
34 34 shopId?: number, // 服务站ID
35 35 user?: string //修改人名称
36 36 fixRemark?: string //修改原因
  37 + type?: number //类型1新增2修改库存3修改价格
37 38 }
38 39  
39 40 interface Option {
... ...