Commit f9572dfaa92bc833e12e86f53b5415640bd70041
1 parent
d73d0ffc
fix-bug: 售后管理,修复客户类型结算标准使用作业类型枚举值错误的问题
Showing
2 changed files
with
173 additions
and
170 deletions
src/pages/cas/CustomerTypePay/api.ts
src/pages/cas/CustomerTypePay/index.tsx
1 | -import React, { useState } from 'react'; | |
2 | -import * as api from './api'; | |
3 | -import usePagination from '@/hooks/usePagination'; | |
4 | -import { PageHeaderWrapper } from '@ant-design/pro-layout'; | |
5 | -import zhCN from 'antd/lib/locale-provider/zh_CN'; | |
6 | -import { Card, ConfigProvider, Table, Button, Popconfirm, message } from 'antd'; | |
7 | -import Filter from './components/Filter'; | |
8 | -import CreateModal from "./components/Modal"; | |
9 | -import VinList from './components/VinList'; | |
10 | - | |
11 | -const { Column } = Table; | |
12 | - | |
13 | -enum userData { | |
14 | - // "工作车辆" = 7, | |
15 | - "员工车辆" = 8, | |
16 | - "大客户", | |
17 | -} | |
18 | - | |
19 | -enum PickCarType { | |
20 | - "机修" = 1, | |
21 | - "电器", | |
22 | - "贴膜", | |
23 | - "基础保养", | |
24 | - "洗车", | |
25 | - "厂家喷漆", | |
26 | - "养护", | |
27 | -} | |
28 | - | |
29 | -export default function OrderManage() { | |
30 | - const { | |
31 | - list, | |
32 | - errMsg, | |
33 | - loading, | |
34 | - setLoading, | |
35 | - paginationConfig, | |
36 | - innerParams, | |
37 | - setParams, | |
38 | - } = usePagination(api.getListApi, { | |
39 | - discountType: 8, | |
40 | - discountTypeName: "员工车辆", | |
41 | - }); | |
42 | - | |
43 | - const [visible, setVisible] = useState(false); | |
44 | - const [item, setItem] = useState<any>({}); | |
45 | - | |
46 | - const [vin, setVin] = useState({visible: false, data: []}); | |
47 | - | |
48 | - function endOrder(row: api.ListVO) { | |
49 | - row.id && api.endApi(row.id).then(res => { | |
50 | - message.success("删除成功"); | |
51 | - setLoading(true); | |
52 | - }).catch(e => { | |
53 | - message.error(`删除失败:${e.message}`); | |
54 | - }); | |
55 | - } | |
56 | - | |
57 | - const onFilter = (option: any = {}) => { | |
58 | - setParams({ ...innerParams, ...option, current: 1 }, true); | |
59 | - }; | |
60 | - | |
61 | - return ( | |
62 | - <PageHeaderWrapper title="客户类型结算标准"> | |
63 | - <Card> | |
64 | - <div style={{ display: "flex", justifyContent: "space-between" }}> | |
65 | - <Filter filterParam={innerParams} onChange={setParams} /> | |
66 | - <Button | |
67 | - type="primary" | |
68 | - onClick={() => { | |
69 | - setVisible(true); | |
70 | - setItem({}); | |
71 | - }} | |
72 | - > | |
73 | - 新增 | |
74 | - </Button> | |
75 | - </div> | |
76 | - <ConfigProvider locale={zhCN}> | |
77 | - <Table | |
78 | - dataSource={list} | |
79 | - loading={loading} | |
80 | - pagination={paginationConfig} | |
81 | - rowKey="id" | |
82 | - > | |
83 | - <Column | |
84 | - title="客户类型" | |
85 | - dataIndex="discountType" | |
86 | - align="center" | |
87 | - width={130} | |
88 | - render={(text) => <span>{userData[text] || "--"}</span>} | |
89 | - /> | |
90 | - <Column | |
91 | - title="适用作业类型" | |
92 | - dataIndex="workTypes" | |
93 | - align="center" | |
94 | - width={130} | |
95 | - render={(text) => ( | |
96 | - <span> | |
97 | - {(text.split(",") || []) | |
98 | - .map((e: any) => PickCarType[e]) | |
99 | - .join(",") || "--"} | |
100 | - </span> | |
101 | - )} | |
102 | - /> | |
103 | - <Column | |
104 | - title="工时折扣" | |
105 | - dataIndex="manHoursFeeDiscount" | |
106 | - width={130} | |
107 | - align="center" | |
108 | - render={(text) => <span>{`${text}折` || "--"}</span>} | |
109 | - /> | |
110 | - <Column | |
111 | - title="材料费折扣" | |
112 | - dataIndex="partFeeDiscount" | |
113 | - align="center" | |
114 | - render={(text) => <span>{`${text}折` || "--"}</span>} | |
115 | - /> | |
116 | - <Column | |
117 | - title="适用大客户" | |
118 | - dataIndex="vehicleListVOS" | |
119 | - align="center" | |
120 | - render={(text, record: any) => (record.vehicleListVOS ? ( | |
121 | - <Button | |
122 | - type="primary" | |
123 | - onClick={() => setVin({ visible: true, data: record.vehicleListVOS })} | |
124 | - > | |
125 | - 查看 | |
126 | - </Button> | |
127 | - ) : ( | |
128 | - "--" | |
129 | - ))} | |
130 | - /> | |
131 | - <Column | |
132 | - title="操作" | |
133 | - align="center" | |
134 | - render={(t, row: api.ListVO) => ( | |
135 | - <div> | |
136 | - {/* <Button size="small" onClick={() => viewDetail(row)}>编辑</Button> */} | |
137 | - <Popconfirm title="确认删除" onConfirm={() => endOrder(row)}> | |
138 | - <Button | |
139 | - danger | |
140 | - type="link" | |
141 | - size="small" | |
142 | - style={{ marginLeft: 10 }} | |
143 | - > | |
144 | - 删除 | |
145 | - </Button> | |
146 | - </Popconfirm> | |
147 | - </div> | |
148 | - )} | |
149 | - /> | |
150 | - </Table> | |
151 | - </ConfigProvider> | |
152 | - </Card> | |
153 | - <CreateModal | |
154 | - item={item} | |
155 | - visible={visible} | |
156 | - onCancel={() => { | |
157 | - setVisible(false); | |
158 | - setItem({}); | |
159 | - setLoading(true); | |
160 | - }} | |
161 | - /> | |
162 | - <VinList | |
163 | - visible={vin.visible} | |
164 | - setVisible={(value) => setVin({ ...vin, visible: value })} | |
165 | - data={vin.data} | |
166 | - /> | |
167 | - </PageHeaderWrapper> | |
168 | - ); | |
169 | -} | |
170 | 1 | \ No newline at end of file |
2 | +import React, { useState } from 'react'; | |
3 | +import * as api from './api'; | |
4 | +import usePagination from '@/hooks/usePagination'; | |
5 | +import { PageHeaderWrapper } from '@ant-design/pro-layout'; | |
6 | +import zhCN from 'antd/lib/locale-provider/zh_CN'; | |
7 | +import { Card, ConfigProvider, Table, Button, Popconfirm, message } from 'antd'; | |
8 | +import Filter from './components/Filter'; | |
9 | +import CreateModal from "./components/Modal"; | |
10 | +import VinList from './components/VinList'; | |
11 | + | |
12 | +const { Column } = Table; | |
13 | + | |
14 | +enum userData { | |
15 | + // "工作车辆" = 7, | |
16 | + "员工车辆" = 8, | |
17 | + "大客户", | |
18 | +} | |
19 | + | |
20 | +enum PickCarType { | |
21 | + "机修" = 1, | |
22 | + "电器", | |
23 | + "钣喷", | |
24 | + "装潢", | |
25 | + "基础保养", | |
26 | + "贴膜", | |
27 | + "洗车", | |
28 | + "厂家喷漆", | |
29 | + "养护", | |
30 | +} | |
31 | + | |
32 | +export default function OrderManage() { | |
33 | + const { | |
34 | + list, | |
35 | + loading, | |
36 | + setLoading, | |
37 | + paginationConfig, | |
38 | + innerParams, | |
39 | + setParams, | |
40 | + } = usePagination(api.getListApi, { | |
41 | + discountType: 8, | |
42 | + discountTypeName: "员工车辆", | |
43 | + }); | |
44 | + | |
45 | + const [visible, setVisible] = useState(false); | |
46 | + const [item, setItem] = useState<any>({}); | |
47 | + | |
48 | + const [vin, setVin] = useState({visible: false, data: []}); | |
49 | + | |
50 | + function endOrder(row: api.ListVO) { | |
51 | + row.id && api.endApi(row.id).then(res => { | |
52 | + message.success("删除成功"); | |
53 | + setLoading(true); | |
54 | + }).catch(e => { | |
55 | + message.error(`删除失败:${e.message}`); | |
56 | + }); | |
57 | + } | |
58 | + | |
59 | + // const onFilter = (option: any = {}) => { | |
60 | + // setParams({ ...innerParams, ...option, current: 1 }, true); | |
61 | + // }; | |
62 | + | |
63 | + return ( | |
64 | + <PageHeaderWrapper title="客户类型结算标准"> | |
65 | + <Card> | |
66 | + <div style={{ display: "flex", justifyContent: "space-between" }}> | |
67 | + <Filter filterParam={innerParams} onChange={setParams} /> | |
68 | + <Button | |
69 | + type="primary" | |
70 | + onClick={() => { | |
71 | + setVisible(true); | |
72 | + setItem({}); | |
73 | + }} | |
74 | + > | |
75 | + 新增 | |
76 | + </Button> | |
77 | + </div> | |
78 | + <ConfigProvider locale={zhCN}> | |
79 | + <Table | |
80 | + dataSource={list} | |
81 | + loading={loading} | |
82 | + pagination={paginationConfig} | |
83 | + rowKey="id" | |
84 | + > | |
85 | + <Column | |
86 | + title="客户类型" | |
87 | + dataIndex="discountType" | |
88 | + align="center" | |
89 | + width={150} | |
90 | + render={(text) => <span>{userData[text] || "--"}</span>} | |
91 | + /> | |
92 | + <Column | |
93 | + title="适用作业类型" | |
94 | + dataIndex="workTypes" | |
95 | + align="center" | |
96 | + render={(text) => ( | |
97 | + <span> | |
98 | + {(text.split(",") || []) | |
99 | + .map((e: any) => PickCarType[e]) | |
100 | + .join(",") || "--"} | |
101 | + </span> | |
102 | + )} | |
103 | + /> | |
104 | + <Column | |
105 | + title="工时折扣" | |
106 | + dataIndex="manHoursFeeDiscount" | |
107 | + width={150} | |
108 | + align="center" | |
109 | + render={(text) => <span>{`${text}折` || "--"}</span>} | |
110 | + /> | |
111 | + <Column | |
112 | + title="材料费折扣" | |
113 | + dataIndex="partFeeDiscount" | |
114 | + width={150} | |
115 | + align="center" | |
116 | + render={(text) => <span>{`${text}折` || "--"}</span>} | |
117 | + /> | |
118 | + <Column | |
119 | + title="适用大客户" | |
120 | + dataIndex="vehicleListVOS" | |
121 | + width={150} | |
122 | + align="center" | |
123 | + render={(text, record: any) => (record.vehicleListVOS ? ( | |
124 | + <Button | |
125 | + type="primary" | |
126 | + onClick={() => setVin({ visible: true, data: record.vehicleListVOS })} | |
127 | + > | |
128 | + 查看 | |
129 | + </Button> | |
130 | + ) : ( | |
131 | + "--" | |
132 | + ))} | |
133 | + /> | |
134 | + <Column | |
135 | + title="操作" | |
136 | + width={100} | |
137 | + align="center" | |
138 | + render={(t, row: api.ListVO) => ( | |
139 | + <div> | |
140 | + {/* <Button size="small" onClick={() => viewDetail(row)}>编辑</Button> */} | |
141 | + <Popconfirm title="确认删除" onConfirm={() => endOrder(row)}> | |
142 | + <Button | |
143 | + danger | |
144 | + type="link" | |
145 | + size="small" | |
146 | + style={{ marginLeft: 10 }} | |
147 | + > | |
148 | + 删除 | |
149 | + </Button> | |
150 | + </Popconfirm> | |
151 | + </div> | |
152 | + )} | |
153 | + /> | |
154 | + </Table> | |
155 | + </ConfigProvider> | |
156 | + </Card> | |
157 | + <CreateModal | |
158 | + item={item} | |
159 | + visible={visible} | |
160 | + onCancel={() => { | |
161 | + setVisible(false); | |
162 | + setItem({}); | |
163 | + setLoading(true); | |
164 | + }} | |
165 | + /> | |
166 | + <VinList | |
167 | + visible={vin.visible} | |
168 | + setVisible={(value) => setVin({ ...vin, visible: value })} | |
169 | + data={vin.data} | |
170 | + /> | |
171 | + </PageHeaderWrapper> | |
172 | + ); | |
173 | +} | ... | ... |