Commit fdf6fc5a4a16195b24abbd774d5fe5340fde7a7b
1 parent
c6f9c477
货拉拉账户配置联调
Showing
4 changed files
with
44 additions
and
29 deletions
src/pages/pms/transfer/HuolalaSetting/api.ts
... | ... | @@ -96,7 +96,6 @@ export interface saveParams{ |
96 | 96 | interface queryList { |
97 | 97 | current?:number |
98 | 98 | pageSize?:number |
99 | - sysId?:number | |
100 | 99 | } |
101 | 100 | // 查询财务账户信息列表 |
102 | 101 | export function getList(params: Params):http.PromisePageResp<ListVO> { |
... | ... | @@ -104,7 +103,7 @@ export function getList(params: Params):http.PromisePageResp<ListVO> { |
104 | 103 | } |
105 | 104 | // 新增/编辑API |
106 | 105 | export function saveApi(params: saveParams) { |
107 | - return request.post(`${PMS_HOST}/erp/finance/account/exit`, {...params}); | |
106 | + return request.post(`${PMS_HOST}/erp/finance/account/save`, {...params}); | |
108 | 107 | } |
109 | 108 | // 推待办角色列表 |
110 | 109 | export function roleListApi(params: queryList): http.PromisePageResp<Role.Info> { |
... | ... | @@ -112,5 +111,5 @@ export function roleListApi(params: queryList): http.PromisePageResp<Role.Info> |
112 | 111 | } |
113 | 112 | // 删除API |
114 | 113 | export function deleteApi(params: {id: number}) { |
115 | - return request.post(`${PMS_HOST}/erp/finance/account/delete`, {...params}); | |
114 | + return request.post(`${PMS_HOST}/erp/finance/account/delete`, {...params}, {contentType: 'form-urlencoded'}); | |
116 | 115 | } |
117 | 116 | \ No newline at end of file | ... | ... |
src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx
... | ... | @@ -12,15 +12,16 @@ const Item = Form.Item; |
12 | 12 | interface Props{ |
13 | 13 | visible?:boolean, |
14 | 14 | onCancel: Function, |
15 | - item?:ListVO | |
15 | + item?:ListVO, | |
16 | + onRefreshing: Function | |
16 | 17 | } |
17 | 18 | |
18 | 19 | export default function Index(props:Props) { |
19 | - const { list: suppliers } = usePagination<item>(getPageListApi, { supplierType: 40, pageSize: 500 }); | |
20 | + const { list: suppliers } = usePagination<item>(getPageListApi, { pageSize: 500 }); | |
20 | 21 | const { data: shops } = useInitail<PmsStoragePartShop.Option[], {}>(getShopApi, [], {}); |
21 | - const { list } = usePagination<Role.Info>(roleListApi, { pageSize: 500, sysId: 229 }); | |
22 | + const { list } = usePagination<Role.Info>(roleListApi, { pageSize: 500 }); | |
22 | 23 | const [loading, setLoading] = useState(false); |
23 | - const { visible, onCancel, item } = props; | |
24 | + const { visible, onCancel, item, onRefreshing } = props; | |
24 | 25 | const [form] = Form.useForm(); |
25 | 26 | |
26 | 27 | useEffect(() => { |
... | ... | @@ -54,6 +55,7 @@ export default function Index(props:Props) { |
54 | 55 | saveApi(params).then(res => { |
55 | 56 | message.success("保存成功"); |
56 | 57 | setLoading(false); |
58 | + onRefreshing(); | |
57 | 59 | onCancel(); |
58 | 60 | }).catch(e => { |
59 | 61 | message.error(e.message); |
... | ... | @@ -65,7 +67,7 @@ export default function Index(props:Props) { |
65 | 67 | return ( |
66 | 68 | <Modal |
67 | 69 | title={item?.id ? "编辑货拉拉账户配置" : "新增货拉拉账户配置"} |
68 | - visible={visible} | |
70 | + open={visible} | |
69 | 71 | maskClosable={false} |
70 | 72 | onCancel={() => onCancel()} |
71 | 73 | footer={[ |
... | ... | @@ -98,7 +100,7 @@ export default function Index(props:Props) { |
98 | 100 | <Item label="推待办角色" name="roleCode" rules={[{ required: true, message: "请选择推办角色" }]}> |
99 | 101 | <PmsSelect |
100 | 102 | placeholder="选择待办角色" |
101 | - options={list.map(item => ({value: item.roleCode, label: item.roleName}))} | |
103 | + options={list.filter(i => i.roleType != 1).map(item => ({value: item.roleCode, label: item.roleName}))} | |
102 | 104 | /> |
103 | 105 | </Item> |
104 | 106 | <Item label="发单账号" name="account" rules={[{ required: true, message: "请填写发单账号" }]}> | ... | ... |
src/pages/pms/transfer/HuolalaSetting/components/ChargeModal.tsx
1 | -import React from 'react'; | |
2 | -import { Form, Button, InputNumber, Modal } from 'antd'; | |
1 | +import React, { useEffect } from 'react'; | |
2 | +import { Form, Button, InputNumber, Modal, Input } from 'antd'; | |
3 | 3 | import PmsSelect from '@/pages/pms/comonents/PmsSelect'; |
4 | +import ImageUpload from '@/pages/pms/comonents/ImageUpload'; | |
5 | +import {ListVO} from '../api'; | |
4 | 6 | |
5 | 7 | const Item = Form.Item; |
6 | 8 | |
7 | 9 | interface Props { |
8 | 10 | visible?: boolean, |
9 | 11 | onCancel: Function, |
10 | - item?: any | |
12 | + item?: ListVO | |
11 | 13 | } |
12 | 14 | export default function Index(props: Props) { |
13 | 15 | const { visible, onCancel, item } = props; |
14 | 16 | const [form] = Form.useForm(); |
15 | 17 | |
18 | + useEffect(() => { | |
19 | + if (visible && item?.id) { | |
20 | + form.setFieldsValue({ | |
21 | + supplierName: item.supplierName, | |
22 | + amount: item.amount, | |
23 | + shopName: item.shopName | |
24 | + }); | |
25 | + } | |
26 | + if (!visible) { | |
27 | + form.resetFields(); | |
28 | + } | |
29 | + }, [visible]); | |
30 | + | |
16 | 31 | const onSave = () => { |
17 | - const params = {id: item.id}; | |
32 | + const params = {id: item?.id}; | |
18 | 33 | console.log(params); |
19 | 34 | }; |
20 | 35 | |
21 | 36 | return ( |
22 | 37 | <Modal |
23 | 38 | title="预付款充值申请" |
24 | - visible={visible} | |
39 | + open={visible} | |
25 | 40 | maskClosable={false} |
26 | 41 | onCancel={() => onCancel()} |
27 | 42 | footer={[ |
... | ... | @@ -34,13 +49,13 @@ export default function Index(props: Props) { |
34 | 49 | labelCol={{ span: 7 }} |
35 | 50 | wrapperCol={{ span: 12 }} |
36 | 51 | > |
37 | - <Item label="往来单位" name="supplierName" rules={[{ required: true, message: "请选择往来单位" }]}> | |
38 | - <PmsSelect /> | |
52 | + <Item label="往来单位" name="supplierName"> | |
53 | + <Input disabled /> | |
39 | 54 | </Item> |
40 | - <Item label="往来单位类型" name="shopName" rules={[{ required: true, message: "请选择签约门店" }]}> | |
41 | - <PmsSelect /> | |
55 | + <Item label="往来单位类型" name="shopName"> | |
56 | + <Input disabled /> | |
42 | 57 | </Item> |
43 | - <Item label="账户余额" name="amount" rules={[{ required: true, message: "请填写金额" }]}> | |
58 | + <Item label="账户余额" name="amount"> | |
44 | 59 | <InputNumber style={{ width: '100%' }} addonAfter="元" disabled /> |
45 | 60 | </Item> |
46 | 61 | <Item label="充值金额" name="awaitAmount" rules={[{ required: true, message: "请填写金额" }]}> |
... | ... | @@ -50,16 +65,16 @@ export default function Index(props: Props) { |
50 | 65 | <InputNumber style={{ width: '100%' }} addonAfter="元" disabled /> |
51 | 66 | </Item> |
52 | 67 | <Item label="结算门店" name="shopName" rules={[{ required: true, message: "请选择推办角色" }]}> |
53 | - <PmsSelect /> | |
68 | + <Input disabled /> | |
54 | 69 | </Item> |
55 | - <Item label="发票金额要求比例" name="role" rules={[{ required: true, message: "请选择推办角色" }]}> | |
56 | - <PmsSelect /> | |
70 | + <Item label="发票金额要求比例" name="role"> | |
71 | + <Input disabled /> | |
57 | 72 | </Item> |
58 | - <Item label="结算方式" name="role" rules={[{ required: true, message: "请选择推办角色" }]}> | |
73 | + <Item label="结算方式" name="role" rules={[{ required: true, message: "请选择结算方式" }]}> | |
59 | 74 | <PmsSelect /> |
60 | 75 | </Item> |
61 | 76 | <Item label="附件" name="files"> |
62 | - <PmsSelect /> | |
77 | + <ImageUpload max={5} /> | |
63 | 78 | </Item> |
64 | 79 | </Form> |
65 | 80 | </Modal> | ... | ... |
src/pages/pms/transfer/HuolalaSetting/index.tsx
... | ... | @@ -11,13 +11,12 @@ export default function Index() { |
11 | 11 | const {list, loading, paginationConfig, setParams} = usePagination<ListVO>(getList, [], {}); |
12 | 12 | const [current, setCurrent] = useState<{ visible: boolean, item: ListVO }>({visible: false, item: {}}); |
13 | 13 | const [chargeInfo, setChargeInfo] = useState<{ visible: boolean, item: ListVO }>({visible: false, item: {}}); |
14 | - const data = [{id: 1, supplierName: "货拉拉", shopName: "不过承诺书可能单纯迪士尼才", amount: 3000, minAmount: 1500, roleName: "计划制定员", account: "15725173,16638183"}]; | |
15 | 14 | return ( |
16 | 15 | <PageHeaderWrapper title="货拉拉账户配置"> |
17 | 16 | <Card |
18 | 17 | extra={<Button type="primary" onClick={() => setCurrent({visible: true, item: {}})}>新增</Button>} |
19 | 18 | > |
20 | - <Table dataSource={data} rowKey="id" loading={loading} pagination={paginationConfig}> | |
19 | + <Table dataSource={list} rowKey="id" loading={loading} pagination={paginationConfig}> | |
21 | 20 | <Column title="往来单位" dataIndex="supplierName" /> |
22 | 21 | <Column title="签约门店" dataIndex="shopName" /> |
23 | 22 | <Column title="当前余额(元)" dataIndex="amount" /> |
... | ... | @@ -28,8 +27,8 @@ export default function Index() { |
28 | 27 | title="操作" |
29 | 28 | render={r => ( |
30 | 29 | <div style={{display: 'flex', flexWrap: 'wrap', alignItems: 'center'}}> |
31 | - <a onClick={() => setChargeInfo({visible: true, item: r})}>预付款充值申请</a> | |
32 | - <Divider type="vertical" /> | |
30 | + {/* <a onClick={() => setChargeInfo({visible: true, item: r})}>预付款充值申请</a> | |
31 | + <Divider type="vertical" /> */} | |
33 | 32 | <a onClick={() => setCurrent({visible: true, item: r})}>编辑</a> |
34 | 33 | <Divider type="vertical" /> |
35 | 34 | <Popconfirm |
... | ... | @@ -47,7 +46,7 @@ export default function Index() { |
47 | 46 | )} |
48 | 47 | /> |
49 | 48 | </Table> |
50 | - <AddModal visible={current.visible} item={current.item} onCancel={() => setCurrent({ visible: false, item: {} })} /> | |
49 | + <AddModal visible={current.visible} item={current.item} onCancel={() => setCurrent({ visible: false, item: {} })} onRefreshing={() => setParams({}, true)} /> | |
51 | 50 | <ChargeModal visible={chargeInfo.visible} item={chargeInfo.item} onCancel={() => setChargeInfo({ visible: false, item: {} })} /> |
52 | 51 | </Card> |
53 | 52 | </PageHeaderWrapper> | ... | ... |