Commit 77d91ab92a3ac9b6cd6698b03032182901aac831
1 parent
c9f5fff0
实物兑换券整合办公用品模块“市场物料物品”
Showing
4 changed files
with
39 additions
and
8 deletions
src/pages/capital/ReceiveRules/component/SelectGoodsTable.tsx
... | ... | @@ -74,6 +74,8 @@ const SelectGoodsTable = (props: Props) => { |
74 | 74 | }; |
75 | 75 | |
76 | 76 | function saveDate() { |
77 | + console.log("🚀 ~ file: SelectGoodsTable.tsx:80 ~ saveDate ~ selectedRow:", selectedRow); | |
78 | + | |
77 | 79 | onChange && onChange(selectedRow); |
78 | 80 | onCancel(); |
79 | 81 | } |
... | ... | @@ -87,8 +89,12 @@ const SelectGoodsTable = (props: Props) => { |
87 | 89 | selectedRowKeys: selectedRow.map(row => row.code), |
88 | 90 | onSelect: (row: any, _selected: boolean) => { |
89 | 91 | const index = selectedRow.findIndex((_row) => _row.code == row.code); |
92 | + if (!multiple) { | |
93 | + setSelectedRow([row]); | |
94 | + return; | |
95 | + } | |
90 | 96 | if (_selected) { |
91 | - selectedRow.unshift(row); | |
97 | + selectedRow.unshift(row); | |
92 | 98 | } else if (index > -1) { |
93 | 99 | selectedRow.splice(index, 1); |
94 | 100 | } | ... | ... |
src/pages/capital/ReceiveRules/subPages/GoodsDimension/components/RenderSelectGoos.tsx
... | ... | @@ -2,14 +2,17 @@ import SelectGoodsTable from '@/pages/capital/ReceiveRules/component/SelectGoods |
2 | 2 | import { Button, Card, Popconfirm, Row, Table } from 'antd'; |
3 | 3 | import React, { useState } from 'react'; |
4 | 4 | import { PlusOutlined } from '@ant-design/icons'; |
5 | +import RenderGoodsSpec from '@/pages/capital/components/RenderGoodsSpec'; | |
5 | 6 | |
6 | 7 | const Column = Table.Column; |
7 | 8 | |
8 | 9 | interface GoodsProps { |
9 | 10 | onChange?: Function; |
10 | 11 | value?: any; |
12 | + multiple?: boolean; | |
13 | + disabled?: boolean; | |
11 | 14 | } |
12 | -function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | |
15 | +function RenderSelectGoos({ onChange, value = [], multiple, disabled }: GoodsProps) { | |
13 | 16 | const [goodsModal, setGoodsModal] = useState({ visible: false }); |
14 | 17 | function deleteItem(code: string) { |
15 | 18 | const newData = value.filter((i: any) => i.code !== code); |
... | ... | @@ -18,11 +21,14 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { |
18 | 21 | |
19 | 22 | return ( |
20 | 23 | <Card> |
21 | - <Row justify="end" style={{ marginBottom: 10 }}> | |
22 | - <Button type="primary" icon={<PlusOutlined />} onClick={() => setGoodsModal({ visible: true })}>新增</Button> | |
23 | - </Row> | |
24 | + {!disabled ? ( | |
25 | + <Row justify="end" style={{ marginBottom: 10 }}> | |
26 | + <Button type="primary" icon={<PlusOutlined />} onClick={() => setGoodsModal({ visible: true })}>新增</Button> | |
27 | + </Row> | |
28 | + ) : null} | |
24 | 29 | <Table |
25 | 30 | dataSource={value} |
31 | + pagination={multiple ? undefined : false} | |
26 | 32 | // loading={loading} |
27 | 33 | bordered={false} |
28 | 34 | size="small" |
... | ... | @@ -31,6 +37,13 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { |
31 | 37 | <Column title="物品名称" dataIndex="name" /> |
32 | 38 | <Column title="物品编码" dataIndex="code" /> |
33 | 39 | <Column |
40 | + title="型号规格" | |
41 | + dataIndex="spec" | |
42 | + width="16%" | |
43 | + ellipsis | |
44 | + render={(text, record) => text && <RenderGoodsSpec specList={JSON.parse(text)} />} | |
45 | + /> | |
46 | + <Column | |
34 | 47 | align="center" |
35 | 48 | title="操作" |
36 | 49 | // width={400} |
... | ... | @@ -38,9 +51,11 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { |
38 | 51 | return ( |
39 | 52 | <> |
40 | 53 | <Popconfirm title="确认删除?" onConfirm={() => deleteItem(value.code)}> |
41 | - <Button type="link"> | |
42 | - 删除 | |
43 | - </Button> | |
54 | + {!disabled && ( | |
55 | + <Button type="link"> | |
56 | + 删除 | |
57 | + </Button> | |
58 | + )} | |
44 | 59 | </Popconfirm> |
45 | 60 | </> |
46 | 61 | ); |
... | ... | @@ -48,6 +63,7 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { |
48 | 63 | /> |
49 | 64 | </Table> |
50 | 65 | <SelectGoodsTable |
66 | + multiple={multiple} | |
51 | 67 | visible={goodsModal.visible} |
52 | 68 | onCancel={() => setGoodsModal({ visible: false })} |
53 | 69 | onChange={(v) => onChange && onChange(v)} | ... | ... |
src/pages/coupon/CouponConfig/components/FullReduce.tsx
... | ... | @@ -8,6 +8,7 @@ import ShopLimit from "./ShopLimit"; |
8 | 8 | import useInitail from "@/hooks/useInitail"; |
9 | 9 | import { PaymentTypeEnum } from '@/pages/coupon/CashChange/api'; |
10 | 10 | import { RightOutlined } from '@ant-design/icons'; |
11 | +import RenderSelectGoos from '@/pages/capital/ReceiveRules/subPages/GoodsDimension/components/RenderSelectGoos'; | |
11 | 12 | |
12 | 13 | const Option = Select.Option; |
13 | 14 | interface Props { |
... | ... | @@ -170,6 +171,12 @@ export default function FullReduce({ |
170 | 171 | /> |
171 | 172 | </Form.Item> |
172 | 173 | )} |
174 | + {/* 实物兑换券选择兑换物品 */} | |
175 | + {classifyInfo.code === "dhyhq" && ( | |
176 | + <Form.Item label="兑换物品" name="amsCode" extra={<span style={{ fontSize: 12 }}>*兑换物品仅限一个</span>} rules={[{ required: true, message: '请选择' }]}> | |
177 | + <RenderSelectGoos multiple={false} disabled={readonly} /> | |
178 | + </Form.Item> | |
179 | + )} | |
173 | 180 | <Form.Item |
174 | 181 | label="优惠券券面金额" |
175 | 182 | name="amount" | ... | ... |
src/pages/coupon/CouponConfig/index.tsx
... | ... | @@ -32,6 +32,7 @@ export default function UpsertCoupon({ visible, onCancel, onSave, remark, disabl |
32 | 32 | classifyCode: data.classifyCode ? { value: data.classifyCode, label: data.classifyName } : undefined, |
33 | 33 | exchangeTypeId: data.exchangeTypeId ? { value: data.exchangeTypeId, label: data.exchangeTypeName } : undefined, |
34 | 34 | orgList: data.orgList ? data.orgList.map((i) => ({ value: i.orgId, label: i.orgName })) : undefined, |
35 | + amsCode: data.amsCode ? [{ code: data.amsCode, name: data.amsName, spec: data.amsSpec }] : undefined, | |
35 | 36 | }); |
36 | 37 | setLoading(false); |
37 | 38 | }).catch((e) => { |
... | ... | @@ -72,6 +73,7 @@ export default function UpsertCoupon({ visible, onCancel, onSave, remark, disabl |
72 | 73 | exchangeTypeId: fields.exchangeTypeId && fields.exchangeTypeId.value, |
73 | 74 | exchangeTypeName: fields.exchangeTypeId && fields.exchangeTypeId.label, |
74 | 75 | schemeList: fields.schemeList ? fields.schemeList.map((i: MktConponSpace.LimitList) => ({ ...i, externalRely: i.externalRely || false })) : [], |
76 | + amsCode: fields.amsCode && fields.amsCode.map((i: { code: string; }) => i.code).join(','), | |
75 | 77 | remark, |
76 | 78 | }; |
77 | 79 | setSaveLoading(true); | ... | ... |