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,6 +74,8 @@ const SelectGoodsTable = (props: Props) => { | ||
74 | }; | 74 | }; |
75 | 75 | ||
76 | function saveDate() { | 76 | function saveDate() { |
77 | + console.log("🚀 ~ file: SelectGoodsTable.tsx:80 ~ saveDate ~ selectedRow:", selectedRow); | ||
78 | + | ||
77 | onChange && onChange(selectedRow); | 79 | onChange && onChange(selectedRow); |
78 | onCancel(); | 80 | onCancel(); |
79 | } | 81 | } |
@@ -87,8 +89,12 @@ const SelectGoodsTable = (props: Props) => { | @@ -87,8 +89,12 @@ const SelectGoodsTable = (props: Props) => { | ||
87 | selectedRowKeys: selectedRow.map(row => row.code), | 89 | selectedRowKeys: selectedRow.map(row => row.code), |
88 | onSelect: (row: any, _selected: boolean) => { | 90 | onSelect: (row: any, _selected: boolean) => { |
89 | const index = selectedRow.findIndex((_row) => _row.code == row.code); | 91 | const index = selectedRow.findIndex((_row) => _row.code == row.code); |
92 | + if (!multiple) { | ||
93 | + setSelectedRow([row]); | ||
94 | + return; | ||
95 | + } | ||
90 | if (_selected) { | 96 | if (_selected) { |
91 | - selectedRow.unshift(row); | 97 | + selectedRow.unshift(row); |
92 | } else if (index > -1) { | 98 | } else if (index > -1) { |
93 | selectedRow.splice(index, 1); | 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,14 +2,17 @@ import SelectGoodsTable from '@/pages/capital/ReceiveRules/component/SelectGoods | ||
2 | import { Button, Card, Popconfirm, Row, Table } from 'antd'; | 2 | import { Button, Card, Popconfirm, Row, Table } from 'antd'; |
3 | import React, { useState } from 'react'; | 3 | import React, { useState } from 'react'; |
4 | import { PlusOutlined } from '@ant-design/icons'; | 4 | import { PlusOutlined } from '@ant-design/icons'; |
5 | +import RenderGoodsSpec from '@/pages/capital/components/RenderGoodsSpec'; | ||
5 | 6 | ||
6 | const Column = Table.Column; | 7 | const Column = Table.Column; |
7 | 8 | ||
8 | interface GoodsProps { | 9 | interface GoodsProps { |
9 | onChange?: Function; | 10 | onChange?: Function; |
10 | value?: any; | 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 | const [goodsModal, setGoodsModal] = useState({ visible: false }); | 16 | const [goodsModal, setGoodsModal] = useState({ visible: false }); |
14 | function deleteItem(code: string) { | 17 | function deleteItem(code: string) { |
15 | const newData = value.filter((i: any) => i.code !== code); | 18 | const newData = value.filter((i: any) => i.code !== code); |
@@ -18,11 +21,14 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | @@ -18,11 +21,14 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | ||
18 | 21 | ||
19 | return ( | 22 | return ( |
20 | <Card> | 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 | <Table | 29 | <Table |
25 | dataSource={value} | 30 | dataSource={value} |
31 | + pagination={multiple ? undefined : false} | ||
26 | // loading={loading} | 32 | // loading={loading} |
27 | bordered={false} | 33 | bordered={false} |
28 | size="small" | 34 | size="small" |
@@ -31,6 +37,13 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | @@ -31,6 +37,13 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | ||
31 | <Column title="物品名称" dataIndex="name" /> | 37 | <Column title="物品名称" dataIndex="name" /> |
32 | <Column title="物品编码" dataIndex="code" /> | 38 | <Column title="物品编码" dataIndex="code" /> |
33 | <Column | 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 | align="center" | 47 | align="center" |
35 | title="操作" | 48 | title="操作" |
36 | // width={400} | 49 | // width={400} |
@@ -38,9 +51,11 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | @@ -38,9 +51,11 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | ||
38 | return ( | 51 | return ( |
39 | <> | 52 | <> |
40 | <Popconfirm title="确认删除?" onConfirm={() => deleteItem(value.code)}> | 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 | </Popconfirm> | 59 | </Popconfirm> |
45 | </> | 60 | </> |
46 | ); | 61 | ); |
@@ -48,6 +63,7 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | @@ -48,6 +63,7 @@ function RenderSelectGoos({ onChange, value = [] }: GoodsProps) { | ||
48 | /> | 63 | /> |
49 | </Table> | 64 | </Table> |
50 | <SelectGoodsTable | 65 | <SelectGoodsTable |
66 | + multiple={multiple} | ||
51 | visible={goodsModal.visible} | 67 | visible={goodsModal.visible} |
52 | onCancel={() => setGoodsModal({ visible: false })} | 68 | onCancel={() => setGoodsModal({ visible: false })} |
53 | onChange={(v) => onChange && onChange(v)} | 69 | onChange={(v) => onChange && onChange(v)} |
src/pages/coupon/CouponConfig/components/FullReduce.tsx
@@ -8,6 +8,7 @@ import ShopLimit from "./ShopLimit"; | @@ -8,6 +8,7 @@ import ShopLimit from "./ShopLimit"; | ||
8 | import useInitail from "@/hooks/useInitail"; | 8 | import useInitail from "@/hooks/useInitail"; |
9 | import { PaymentTypeEnum } from '@/pages/coupon/CashChange/api'; | 9 | import { PaymentTypeEnum } from '@/pages/coupon/CashChange/api'; |
10 | import { RightOutlined } from '@ant-design/icons'; | 10 | import { RightOutlined } from '@ant-design/icons'; |
11 | +import RenderSelectGoos from '@/pages/capital/ReceiveRules/subPages/GoodsDimension/components/RenderSelectGoos'; | ||
11 | 12 | ||
12 | const Option = Select.Option; | 13 | const Option = Select.Option; |
13 | interface Props { | 14 | interface Props { |
@@ -170,6 +171,12 @@ export default function FullReduce({ | @@ -170,6 +171,12 @@ export default function FullReduce({ | ||
170 | /> | 171 | /> |
171 | </Form.Item> | 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 | <Form.Item | 180 | <Form.Item |
174 | label="优惠券券面金额" | 181 | label="优惠券券面金额" |
175 | name="amount" | 182 | name="amount" |
src/pages/coupon/CouponConfig/index.tsx
@@ -32,6 +32,7 @@ export default function UpsertCoupon({ visible, onCancel, onSave, remark, disabl | @@ -32,6 +32,7 @@ export default function UpsertCoupon({ visible, onCancel, onSave, remark, disabl | ||
32 | classifyCode: data.classifyCode ? { value: data.classifyCode, label: data.classifyName } : undefined, | 32 | classifyCode: data.classifyCode ? { value: data.classifyCode, label: data.classifyName } : undefined, |
33 | exchangeTypeId: data.exchangeTypeId ? { value: data.exchangeTypeId, label: data.exchangeTypeName } : undefined, | 33 | exchangeTypeId: data.exchangeTypeId ? { value: data.exchangeTypeId, label: data.exchangeTypeName } : undefined, |
34 | orgList: data.orgList ? data.orgList.map((i) => ({ value: i.orgId, label: i.orgName })) : undefined, | 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 | setLoading(false); | 37 | setLoading(false); |
37 | }).catch((e) => { | 38 | }).catch((e) => { |
@@ -72,6 +73,7 @@ export default function UpsertCoupon({ visible, onCancel, onSave, remark, disabl | @@ -72,6 +73,7 @@ export default function UpsertCoupon({ visible, onCancel, onSave, remark, disabl | ||
72 | exchangeTypeId: fields.exchangeTypeId && fields.exchangeTypeId.value, | 73 | exchangeTypeId: fields.exchangeTypeId && fields.exchangeTypeId.value, |
73 | exchangeTypeName: fields.exchangeTypeId && fields.exchangeTypeId.label, | 74 | exchangeTypeName: fields.exchangeTypeId && fields.exchangeTypeId.label, |
74 | schemeList: fields.schemeList ? fields.schemeList.map((i: MktConponSpace.LimitList) => ({ ...i, externalRely: i.externalRely || false })) : [], | 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 | remark, | 77 | remark, |
76 | }; | 78 | }; |
77 | setSaveLoading(true); | 79 | setSaveLoading(true); |