Commit 83a82b589c547d6bd76935bcac35586d25a7a2b3
Merge remote-tracking branch 'origin/fvm'
Showing
52 changed files
with
7519 additions
and
911 deletions
Too many changes to show.
To preserve performance only 18 of 52 files are displayed.
config/routers/fvm.ts
... | ... | @@ -304,6 +304,14 @@ export default [ |
304 | 304 | path: "fvm/allowance/edit/:id?", // 折让确认管理编辑新增 |
305 | 305 | component: "./stock/AllowanceConfirm/EditComfirm/index", |
306 | 306 | }, |
307 | + { | |
308 | + path: "fvm/directVehicles/allowance", // 直营车折让确认 | |
309 | + component: "./stock/DirectVehicles", | |
310 | + }, | |
311 | + { | |
312 | + path: "fvm/directVehicles/edit/:id?", // 直营车折让确认编辑啊 | |
313 | + component: "./stock/DirectVehicles/EditComfirm", | |
314 | + }, | |
307 | 315 | // OTD计划设置 |
308 | 316 | { |
309 | 317 | path: "/fvm/plan/ticket/execution", | ... | ... |
src/pages/mkt/ActivityCreate/ExternalPromotion/components/ActivityScope/CarSelect.tsx
... | ... | @@ -67,7 +67,7 @@ export default function index({ onChange, value, disabled }: Props) { |
67 | 67 | })); |
68 | 68 | currentItem.specs = _specs; |
69 | 69 | currentItem.authType = 2; |
70 | - const tempData = savaData.map((item: any) => (item.seriesId === currentItem.seriesId ? currentItem : item) | |
70 | + const tempData = savaData.map((item: any) => (item.seriesId === currentItem.seriesId ? currentItem : item) | |
71 | 71 | ); |
72 | 72 | setSavadata([...tempData]); |
73 | 73 | onChange && onChange(tempData); |
... | ... | @@ -156,36 +156,40 @@ export default function index({ onChange, value, disabled }: Props) { |
156 | 156 | <span> |
157 | 157 | {record.specs.map((item: any) => item.specName).join(",")} |
158 | 158 | </span> |
159 | - ) : ( | |
160 | - <span>全部</span> | |
161 | - ))} | |
159 | + ) : ( | |
160 | + <span>全部</span> | |
161 | + ))} | |
162 | 162 | /> |
163 | - <Column | |
164 | - title="操作" | |
165 | - key="operation" | |
166 | - render={(_, record) => ( | |
167 | - <Space> | |
168 | - <Button | |
169 | - type="link" | |
170 | - onClick={() => onSelectSpec(record)} | |
171 | - disabled={disabled} | |
172 | - > | |
173 | - 编辑车型 | |
174 | - </Button> | |
175 | - | |
176 | - <Popconfirm | |
177 | - title="确定删除?" | |
178 | - okText="确定" | |
179 | - cancelText="取消" | |
180 | - onConfirm={() => onDelete(record)} | |
181 | - > | |
182 | - <Button type="link" danger disabled={disabled}> | |
183 | - 删除 | |
163 | + {!disabled && ( | |
164 | + <Column | |
165 | + title="操作" | |
166 | + key="operation" | |
167 | + render={(_, record) => ( | |
168 | + <Space> | |
169 | + <Button | |
170 | + type="link" | |
171 | + style={{ padding: 0 }} | |
172 | + onClick={() => onSelectSpec(record)} | |
173 | + disabled={disabled} | |
174 | + > | |
175 | + 编辑车型 | |
184 | 176 | </Button> |
185 | - </Popconfirm> | |
186 | - </Space> | |
187 | - )} | |
188 | - /> | |
177 | + | |
178 | + <Popconfirm | |
179 | + title="确定删除?" | |
180 | + okText="确定" | |
181 | + style={{ padding: 0 }} | |
182 | + cancelText="取消" | |
183 | + onConfirm={() => onDelete(record)} | |
184 | + > | |
185 | + <Button type="link" danger disabled={disabled}> | |
186 | + 删除 | |
187 | + </Button> | |
188 | + </Popconfirm> | |
189 | + </Space> | |
190 | + )} | |
191 | + /> | |
192 | + )} | |
189 | 193 | </Table> |
190 | 194 | </Card> |
191 | 195 | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/Manufacturer/api.ts
... | ... | @@ -18,8 +18,8 @@ export function getOrderDetail(orderId: number): http.PromiseResp<FvmAllowance.O |
18 | 18 | |
19 | 19 | /** 保存补贴折让差异 */ |
20 | 20 | export function saveDiffApi(param: FvmAllowance.SaveDiffParam): http.PromiseResp<string> { |
21 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/subsidy/order/diff/confirm`, param); | |
22 | -} | |
21 | + return request.post<string>(`${FVM_HOST}/factory/rebate/subsidy/diff/save`, param); | |
22 | +} | |
23 | 23 | |
24 | 24 | /** 确认补贴折让信息 */ |
25 | 25 | export function subsidyComfirmApi(param: FvmAllowance.saveCheckParam): http.PromiseResp<string> { |
... | ... | @@ -28,7 +28,7 @@ export function subsidyComfirmApi(param: FvmAllowance.saveCheckParam): http.Prom |
28 | 28 | |
29 | 29 | /** 撤销补贴折让确认 */ |
30 | 30 | export function subsidyCancelApi(rebateId: number): http.PromiseResp<any> { |
31 | - return request.get<string>(`${FVM_HOST}/erp/factory/rebate/subsidy/order/cancel/check`, { params: { rebateId }}); | |
31 | + return request.get<string>(`${FVM_HOST}/erp/factory/rebate/subsidy/order/cancel/check`, { params: { rebateId } }); | |
32 | 32 | } |
33 | 33 | |
34 | 34 | /******现金启票**** */ |
... | ... | @@ -42,7 +42,7 @@ export function getCashOrderDetail(orderId: number): http.PromiseResp<FvmAllowan |
42 | 42 | } |
43 | 43 | /** 保存现金折让差异 */ |
44 | 44 | export function saveCashDiffApi(param: FvmAllowance.SaveDiffParam): http.PromiseResp<string> { |
45 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/cash/order/diff/confirm`, param); | |
45 | + return request.post<string>(`${FVM_HOST}/factory/rebate/cash/diff/save`, param); | |
46 | 46 | } |
47 | 47 | /** 现金启票折让确认 */ |
48 | 48 | export function cashComfirmApi(param: FvmAllowance.saveCheckParam): http.PromiseResp<string> { |
... | ... | @@ -53,18 +53,246 @@ export function cashCancelApi(rebateId: number): http.PromiseResp<any> { |
53 | 53 | return request.get<string>(`${FVM_HOST}/erp/factory/rebate/cash/order/cancel/check`, { params: { rebateId } }); |
54 | 54 | } |
55 | 55 | |
56 | -/**厂家代收 */ | |
57 | -/** 代收折让清单折让清单*/ | |
56 | +// /**厂家直营车 */ | |
57 | +// /** 厂家直营车折让清单*/ | |
58 | +// export function getDirectOrderListApi(params: FvmAllowance.OrderListParams): http.PromiseRespA<FvmAllowance.OrderItemVo> { | |
59 | +// return request.get(`${FVM_HOST}/erp/factory/rebate/direct/order/list`, { params }); | |
60 | +// } | |
61 | +// /** 直营车折让详情*/ | |
62 | +// export function getDirectOrderDetail(orderId: number): http.PromiseResp<FvmAllowance.OrderDetailVo> { | |
63 | +// return request.get(`${FVM_HOST}/erp/factory/rebate/direct/order/detail`, { params: { orderId } }); | |
64 | +// } | |
65 | +// /** 直营车确认折让差异 */ | |
66 | +// export function saveDirectDiffApi(param: FvmAllowance.SaveDiffParam): http.PromiseResp<string> { | |
67 | +// return request.post<string>(`${FVM_HOST}/erp/factory/rebate/direct/order/diff/confirm`, param); | |
68 | +// } | |
69 | +// /** 确认折让车辆选择完成 */ | |
70 | +// export function directComfirmApi(param: FvmAllowance.saveCheckParam): http.PromiseResp<string> { | |
71 | +// return request.post<string>(`${FVM_HOST}/erp/factory/rebate/direct/order/check/save`, param); | |
72 | +// } | |
73 | +// /** 撤销直营车折让选择 */ | |
74 | +// export function directCancelApi(rebateId: number): http.PromiseResp<any> { | |
75 | +// return request.get<string>(`${FVM_HOST}/erp/factory/rebate/direct/order/cancel/check`, { params: { rebateId } }); | |
76 | +// } | |
77 | + | |
78 | +/**促销折让 */ | |
79 | +/** 促销折让清单列表*/ | |
80 | +export function getPromotionOrderListApi(params: FvmAllowance.OrderListParams): http.PromiseRespA<FvmAllowance.OrderItemVo> { | |
81 | + return request.get(`${FVM_HOST}/erp/factory/rebate/promotion/order/list`, { params }); | |
82 | +} | |
83 | +/** 促销清单详情*/ | |
84 | +export function getPromotionOrderDetail(orderId: number): http.PromiseResp<FvmAllowance.OrderDetailVo> { | |
85 | + return request.get(`${FVM_HOST}/erp/factory/rebate/promotion/order/detail`, { params: { orderId } }); | |
86 | +} | |
87 | +/** 保存折让差异(正激励) */ | |
88 | +export function savePromotionDiffApi(param: FvmAllowance.SaveDiffParam): http.PromiseResp<string> { | |
89 | + return request.post<string>(`${FVM_HOST}/factory/rebate/promotion/diff/save`, param); | |
90 | +} | |
91 | +/** 保存促销折让 */ | |
92 | +export function promotionComfirmApi(param: FvmAllowance.saveCheckParam): http.PromiseResp<string> { | |
93 | + return request.post<string>(`${FVM_HOST}/erp/factory/rebate/promotion/order/save/check`, param); | |
94 | +} | |
95 | + | |
96 | +/** 撤销代收折让确认 */ | |
97 | +export function promotionCancelApi(rebateId: number): http.PromiseResp<any> { | |
98 | + return request.get<string>(`${FVM_HOST}/erp/factory/rebate/promotion/order/cancel/check`, { params: { rebateId } }); | |
99 | +} | |
100 | + | |
101 | +/**1、 厂家补贴 */ | |
102 | +/** | |
103 | + * 厂家补贴折让未确认清单 | |
104 | +*/ | |
105 | +export function getSubsidyWaitCheck(params: FvmAllowance.WaitCheckParam): http.PromisePageResp<FvmAllowance.WaitCheckListItems> { | |
106 | + return request.get(`${FVM_HOST}/factory/rebate/subsidy/wait/check/list`, { params }); | |
107 | +} | |
108 | + | |
109 | +/** 厂家补贴折让提交清单清单 | |
110 | +*/ | |
111 | +export function getSubsidyCheck(params: FvmAllowance.WaitCheckParam): http.PromisePageResp<FvmAllowance.CheckListItems> { | |
112 | + return request.get(`${FVM_HOST}/factory/rebate/subsidy/check/list`, { params }); | |
113 | +} | |
114 | + | |
115 | +/** | |
116 | + * 选中厂家补贴折让加入提交清单 | |
117 | + * http://testgate.feewee.cn/fvm/factory/rebate/subsidy/check | |
118 | +*/ | |
119 | +export function rebateSubsidyCheck(params: FvmAllowance.SubsidyCheckParams): http.PromiseResp<any> { | |
120 | + return request.post(`${FVM_HOST}/factory/rebate/subsidy/check`, params); | |
121 | +} | |
122 | + | |
123 | +/**手动生成补贴折让记录 */ | |
124 | +export function subsidyhandleCheck(params: FvmAllowance.SubsidyCheckParams): http.PromiseResp<any> { | |
125 | + return request.post(`${FVM_HOST}/erp/create/rebate/subsidy/rec`, params); | |
126 | +} | |
127 | + | |
128 | +/** | |
129 | + * 选中厂家补贴折让移出提交清单 | |
130 | + * http://testgate.feewee.cn/fvm/factory/rebate/subsidy/remove | |
131 | +*/ | |
132 | +export function rebateSubsidyRemove(params: FvmAllowance.SubsidyCheckParams): http.PromiseResp<any> { | |
133 | + return request.post(`${FVM_HOST}/factory/rebate/subsidy/remove`, params); | |
134 | +} | |
135 | + | |
136 | +/** | |
137 | + * 保存厂家补贴折让差异 | |
138 | + * http://testgate.feewee.cn/fvm/factory/rebate/subsidy/diff/save | |
139 | +*/ | |
140 | +export function saveSubsidyDiffApi(params: FvmAllowance.SubsidyCheckParams): http.PromiseResp<any> { | |
141 | + return request.post(`${FVM_HOST}/factory/rebate/subsidy/diff/save`, params); | |
142 | +} | |
143 | + | |
144 | +/**2、厂家代收 */ | |
145 | +/** | |
146 | + * 厂家代收款折让未确认清单 | |
147 | +*/ | |
148 | +export function getInwardWaitCheckListApi(params: FvmAllowance.OrderListParams): http.PromiseRespA<FvmAllowance.OrderItemVo> { | |
149 | + return request.get(`${FVM_HOST}/factory/rebate/inward/wait/check/list`, { params }); | |
150 | +} | |
151 | +/** | |
152 | + * 厂家代收款折让已确认清单 | |
153 | +*/ | |
154 | +export function getInwardCheckListApi(params: FvmAllowance.OrderListParams): http.PromiseRespA<FvmAllowance.OrderItemVo> { | |
155 | + return request.get(`${FVM_HOST}/factory/rebate/inward/check/list`, { params }); | |
156 | +} | |
157 | + | |
158 | +/** | |
159 | + * 选中厂家代收款折让加入提交清单 | |
160 | + */ | |
161 | +export function rebateInwardCheck(params: FvmAllowance.InwardCheckParams): http.PromiseResp<any> { | |
162 | + return request.post(`${FVM_HOST}/factory/rebate/inward/check`, params); | |
163 | +} | |
164 | + | |
165 | +/** | |
166 | + * 手动生成代收款折让记录 | |
167 | + */ | |
168 | +export function inwardHandleCheck(params: FvmAllowance.InwardCheckParams): http.PromiseResp<any> { | |
169 | + return request.post(`${FVM_HOST}/erp/create/rebate/inward/rec`, params); | |
170 | +} | |
171 | + | |
172 | +/** | |
173 | + * 选中厂家代收款折移出提交清单 | |
174 | + */ | |
175 | +export function rebateInwardRemove(params: FvmAllowance.InwardCheckParams): http.PromiseResp<any> { | |
176 | + return request.post(`${FVM_HOST}/factory/rebate/inward/remove`, params); | |
177 | +} | |
178 | + | |
58 | 179 | export function getInwardOrderListApi(params: FvmAllowance.OrderListParams): http.PromiseRespA<FvmAllowance.OrderItemVo> { |
59 | 180 | return request.get(`${FVM_HOST}/erp/factory/rebate/inward/order/list`, { params }); |
60 | 181 | } |
182 | + | |
183 | +/**3、厂家促销 */ | |
184 | +/** | |
185 | + * 询待确认促销活动列表 | |
186 | +*/ | |
187 | +export function getSupportWaitCheckListApi(params: FvmAllowance.SuportWaitCheckParams): http.PromisePageResp<FvmAllowance.SuportWaitCheckItems> { | |
188 | + return request.get(`${FVM_HOST}/factory/rebate/support/wait/check/list`, { params }); | |
189 | +} | |
190 | + | |
191 | +/** | |
192 | + * 选中促销政策加入折让清单 | |
193 | +*/ | |
194 | +export function getSupportCheckListApi(params: FvmAllowance.SuportCheckParams): http.PromiseResp<any> { | |
195 | + return request.post(`${FVM_HOST}/factory/rebate/support/check`, params); | |
196 | +} | |
197 | + | |
198 | +/** | |
199 | + * 选中促销政策移出折让清单 | |
200 | +*/ | |
201 | +export function getRemoveCheckListApi(params: FvmAllowance.SuportCheckParams): http.PromiseResp<any> { | |
202 | + return request.post(`${FVM_HOST}/factory/rebate/support/remove`, params); | |
203 | +} | |
204 | + | |
205 | +/** | |
206 | + * 选中促销折让加入提交清单(车辆) | |
207 | +*/ | |
208 | +export function rebatePromotionCheck(params: FvmAllowance.SuportCheckParams): http.PromiseResp<any> { | |
209 | + return request.post(`${FVM_HOST}/factory/rebate/promotion/check`, params); | |
210 | +} | |
211 | +/** | |
212 | + * 手动生成启票促销折让记录 | |
213 | +*/ | |
214 | +export function promotionTicketCheck(params: FvmAllowance.SuportCheckParams): http.PromiseResp<any> { | |
215 | + return request.post(`${FVM_HOST}/erp/create/rebate/ticket/promotion/rec`, params); | |
216 | +} | |
217 | +/** | |
218 | + * 手动生成实销促销折让记录 | |
219 | +*/ | |
220 | +export function promotionSaleCheck(params: FvmAllowance.SuportCheckParams): http.PromiseResp<any> { | |
221 | + return request.post(`${FVM_HOST}/erp/create/rebate/sale/promotion/rec`, params); | |
222 | +} | |
223 | + | |
224 | +/** | |
225 | + * 选中促销政策移出折让清单 | |
226 | +*/ | |
227 | +export function rebatePromotionRemove(params: FvmAllowance.SuportCheckParams): http.PromiseResp<any> { | |
228 | + return request.post(`${FVM_HOST}/factory/rebate/promotion/remove`, params); | |
229 | +} | |
230 | + | |
231 | +/** | |
232 | + * 查询促销折让提交详情 | |
233 | + * @param params | |
234 | + * @returns | |
235 | + */ | |
236 | +export function queryDetailListApi(params: FvmAllowance.PromotionDetailParams): http.PromisePageResp<FvmAllowance.RebateDetail> { | |
237 | + return request.get(`${FVM_HOST}/erp/factory/rebate/manage/promotion/detail`, { params }); | |
238 | +} | |
239 | + | |
240 | +/** | |
241 | + * 厂家促销活动待确认车辆清单(正激励) | |
242 | +*/ | |
243 | +export function getPromotionWaitCheckListApi(params: FvmAllowance.PromotionListParams): http.PromisePageResp<FvmAllowance.PromotipnItemVo> { | |
244 | + return request.get(`${FVM_HOST}/factory/rebate/promotion/wait/check/list`, { params }); | |
245 | +} | |
246 | + | |
247 | +/**厂家促销已确认车辆清单(正激励)*/ | |
248 | +export function getPromotionCheckListApi(params: FvmAllowance.PromotionListParams): http.PromisePageResp<FvmAllowance.PromotipnItemVo> { | |
249 | + return request.get(`${FVM_HOST}/factory/rebate/promotion/check/list`, { params }); | |
250 | +} | |
251 | + | |
252 | +/** | |
253 | + * 保存负激励促销信息 | |
254 | +*/ | |
255 | +export function savePromotionNegativeApi(params: FvmAllowance.PromotipnItemVo): http.PromiseResp<any> { | |
256 | + return request.post(`${FVM_HOST}/factory/rebate/promotion/negative/save`, params); | |
257 | +} | |
258 | +/**4、现金启票奖励 */ | |
259 | +/** | |
260 | + * 现金启票折让未确认清单 | |
261 | + * http://testgate.feewee.cn/fvm/factory/rebate/cash/wait/check/list | |
262 | +*/ | |
263 | +export function getCashWaitCheckListApi(params: FvmAllowance.CashListParams): http.PromiseRespA<FvmAllowance.CashListItemV0> { | |
264 | + return request.get(`${FVM_HOST}/factory/rebate/cash/wait/check/list`, { params }); | |
265 | +} | |
266 | +/** | |
267 | + *现金启票折让已确认清单 | |
268 | + * http://testgate.feewee.cn/fvm/factory/rebate/cash/check/list | |
269 | +*/ | |
270 | +export function getCashCheckListApi(params: FvmAllowance.CashListParams): http.PromiseRespA<FvmAllowance.CashListItemV0> { | |
271 | + return request.get(`${FVM_HOST}/factory/rebate/cash/check/list`, { params }); | |
272 | +} | |
273 | + | |
274 | +/** | |
275 | + * 选中现金启票奖励加入提交清单 | |
276 | + */ | |
277 | +export function rebateCashCheck(params: FvmAllowance.InwardCheckParams): http.PromiseResp<any> { | |
278 | + return request.post(`${FVM_HOST}/factory/rebate/cash/check`, params); | |
279 | +} | |
280 | + | |
281 | +/** | |
282 | + *选中现金启票奖励移出提交清单 | |
283 | + * http://testgate.feewee.cn/fvm/factory/rebate/cash/remove | |
284 | + */ | |
285 | +export function rebateCashRemove(params: FvmAllowance.InwardCheckParams): http.PromiseResp<any> { | |
286 | + return request.post(`${FVM_HOST}/factory/rebate/cash/remove`, params); | |
287 | +} | |
288 | + | |
61 | 289 | /** 代收折让详情*/ |
62 | 290 | export function getInwardOrderDetail(orderId: number): http.PromiseResp<FvmAllowance.OrderDetailVo> { |
63 | 291 | return request.get(`${FVM_HOST}/erp/factory/rebate/inward/order/detail`, { params: { orderId } }); |
64 | 292 | } |
65 | 293 | /** 保存代收折让差异 */ |
66 | 294 | export function saveInwardDiffApi(param: FvmAllowance.SaveDiffParam): http.PromiseResp<string> { |
67 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/inward/order/diff/confirm`, param); | |
295 | + return request.post<string>(`${FVM_HOST}/factory/rebate/inward/diff/save`, param); | |
68 | 296 | } |
69 | 297 | /** 保存选中的代收折让信息 */ |
70 | 298 | export function inwardComfirmApi(param: FvmAllowance.saveCheckParam): http.PromiseResp<string> { |
... | ... | @@ -75,47 +303,25 @@ export function inwardCancelApi(rebateId: number): http.PromiseResp<any> { |
75 | 303 | return request.get<string>(`${FVM_HOST}/erp/factory/rebate/inward/order/cancel/check`, { params: { rebateId } }); |
76 | 304 | } |
77 | 305 | |
78 | -/**厂家直营车 */ | |
79 | -/** 厂家直营车折让清单*/ | |
80 | -export function getDirectOrderListApi(params: FvmAllowance.OrderListParams): http.PromiseRespA<FvmAllowance.OrderItemVo> { | |
81 | - return request.get(`${FVM_HOST}/erp/factory/rebate/direct/order/list`, { params }); | |
82 | -} | |
83 | -/** 直营车折让详情*/ | |
84 | -export function getDirectOrderDetail(orderId: number): http.PromiseResp<FvmAllowance.OrderDetailVo> { | |
85 | - return request.get(`${FVM_HOST}/erp/factory/rebate/direct/order/detail`, { params: { orderId } }); | |
86 | -} | |
87 | -/** 直营车确认折让差异 */ | |
88 | -export function saveDirectDiffApi(param: FvmAllowance.SaveDiffParam): http.PromiseResp<string> { | |
89 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/direct/order/diff/confirm`, param); | |
90 | -} | |
91 | -/** 确认折让车辆选择完成 */ | |
92 | -export function directComfirmApi(param: FvmAllowance.saveCheckParam): http.PromiseResp<string> { | |
93 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/direct/order/check/save`, param); | |
94 | -} | |
95 | -/** 撤销直营车折让选择 */ | |
96 | -export function directCancelApi(rebateId: number): http.PromiseResp<any> { | |
97 | - return request.get<string>(`${FVM_HOST}/erp/factory/rebate/direct/order/cancel/check`, { params: { rebateId } }); | |
306 | +/**5 、扣款清单 */ | |
307 | +/** | |
308 | + * 查询奖励扣款折让提交详情 | |
309 | + * http://testgate.feewee.cn/fvm/erp/factory/rebate/manage/reward/detail | |
310 | + * @param params | |
311 | + * @returns | |
312 | + */ | |
313 | +export function queryRewardDetailListApi(params: FvmAllowance.RewardDetailParams): http.PromisePageResp<FvmAllowance.RebateDetail> { | |
314 | + return request.get(`${FVM_HOST}/erp/factory/rebate/manage/reward/detail`, { params }); | |
98 | 315 | } |
99 | 316 | |
100 | -/**促销折让 */ | |
101 | -/** 促销折让清单列表*/ | |
102 | -export function getPromotionOrderListApi(params: FvmAllowance.OrderListParams): http.PromiseRespA<FvmAllowance.OrderItemVo> { | |
103 | - return request.get(`${FVM_HOST}/erp/factory/rebate/promotion/order/list`, { params }); | |
104 | -} | |
105 | -/** 促销清单详情*/ | |
106 | -export function getPromotionOrderDetail(orderId: number): http.PromiseResp<FvmAllowance.OrderDetailVo> { | |
107 | - return request.get(`${FVM_HOST}/erp/factory/rebate/promotion/order/detail`, { params: { orderId } }); | |
108 | -} | |
109 | -/** 保存促销折让差异 */ | |
110 | -export function savePromotionDiffApi(param: FvmAllowance.SaveDiffParam): http.PromiseResp<string> { | |
111 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/promotion/order/diff/confirm`, param); | |
317 | +/**------------车辆确认订单(启票、零售 ----------------- */ | |
318 | +/**查询启票车辆信息 | |
319 | + * params{rebateId,vin} | |
320 | + */ | |
321 | +export function getRebateTicketList(params: FvmAllowance.WaitCheckParam): http.PromisePageResp<FvmAllowance.WaitCheckListItems> { | |
322 | + return request.get(`${FVM_HOST}/erp/create/rebate/ticket/list`, { params }); | |
112 | 323 | } |
113 | -/** 保存促销折让 */ | |
114 | -export function promotionComfirmApi(param: FvmAllowance.saveCheckParam): http.PromiseResp<string> { | |
115 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/promotion/order/save/check`, param); | |
116 | -} | |
117 | - | |
118 | -/** 撤销代收折让确认 */ | |
119 | -export function promotionCancelApi(rebateId: number): http.PromiseResp<any> { | |
120 | - return request.get<string>(`${FVM_HOST}/erp/factory/rebate/promotion/order/cancel/check`, { params: { rebateId } }); | |
324 | +/**查询下零售车辆信息 */ | |
325 | +export function getRebateRetailList(params: FvmAllowance.WaitCheckParam): http.PromisePageResp<FvmAllowance.RebateDetail> { | |
326 | + return request.get(`${FVM_HOST}/erp/create/rebate/retail/list`, { params }); | |
121 | 327 | } |
122 | 328 | \ No newline at end of file | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/Manufacturer/index.tsx
1 | 1 | import React, { useEffect, useState } from "react"; |
2 | -import { message, Modal, Button, Table, Row, Input, Select, DatePicker } from "antd"; | |
3 | -import { useStore } from '../index'; | |
4 | -import DetailModal from '../components/CreatelModal'; | |
5 | -import _ from 'lodash'; | |
6 | -import SubidyColumn from '../components/SubidyColumn'; | |
7 | -import useInitail from '@/hooks/useInitail'; | |
8 | -import { getShopApi } from '@/common/api'; | |
9 | -import { SubsidyTypeList } from '@/pages/stock/AllowanceConfirm/entity'; | |
2 | +import { message, Modal, DatePicker } from "antd"; | |
3 | +import { useStore } from "../index"; | |
4 | +import ComfirmDiffModal from "../components/ComfirmDiffModal"; | |
5 | +import * as Api from "./api"; | |
6 | +import _ from "lodash"; | |
7 | +import SubidyColumn from "../components/SubidyColumn"; | |
8 | +import TransferTable from "../components/TransferTable"; | |
9 | +import usePagination from "@/hooks/usePagination"; | |
10 | 10 | |
11 | 11 | interface Props { } |
12 | 12 | const { RangePicker } = DatePicker; |
13 | 13 | interface Search { |
14 | - vin?: string, | |
15 | - shopId?: number, //下零售门店 | |
16 | - retailBegin?: any, //下零售开始时间 | |
17 | - retailEnd?: any, //下零售结束时间 | |
18 | - subsidyName?: string, //补贴类型 | |
14 | + vin?: string; | |
15 | + shopId?: number; //下零售门店 | |
16 | + retailBegin?: any; //下零售开始时间 | |
17 | + retailEnd?: any; //下零售结束时间 | |
18 | + subsidyName?: string; //补贴类型 | |
19 | 19 | } |
20 | 20 | export default function CreateModal(props: Props) { |
21 | - const { visible, rebateId, setVisible, data, setLoading: setDetailLoading, currentItem, setOrderId, commonOrderList, orderId, detailVisible, setDetailVisible, commonComfirmApi } = useStore(); | |
21 | + const { | |
22 | + subsidyTypeList, | |
23 | + visible, | |
24 | + rebateId, | |
25 | + setVisible, | |
26 | + data, | |
27 | + setLoading: setDetailLoading, | |
28 | + currentItem, | |
29 | + setOrderId, | |
30 | + commonOrderList, | |
31 | + orderId, | |
32 | + detailVisible, | |
33 | + setDetailVisible, | |
34 | + commonComfirmApi, | |
35 | + setSelectedRowkeys, | |
36 | + setSubmitSelectedRowkeys, | |
37 | + selectedRowKeys, | |
38 | + commonWaitCheckList, | |
39 | + handleCheckListApi, | |
40 | + commonCheckList, | |
41 | + commonRemoveCheckList, | |
42 | + commonEnterCheckList, | |
43 | + readOnly, | |
44 | + carOrderTabkey, | |
45 | + setCarOrderTabkey, | |
46 | + } = useStore(); | |
47 | + const { dimension } = currentItem; | |
22 | 48 | const [comfrimloading, setComfirmLoading] = useState(false); |
23 | - const { data: shopList } = useInitail<CommonApi.OptionVO[], CommonApi.ShopParam>(getShopApi, [], { bizType: 1 }); | |
24 | - const [selectedRow, setSelectedRow] = useState<number[]>([]); | |
25 | - const [loading, setLoading] = useState(false); | |
49 | + | |
50 | + const [delay, setDelay] = useState(true); | |
51 | + const [checkDelay, setCheckDelay] = useState(true); | |
26 | 52 | const [orderList, setOrderList] = useState([]); |
27 | - const [searchParams, setSearchParams] = useState<Search>({}); | |
53 | + const [confirmOrderList, setConfirmOrderList] = useState([]); | |
54 | + // 请求参数 | |
55 | + const queryParams = new Map([ | |
56 | + [1, { rebateId, subsidyType: currentItem.subsidyType }], | |
57 | + [2, { rebateId }], | |
58 | + [3, { rebateId, promotionId: currentItem.promotionId }], | |
59 | + [4, { rebateId }], | |
60 | + ]); | |
61 | + const waitCheckListApi = () => { | |
62 | + if ([1, 2, 3].includes(dimension) && carOrderTabkey === '2') { | |
63 | + return currentItem.supportType === 1 ? Api.getRebateTicketList : Api.getRebateRetailList; | |
64 | + } | |
65 | + // if (dimension === 3 && carOrderTabkey === '2') { | |
66 | + // return currentItem.supportType === 1 ? Api.getRebateTicketList : Api.getRebateRetailList; | |
67 | + // } | |
68 | + return commonWaitCheckList[dimension]; | |
69 | + }; | |
28 | 70 | |
29 | 71 | useEffect(() => { |
30 | - if (currentItem.status == 2) { | |
31 | - const new_item = orderList.filter((item: FvmAllowance.OrderItemVo) => !!item.confirm).map((i: FvmAllowance.OrderItemVo) => i.id); | |
32 | - setSelectedRow(new_item); | |
33 | - return; | |
72 | + if (carOrderTabkey) { | |
73 | + setParams(queryParams.get(dimension), true); | |
34 | 74 | } |
35 | - setSelectedRow(orderList.map((i: FvmAllowance.OrderItemVo) => i.id)); | |
36 | - }, [orderList]); | |
75 | + }, [carOrderTabkey]); | |
76 | + /** 未确认清单 */ | |
77 | + // commonWaitCheckList[dimension], | |
78 | + const { | |
79 | + list, | |
80 | + loading, | |
81 | + setParams, | |
82 | + paginationConfig, | |
83 | + setLoading, | |
84 | + innerParams, | |
85 | + } = usePagination<FvmAllowance.WaitCheckListItems>( | |
86 | + waitCheckListApi(), | |
87 | + queryParams.get(dimension), | |
88 | + { delay } | |
89 | + ); | |
37 | 90 | |
91 | + // 确认清单 | |
92 | + const { | |
93 | + list: checkList, | |
94 | + loading: checkLoading, | |
95 | + setParams: setCheckParams, | |
96 | + paginationConfig: checkPaginationConfig, | |
97 | + setLoading: setCheckLoading, | |
98 | + innerParams: checkInnerParams, | |
99 | + } = usePagination<FvmAllowance.CheckListItems>( | |
100 | + commonCheckList[dimension], | |
101 | + queryParams.get(dimension), | |
102 | + { delay: checkDelay } | |
103 | + ); | |
104 | + | |
105 | + const fetchTableList = () => { | |
106 | + if (dimension === 1) { | |
107 | + //厂家补贴 | |
108 | + if (rebateId && currentItem.subsidyType) { | |
109 | + setParams( | |
110 | + { | |
111 | + rebateId, | |
112 | + subsidyType: currentItem.subsidyType, | |
113 | + }, | |
114 | + true | |
115 | + ); | |
116 | + setCheckParams( | |
117 | + { | |
118 | + rebateId, | |
119 | + subsidyType: currentItem.subsidyType, | |
120 | + }, | |
121 | + true | |
122 | + ); | |
123 | + setDelay(false); | |
124 | + setCheckDelay(false); | |
125 | + } | |
126 | + } | |
127 | + //厂家代收款 | |
128 | + if (dimension === 2) { | |
129 | + if (rebateId) { | |
130 | + setParams( | |
131 | + { | |
132 | + rebateId, | |
133 | + }, | |
134 | + true | |
135 | + ); | |
136 | + setCheckParams( | |
137 | + { | |
138 | + rebateId, | |
139 | + }, | |
140 | + true | |
141 | + ); | |
142 | + setCheckDelay(false); | |
143 | + setDelay(false); | |
144 | + } | |
145 | + } | |
146 | + //厂家促销(正激励) | |
147 | + if (dimension === 3) { | |
148 | + if (rebateId && currentItem.promotionId) { | |
149 | + setParams( | |
150 | + { | |
151 | + rebateId, | |
152 | + promotionId: currentItem.promotionId, | |
153 | + }, | |
154 | + true | |
155 | + ); | |
156 | + setCheckParams( | |
157 | + { | |
158 | + rebateId, | |
159 | + promotionId: currentItem.promotionId, | |
160 | + }, | |
161 | + true | |
162 | + ); | |
163 | + setCheckDelay(false); | |
164 | + setDelay(false); | |
165 | + } | |
166 | + } | |
167 | + //现金启票奖励 | |
168 | + if (dimension === 4) { | |
169 | + if (rebateId) { | |
170 | + setParams( | |
171 | + { | |
172 | + rebateId, | |
173 | + }, | |
174 | + true | |
175 | + ); | |
176 | + setCheckParams( | |
177 | + { | |
178 | + rebateId, | |
179 | + }, | |
180 | + true | |
181 | + ); | |
182 | + setCheckDelay(false); | |
183 | + setDelay(false); | |
184 | + } | |
185 | + } | |
186 | + }; | |
38 | 187 | useEffect(() => { |
39 | 188 | if (visible) { |
40 | - getOrderList(); | |
189 | + fetchTableList(); | |
41 | 190 | } |
42 | - }, [visible]); | |
191 | + }, [rebateId, currentItem, visible]); | |
192 | + | |
193 | + // useEffect(() => { | |
194 | + // if (list instanceof Array) { | |
195 | + // setOrderList([...list]); | |
196 | + // } | |
197 | + // if (checkList instanceof Array) { | |
198 | + // setConfirmOrderList([...checkList]); | |
199 | + // } | |
200 | + // }, [list, checkList]); | |
43 | 201 | |
44 | - function getOrderList(searchParams?: Search) { | |
202 | + function getNotConfirmOrder(searchParams?: Search) { | |
45 | 203 | setLoading(true); |
46 | - const pa = currentItem.promotionId && currentItem.rebateFundsType === 4 ? | |
47 | - { id: currentItem.id, ...searchParams } : { | |
48 | - payeeDealerId: data.dealerId, | |
49 | - brandId: data.brandId, | |
50 | - factoryId: data.factoryId, | |
51 | - year: data.year, | |
52 | - month: data.month, | |
53 | - ...searchParams, | |
54 | - rebateId: currentItem.status == 2 ? rebateId : undefined | |
55 | - }; | |
56 | - commonOrderList[currentItem.rebateFundsType](pa).then((res: any) => { | |
57 | - setOrderList(res.data || []); | |
58 | - setLoading(false); | |
59 | - }).catch((e: any) => { | |
60 | - message.error(e.message); | |
61 | - setLoading(false); | |
62 | - }); | |
204 | + const pa = { | |
205 | + rebateId, | |
206 | + subsidyType: currentItem.subsidyType, | |
207 | + ...searchParams, | |
208 | + }; | |
209 | + setParams({ ...pa, ...searchParams }, true); | |
63 | 210 | } |
64 | - const selectedMoeny = () => { | |
65 | - let count = 0; | |
66 | - orderList.forEach((i: FvmAllowance.OrderItemVo) => { | |
67 | - if (selectedRow.includes(i.id)) { | |
68 | - count += i.actualRebateAmount || 0; | |
69 | - } | |
211 | + | |
212 | + /** | |
213 | + *厂家补贴折让提交清单 | |
214 | + * @param searchParams | |
215 | + */ | |
216 | + function getConfirmOrder(searchParams?: Search) { | |
217 | + setLoading(true); | |
218 | + const pa = { | |
219 | + rebateId, | |
220 | + subsidyType: currentItem.subsidyType, | |
221 | + }; | |
222 | + setParams({ ...pa, ...searchParams }, true); | |
223 | + } | |
224 | + | |
225 | + const addList = async (values: any[]) => { | |
226 | + // const res = orderList.filter((x) => !values.find((y) => y.id === x.id)); | |
227 | + const orderIds = values.map((i) => i.id); | |
228 | + /** | |
229 | + * 选中厂家补贴折让加入提交清单 | |
230 | + */ | |
231 | + let submitApi = commonEnterCheckList[dimension]; | |
232 | + if ([1, 2].includes(dimension) && carOrderTabkey === '2') { | |
233 | + submitApi = handleCheckListApi[dimension]; | |
234 | + } | |
235 | + if (dimension === 3 && carOrderTabkey === '2') { | |
236 | + submitApi = currentItem.supportType === 1 ? Api.promotionTicketCheck : Api.promotionSaleCheck; | |
237 | + } | |
238 | + const { result, success } = await submitApi({ | |
239 | + rebateId, | |
240 | + orderIds, | |
241 | + carId: carOrderTabkey === '2' ? values[0].id : undefined, | |
242 | + inwardName: values[0].inwardName, | |
243 | + subsidyType: currentItem.subsidyType, | |
244 | + promotionId: dimension == 3 ? currentItem.promotionId : undefined | |
70 | 245 | }); |
71 | - return count.toFixed(2); | |
246 | + if (!success) { | |
247 | + message.error(result.message); | |
248 | + return; | |
249 | + } else { | |
250 | + message.success("操作成功"); | |
251 | + } | |
252 | + // 从表格一删除 | |
253 | + // setOrderList([...res]); | |
254 | + setSelectedRowkeys([]); | |
255 | + /** 加入表格二 */ | |
256 | + // setConfirmOrderList([...confirmOrderList, ...values]); | |
257 | + // 重新加载两个列表 | |
258 | + setParams({ ...innerParams }, true); | |
259 | + setCheckParams({ ...checkInnerParams }, true); | |
72 | 260 | }; |
73 | 261 | |
74 | - function handSubmit() { | |
75 | - if (!selectedRow.length) { | |
76 | - message.error("请选勾选折让清单后提交"); | |
262 | + const removeList = async (values: any[]) => { | |
263 | + const res = confirmOrderList.filter( | |
264 | + (x) => !values.find((y) => y.id === x.id) | |
265 | + ); | |
266 | + // 从表格二删除 | |
267 | + // setConfirmOrderList([...res]); | |
268 | + setSubmitSelectedRowkeys([]); | |
269 | + /** 加入表格一 */ | |
270 | + // setOrderList([...orderList, ...values]); | |
271 | + /** | |
272 | + * 选中厂家补贴折让移出提交清单 | |
273 | + */ | |
274 | + const orderIds = values.map((i) => i.id); | |
275 | + | |
276 | + // const { result, success } = await api.rebateSubsidyRemove({ | |
277 | + const { result, success } = await commonRemoveCheckList[dimension]({ | |
278 | + rebateId, | |
279 | + orderIds, | |
280 | + subsidyType: currentItem.subsidyType, | |
281 | + }); | |
282 | + if (!success) { | |
283 | + message.error(result); | |
77 | 284 | return; |
78 | 285 | } |
79 | - let param: any = { | |
80 | - rebateId: data.id, | |
81 | - orderIds: selectedRow | |
82 | - }; | |
83 | - // if (currentItem.rebateFundsType === 4) { | |
84 | - // param = { ...param, id: currentItem.id, promotionName: currentItem.promotionName, promotionFid: currentItem.promotionFid }; | |
85 | - // } | |
86 | - setComfirmLoading(true); | |
87 | - const api = commonComfirmApi[currentItem.rebateFundsType]; | |
88 | - api(param).then(() => { | |
89 | - message.success('操作成功'); | |
90 | - setComfirmLoading(false); | |
91 | - setDetailLoading(true); | |
92 | - setVisible(false); | |
93 | - }).catch((e: any) => { | |
94 | - message.error(e.message); | |
95 | - setComfirmLoading(false); | |
96 | - }); | |
97 | - } | |
286 | + // 重新加载两个列表 | |
287 | + setParams({ ...innerParams }, true); | |
288 | + setCheckParams({ ...checkInnerParams }, true); | |
289 | + }; | |
98 | 290 | |
99 | - function getCurrent() { | |
100 | - const newItem = SubidyColumn(); | |
101 | - if (currentItem.status === 1) { | |
102 | - return newItem; | |
291 | + const getColumn = () => { | |
292 | + const tmpColumn = SubidyColumn()[dimension][1]; | |
293 | + if (readOnly) { | |
294 | + tmpColumn.pop(); | |
103 | 295 | } |
104 | - newItem.pop(); | |
105 | - return newItem; | |
106 | - } | |
107 | - | |
296 | + return tmpColumn; | |
297 | + }; | |
108 | 298 | return ( |
109 | 299 | <Modal |
110 | - title={`${currentItem.fundsName || ''}车辆清单`} | |
300 | + title={`${currentItem.fundsName || ""}车辆清单`} | |
111 | 301 | visible={visible} |
112 | 302 | width="70%" |
113 | 303 | maskClosable={false} |
114 | 304 | confirmLoading={comfrimloading} |
115 | 305 | destroyOnClose |
116 | - onCancel={() => setVisible(false)} | |
117 | - footer={currentItem.status == 1 && data.status == 1 ? [ | |
118 | - <Button key="1" onClick={() => setVisible(false)}>取消</Button>, | |
119 | - <Button key="2" type="primary" onClick={handSubmit}>确认折让</Button> | |
120 | - ] : []} | |
306 | + onCancel={() => { setVisible(false); setCarOrderTabkey(''); }} | |
307 | + onOk={() => { setVisible(false); setCarOrderTabkey(''); !readOnly && setDetailLoading(true); }} | |
308 | + // footer={ | |
309 | + // <Button | |
310 | + // onClick={() => { setVisible(false); !readOnly && setDetailLoading(true); }} | |
311 | + // > | |
312 | + // {readOnly ? "取消" : "完成"} | |
313 | + // </Button> | |
314 | + // } | |
121 | 315 | > |
122 | 316 | <div> |
123 | - <Row justify="space-between" style={{ marginBottom: 16, flexWrap: "wrap" }}> | |
124 | - <div> | |
125 | - <span>VIN:</span> | |
126 | - <Input style={{ width: 200 }} allowClear placeholder="搜索VIN" onChange={(e) => setSearchParams({ ...searchParams, vin: e.target.value || undefined })} /> | |
127 | - </div> | |
128 | - <div> | |
129 | - <span style={{ marginLeft: 15 }}>门店:</span> | |
130 | - <Select | |
131 | - optionFilterProp="children" | |
132 | - showSearch | |
133 | - allowClear | |
134 | - style={{ width: 200, marginRight: 15 }} | |
135 | - placeholder="请选择门店" | |
136 | - onChange={(v) => setSearchParams({ ...searchParams, shopId: v ? Number(v) : undefined })} | |
137 | - > | |
138 | - {shopList.map((shop) => ( | |
139 | - <Select.Option value={shop.id} key={shop.id}>{shop.name}</Select.Option> | |
140 | - ))} | |
141 | - </Select> | |
142 | - </div> | |
143 | - <div> | |
144 | - <span>下零售日期范围:</span> | |
145 | - <RangePicker allowClear format="YYYY-MM-DD" onChange={(v) => setSearchParams({ ...searchParams, retailBegin: v && v[0] && v[0].valueOf(), retailEnd: v && v[1] && v[1].valueOf() })} /> | |
146 | - </div> | |
147 | - {[1, 2].includes(currentItem.rebateFundsType) && ( | |
148 | - <div style={{ marginTop: 15 }}> | |
149 | - <span>{currentItem.rebateFundsType == 1 ? "补贴类型:" :"厂家代收款名称:"}</span> | |
150 | - <Input style={{ width: 200 }} allowClear placeholder="请输入" onChange={(e) => setSearchParams({ ...searchParams, subsidyName: e.target.value || undefined })} /> | |
151 | - </div> | |
152 | - )} | |
153 | - <Button type="primary" style={{ marginTop: [1, 2].includes(currentItem.rebateFundsType) ? 15 : 0 }} onClick={() => getOrderList(searchParams)}>查询</Button> | |
154 | - </Row> | |
155 | - {currentItem.status !== 2 && currentItem.rebateFundsType !== 4 && <p style={{ marginBottom: 10, fontSize: 16 }}> 已选择{selectedRow.length}项,合计折让金额 <span style={{ color: 'red' }}>{selectedMoeny()}</span> 元</p>} | |
156 | - <Table | |
157 | - loading={loading} | |
158 | - pagination={false} | |
159 | - rowKey="id" | |
160 | - scroll={{ y: 500 }} | |
161 | - rowSelection={currentItem.rebateFundsType !== 4 ? { | |
162 | - selectedRowKeys: selectedRow, | |
163 | - onChange: (selectedRowKeys: any) => { | |
164 | - setSelectedRow(selectedRowKeys); | |
165 | - }, | |
166 | - getCheckboxProps: (record: FvmAllowance.OrderItemVo) => ({ | |
167 | - disabled: currentItem.status === 2, | |
168 | - // name: record.name, | |
169 | - }), | |
170 | - } : undefined} | |
171 | - dataSource={orderList} | |
172 | - columns={getCurrent()} | |
317 | + <TransferTable | |
318 | + upLoading={loading} | |
319 | + dowmLoading={checkLoading} | |
320 | + dataSource1={list} | |
321 | + dataSource2={checkList} | |
322 | + columns1={SubidyColumn()[dimension][0]} | |
323 | + columns2={getColumn()} | |
324 | + paginationConfig={paginationConfig} | |
325 | + checkPaginationConfig={checkPaginationConfig} | |
326 | + addList={addList} | |
327 | + removeList={removeList} | |
328 | + getConfirmOrder={getConfirmOrder} | |
329 | + getNotConfirmOrder={getNotConfirmOrder} | |
173 | 330 | /> |
174 | 331 | </div> |
175 | - <DetailModal | |
332 | + <ComfirmDiffModal | |
176 | 333 | visible={detailVisible} |
177 | - onCancel={() => { setDetailVisible(false); setOrderId(undefined); }} | |
334 | + onCancel={() => { | |
335 | + setDetailVisible(false); | |
336 | + setOrderId(undefined); | |
337 | + }} | |
178 | 338 | orderId={orderId} |
179 | - fetchList={() => getOrderList()} | |
339 | + fetchList={() => { | |
340 | + setLoading(true); | |
341 | + setCheckLoading(true); | |
342 | + }} | |
180 | 343 | /> |
181 | 344 | </Modal> |
182 | 345 | ); | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/RewardsList/api.ts
... | ... | @@ -3,28 +3,44 @@ import request from '@/utils/request'; |
3 | 3 | import { FVM_HOST } from '@/utils/host'; |
4 | 4 | |
5 | 5 | export interface ListVO { |
6 | - id: number, | |
7 | - dealerId: number, | |
8 | - dealerName: number, | |
9 | - rewardsName: string, | |
10 | - rewardsId: number, | |
11 | - rewardsType: number, | |
12 | - amount: number | |
6 | + rebateId: number, // 折让id | |
7 | + rewardsType: number, // 款项类型 1扣款 2奖励 | |
8 | + rewardsId: number, // 奖惩id | |
9 | + rewardsName: string, //奖惩名称 | |
10 | + totalAmount: number, // 折让金额 | |
11 | + costSharing: CashSharing[], //金额分摊 | |
12 | + fundsName: string; // 款项名称 | |
13 | + | |
14 | +} | |
15 | + | |
16 | +// 金额分摊 | |
17 | +interface CashSharing { | |
18 | + rewardBelong: number, // 奖惩金额归属 1指定商家 2门店分摊 | |
19 | + dealerId?: number, // 商家id | |
20 | + dealerName?: string, // 商家名称 | |
21 | + shopId?: number, // 门店id | |
22 | + shopName?: string, //门店名称 | |
23 | + amount: number, // 分摊金额 | |
24 | + ratio: number, // 分摊比例 | |
13 | 25 | } |
14 | 26 | |
15 | 27 | /** |
16 | 28 | * 奖励扣款列表 |
17 | 29 | */ |
18 | 30 | export function getRewardsListApi(rebateId: number): http.PromiseResp<ListVO[]> { |
19 | - return request.get(`${FVM_HOST}/erp/factory/rebate/check/rewards/list`, { params: { rebateId }}); | |
31 | + return request.get(`${FVM_HOST}/erp/factory/rebate/check/rewards/list`, { params: { rebateId } }); | |
20 | 32 | } |
21 | 33 | |
22 | -/** 新增奖励扣款 */ | |
34 | +/** 新增奖励扣款 | |
35 | + * http://testgate.feewee.cn/fvm/factory/rebate/check/rewards/save | |
36 | + */ | |
23 | 37 | export function saveRewardsListApi(param: ListVO): http.PromiseResp<string> { |
24 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/check/rewards/save`, param); | |
38 | + return request.post<string>(`${FVM_HOST}/factory/rebate/check/rewards/save`, param); | |
25 | 39 | } |
26 | 40 | |
27 | -/**删除奖励扣款 */ | |
41 | +/** | |
42 | + * 删除保存奖励、扣款 | |
43 | +*/ | |
28 | 44 | export function getDeleteListApi(id: number): http.PromiseResp<FvmAllowance.ResonItem[]> { |
29 | - return request.get(`${FVM_HOST}/erp/factory/rebate/check/rewards/del`, {params: { id }}); | |
45 | + return request.get(`${FVM_HOST}/factory/rebate/check/rewards/del`, { params: { id } }); | |
30 | 46 | } | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/RewardsList/index.tsx
1 | 1 | import React, { useState } from "react"; |
2 | -import { Table, Popconfirm, Row, Button, message } from 'antd'; | |
3 | -import { useStore } from '../index'; | |
4 | -import * as api from './api'; | |
5 | -import { PlusOutlined } from '@ant-design/icons'; | |
6 | -import AddRewardsModal from '../components/AddRewardsModal'; | |
7 | -import { RewardsType } from '@/pages/stock/AllowanceConfirm/entity'; | |
2 | +import { Table, Popconfirm, Row, Button, message, Space, Divider } from "antd"; | |
3 | +import { useStore } from "../index"; | |
4 | +import * as api from "./api"; | |
5 | +import { PlusOutlined } from "@ant-design/icons"; | |
6 | +import AddRewardsModal from "../components/AddRewardsModal"; | |
7 | +import { RewardsType } from "@/pages/stock/AllowanceConfirm/entity"; | |
8 | 8 | |
9 | 9 | const { Column } = Table; |
10 | 10 | |
11 | 11 | interface Props { |
12 | - rewardsType: number, | |
12 | + rewardsType: number; | |
13 | + // data: FvmAllowance.RewardsItemList[]; | |
13 | 14 | } |
14 | 15 | function RewardsList(props: Props) { |
16 | + // const { rewardsType, data } = props; | |
15 | 17 | const { rewardsType } = props; |
16 | - const { rewardList, data, setLoading } = useStore(); | |
18 | + const { | |
19 | + setParams, | |
20 | + params, | |
21 | + rewardOrder, | |
22 | + disCountOrder, | |
23 | + RewardOrderPagination, | |
24 | + DiscountOrderPagination, | |
25 | + setRewardOrderParams, | |
26 | + setDiscountOrderParams, | |
27 | + rebateId, | |
28 | + readOnly, | |
29 | + } = useStore(); | |
30 | + const paginationTypeList = { | |
31 | + 1: DiscountOrderPagination, | |
32 | + 2: RewardOrderPagination, | |
33 | + }; | |
34 | + | |
35 | + const tableData = { 1: disCountOrder, 2: rewardOrder }; | |
17 | 36 | const [saveLoading, setSaveLoading] = useState(false); |
18 | 37 | const [visible, setVisible] = useState(false); |
38 | + // 当前编辑项 | |
39 | + const [currentItem, setCurrentItem] = useState({}); | |
19 | 40 | |
20 | 41 | function handleDelete(record: api.ListVO) { |
21 | 42 | setSaveLoading(true); |
22 | - api.getDeleteListApi(record.id).then(res => { | |
23 | - message.success("操作成功"); | |
24 | - setSaveLoading(false); | |
25 | - // setRewardLoading(true); | |
26 | - }).catch(e => { | |
27 | - setSaveLoading(false); | |
28 | - message.error(e.message); | |
29 | - } | |
30 | - ); | |
43 | + api | |
44 | + .getDeleteListApi(record.id) | |
45 | + .then((res) => { | |
46 | + message.success("操作成功"); | |
47 | + setSaveLoading(false); | |
48 | + fetchList(); | |
49 | + }) | |
50 | + .catch((e) => { | |
51 | + setSaveLoading(false); | |
52 | + message.error(e.message); | |
53 | + }); | |
31 | 54 | } |
55 | + | |
56 | + // 配置 | |
57 | + const onEdit = (record: api.ListVO) => { | |
58 | + setVisible(true); | |
59 | + setCurrentItem({ ...record }); | |
60 | + }; | |
61 | + | |
62 | + // 获取奖励、扣款清单 | |
63 | + const fetchList = () => { | |
64 | + setDiscountOrderParams({ rebateId, rewardType: 1 }, true); | |
65 | + setRewardOrderParams({ rebateId, rewardType: 2 }, true); | |
66 | + }; | |
32 | 67 | return ( |
33 | 68 | <div style={{ marginTop: 100 }}> |
34 | 69 | <Row justify="space-between" style={{ marginBottom: 20 }}> |
35 | - <h3>{rewardsType == 1 ? "2、扣款清单" : "3、奖励清单"}</h3> | |
36 | - <Button type="primary" icon={<PlusOutlined />} disabled={data.status !== 1} onClick={() => setVisible(true)}>新增{rewardsType == 1 ? "扣款" : "奖励"}</Button> | |
70 | + <h3>{rewardsType == 1 ? "1、扣款清单" : "2、奖励清单"}</h3> | |
71 | + <Button | |
72 | + type="primary" | |
73 | + icon={<PlusOutlined />} | |
74 | + onClick={() => setVisible(true)} | |
75 | + disabled={readOnly} | |
76 | + > | |
77 | + 新增{rewardsType == 1 ? "扣款" : "奖励"} | |
78 | + </Button> | |
37 | 79 | </Row> |
38 | 80 | <Table |
39 | - dataSource={rewardList.filter(reward => reward.rewardsType === rewardsType)} | |
40 | - pagination={false} | |
81 | + dataSource={tableData[rewardsType]} | |
82 | + pagination={paginationTypeList[rewardsType]} | |
41 | 83 | rowKey="id" |
42 | 84 | loading={false} |
43 | 85 | > |
44 | - <Column title="名称" width="30%" dataIndex="rewardsName" align="center" /> | |
45 | - <Column title="商家" dataIndex="dealerName" align="center" /> | |
46 | - <Column title={`${RewardsType[rewardsType]}金额(元)`} dataIndex="amount" align="center" /> | |
86 | + <Column title="名称" width="30%" dataIndex="fundsName" align="center" /> | |
87 | + <Column | |
88 | + title="类型" | |
89 | + width="30%" | |
90 | + dataIndex="rewardsType" | |
91 | + align="center" | |
92 | + render={(text: number) => (text ? RewardsType[text] : "--")} | |
93 | + /> | |
47 | 94 | <Column |
48 | - title="操作" | |
95 | + title="实际折让金额(元)" | |
96 | + dataIndex="actualRebateAmount" | |
97 | + align="center" | |
98 | + /> | |
99 | + <Column | |
100 | + title="折让分摊" | |
49 | 101 | align="center" |
50 | 102 | width={150} |
51 | 103 | render={(text, record: api.ListVO) => ( |
52 | 104 | <> |
53 | - <Popconfirm | |
54 | - title={`确定删除【${record.rewardsName}】配置?`} | |
55 | - onConfirm={() => handleDelete(record)} | |
56 | - okText="确定" | |
57 | - cancelText="取消" | |
58 | - > | |
59 | - {data.status === 1 ? <Button type="link" style={{ color: 'red' }} loading={saveLoading}>删除</Button> : null} | |
60 | - </Popconfirm> | |
105 | + <Space> | |
106 | + <Button | |
107 | + type="link" | |
108 | + loading={saveLoading} | |
109 | + onClick={() => onEdit(record)} | |
110 | + > | |
111 | + {/* 配置 */} | |
112 | + {readOnly?'查看':'配置'} | |
113 | + </Button> | |
114 | + <Divider type="vertical" /> | |
115 | + | |
116 | + <Popconfirm | |
117 | + title={`确定删除【${record.fundsName}】配置?`} | |
118 | + onConfirm={() => handleDelete(record)} | |
119 | + okText="确定" | |
120 | + cancelText="取消" | |
121 | + > | |
122 | + <Button | |
123 | + type="link" | |
124 | + style={{ color: "red" }} | |
125 | + loading={saveLoading} | |
126 | + > | |
127 | + 删除 | |
128 | + </Button> | |
129 | + </Popconfirm> | |
130 | + </Space> | |
61 | 131 | </> |
62 | 132 | )} |
63 | 133 | /> |
64 | 134 | </Table> |
65 | 135 | <AddRewardsModal |
66 | 136 | visible={visible} |
67 | - onCancel={() => setVisible(false)} | |
137 | + onCancel={() => { | |
138 | + setVisible(false); | |
139 | + setCurrentItem({}); | |
140 | + }} | |
141 | + currentItem={currentItem} | |
68 | 142 | rewardsType={rewardsType} |
69 | - fetchList={() => setLoading(true)} | |
143 | + dimension={5} | |
144 | + fetchList={() => { | |
145 | + fetchList(); | |
146 | + }} | |
70 | 147 | /> |
71 | 148 | </div> |
72 | 149 | ); |
73 | -} | |
150 | +} | |
74 | 151 | |
75 | - export default React.memo(RewardsList); | |
76 | 152 | \ No newline at end of file |
153 | +export default React.memo(RewardsList); | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/api.ts
... | ... | @@ -28,16 +28,34 @@ export interface SaveParam { |
28 | 28 | fid?: string //红字发票?: UserItem[] |
29 | 29 | } |
30 | 30 | |
31 | +export interface SubsidyTypeList { | |
32 | + subsidyType: number, | |
33 | + subsidyName: string, | |
34 | + rebateAmount?: number, //应折让金额 | |
35 | +} | |
36 | +/** 厂家折让管理详情参数 */ | |
37 | +export interface ManageDetailParam { | |
38 | + rebateId?: number, //折让管理id | |
39 | + financeNo?: string, // | |
40 | +} | |
41 | + | |
42 | +/** 查询门店 */ | |
43 | +export interface DetailParam { | |
44 | + subjectId: number;//投资主体id | |
45 | + brandId: number; //品牌id | |
46 | +} | |
31 | 47 | /** |
32 | 48 | * 月度厂家折让详情 |
49 | + * 厂家折让管理详情 | |
33 | 50 | */ |
34 | -export function queryDetailListApi(rebateId: number): http.PromiseResp<FvmAllowance.RebateDetail> { | |
35 | - return request.get(`${FVM_HOST}/erp/factory/rebate/check/detail`, { params: { rebateId } }); | |
51 | +export function queryDetailListApi(params: ManageDetailParam): http.PromiseResp<FvmAllowance.RebateDetail> { | |
52 | + return request.get(`${FVM_HOST}/erp/factory/rebate/manage/detail`, { params }); | |
36 | 53 | } |
37 | 54 | |
38 | -/** 提交厂家折让 */ | |
55 | +/** 厂家折让提交 | |
56 | +*/ | |
39 | 57 | export function commitRebateApi(param: SaveParam): http.PromiseResp<string> { |
40 | - return request.post<string>(`${FVM_HOST}/erp/factory/rebate/check/commit`, param); | |
58 | + return request.post<string>(`${FVM_HOST}/erp/factory/rebate/manage/commit`, param); | |
41 | 59 | } |
42 | 60 | |
43 | 61 | /**折让不足原因 */ |
... | ... | @@ -54,12 +72,24 @@ export function getRewardsSelectApi(rewardsType: number): http.PromiseResp<FvmAl |
54 | 72 | * 查询到账商家对应投资主体范围商家 |
55 | 73 | */ |
56 | 74 | export function getRewardsDealer(subjectId: number): http.PromiseResp<FvmAllowance.DealerItem[]> { |
57 | - return request.get(`${FVM_HOST}/erp/factory/rebate/check/dealer/select`, { params: { subjectId } }); | |
75 | + return request.get(`${FVM_HOST}/erp/factory/rebate/manage/dealer/select`, { params: { subjectId } }); | |
58 | 76 | } |
59 | 77 | |
60 | 78 | /** |
61 | 79 | * 促销折让金额核对确认 |
62 | 80 | */ |
63 | 81 | export function savePromotionApi(params: { id: number, actualRebateAmount: number }): http.PromiseResp<FvmAllowance.DealerItem[]> { |
64 | - return request.post(`${FVM_HOST}/erp/factory/rebate/promotion/order/save/check`, params); | |
82 | + return request.post(`${FVM_HOST}/factory/rebate/promotion/diff/save`, params); | |
83 | +} | |
84 | + | |
85 | +/** 查询厂家补贴类型 */ | |
86 | +export function getSubsidyType(): http.PromiseResp<SubsidyTypeList[]> { | |
87 | + return request.get(`${FVM_HOST}/factory/rebate/subsidy/type/list`); | |
65 | 88 | } |
89 | + | |
90 | +/** | |
91 | + * 查询商家-门店 | |
92 | + */ | |
93 | +export function getRebateShop(params: DetailParam): http.PromiseResp<SubsidyTypeList[]> { | |
94 | + return request.get(`${FVM_HOST}/erp/factory/rebate/manage/shop/select`, { params }); | |
95 | +} | |
66 | 96 | \ No newline at end of file | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/AddRewardsModal.tsx
1 | 1 | import React, { useEffect, useState } from "react"; |
2 | -import { Modal, Form, Select, InputNumber, message, Spin } from "antd"; | |
2 | +import { Modal, Form, Select, InputNumber, message, Button, Spin } from "antd"; | |
3 | 3 | import { saveRewardsListApi } from "../RewardsList/api"; |
4 | -import { useStore } from '../index'; | |
5 | -import { getRewardsDealer, getRewardsSelectApi } from '../api'; | |
6 | -import _ from 'lodash'; | |
7 | -import useInitail from '@/hooks/useInitail'; | |
8 | -import { RewardsType } from '@/pages/stock/AllowanceConfirm/entity'; | |
4 | +import { useStore } from "../index"; | |
5 | +import { getRewardsDealer, getRewardsSelectApi } from "../api"; | |
6 | +import _ from "lodash"; | |
7 | +import useInitail from "@/hooks/useInitail"; | |
8 | +import { RewardsType } from "@/pages/stock/AllowanceConfirm/entity"; | |
9 | +import EditableTable from "./EditTable"; | |
10 | +import { savePromotionNegativeApi } from "@/pages/stock/AllowanceConfirm/EditComfirm/Manufacturer/api"; | |
9 | 11 | |
10 | 12 | const Option = Select.Option; |
11 | 13 | interface Props { |
12 | - visible: boolean, | |
13 | - onCancel: Function, | |
14 | - rewardsType: number, | |
15 | - fetchList: () => any, | |
14 | + visible: boolean; | |
15 | + onCancel: Function; | |
16 | + rewardsType?: number; | |
17 | + fetchList: () => any; | |
18 | + currentItem: any; | |
19 | + dimension: number; //5 奖励 ,4 :负激励 | |
16 | 20 | } |
21 | +const currentApi = { | |
22 | + 4: savePromotionNegativeApi, | |
23 | + 5: saveRewardsListApi, | |
24 | +}; | |
17 | 25 | |
18 | 26 | export default function CreateModal(props: Props) { |
19 | 27 | const [form] = Form.useForm(); |
20 | - const { visible, onCancel, fetchList, rewardsType } = props; | |
21 | - const { data, rebateId } = useStore(); | |
28 | + const { visible, onCancel, fetchList, rewardsType, currentItem, dimension } = | |
29 | + props; | |
30 | + const { data, rebateId, readOnly } = useStore(); | |
31 | + | |
32 | + // 扣款金额 | |
33 | + const [amount, setAmount] = useState<number>(0); | |
22 | 34 | const [delay, setDelay] = useState(true); |
35 | + const [shopDelay, setShopDelay] = useState(true); | |
23 | 36 | const [dealerList, setDealerList] = useState<FvmAllowance.DealerItem[]>([]); |
24 | - const { data: rewardsList, setParams, loading } = useInitail(getRewardsSelectApi, [], rewardsType, delay); | |
37 | + const [shopList, setShopList] = useState<any[]>([]); | |
38 | + /** | |
39 | + * 存储已经选择门店列表 | |
40 | + */ | |
41 | + const [selesctedDealerList, setSelectedDealerList] = useState<any[]>([]); | |
42 | + | |
43 | + /** 获取折让类型列表 */ | |
44 | + const { | |
45 | + data: rewardsList, | |
46 | + setParams, | |
47 | + loading, | |
48 | + } = useInitail(getRewardsSelectApi, [], rewardsType, delay); | |
25 | 49 | const [saveLoading, setSaveLoading] = useState(false); |
26 | 50 | |
27 | 51 | useEffect(() => { |
28 | - if (rewardsType && visible) { | |
52 | + if (visible) { | |
53 | + setAmount(currentItem.actualRebateAmount || 0); | |
54 | + // 选中商家 | |
55 | + if (currentItem.costSharing && currentItem.costSharing.length) { | |
56 | + const shops = currentItem.costSharing.map((i) => ({ | |
57 | + label: i.dealerName, | |
58 | + value: i.dealerId, | |
59 | + })); | |
60 | + const tmpList = currentItem.costSharing.map((i) => ({ | |
61 | + ...i, | |
62 | + key: i.dealerId, | |
63 | + })); | |
64 | + currentItem.dealerId = shops; | |
65 | + | |
66 | + setSelectedDealerList([...tmpList]); | |
67 | + } | |
68 | + form.setFieldsValue({ | |
69 | + ...currentItem, | |
70 | + amount: currentItem.actualRebateAmount, | |
71 | + rewardsSelectType: { | |
72 | + label: currentItem.fundsName, | |
73 | + value: currentItem.rewardsId, | |
74 | + }, | |
75 | + }); | |
76 | + } | |
77 | + if (dimension === 4) { | |
78 | + setDelay(true); | |
79 | + } | |
80 | + if (rewardsType && visible && dimension === 5) { | |
29 | 81 | setParams(rewardsType, true); |
30 | 82 | setDelay(false); |
31 | 83 | } |
32 | - }, [visible]); | |
84 | + // if (data.brandId && data.brandId && visible) { | |
85 | + // getShopList({ brandId: data.brandId, subjectId: data.subjectId }); | |
86 | + // } | |
87 | + }, [visible, data]); | |
33 | 88 | |
34 | 89 | useEffect(() => { |
35 | 90 | if (dealerList.length) return; |
... | ... | @@ -37,67 +92,217 @@ export default function CreateModal(props: Props) { |
37 | 92 | }, [data.subjectId, visible]); |
38 | 93 | |
39 | 94 | function getDealerList() { |
40 | - getRewardsDealer(data.subjectId).then(res => { | |
41 | - setDealerList(res.data || []); | |
42 | - }).catch(e => { | |
43 | - message.error(e.message); | |
44 | - }); | |
95 | + getRewardsDealer(data.subjectId) | |
96 | + .then((res) => { | |
97 | + setDealerList(res.data || []); | |
98 | + }) | |
99 | + .catch((e) => { | |
100 | + message.error(e.message); | |
101 | + }); | |
45 | 102 | } |
46 | 103 | |
104 | + /** 查询商家--门店 */ | |
105 | + // function getShopList(param: any) { | |
106 | + // getRebateShop(param) | |
107 | + // .then((res) => { | |
108 | + // setShopList(res.data || []); | |
109 | + // }) | |
110 | + // .catch((e) => { | |
111 | + // message.error(e.message); | |
112 | + // }); | |
113 | + // } | |
114 | + | |
47 | 115 | function handSubmit(fieldsValue: any) { |
116 | + if (fieldsValue.costSharing && fieldsValue.costSharing.length) { | |
117 | + const costSharing = fieldsValue.costSharing; | |
118 | + const sum = costSharing.reduce((previousValue, currentValue) => { | |
119 | + return previousValue + currentValue.amount; | |
120 | + }, 0); | |
121 | + | |
122 | + if (sum !== fieldsValue.amount) { | |
123 | + message.error("分摊金额之和不等于扣款金额"); | |
124 | + return; | |
125 | + } | |
126 | + } | |
48 | 127 | const param: any = { |
128 | + ...fieldsValue, | |
49 | 129 | rebateId, |
50 | 130 | rewardsType, |
51 | - dealerId: fieldsValue.dealerId.value, | |
52 | - dealerName: fieldsValue.dealerId.label, | |
53 | - rewardsId: fieldsValue.rewardsId.value, | |
54 | - rewardsName: fieldsValue.rewardsId.label, | |
55 | - amount: fieldsValue.amount | |
131 | + actualRebateAmount: fieldsValue.amount, | |
56 | 132 | }; |
133 | + if (dimension === 5) { | |
134 | + param.rewardsId = fieldsValue.rewardsSelectType.value; | |
135 | + param.rewardsName = fieldsValue.rewardsSelectType.label; | |
136 | + } | |
137 | + // 厂家促销==》负激励 | |
138 | + if (dimension === 4) { | |
139 | + param.promotionId = currentItem.promotionId; | |
140 | + } | |
57 | 141 | setSaveLoading(true); |
58 | - saveRewardsListApi(param).then(() => { | |
59 | - message.success('操作成功'); | |
60 | - setSaveLoading(false); | |
61 | - fetchList && fetchList(); | |
62 | - onCancel && onCancel(); | |
63 | - }).catch(e => { | |
64 | - message.error(e.message); | |
65 | - setSaveLoading(false); | |
66 | - }); | |
142 | + | |
143 | + currentApi[dimension](param) | |
144 | + .then(() => { | |
145 | + message.success("操作成功"); | |
146 | + setSaveLoading(false); | |
147 | + fetchList && fetchList(); | |
148 | + onCancel && onCancel(); | |
149 | + }) | |
150 | + .catch((e) => { | |
151 | + message.error(e.message); | |
152 | + setSaveLoading(false); | |
153 | + }); | |
67 | 154 | } |
68 | 155 | |
156 | + // 选择商家 | |
157 | + const _onSelect = (values: any[]) => { | |
158 | + if (values.length) { | |
159 | + const res = values.map((i) => ({ | |
160 | + dealerName: i.label, | |
161 | + dealerId: i.value, | |
162 | + key: i.value, | |
163 | + amount: 0, | |
164 | + ratio: 0, | |
165 | + rewardBelong: 1, | |
166 | + })); | |
167 | + setSelectedDealerList([...res]); | |
168 | + | |
169 | + return; | |
170 | + } | |
171 | + setSelectedDealerList([]); | |
172 | + }; | |
69 | 173 | return ( |
70 | 174 | <Modal |
71 | - title={`新增${RewardsType[rewardsType]}`} | |
175 | + title={ | |
176 | + dimension === 5 && rewardsType | |
177 | + ? `${currentItem.id ? "设置" : "新增"} ${RewardsType[rewardsType]}` | |
178 | + : `${currentItem.id ? "设置" : "新增"}负激励` | |
179 | + } | |
72 | 180 | visible={visible} |
73 | 181 | maskClosable={false} |
74 | 182 | confirmLoading={saveLoading} |
75 | - afterClose={form.resetFields} | |
183 | + afterClose={() => { | |
184 | + form.resetFields(); | |
185 | + setSelectedDealerList([]); | |
186 | + }} | |
76 | 187 | onCancel={() => onCancel()} |
77 | 188 | onOk={form.submit} |
189 | + width={800} | |
190 | + footer={ | |
191 | + readOnly | |
192 | + ? null | |
193 | + : [ | |
194 | + <Button key="back" onClick={() => onCancel()}> | |
195 | + 取消 | |
196 | + </Button>, | |
197 | + <Button key="submit" type="primary" onClick={form.submit}> | |
198 | + 确定 | |
199 | + </Button>, | |
200 | + ] | |
201 | + } | |
78 | 202 | > |
79 | - <Spin spinning={loading}> | |
203 | + <Spin spinning={dimension === 4 ? false : loading}> | |
80 | 204 | <Form |
81 | 205 | form={form} |
82 | 206 | labelCol={{ span: 5 }} |
83 | 207 | wrapperCol={{ span: 15 }} |
84 | 208 | onFinish={handSubmit} |
85 | 209 | > |
86 | - <Form.Item name="dealerId" label="商家" rules={[{ required: true, message: "请选择商家" }]}> | |
87 | - <Select placeholder="选择商家" labelInValue> | |
88 | - {dealerList.map(item => (<Option value={item.dealerId} key={item.dealerId}>{item.dealerName}</Option>))} | |
89 | - </Select> | |
210 | + {dimension === 5 && ( | |
211 | + <Form.Item | |
212 | + name="rewardsSelectType" | |
213 | + label="折让类型" | |
214 | + rules={[{ required: true, message: "请选择折让类型" }]} | |
215 | + > | |
216 | + <Select placeholder="请选择" labelInValue> | |
217 | + {rewardsList.map((item) => ( | |
218 | + <Option value={item.id} key={item.id}> | |
219 | + {item.name} | |
220 | + </Option> | |
221 | + ))} | |
222 | + </Select> | |
223 | + </Form.Item> | |
224 | + )} | |
225 | + | |
226 | + <Form.Item | |
227 | + label={ | |
228 | + dimension === 5 | |
229 | + ? ` ${RewardsType[rewardsType]}金额` | |
230 | + : `负激励金额` | |
231 | + } | |
232 | + required | |
233 | + > | |
234 | + <Form.Item | |
235 | + noStyle | |
236 | + name="amount" | |
237 | + rules={[ | |
238 | + { required: true, message: "请输入" }, | |
239 | + { pattern: /^[1-9]*[1-9][0-9]*$/, message: "金额必须大于0" }, | |
240 | + ]} | |
241 | + > | |
242 | + <InputNumber | |
243 | + placeholder="请输入" | |
244 | + style={{ width: "90%" }} | |
245 | + onChange={(value: number) => setAmount(value)} | |
246 | + /> | |
247 | + </Form.Item> | |
248 | + <span style={{ paddingLeft: 10 }}>元</span> | |
90 | 249 | </Form.Item> |
91 | - <Form.Item name="rewardsId" label="款项" rules={[{ required: true, message: "请选择款项" }]}> | |
92 | - <Select placeholder="请选择" labelInValue> | |
93 | - {rewardsList.map(item => (<Option value={item.id} key={item.id}>{item.name}</Option>))} | |
250 | + <Form.Item | |
251 | + name="dealerId" | |
252 | + label="商家" | |
253 | + rules={[{ required: true, message: "请选择商家" }]} | |
254 | + > | |
255 | + <Select | |
256 | + placeholder="选择商家" | |
257 | + labelInValue | |
258 | + mode="multiple" | |
259 | + onChange={(values) => { | |
260 | + const amount = form.getFieldValue("amount"); | |
261 | + if (typeof amount !== "number") { | |
262 | + message.error("请先输入金额"); | |
263 | + form.setFieldsValue({ dealerId: [] }); | |
264 | + return; | |
265 | + } | |
266 | + _onSelect(values); | |
267 | + }} | |
268 | + > | |
269 | + {dealerList.map((item) => ( | |
270 | + <Option value={item.dealerId} key={item.dealerId}> | |
271 | + {item.dealerName} | |
272 | + </Option> | |
273 | + ))} | |
94 | 274 | </Select> |
95 | 275 | </Form.Item> |
96 | - <Form.Item label={`${RewardsType[rewardsType]}金额`} required> | |
97 | - <Form.Item noStyle name="amount" rules={[{ required: true, message: "请输入" }]}> | |
98 | - <InputNumber placeholder="请输入" style={{ width: '90%' }} /> | |
99 | - </Form.Item> | |
100 | - <span style={{ paddingLeft: 10 }}>元</span> | |
276 | + {/* <Form.Item | |
277 | + name="shopId" | |
278 | + label="门店" | |
279 | + rules={[{ required: true, message: "请选择门店" }]} | |
280 | + > | |
281 | + <Select | |
282 | + placeholder="请选择" | |
283 | + labelInValue | |
284 | + mode="multiple" | |
285 | + onChange={(values) => { | |
286 | + const amount = form.getFieldValue("amount"); | |
287 | + if (typeof amount !== "number") { | |
288 | + message.error("请先输入金额"); | |
289 | + return; | |
290 | + } | |
291 | + _onSelect(values); | |
292 | + }} | |
293 | + > | |
294 | + {shopList.map((item) => ( | |
295 | + <Option value={item.shopId} key={item.shopId}> | |
296 | + {item.shopName} | |
297 | + </Option> | |
298 | + ))} | |
299 | + </Select> | |
300 | + </Form.Item> */} | |
301 | + <Form.Item name="costSharing" label="分摊"> | |
302 | + <EditableTable | |
303 | + tableDataSource={selesctedDealerList} | |
304 | + amount={amount} | |
305 | + /> | |
101 | 306 | </Form.Item> |
102 | 307 | </Form> |
103 | 308 | </Spin> | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/BehalfMoney.tsx
0 → 100644
1 | +import React, { useEffect, useState } from "react"; | |
2 | +import { | |
3 | + Button, | |
4 | + Modal, | |
5 | + Form, | |
6 | + Select, | |
7 | + InputNumber, | |
8 | + Radio, | |
9 | + message, | |
10 | + Spin, | |
11 | + Input, | |
12 | +} from "antd"; | |
13 | +import { | |
14 | + getOrderDetail, | |
15 | + saveDiffApi, | |
16 | + saveSubsidyDiffApi, | |
17 | +} from "../Manufacturer/api"; | |
18 | +import { useStore } from "../index"; | |
19 | +import _ from "lodash"; | |
20 | +import useInitail from "@/hooks/useInitail"; | |
21 | +import moment from "moment"; | |
22 | + | |
23 | +const { TextArea } = Input; | |
24 | +const Option = Select.Option; | |
25 | +interface Props { | |
26 | + visible: boolean; | |
27 | + onCancel: Function; | |
28 | + // eslint-disable-next-line react/require-default-props | |
29 | + orderId?: number; | |
30 | + fetchList: () => any; | |
31 | +} | |
32 | + | |
33 | +export default function CreateModal(props: Props) { | |
34 | + const [form] = Form.useForm(); | |
35 | + const { visible, onCancel, fetchList, orderId } = props; | |
36 | + // differenceItem, | |
37 | + const { | |
38 | + reasonList, | |
39 | + commonOrderDetail, | |
40 | + currentItem, | |
41 | + commonSaveDiffApi, | |
42 | + differenceItem, | |
43 | + setDifferencetItem, | |
44 | + rebateId, | |
45 | + } = useStore(); | |
46 | + | |
47 | + const [saveLoading, setSaveLoading] = useState(false); | |
48 | + | |
49 | + // function handSubmit(fieldsValue: any) { | |
50 | + // const param: any = { | |
51 | + // orderId, | |
52 | + // actualRebateAmount: fieldsValue.actualRebateAmount, | |
53 | + // reason: | |
54 | + // fieldsValue.type && fieldsValue.type === 1 | |
55 | + // ? fieldsValue.writeReason | |
56 | + // : fieldsValue.reason && fieldsValue.reason.label, | |
57 | + // }; | |
58 | + // setSaveLoading(true); | |
59 | + // const api = commonSaveDiffApi[currentItem.rebateFundsType]; | |
60 | + // api(param) | |
61 | + // .then(() => { | |
62 | + // message.success("操作成功"); | |
63 | + // setSaveLoading(false); | |
64 | + // fetchList && fetchList(); | |
65 | + // onCancel && onCancel(); | |
66 | + // setData({}); | |
67 | + // }) | |
68 | + // .catch((e) => { | |
69 | + // message.error(e.message); | |
70 | + // setSaveLoading(false); | |
71 | + // }); | |
72 | + // } | |
73 | + | |
74 | + function handSubmit(fieldsValue: any) { | |
75 | + const param: any = { | |
76 | + rebateId, | |
77 | + orderId: differenceItem.id, | |
78 | + actualRebateAmount: fieldsValue.actualRebateAmount, | |
79 | + reason: | |
80 | + fieldsValue.type && fieldsValue.type === 1 | |
81 | + ? fieldsValue.writeReason | |
82 | + : fieldsValue.reason && fieldsValue.reason.label, | |
83 | + subsidyType: currentItem.subsidyType, | |
84 | + }; | |
85 | + setSaveLoading(true); | |
86 | + saveSubsidyDiffApi(param) | |
87 | + .then(() => { | |
88 | + message.success("操作成功"); | |
89 | + setSaveLoading(false); | |
90 | + fetchList && fetchList(); | |
91 | + onCancel && onCancel(); | |
92 | + setDifferencetItem({}); | |
93 | + }) | |
94 | + .catch((e) => { | |
95 | + message.error(e.message); | |
96 | + setSaveLoading(false); | |
97 | + }); | |
98 | + } | |
99 | + | |
100 | + useEffect(() => { | |
101 | + if (visible) { | |
102 | + form.setFieldsValue({ | |
103 | + ...differenceItem, | |
104 | + }); | |
105 | + } | |
106 | + }, [visible]); | |
107 | + | |
108 | + return ( | |
109 | + <Modal | |
110 | + title="确认折让差异" | |
111 | + visible={visible} | |
112 | + maskClosable={false} | |
113 | + confirmLoading={saveLoading} | |
114 | + afterClose={form.resetFields} | |
115 | + onCancel={() => onCancel()} | |
116 | + footer={[ | |
117 | + <Button key="2" type="primary" onClick={form.submit}> | |
118 | + 确认差异 | |
119 | + </Button>, | |
120 | + ]} | |
121 | + > | |
122 | + <Form | |
123 | + form={form} | |
124 | + labelCol={{ span: 7 }} | |
125 | + wrapperCol={{ span: 18 }} | |
126 | + onFinish={handSubmit} | |
127 | + > | |
128 | + {differenceItem.realName && ( | |
129 | + <Form.Item label="客户" style={{ marginBottom: 0 }}> | |
130 | + {differenceItem.realName} | |
131 | + </Form.Item> | |
132 | + )} | |
133 | + <Form.Item label="车辆" style={{ marginBottom: 0 }}> | |
134 | + {differenceItem.materialName} | |
135 | + </Form.Item> | |
136 | + <Form.Item label="下零售时间" style={{ marginBottom: 0 }}> | |
137 | + {differenceItem.retailTime | |
138 | + ? moment(differenceItem.retailTime).format("YYYY-MM-DD HH:mm:ss") | |
139 | + : "-"} | |
140 | + </Form.Item> | |
141 | + <Form.Item label="下零售门店" style={{ marginBottom: 0 }}> | |
142 | + {differenceItem.retailShopName || "-"} | |
143 | + </Form.Item> | |
144 | + <Form.Item label="下零售商家" style={{ marginBottom: 0 }}> | |
145 | + {differenceItem.dealerName || "-"} | |
146 | + </Form.Item> | |
147 | + <div style={{ height: 30 }} /> | |
148 | + <Form.Item label="零售终端补贴金额" required> | |
149 | + {differenceItem.saleSubsidyAmount}元 | |
150 | + </Form.Item> | |
151 | + <Form.Item label="应折让金额" required> | |
152 | + {differenceItem.rebateAmount}元 | |
153 | + </Form.Item> | |
154 | + <Form.Item label="实际折让金额" required> | |
155 | + <Form.Item | |
156 | + noStyle | |
157 | + name="actualRebateAmount" | |
158 | + rules={[{ required: true, message: "请输入" }]} | |
159 | + > | |
160 | + <InputNumber placeholder="请输入" style={{ width: "60%" }} /> | |
161 | + </Form.Item> | |
162 | + <span style={{ paddingLeft: 10 }}>元</span> | |
163 | + </Form.Item> | |
164 | + <Form.Item name="type" label="原因"> | |
165 | + <Radio.Group> | |
166 | + <Radio value={1}>输入原因</Radio> | |
167 | + <Radio value={2}>选择原因</Radio> | |
168 | + </Radio.Group> | |
169 | + </Form.Item> | |
170 | + | |
171 | + <Form.Item | |
172 | + noStyle | |
173 | + shouldUpdate={(prevValues, currentValues) => | |
174 | + prevValues.type != currentValues.type | |
175 | + } | |
176 | + > | |
177 | + {({ getFieldValue }): any => { | |
178 | + return getFieldValue("type") == 1 ? ( | |
179 | + <Form.Item | |
180 | + name="writeReason" | |
181 | + style={{ marginLeft: 130 }} | |
182 | + rules={[{ required: true, message: "请填写原因" }]} | |
183 | + > | |
184 | + <TextArea | |
185 | + allowClear | |
186 | + placeholder="请输入" | |
187 | + rows={2} | |
188 | + style={{ width: "100%" }} | |
189 | + /> | |
190 | + </Form.Item> | |
191 | + ) : getFieldValue("type") == 2 ? ( | |
192 | + <Form.Item | |
193 | + name="reason" | |
194 | + style={{ marginLeft: 130 }} | |
195 | + rules={[{ required: true, message: "请选择原因" }]} | |
196 | + > | |
197 | + <Select placeholder="选择原因" labelInValue> | |
198 | + {reasonList.map((item) => ( | |
199 | + <Option value={item.id} key={item.id}> | |
200 | + {item.name} | |
201 | + </Option> | |
202 | + ))} | |
203 | + </Select> | |
204 | + </Form.Item> | |
205 | + ) : null; | |
206 | + }} | |
207 | + </Form.Item> | |
208 | + </Form> | |
209 | + </Modal> | |
210 | + ); | |
211 | +} | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/ComfirmDiffModal.tsx
0 → 100644
1 | +import React, { useEffect, useState } from "react"; | |
2 | +import { | |
3 | + Button, | |
4 | + Modal, | |
5 | + Form, | |
6 | + Select, | |
7 | + InputNumber, | |
8 | + Radio, | |
9 | + message, | |
10 | + Spin, | |
11 | + Input, | |
12 | +} from "antd"; | |
13 | +import { | |
14 | + getOrderDetail, | |
15 | + saveDiffApi, | |
16 | + saveSubsidyDiffApi, | |
17 | +} from "../Manufacturer/api"; | |
18 | +import { useStore } from "../index"; | |
19 | +import _ from "lodash"; | |
20 | +import useInitail from "@/hooks/useInitail"; | |
21 | +import moment from "moment"; | |
22 | + | |
23 | +const { TextArea } = Input; | |
24 | +const Option = Select.Option; | |
25 | +interface Props { | |
26 | + visible: boolean; | |
27 | + onCancel: Function; | |
28 | + // eslint-disable-next-line react/require-default-props | |
29 | + orderId?: number; | |
30 | + fetchList: () => any; | |
31 | +} | |
32 | + | |
33 | +function ComfirmDiffModal(props: Props) { | |
34 | + const [form] = Form.useForm(); | |
35 | + const { visible, onCancel, fetchList, orderId } = props; | |
36 | + // differenceItem, | |
37 | + const { | |
38 | + reasonList, | |
39 | + currentItem, | |
40 | + commonSaveDiffApi, | |
41 | + differenceItem, | |
42 | + setDifferencetItem, | |
43 | + rebateId, | |
44 | + } = useStore(); | |
45 | + | |
46 | + const [saveLoading, setSaveLoading] = useState(false); | |
47 | + | |
48 | + function handSubmit(fieldsValue: any) { | |
49 | + const param: any = { | |
50 | + rebateId, | |
51 | + orderId: differenceItem.id, | |
52 | + promotionId: currentItem.promotionId, | |
53 | + actualRebateAmount: fieldsValue.actualRebateAmount, | |
54 | + reason: | |
55 | + fieldsValue.type && fieldsValue.type === 1 | |
56 | + ? fieldsValue.writeReason | |
57 | + : fieldsValue.reason && fieldsValue.reason.label, | |
58 | + subsidyType: currentItem.subsidyType, | |
59 | + }; | |
60 | + setSaveLoading(true); | |
61 | + const api = commonSaveDiffApi[currentItem.dimension]; | |
62 | + api(param).then(() => { | |
63 | + message.success("操作成功"); | |
64 | + setSaveLoading(false); | |
65 | + fetchList && fetchList(); | |
66 | + onCancel && onCancel(); | |
67 | + setDifferencetItem({}); | |
68 | + }).catch((e) => { | |
69 | + message.error(e.message); | |
70 | + setSaveLoading(false); | |
71 | + }); | |
72 | + } | |
73 | + | |
74 | + useEffect(() => { | |
75 | + if (visible) { | |
76 | + form.setFieldsValue({ | |
77 | + ...differenceItem, | |
78 | + type: 1, | |
79 | + writeReason: differenceItem.reason, | |
80 | + reason: undefined, | |
81 | + }); | |
82 | + } | |
83 | + }, [visible]); | |
84 | + | |
85 | + return ( | |
86 | + <Modal | |
87 | + title="确认折让差异" | |
88 | + visible={visible} | |
89 | + maskClosable={false} | |
90 | + confirmLoading={saveLoading} | |
91 | + afterClose={form.resetFields} | |
92 | + onCancel={() => onCancel()} | |
93 | + footer={[ | |
94 | + <Button key="2" type="primary" onClick={form.submit}> | |
95 | + 确认差异 | |
96 | + </Button>, | |
97 | + ]} | |
98 | + > | |
99 | + <Form | |
100 | + form={form} | |
101 | + labelCol={{ span: 7 }} | |
102 | + wrapperCol={{ span: 18 }} | |
103 | + onFinish={handSubmit} | |
104 | + > | |
105 | + {differenceItem.realName && ( | |
106 | + <Form.Item label="客户" style={{ marginBottom: 0 }}> | |
107 | + {differenceItem.realName} | |
108 | + </Form.Item> | |
109 | + )} | |
110 | + <Form.Item label="车辆" style={{ marginBottom: 0 }}> | |
111 | + {differenceItem.materialName} | |
112 | + </Form.Item> | |
113 | + <Form.Item label="下零售时间" style={{ marginBottom: 0 }}> | |
114 | + {differenceItem.retailTime | |
115 | + ? moment(differenceItem.retailTime).format("YYYY-MM-DD HH:mm:ss") | |
116 | + : "-"} | |
117 | + </Form.Item> | |
118 | + <Form.Item label="下零售门店" style={{ marginBottom: 0 }}> | |
119 | + {differenceItem.retailShopName || "-"} | |
120 | + </Form.Item> | |
121 | + <Form.Item label="下零售商家" style={{ marginBottom: 0 }}> | |
122 | + {differenceItem.dealerName || "-"} | |
123 | + </Form.Item> | |
124 | + <div style={{ height: 30 }} /> | |
125 | + {differenceItem.saleSubsidyAmount != null && ( | |
126 | + <Form.Item label="零售终端补贴金额" required> | |
127 | + {differenceItem.saleSubsidyAmount || 0}元 | |
128 | + </Form.Item> | |
129 | + )} | |
130 | + <Form.Item label="应折让金额" required> | |
131 | + {differenceItem.rebateAmount}元 | |
132 | + </Form.Item> | |
133 | + <Form.Item label="实际折让金额" required> | |
134 | + <Form.Item | |
135 | + noStyle | |
136 | + name="actualRebateAmount" | |
137 | + rules={[{ required: true, message: "请输入" }]} | |
138 | + > | |
139 | + <InputNumber placeholder="请输入" style={{ width: "60%" }} /> | |
140 | + </Form.Item> | |
141 | + <span style={{ paddingLeft: 10 }}>元</span> | |
142 | + </Form.Item> | |
143 | + <Form.Item name="type" label="原因" required> | |
144 | + <Radio.Group> | |
145 | + <Radio value={1}>输入原因</Radio> | |
146 | + <Radio value={2}>选择原因</Radio> | |
147 | + </Radio.Group> | |
148 | + </Form.Item> | |
149 | + | |
150 | + <Form.Item | |
151 | + noStyle | |
152 | + shouldUpdate={(prevValues, currentValues) => | |
153 | + prevValues.type != currentValues.type | |
154 | + } | |
155 | + > | |
156 | + {({ getFieldValue }): any => { | |
157 | + return getFieldValue("type") == 1 ? ( | |
158 | + <Form.Item | |
159 | + name="writeReason" | |
160 | + style={{ marginLeft: 130 }} | |
161 | + rules={[{ required: true, message: "请填写原因" }]} | |
162 | + > | |
163 | + <TextArea | |
164 | + allowClear | |
165 | + placeholder="请输入" | |
166 | + rows={2} | |
167 | + style={{ width: "100%" }} | |
168 | + /> | |
169 | + </Form.Item> | |
170 | + ) : getFieldValue("type") == 2 ? ( | |
171 | + <Form.Item | |
172 | + name="reason" | |
173 | + style={{ marginLeft: 130 }} | |
174 | + rules={[{ required: true, message: "请选择原因" }]} | |
175 | + > | |
176 | + <Select placeholder="选择原因" labelInValue> | |
177 | + {reasonList.map((item) => ( | |
178 | + <Option value={item.id} key={item.id}> | |
179 | + {item.name} | |
180 | + </Option> | |
181 | + ))} | |
182 | + </Select> | |
183 | + </Form.Item> | |
184 | + ) : null; | |
185 | + }} | |
186 | + </Form.Item> | |
187 | + </Form> | |
188 | + </Modal> | |
189 | + ); | |
190 | +} | |
191 | + | |
192 | +export default React.memo(ComfirmDiffModal); | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/EditTable.tsx
0 → 100644
1 | +import React, { useState, useEffect } from "react"; | |
2 | +import { Table, Input, InputNumber, Popconfirm, Form, Typography } from "antd"; | |
3 | +import { useStore } from "../index"; | |
4 | + | |
5 | +interface Item { | |
6 | + key: string; | |
7 | + shopId: number; | |
8 | + shopName: string; | |
9 | + amount: number; | |
10 | + ratio: number; | |
11 | + rewardBelong: number; | |
12 | +} | |
13 | + | |
14 | +interface EditableCellProps extends React.HTMLAttributes<HTMLElement> { | |
15 | + editing: boolean; | |
16 | + dataIndex: string; | |
17 | + title: any; | |
18 | + inputType: "number" | "text"; | |
19 | + record: Item; | |
20 | + index: number; | |
21 | + children: React.ReactNode; | |
22 | +} | |
23 | + | |
24 | +const EditableCell: React.FC<EditableCellProps> = ({ | |
25 | + editing, | |
26 | + dataIndex, | |
27 | + title, | |
28 | + inputType, | |
29 | + record, | |
30 | + index, | |
31 | + children, | |
32 | + ...restProps | |
33 | +}) => { | |
34 | + const inputNode = inputType === "number" ? <InputNumber /> : <Input />; | |
35 | + | |
36 | + return ( | |
37 | + <td {...restProps}> | |
38 | + {editing ? ( | |
39 | + <Form.Item | |
40 | + name={dataIndex} | |
41 | + style={{ margin: 0 }} | |
42 | + rules={[ | |
43 | + { | |
44 | + required: true, | |
45 | + message: `请输入 ${title}!`, | |
46 | + }, | |
47 | + ]} | |
48 | + > | |
49 | + {inputNode} | |
50 | + </Form.Item> | |
51 | + ) : ( | |
52 | + children | |
53 | + )} | |
54 | + </td> | |
55 | + ); | |
56 | +}; | |
57 | + | |
58 | +interface Props { | |
59 | + tableDataSource: any[]; | |
60 | + // 扣款金额 | |
61 | + amount: number; | |
62 | + value?: any[]; | |
63 | + onChange?: () => void; | |
64 | +} | |
65 | +const EditableTable = ({ tableDataSource, amount, onChange, value }: Props) => { | |
66 | + const { readOnly } = useStore(); | |
67 | + const [form] = Form.useForm(); | |
68 | + const [data, setData] = useState(tableDataSource || []); | |
69 | + const [editingKey, setEditingKey] = useState(""); | |
70 | + | |
71 | + const isEditing = (record: Item) => record.key === editingKey; | |
72 | + | |
73 | + const edit = (record: Partial<Item> & { key: React.Key }) => { | |
74 | + form.setFieldsValue({ ratio: "", ...record }); | |
75 | + setEditingKey(record.key); | |
76 | + }; | |
77 | + | |
78 | + const cancel = () => { | |
79 | + setEditingKey(""); | |
80 | + }; | |
81 | + | |
82 | + useEffect(() => { | |
83 | + setData([...tableDataSource]); | |
84 | + }, [tableDataSource]); | |
85 | + const save = async (key: React.Key) => { | |
86 | + try { | |
87 | + const row = (await form.validateFields()) as Item; | |
88 | + const { ratio } = row; | |
89 | + const money = (amount * ratio) / 100; | |
90 | + | |
91 | + const newData = [...data]; | |
92 | + const index = newData.findIndex((item) => key === item.key); | |
93 | + if (index > -1) { | |
94 | + const item = newData[index]; | |
95 | + newData.splice(index, 1, { | |
96 | + ...item, | |
97 | + ...row, | |
98 | + amount: money, | |
99 | + }); | |
100 | + setData(newData); | |
101 | + setEditingKey(""); | |
102 | + } else { | |
103 | + newData.push(row); | |
104 | + setData(newData); | |
105 | + setEditingKey(""); | |
106 | + } | |
107 | + onChange && onChange(newData); | |
108 | + } catch (errInfo) { | |
109 | + console.log("Validate Failed:", errInfo); | |
110 | + } | |
111 | + }; | |
112 | + | |
113 | + const columns = [ | |
114 | + { | |
115 | + title: "商家", | |
116 | + dataIndex: "dealerName", | |
117 | + width: "30%", | |
118 | + }, | |
119 | + { | |
120 | + title: "分摊金额", | |
121 | + dataIndex: "amount", | |
122 | + width: "25%", | |
123 | + }, | |
124 | + { | |
125 | + title: "分摊比例(%)", | |
126 | + dataIndex: "ratio", | |
127 | + width: "20%", | |
128 | + editable: true, | |
129 | + }, | |
130 | + { | |
131 | + title: "操作", | |
132 | + dataIndex: "operation", | |
133 | + width: "25%", | |
134 | + render: (_: any, record: Item) => { | |
135 | + const editable = isEditing(record); | |
136 | + return editable ? ( | |
137 | + <span> | |
138 | + <Typography.Link | |
139 | + onClick={() => save(record.key)} | |
140 | + style={{ marginRight: 8 }} | |
141 | + > | |
142 | + 保存 | |
143 | + </Typography.Link> | |
144 | + <Popconfirm title="确定取消?" onConfirm={cancel}> | |
145 | + <a>取消</a> | |
146 | + </Popconfirm> | |
147 | + </span> | |
148 | + ) : ( | |
149 | + <Typography.Link | |
150 | + disabled={editingKey !== ""} | |
151 | + onClick={() => edit(record)} | |
152 | + > | |
153 | + 编辑 | |
154 | + </Typography.Link> | |
155 | + ); | |
156 | + }, | |
157 | + }, | |
158 | + ]; | |
159 | + | |
160 | + const getColumns = () => { | |
161 | + if (readOnly) { | |
162 | + columns.pop(); | |
163 | + } | |
164 | + return columns; | |
165 | + }; | |
166 | + const mergedColumns = getColumns().map((col) => { | |
167 | + if (!col.editable) { | |
168 | + return col; | |
169 | + } | |
170 | + return { | |
171 | + ...col, | |
172 | + onCell: (record: Item) => ({ | |
173 | + record, | |
174 | + inputType: "number", | |
175 | + dataIndex: col.dataIndex, | |
176 | + title: col.title, | |
177 | + editing: isEditing(record), | |
178 | + }), | |
179 | + }; | |
180 | + }); | |
181 | + | |
182 | + return ( | |
183 | + <Form form={form} component={false}> | |
184 | + <Table | |
185 | + components={{ | |
186 | + body: { | |
187 | + cell: EditableCell, | |
188 | + }, | |
189 | + }} | |
190 | + rowKey={(_, record) => `id_${record.key}`} | |
191 | + bordered | |
192 | + dataSource={data} | |
193 | + columns={mergedColumns} | |
194 | + rowClassName="editable-row" | |
195 | + pagination={{ | |
196 | + onChange: cancel, | |
197 | + }} | |
198 | + /> | |
199 | + </Form> | |
200 | + ); | |
201 | +}; | |
202 | + | |
203 | +export default EditableTable; | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/PromotionConfig.tsx
1 | 1 | import React, { useState } from "react"; |
2 | -import { Table, Row, message, Modal, InputNumber, Input } from 'antd'; | |
3 | -import { savePromotionApi } from '../api'; | |
4 | -import { useStore } from '../index'; | |
5 | -import { debounce } from 'lodash'; | |
2 | +import { | |
3 | + Table, | |
4 | + Row, | |
5 | + message, | |
6 | + Modal, | |
7 | + InputNumber, | |
8 | + Input, | |
9 | + Card, | |
10 | + Space, | |
11 | + Divider, | |
12 | + Button, | |
13 | +} from "antd"; | |
14 | +import { savePromotionApi } from "../api"; | |
15 | +import { useStore } from "../index"; | |
16 | +import { debounce } from "lodash"; | |
17 | +import WaitConfirmList from "./WaitConfirmList"; | |
18 | +import { getRemoveCheckListApi, savePromotionNegativeApi } from "@/pages/stock/AllowanceConfirm/EditComfirm/Manufacturer/api"; | |
19 | +import AddRewardsModal from "@/pages/stock/AllowanceConfirm/EditComfirm/components/AddRewardsModal"; | |
20 | +import { AwardTypeEnum, SubjectTypeEnum } from "@/pages/stock/AllowanceConfirm/entity"; | |
6 | 21 | |
7 | 22 | const { Column } = Table; |
8 | 23 | interface Props { |
24 | + dimension: number; | |
9 | 25 | } |
26 | + | |
10 | 27 | export default function PromotionConfig(props: Props) { |
11 | - const { data, setVisible, setCurrentItem, setLoading, loading } = useStore(); | |
12 | - const [size, setSize] = useState(10); | |
28 | + const { dimension } = props; | |
29 | + const { | |
30 | + readOnly, | |
31 | + data, | |
32 | + setVisible, | |
33 | + setCurrentItem, | |
34 | + setLoading, | |
35 | + loading, | |
36 | + promotionReward, | |
37 | + discountPromotion, | |
38 | + setDiscountLoading, | |
39 | + setRewardParams, | |
40 | + setDiscountParams, | |
41 | + RewardPagination, //正激励 | |
42 | + DiscountPagination, //负激励 | |
43 | + rebateId, | |
44 | + } = useStore(); | |
45 | + const awardTypeEnum = { 1: promotionReward, 2: discountPromotion }; | |
46 | + const paginationTypeList = { 1: RewardPagination, 2: DiscountPagination }; | |
47 | + // 分摊编辑项 | |
48 | + const [discountItem, setDiscountItem] = useState({}); | |
49 | + /** 厂家促销选中移除清单项 */ | |
50 | + const [selectedRowKeys, setSelectedRowkeys] = useState<React.Key[]>([]); | |
51 | + const [modalVisible, setModalVisible] = useState(false); | |
13 | 52 | const [saveViseble, setSaveVissible] = useState(false); |
14 | 53 | const [saveLoading, setSaveLoading] = useState(false); |
15 | - const [saveItem, setSaveItem] = useState<FvmAllowance.PromotionVo>({} as FvmAllowance.PromotionVo); | |
16 | - const [searchData, setSearchData] = useState<FvmAllowance.PromotionVo[]>(); | |
54 | + const [saveItem, setSaveItem] = useState<FvmAllowance.PromotionVo>( | |
55 | + {} as FvmAllowance.PromotionVo | |
56 | + ); | |
57 | + const [activityVisible, setActivityVisible] = useState<boolean>(false); | |
58 | + const [awardType, setAwardType] = useState<number>(); | |
17 | 59 | |
60 | + /**保存促销负激励折让差异 */ | |
18 | 61 | function handSubmit() { |
19 | 62 | if (saveLoading) return; |
20 | 63 | const pa = { |
21 | - id: saveItem.id, | |
64 | + rebateId, | |
65 | + promotionId: saveItem.promotionId, | |
66 | + reason: saveItem.reason, | |
22 | 67 | actualRebateAmount: saveItem.actualRebateAmount, |
23 | 68 | }; |
24 | 69 | setSaveLoading(true); |
25 | - savePromotionApi(pa).then(res => { | |
26 | - setSaveLoading(false); | |
27 | - message.success("操作成功"); | |
28 | - setLoading(true); | |
29 | - setSaveLoading(false); | |
30 | - setSaveVissible(false); | |
31 | - }).catch(e => { | |
32 | - setSaveLoading(false); | |
33 | - message.error(e.message); | |
34 | - } | |
35 | - ); | |
70 | + savePromotionNegativeApi(pa) | |
71 | + .then((res) => { | |
72 | + setSaveLoading(false); | |
73 | + setDiscountLoading(true); | |
74 | + setSaveLoading(false); | |
75 | + setSaveVissible(false); | |
76 | + message.success("操作成功"); | |
77 | + }) | |
78 | + .catch((e) => { | |
79 | + setSaveLoading(false); | |
80 | + message.error(e.message); | |
81 | + }); | |
36 | 82 | } |
37 | 83 | |
38 | - function onShowSizeChange(current: number, pageSize: number) { | |
39 | - setSize(pageSize); | |
40 | - } | |
41 | - | |
42 | - const searchList = debounce(value => { | |
43 | - if (!value) return setSearchData(undefined); | |
44 | - const result = (data.promotionList || []).filter(i => i.promotionName.indexOf(value) >= 0); | |
45 | - setSearchData(result); | |
84 | + const searchList = debounce((value, awardType) => { | |
85 | + if (awardType === 1) { | |
86 | + setRewardParams({ supportName: value }, true); | |
87 | + return; | |
88 | + } | |
89 | + setDiscountParams({ supportName: value }, true); | |
46 | 90 | }, 500); |
91 | + const onSelectChange = ( | |
92 | + selectedRowKeys: React.Key[], | |
93 | + selectedRows: FvmAllowance.WaitCheckListItems[] | |
94 | + ) => { | |
95 | + setSelectedRowkeys([...selectedRowKeys]); | |
96 | + }; | |
97 | + const rowSelection = { | |
98 | + selectedRowKeys, | |
99 | + onChange: onSelectChange, | |
100 | + }; | |
101 | + | |
102 | + const renderItem = (awardType: number) => { | |
103 | + return ( | |
104 | + <Card key={`promotion-${awardType}`} type="inner" style={{ marginBottom: 20 }}> | |
105 | + <div> | |
106 | + <Row style={{ marginBottom: 20 }} justify="space-between"> | |
107 | + <div> | |
108 | + <span style={{ color: "red", marginRight: 20 }}> | |
109 | + {`${AwardTypeEnum[awardType]}:`} | |
110 | + </span> | |
111 | + <Input.Search | |
112 | + placeholder="搜索促销名称" | |
113 | + style={{ width: 300 }} | |
114 | + allowClear | |
115 | + onChange={(v) => searchList(v.target.value, awardType)} | |
116 | + /> | |
117 | + </div> | |
118 | + <Button | |
119 | + type="primary" | |
120 | + onClick={() => { | |
121 | + setActivityVisible(true); | |
122 | + setAwardType(awardType); | |
123 | + }} | |
124 | + disabled={readOnly} | |
125 | + > | |
126 | + 选择待确认活动 | |
127 | + </Button> | |
128 | + </Row> | |
129 | + <p style={{ color: "#ffa39e" }}> | |
130 | + * 请确认全部厂家促销折让项,核对实际金额 | |
131 | + </p> | |
132 | + | |
133 | + <Table | |
134 | + dataSource={awardTypeEnum[awardType] || []} | |
135 | + rowSelection={rowSelection} | |
136 | + pagination={paginationTypeList[awardType]} | |
137 | + bordered | |
138 | + size="small" | |
139 | + rowKey="id" | |
140 | + loading={loading} | |
141 | + > | |
142 | + <Column title="促销名称" width="20%" dataIndex="fundsName" /> | |
143 | + <Column | |
144 | + title="考核类型" | |
145 | + width="10%" | |
146 | + dataIndex="subjectType" | |
147 | + render={(text: number) => text && SubjectTypeEnum[text]} | |
148 | + /> | |
149 | + | |
150 | + <Column | |
151 | + width="15%" | |
152 | + title="考核对象" | |
153 | + dataIndex="subjectConfigName" | |
154 | + /> | |
155 | + <Column | |
156 | + title="应折让金额(元)" | |
157 | + width="10%" | |
158 | + dataIndex="rebateAmount" | |
159 | + /> | |
160 | + <Column | |
161 | + title="实际折让金额(元)" | |
162 | + width="15%" | |
163 | + dataIndex="actualRebateAmount" | |
164 | + /> | |
165 | + {/* <Column | |
166 | + title="实际支持标准单价(元)" | |
167 | + width="10%" | |
168 | + dataIndex="actualSupportStandard" | |
169 | + /> */} | |
170 | + <Column | |
171 | + title="附件" | |
172 | + width="10%" | |
173 | + dataIndex="promotionFid" | |
174 | + render={(text) => (text ? ( | |
175 | + <a | |
176 | + title="点击下载文档" | |
177 | + target="_blank" | |
178 | + rel="noreferrer" | |
179 | + href={`/api/file/show?fid=${text}`} | |
180 | + > | |
181 | + 查看 | |
182 | + </a> | |
183 | + ) : ( | |
184 | + "--" | |
185 | + ))} | |
186 | + /> | |
187 | + <Column | |
188 | + width="10%" | |
189 | + title={awardType === 1 ? "符合条件车辆" : "操作"} | |
190 | + render={ | |
191 | + (_, record: FvmAllowance.PromotionVo) => (awardType === 1 ? ( | |
192 | + <a | |
193 | + onClick={() => { | |
194 | + setVisible(true); | |
195 | + setCurrentItem({ | |
196 | + ...record, | |
197 | + dimension, | |
198 | + }); | |
199 | + }} | |
200 | + > | |
201 | + {`${readOnly ? "查看" : "确认"}清单`} | |
202 | + </a> | |
203 | + ) : record.subjectType === 1 ? ( | |
204 | + <a onClick={() => onEdit(record)}> | |
205 | + {readOnly ? "查看" : "折让分摊"} | |
206 | + </a> | |
207 | + ) : ( | |
208 | + <a onClick={() => { setSaveItem(record); setSaveVissible(true); }}> | |
209 | + {readOnly ? "查看" : "确认折让差异"} | |
210 | + </a> | |
211 | + )) | |
212 | + } | |
213 | + /> | |
214 | + {/* <Column | |
215 | + title="操作" | |
216 | + width="10%" | |
217 | + render={(text, record: FvmAllowance.PromotionVo) => ( | |
218 | + <> | |
219 | + <a | |
220 | + onClick={() => { | |
221 | + setVisible(true); | |
222 | + setCurrentItem({ | |
223 | + ...record, | |
224 | + status: 2, | |
225 | + }); | |
226 | + }} | |
227 | + > | |
228 | + {` 政策监控 >`} | |
229 | + </a> | |
230 | + {AwardTypeEnum[awardType] === "正激励" && ( | |
231 | + <Button | |
232 | + type="link" | |
233 | + style={{ padding: 0 }} | |
234 | + onClick={() => { setSaveVissible(true); setSaveItem(record); }} | |
235 | + > | |
236 | + 确认差异 | |
237 | + </Button> | |
238 | + )} | |
239 | + </> | |
240 | + )} | |
241 | + /> */} | |
242 | + </Table> | |
243 | + </div> | |
244 | + </Card> | |
245 | + ); | |
246 | + }; | |
247 | + // 配置 | |
248 | + const onEdit = (record: FvmAllowance.PromotionVo) => { | |
249 | + setModalVisible(true); | |
250 | + setDiscountItem({ ...record }); | |
251 | + }; | |
252 | + // 获取厂家促销列表 | |
253 | + const fetchPromotionList = () => { | |
254 | + setRewardParams({ rebateId, awardType: 1 }, true); | |
255 | + setDiscountParams({ rebateId, awardType: 2 }, true); | |
256 | + }; | |
257 | + | |
258 | + const removeList = async () => { | |
259 | + const { success, result } = await getRemoveCheckListApi({ | |
260 | + rebateId, | |
261 | + promotionIds: selectedRowKeys as number[], | |
262 | + }); | |
263 | + if (!success) { | |
264 | + return message.error(result, 5); | |
265 | + } | |
266 | + //重新渲染厂家促销列表 | |
267 | + setSelectedRowkeys([]); | |
268 | + fetchPromotionList(); | |
269 | + }; | |
47 | 270 | |
271 | + // 获取 负激励清单 | |
272 | + const fetchList = () => { | |
273 | + setDiscountParams({ rebateId, awardType: 2 }, true); | |
274 | + }; | |
48 | 275 | return ( |
49 | 276 | <> |
50 | - <Row style={{ marginBottom: 20 }}> | |
51 | - <Input.Search placeholder="搜索促销名称" style={{ width: 300 }} allowClear onChange={(v) => searchList(v.target.value)} /> | |
52 | - </Row> | |
53 | - <p style={{ color: '#ffa39e' }}>* 请确认全部厂家促销折让项,核对实际金额</p> | |
54 | - <Table | |
55 | - dataSource={searchData || (data.promotionList || [])} | |
56 | - pagination={{ showSizeChanger: true, total: (searchData || (data.promotionList || [])).length, pageSize: size, onShowSizeChange }} | |
57 | - bordered | |
58 | - size="small" | |
59 | - rowKey="id" | |
60 | - loading={loading} | |
277 | + <Card | |
278 | + extra={ | |
279 | + <Space split={<Divider type="vertical" />}> | |
280 | + <Button | |
281 | + type="primary" | |
282 | + disabled={!selectedRowKeys.length || readOnly} | |
283 | + onClick={() => { | |
284 | + removeList(); | |
285 | + }} | |
286 | + > | |
287 | + 移出清单 | |
288 | + </Button> | |
289 | + </Space> | |
290 | + } | |
61 | 291 | > |
62 | - <Column title="促销名称" width="30%" dataIndex="promotionName" /> | |
63 | - <Column title="考核对象" width="15%" dataIndex="assessName" /> | |
64 | - <Column title="激励类型" width="15%" dataIndex="awardType" render={(text) => (text === 1 ? "正激励" : "负激励")} /> | |
65 | - <Column title="预估金额(元)" dataIndex="rebateAmount" /> | |
66 | - <Column title="实际金额(元)" dataIndex="actualRebateAmount" /> | |
67 | - <Column title="附件" dataIndex="promotionFid" render={(text) => (text ? <a title="点击下载文档" target="_blank" rel="noreferrer" href={`/api/file/show?fid=${text}`}>查看</a> : '—')} /> | |
68 | - <Column | |
69 | - title="操作" | |
70 | - width={150} | |
71 | - render={(text, record: FvmAllowance.PromotionVo) => ( | |
72 | - <> | |
73 | - {data.status === 1 ? ( | |
74 | - <div> | |
75 | - <a onClick={() => { setSaveVissible(true); setSaveItem(record); }}>确认折让</a> | |
76 | - </div> | |
77 | - ) : null} | |
78 | - {record.awardType == 1 && (<a onClick={() => { setVisible(true); setCurrentItem({ ...record, rebateFundsType: 4, status: 2 }); }}>查看清单</a>)} | |
79 | - </> | |
80 | - )} | |
81 | - /> | |
82 | - </Table> | |
292 | + {[1, 2].map((i) => { | |
293 | + return renderItem(i); | |
294 | + })} | |
295 | + </Card> | |
296 | + {/* 负激励==》折让分摊 */} | |
297 | + <AddRewardsModal | |
298 | + dimension={4} | |
299 | + visible={modalVisible} | |
300 | + onCancel={() => { | |
301 | + setModalVisible(false); | |
302 | + setDiscountItem({}); | |
303 | + }} | |
304 | + currentItem={discountItem} | |
305 | + // rewardsType={rewardsType} | |
306 | + fetchList={() => { | |
307 | + fetchList(); | |
308 | + }} | |
309 | + /> | |
83 | 310 | <Modal |
84 | - title={<div style={{ marginRight: 80, color: '#666' }}>{`${saveItem.promotionName} ——实际金额确认`}</div>} | |
311 | + title={ | |
312 | + <div style={{ marginRight: 80, color: "#666" }}> | |
313 | + {/* {`${saveItem.fundsName} ——实际折让金额确认`} */} | |
314 | + 实际折让金额确认 | |
315 | + </div> | |
316 | + } | |
85 | 317 | centered |
86 | 318 | visible={saveViseble} |
87 | 319 | maskClosable={false} |
88 | 320 | confirmLoading={saveLoading} |
89 | - onCancel={() => { setSaveVissible(false); }} | |
321 | + onCancel={() => { | |
322 | + setSaveVissible(false); | |
323 | + }} | |
90 | 324 | onOk={handSubmit} |
91 | 325 | > |
92 | - <Row style={{ height: 100, alignItems: 'center' }}> | |
93 | - <span>折让实际金额:</span> | |
326 | + <div style={{ marginBottom: 15 }}>促销名称:{saveItem.fundsName}</div> | |
327 | + <Row style={{ alignItems: "center", marginBottom: 20 }}> | |
328 | + <span>实际折让金额(元):</span> | |
94 | 329 | <InputNumber |
95 | 330 | precision={2} |
96 | - style={{ width: '70%', marginRight: 10 }} | |
331 | + style={{ width: "60%" }} | |
97 | 332 | value={saveItem.actualRebateAmount} |
98 | - placeholder="输入折让实际金额(元)" | |
333 | + placeholder="输入折让实际金额" | |
99 | 334 | onChange={(v) => setSaveItem({ ...saveItem, actualRebateAmount: v })} |
100 | - /> 元 | |
335 | + /> | |
101 | 336 | </Row> |
337 | + <span style={{ marginLeft: 53 }}>差异原因:</span> | |
338 | + <Input style={{ width: "60%" }} placeholder="折让不足原因" onChange={(v) => setSaveItem({ ...saveItem, reason: v.target.value })} /> | |
102 | 339 | </Modal> |
340 | + {/* 厂家促销==》选择待确认活动 */} | |
341 | + <WaitConfirmList | |
342 | + visible={activityVisible} | |
343 | + awardType={awardType} | |
344 | + onCancel={() => setActivityVisible(false)} | |
345 | + onFinish={() => fetchPromotionList()} | |
346 | + /> | |
103 | 347 | </> |
104 | 348 | ); |
105 | 349 | } | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/SubidyColumn(old).tsx
0 → 100644
1 | +import moment from 'moment'; | |
2 | +import React from 'react'; | |
3 | +import { useStore } from '../index'; | |
4 | + | |
5 | +export default function SubidyColumn() { | |
6 | + const { setDetailVisible, setOrderId, currentItem } = useStore(); | |
7 | + const FactoryColumn = [ | |
8 | + { | |
9 | + title: "VIN", | |
10 | + dataIndex: "vin", | |
11 | + key: "vin", | |
12 | + width: "10%", | |
13 | + render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
14 | + }, | |
15 | + { | |
16 | + title: "车辆", | |
17 | + dataIndex: "materialName", | |
18 | + key: "materialName", | |
19 | + }, | |
20 | + { | |
21 | + title: "补贴类型", | |
22 | + dataIndex: "subsidyName", | |
23 | + key: "subsidyName" | |
24 | + }, | |
25 | + { | |
26 | + title: "应折让金额(元)", | |
27 | + dataIndex: "rebateAmount", | |
28 | + key: "rebateAmount", | |
29 | + }, | |
30 | + { | |
31 | + title: "实际折让金额(元)", | |
32 | + dataIndex: "actualRebateAmount", | |
33 | + key: "actualRebateAmount", | |
34 | + }, | |
35 | + { | |
36 | + title: "往来单位", | |
37 | + dataIndex: "factoryName", | |
38 | + key: "factoryName", | |
39 | + }, | |
40 | + { | |
41 | + title: "下零售门店", | |
42 | + dataIndex: "retailShopName", | |
43 | + key: "retailShopName", | |
44 | + }, | |
45 | + { | |
46 | + title: "下零售日期", | |
47 | + dataIndex: "retailTime", | |
48 | + key: "retailTime", | |
49 | + render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
50 | + }, | |
51 | + { | |
52 | + title: "操作", | |
53 | + width: "10%", | |
54 | + key: "options", | |
55 | + render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
56 | + <> | |
57 | + <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
58 | + </> | |
59 | + ) | |
60 | + } | |
61 | + ]; | |
62 | + /**厂家代收 */ | |
63 | + const CollectionColumn = [ | |
64 | + { | |
65 | + title: "VIN", | |
66 | + dataIndex: "vin", | |
67 | + key: "vin", | |
68 | + width: "10%", | |
69 | + render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
70 | + }, | |
71 | + { | |
72 | + title: "车辆", | |
73 | + dataIndex: "materialName", | |
74 | + key: "materialName", | |
75 | + }, | |
76 | + { | |
77 | + title: currentItem.rebateFundsType == 2 ? "厂家代收款名称" : "厂家直营车折让名称", | |
78 | + dataIndex: "subsidyName", | |
79 | + width: "10%" | |
80 | + }, | |
81 | + { | |
82 | + title: "应折让金额(元)", | |
83 | + dataIndex: "rebateAmount", | |
84 | + key: "rebateAmount", | |
85 | + }, | |
86 | + { | |
87 | + title: "实际折让金额(元)", | |
88 | + dataIndex: "actualRebateAmount", | |
89 | + key: "actualRebateAmount", | |
90 | + }, | |
91 | + { | |
92 | + title: "往来单位", | |
93 | + dataIndex: "factoryName", | |
94 | + key: "factoryName", | |
95 | + }, | |
96 | + { | |
97 | + title: "下零售门店", | |
98 | + dataIndex: "retailShopName", | |
99 | + key: "retailShopName", | |
100 | + }, | |
101 | + { | |
102 | + title: "下零售日期", | |
103 | + dataIndex: "retailTime", | |
104 | + key: "retailTime", | |
105 | + render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
106 | + }, | |
107 | + { | |
108 | + title: "操作", | |
109 | + width: "10%", | |
110 | + key: "options", | |
111 | + render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
112 | + <> | |
113 | + <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
114 | + </> | |
115 | + ) | |
116 | + } | |
117 | + ]; | |
118 | + const CashColumn = [ | |
119 | + { | |
120 | + title: "VIN", | |
121 | + dataIndex: "vin", | |
122 | + key: "vin", | |
123 | + width: "10%", | |
124 | + render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
125 | + }, | |
126 | + { | |
127 | + title: "车辆", | |
128 | + dataIndex: "materialName", | |
129 | + key: "materialName", | |
130 | + }, | |
131 | + { | |
132 | + title: "启票金额(元)", | |
133 | + dataIndex: "rebateAmount", | |
134 | + key: "rebateAmount", | |
135 | + }, | |
136 | + { | |
137 | + title: "现金启票奖励折让金额(元)", | |
138 | + dataIndex: "actualRebateAmount", | |
139 | + key: "actualRebateAmount", | |
140 | + }, | |
141 | + { | |
142 | + title: "往来单位", | |
143 | + dataIndex: "factoryName", | |
144 | + key: "factoryName", | |
145 | + }, | |
146 | + { | |
147 | + title: "下零售门店", | |
148 | + dataIndex: "retailShopName", | |
149 | + key: "retailShopName", | |
150 | + }, | |
151 | + { | |
152 | + title: "启票日期", | |
153 | + dataIndex: "ticketTime", | |
154 | + key: "ticketTime", | |
155 | + render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
156 | + }, | |
157 | + { | |
158 | + title: "操作", | |
159 | + width: "10%", | |
160 | + key: "options", | |
161 | + render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
162 | + <> | |
163 | + <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
164 | + </> | |
165 | + ) | |
166 | + } | |
167 | + ]; | |
168 | + /**厂家促销确认清单 */ | |
169 | + const PromotionColumn = [ | |
170 | + { | |
171 | + title: "VIN", | |
172 | + dataIndex: "vin", | |
173 | + key: "vin", | |
174 | + width: "10%", | |
175 | + render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
176 | + }, | |
177 | + { | |
178 | + title: "车辆", | |
179 | + dataIndex: "materialName", | |
180 | + key: "materialName", | |
181 | + }, | |
182 | + // { | |
183 | + // title: "折让类型", | |
184 | + // dataIndex: "subsidyName", | |
185 | + // key: "subsidyName" | |
186 | + // }, | |
187 | + // { | |
188 | + // title: "应折让金额(元)", | |
189 | + // dataIndex: "rebateAmount", | |
190 | + // key: "rebateAmount", | |
191 | + // }, | |
192 | + // { | |
193 | + // title: "实际折让金额(元)", | |
194 | + // dataIndex: "actualRebateAmount", | |
195 | + // key: "actualRebateAmount", | |
196 | + // }, | |
197 | + { | |
198 | + title: "往来单位", | |
199 | + dataIndex: "factoryName", | |
200 | + key: "factoryName", | |
201 | + }, | |
202 | + { | |
203 | + title: "下零售门店", | |
204 | + dataIndex: "retailShopName", | |
205 | + key: "retailShopName", | |
206 | + }, | |
207 | + { | |
208 | + title: "下零售时间", | |
209 | + dataIndex: "retailTime", | |
210 | + key: "retailTime", | |
211 | + render: (text: number) => moment(text).format("YYYY-MM-DD") | |
212 | + }, | |
213 | + { | |
214 | + title: "启票日期", | |
215 | + dataIndex: "ticketTime", | |
216 | + key: "ticketTime", | |
217 | + render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
218 | + }, | |
219 | + // { | |
220 | + // title: "操作", | |
221 | + // width: "10%", | |
222 | + // key: "options", | |
223 | + // render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
224 | + // <> | |
225 | + // <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
226 | + // </> | |
227 | + // ) | |
228 | + // } | |
229 | + ]; | |
230 | + if (currentItem.rebateFundsType == 1) { | |
231 | + return FactoryColumn; | |
232 | + } | |
233 | + if (currentItem.rebateFundsType == 2) { | |
234 | + return CollectionColumn; | |
235 | + } | |
236 | + if (currentItem.rebateFundsType == 3) { | |
237 | + return CashColumn; | |
238 | + } | |
239 | + if (currentItem.rebateFundsType == 4) { | |
240 | + return PromotionColumn; | |
241 | + } | |
242 | + if (currentItem.rebateFundsType == 6) { | |
243 | + return CollectionColumn; | |
244 | + } | |
245 | + return []; | |
246 | +} | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/SubidyColumn.tsx
1 | -import moment from 'moment'; | |
2 | -import React from 'react'; | |
3 | -import { useStore } from '../index'; | |
1 | +import moment from "moment"; | |
2 | +import React from "react"; | |
3 | +import { useStore } from "../index"; | |
4 | 4 | |
5 | 5 | export default function SubidyColumn() { |
6 | - const { setDetailVisible, setOrderId, currentItem } = useStore(); | |
7 | - const FactoryColumn = [ | |
6 | + const { setDetailVisible, setOrderId, currentItem, setDifferencetItem } = | |
7 | + useStore(); | |
8 | + | |
9 | + /**厂家促销==》待确认清单 */ | |
10 | + const waitCheckPromotion = [ | |
8 | 11 | { |
9 | 12 | title: "VIN", |
10 | 13 | dataIndex: "vin", |
11 | 14 | key: "vin", |
12 | 15 | width: "10%", |
13 | - render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
16 | + fixed: 'left', | |
17 | + render: (text: string) => ( | |
18 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
19 | + {text} | |
20 | + </div> | |
21 | + ), | |
14 | 22 | }, |
15 | 23 | { |
16 | 24 | title: "车辆", |
... | ... | @@ -18,65 +26,239 @@ export default function SubidyColumn() { |
18 | 26 | key: "materialName", |
19 | 27 | }, |
20 | 28 | { |
21 | - title: "补贴类型", | |
22 | - dataIndex: "subsidyName", | |
23 | - key: "subsidyName" | |
29 | + title: "授信商家名称", | |
30 | + dataIndex: "creditDealerName", | |
31 | + key: "creditDealerName", | |
24 | 32 | }, |
25 | 33 | { |
26 | - title: "应折让金额(元)", | |
27 | - dataIndex: "rebateAmount", | |
28 | - key: "rebateAmount", | |
34 | + title: "启票商家", | |
35 | + dataIndex: "ticketDealerName", | |
36 | + key: "ticketDealerName", | |
29 | 37 | }, |
30 | 38 | { |
31 | - title: "实际折让金额(元)", | |
32 | - dataIndex: "actualRebateAmount", | |
33 | - key: "actualRebateAmount", | |
39 | + title: "启票日期", | |
40 | + dataIndex: "ticketTime", | |
41 | + key: "ticketTime", | |
42 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
34 | 43 | }, |
35 | 44 | { |
36 | - title: "往来单位", | |
37 | - dataIndex: "factoryName", | |
38 | - key: "factoryName", | |
45 | + title: "销售商家名称", | |
46 | + dataIndex: "saleDealerName", | |
47 | + key: " saleDealerName", | |
39 | 48 | }, |
40 | 49 | { |
41 | - title: "下零售门店", | |
42 | - dataIndex: "retailShopName", | |
43 | - key: "retailShopName", | |
50 | + title: "下零售商家", | |
51 | + dataIndex: "retailDealerName", | |
52 | + key: "retailDealerName", | |
44 | 53 | }, |
45 | 54 | { |
46 | - title: "下零售日期", | |
55 | + title: "下零售时间", | |
47 | 56 | dataIndex: "retailTime", |
48 | 57 | key: "retailTime", |
49 | - render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
58 | + render: (text: number) => moment(text).format("YYYY-MM-DD"), | |
59 | + }, | |
60 | + { | |
61 | + title: "折让归属商家", | |
62 | + dataIndex: "belongDealerName", | |
63 | + key: "belongDealerName", | |
64 | + }, | |
65 | + | |
66 | + // { | |
67 | + // title: "操作", | |
68 | + // width: "10%", | |
69 | + // key: "options", | |
70 | + // render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
71 | + // <> | |
72 | + // <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
73 | + // </> | |
74 | + // ) | |
75 | + // } | |
76 | + ]; | |
77 | + | |
78 | + /**厂家促销==》已确认清单 */ | |
79 | + const checkPromotion = [ | |
80 | + { | |
81 | + title: "VIN", | |
82 | + dataIndex: "vin", | |
83 | + key: "vin", | |
84 | + width: "10%", | |
85 | + fixed: 'left', | |
86 | + render: (text: string) => ( | |
87 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
88 | + {text} | |
89 | + </div> | |
90 | + ), | |
91 | + }, | |
92 | + { | |
93 | + title: "车辆", | |
94 | + dataIndex: "materialName", | |
95 | + key: "materialName", | |
96 | + }, | |
97 | + { | |
98 | + title: "授信商家名称", | |
99 | + dataIndex: "creditDealerName", | |
100 | + key: "creditDealerName", | |
101 | + }, | |
102 | + { | |
103 | + title: "启票商家", | |
104 | + dataIndex: "ticketDealerName", | |
105 | + key: "ticketDealerName", | |
106 | + }, | |
107 | + { | |
108 | + title: "启票日期", | |
109 | + dataIndex: "ticketTime", | |
110 | + key: "ticketTime", | |
111 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
112 | + }, | |
113 | + { | |
114 | + title: "销售商家名称", | |
115 | + dataIndex: "saleDealerName", | |
116 | + key: "saleDealerName", | |
117 | + }, | |
118 | + { | |
119 | + title: "下零售商家", | |
120 | + dataIndex: "retailDealerName", | |
121 | + key: "retailDealerName", | |
122 | + render: (text: string) => text || '--' | |
123 | + }, | |
124 | + { | |
125 | + title: "下零售时间", | |
126 | + dataIndex: "retailTime", | |
127 | + key: "retailTime", | |
128 | + render: (text: number) => moment(text).format("YYYY-MM-DD"), | |
129 | + }, | |
130 | + { | |
131 | + title: "折让归属商家", | |
132 | + dataIndex: "belongDealerName", | |
133 | + key: "belongDealerName", | |
134 | + render: (text: string) => text || '--' | |
135 | + }, | |
136 | + { | |
137 | + title: "应折让金额(元)", | |
138 | + dataIndex: "rebateAmount", | |
139 | + key: "rebateAmount", | |
140 | + }, | |
141 | + { | |
142 | + title: "实际折让金额(元)", | |
143 | + dataIndex: "actualRebateAmount", | |
144 | + key: "actualRebateAmount", | |
50 | 145 | }, |
51 | 146 | { |
52 | 147 | title: "操作", |
53 | 148 | width: "10%", |
54 | 149 | key: "options", |
55 | - render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
150 | + fixed: 'right', | |
151 | + render: (text: any, record: FvmAllowance.CheckListItems) => ( | |
56 | 152 | <> |
57 | - <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
153 | + <a | |
154 | + onClick={() => { | |
155 | + setDetailVisible(true); | |
156 | + setOrderId(record.id); | |
157 | + setDifferencetItem(record); | |
158 | + }} | |
159 | + > | |
160 | + 确认折让差异 | |
161 | + </a> | |
58 | 162 | </> |
59 | - ) | |
60 | - } | |
163 | + ), | |
164 | + }, | |
61 | 165 | ]; |
62 | - /**厂家代收 */ | |
63 | - const CollectionColumn = [ | |
166 | + /** | |
167 | + * 厂家补贴==》待确认清单 | |
168 | + */ | |
169 | + const waitCheckSubsidies = [ | |
64 | 170 | { |
65 | 171 | title: "VIN", |
66 | 172 | dataIndex: "vin", |
67 | 173 | key: "vin", |
174 | + width: 100, | |
175 | + fixed: 'left', | |
176 | + render: (text: string) => ( | |
177 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
178 | + {" "} | |
179 | + {text} | |
180 | + </div> | |
181 | + ), | |
182 | + }, | |
183 | + { | |
184 | + title: "车辆", | |
185 | + dataIndex: "materialName", | |
186 | + key: "materialName", | |
68 | 187 | width: "10%", |
69 | - render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
188 | + }, | |
189 | + { | |
190 | + title: "客户", | |
191 | + dataIndex: "realName", | |
192 | + key: "realName", | |
193 | + width: 100 | |
194 | + }, | |
195 | + { | |
196 | + title: "零售门店", | |
197 | + dataIndex: "saleShopName", | |
198 | + key: "saleShopName", | |
199 | + }, | |
200 | + { | |
201 | + title: "折让归属商家", | |
202 | + dataIndex: "belongDealerName", | |
203 | + key: "belongDealerName", | |
204 | + }, | |
205 | + { | |
206 | + title: "应折让金额(元)", | |
207 | + dataIndex: "rebateAmount", | |
208 | + key: "rebateAmount", | |
209 | + }, | |
210 | + { | |
211 | + title: "下零售商家", | |
212 | + dataIndex: "dealerName", | |
213 | + key: "dealerName", | |
214 | + }, | |
215 | + { | |
216 | + title: "下零售日期", | |
217 | + dataIndex: "retailTime", | |
218 | + key: "retailTime", | |
219 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
220 | + }, | |
221 | + ]; | |
222 | + | |
223 | + /** | |
224 | + * 厂家补贴==》已确认清单 | |
225 | + */ | |
226 | + const checkSubsidies = [ | |
227 | + { | |
228 | + title: "VIN", | |
229 | + dataIndex: "vin", | |
230 | + key: "vin", | |
231 | + width: 100, | |
232 | + fixed: 'left', | |
233 | + render: (text: string) => ( | |
234 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
235 | + {" "} | |
236 | + {text} | |
237 | + </div> | |
238 | + ), | |
70 | 239 | }, |
71 | 240 | { |
72 | 241 | title: "车辆", |
73 | 242 | dataIndex: "materialName", |
74 | 243 | key: "materialName", |
244 | + width: "10%", | |
245 | + // width: 100, | |
246 | + fixed: 'left', | |
247 | + }, | |
248 | + { | |
249 | + title: "客户", | |
250 | + dataIndex: "realName", | |
251 | + key: "realName", | |
75 | 252 | }, |
76 | 253 | { |
77 | - title: currentItem.rebateFundsType == 2 ? "厂家代收款名称" : "厂家直营车折让名称", | |
78 | - dataIndex: "subsidyName", | |
79 | - width: "10%" | |
254 | + title: "零售门店", | |
255 | + dataIndex: "saleShopName", | |
256 | + key: "saleShopName", | |
257 | + }, | |
258 | + { | |
259 | + title: "折让归属商家", | |
260 | + dataIndex: "belongDealerName", | |
261 | + key: "belongDealerName", | |
80 | 262 | }, |
81 | 263 | { |
82 | 264 | title: "应折让金额(元)", |
... | ... | @@ -89,158 +271,322 @@ export default function SubidyColumn() { |
89 | 271 | key: "actualRebateAmount", |
90 | 272 | }, |
91 | 273 | { |
92 | - title: "往来单位", | |
93 | - dataIndex: "factoryName", | |
94 | - key: "factoryName", | |
95 | - }, | |
96 | - { | |
97 | - title: "下零售门店", | |
98 | - dataIndex: "retailShopName", | |
99 | - key: "retailShopName", | |
274 | + title: "下零售商家", | |
275 | + dataIndex: "dealerName", | |
276 | + key: "dealerName", | |
100 | 277 | }, |
101 | 278 | { |
102 | 279 | title: "下零售日期", |
103 | 280 | dataIndex: "retailTime", |
104 | 281 | key: "retailTime", |
105 | - render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
282 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
283 | + }, | |
284 | + { | |
285 | + title: "折让差异原因", | |
286 | + dataIndex: "reason", | |
287 | + key: "reason", | |
288 | + render: (text: any, record: FvmAllowance.CheckListItems) => text || "--", | |
106 | 289 | }, |
107 | 290 | { |
108 | 291 | title: "操作", |
109 | - width: "10%", | |
292 | + width: 100, | |
293 | + fixed: 'right', | |
110 | 294 | key: "options", |
111 | - render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
295 | + render: (text: any, record: FvmAllowance.CheckListItems) => ( | |
112 | 296 | <> |
113 | - <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
297 | + <a | |
298 | + onClick={() => { | |
299 | + setDetailVisible(true); | |
300 | + setOrderId(record.id); | |
301 | + setDifferencetItem(record); | |
302 | + }} | |
303 | + > | |
304 | + 确认折让差异 | |
305 | + </a> | |
114 | 306 | </> |
115 | - ) | |
116 | - } | |
307 | + ), | |
308 | + }, | |
117 | 309 | ]; |
118 | - const CashColumn = [ | |
310 | + | |
311 | + /** | |
312 | + * 厂家代收款==》待确认清单 | |
313 | + */ | |
314 | + const waitCheckInward = [ | |
119 | 315 | { |
120 | 316 | title: "VIN", |
121 | 317 | dataIndex: "vin", |
122 | 318 | key: "vin", |
319 | + width: 100, | |
320 | + fixed: 'left', | |
321 | + render: (text: string) => ( | |
322 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
323 | + {text} | |
324 | + </div> | |
325 | + ), | |
326 | + }, | |
327 | + { | |
328 | + title: "车辆", | |
329 | + dataIndex: "materialName", | |
330 | + key: "materialName", | |
123 | 331 | width: "10%", |
124 | - render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
332 | + }, | |
333 | + { | |
334 | + title: "客户", | |
335 | + dataIndex: "realName", | |
336 | + key: "realName", | |
337 | + }, | |
338 | + { | |
339 | + title: "款项", | |
340 | + dataIndex: "inwardName", | |
341 | + key: "inwardName", | |
342 | + }, | |
343 | + { | |
344 | + title: "零售门店", | |
345 | + dataIndex: "saleShopName", | |
346 | + key: "saleShopName", | |
347 | + }, | |
348 | + { | |
349 | + title: "折让归属商家", | |
350 | + dataIndex: "belongDealerName", | |
351 | + key: "belongDealerName", | |
352 | + }, | |
353 | + { | |
354 | + title: "应折让金额(元)", | |
355 | + dataIndex: "rebateAmount", | |
356 | + key: "rebateAmount", | |
357 | + }, | |
358 | + { | |
359 | + title: "下零售商家", | |
360 | + dataIndex: "dealerName", | |
361 | + key: "dealerName", | |
362 | + }, | |
363 | + { | |
364 | + title: "下零售日期", | |
365 | + dataIndex: "retailTime", | |
366 | + key: "retailTime", | |
367 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
368 | + }, | |
369 | + ]; | |
370 | + | |
371 | + /** | |
372 | + * 厂家代收款==》已确认清单 | |
373 | + */ | |
374 | + const checkInward = [ | |
375 | + { | |
376 | + title: "VIN", | |
377 | + dataIndex: "vin", | |
378 | + key: "vin", | |
379 | + width: 100, | |
380 | + fixed: 'left', | |
381 | + render: (text: string) => ( | |
382 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
383 | + {text} | |
384 | + </div> | |
385 | + ), | |
386 | + }, | |
387 | + { | |
388 | + title: "客户", | |
389 | + dataIndex: "realName", | |
390 | + key: "realName", | |
125 | 391 | }, |
126 | 392 | { |
127 | 393 | title: "车辆", |
128 | 394 | dataIndex: "materialName", |
129 | 395 | key: "materialName", |
396 | + width: "10%", | |
397 | + }, | |
398 | + { | |
399 | + title: "款项", | |
400 | + dataIndex: "inwardName", | |
401 | + key: "inwardName", | |
402 | + width: "10%", | |
403 | + }, | |
404 | + { | |
405 | + title: "零售门店", | |
406 | + dataIndex: "saleShopName", | |
407 | + key: "saleShopName", | |
130 | 408 | }, |
131 | 409 | { |
132 | - title: "启票金额(元)", | |
410 | + title: "折让归属商家", | |
411 | + dataIndex: "belongDealerName", | |
412 | + key: "belongDealerName", | |
413 | + }, | |
414 | + { | |
415 | + title: "应折让金额(元)", | |
133 | 416 | dataIndex: "rebateAmount", |
134 | 417 | key: "rebateAmount", |
135 | 418 | }, |
136 | 419 | { |
137 | - title: "现金启票奖励折让金额(元)", | |
420 | + title: "实际折让金额(元)", | |
138 | 421 | dataIndex: "actualRebateAmount", |
139 | 422 | key: "actualRebateAmount", |
140 | 423 | }, |
141 | 424 | { |
142 | - title: "往来单位", | |
143 | - dataIndex: "factoryName", | |
144 | - key: "factoryName", | |
425 | + title: "下零售商家", | |
426 | + dataIndex: "dealerName", | |
427 | + key: "dealerName", | |
145 | 428 | }, |
146 | 429 | { |
147 | - title: "下零售门店", | |
148 | - dataIndex: "retailShopName", | |
149 | - key: "retailShopName", | |
430 | + title: "下零售日期", | |
431 | + dataIndex: "retailTime", | |
432 | + key: "retailTime", | |
433 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
150 | 434 | }, |
151 | 435 | { |
152 | - title: "启票日期", | |
153 | - dataIndex: "ticketTime", | |
154 | - key: "ticketTime", | |
155 | - render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
436 | + title: "折让差异原因", | |
437 | + dataIndex: "reason", | |
438 | + key: "reason", | |
439 | + render: (text: any, record: FvmAllowance.CheckListItems) => text || "--", | |
156 | 440 | }, |
157 | 441 | { |
158 | 442 | title: "操作", |
159 | 443 | width: "10%", |
160 | 444 | key: "options", |
161 | - render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
445 | + fixed: 'right', | |
446 | + render: (text: any, record: FvmAllowance.CheckListItems) => ( | |
162 | 447 | <> |
163 | - <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
448 | + <a | |
449 | + onClick={() => { | |
450 | + setDetailVisible(true); | |
451 | + setOrderId(record.id); | |
452 | + setDifferencetItem(record); | |
453 | + }} | |
454 | + > | |
455 | + 确认折让差异 | |
456 | + </a> | |
164 | 457 | </> |
165 | - ) | |
166 | - } | |
458 | + ), | |
459 | + }, | |
167 | 460 | ]; |
168 | - /**厂家促销确认清单 */ | |
169 | - const PromotionColumn = [ | |
461 | + | |
462 | + /** | |
463 | + * 现金启票奖励==》待确认清单 | |
464 | + */ | |
465 | + const waitCashTicket = [ | |
170 | 466 | { |
171 | 467 | title: "VIN", |
172 | 468 | dataIndex: "vin", |
173 | 469 | key: "vin", |
174 | 470 | width: "10%", |
175 | - render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>) | |
471 | + render: (text: string) => ( | |
472 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
473 | + {text} | |
474 | + </div> | |
475 | + ), | |
176 | 476 | }, |
177 | 477 | { |
178 | 478 | title: "车辆", |
179 | 479 | dataIndex: "materialName", |
180 | 480 | key: "materialName", |
481 | + width: "10%", | |
181 | 482 | }, |
182 | - // { | |
183 | - // title: "折让类型", | |
184 | - // dataIndex: "subsidyName", | |
185 | - // key: "subsidyName" | |
186 | - // }, | |
187 | - // { | |
188 | - // title: "应折让金额(元)", | |
189 | - // dataIndex: "rebateAmount", | |
190 | - // key: "rebateAmount", | |
191 | - // }, | |
192 | - // { | |
193 | - // title: "实际折让金额(元)", | |
194 | - // dataIndex: "actualRebateAmount", | |
195 | - // key: "actualRebateAmount", | |
196 | - // }, | |
197 | 483 | { |
198 | - title: "往来单位", | |
199 | - dataIndex: "factoryName", | |
200 | - key: "factoryName", | |
484 | + title: "折让归属商家", | |
485 | + dataIndex: "belongDealerName", | |
486 | + key: "belongDealerName", | |
201 | 487 | }, |
202 | 488 | { |
203 | - title: "下零售门店", | |
204 | - dataIndex: "retailShopName", | |
205 | - key: "retailShopName", | |
489 | + title: "启票商家", | |
490 | + dataIndex: "belongDealerName", | |
491 | + key: "belongDealerName", | |
206 | 492 | }, |
207 | 493 | { |
208 | - title: "下零售时间", | |
494 | + title: "启票日期", | |
209 | 495 | dataIndex: "retailTime", |
210 | 496 | key: "retailTime", |
211 | - render: (text: number) => moment(text).format("YYYY-MM-DD") | |
497 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
498 | + }, | |
499 | + { | |
500 | + title: "应折让金额(元)", | |
501 | + dataIndex: "rebateAmount", | |
502 | + key: "rebateAmount", | |
503 | + }, | |
504 | + ]; | |
505 | + | |
506 | + /** | |
507 | + * 现金启票奖励==》已确认清单 | |
508 | + */ | |
509 | + const cashTicket = [ | |
510 | + { | |
511 | + title: "VIN", | |
512 | + dataIndex: "vin", | |
513 | + key: "vin", | |
514 | + width: "10%", | |
515 | + fixed: 'left', | |
516 | + render: (text: string) => ( | |
517 | + <div style={{ wordWrap: "break-word", wordBreak: "break-word" }}> | |
518 | + {text} | |
519 | + </div> | |
520 | + ), | |
521 | + }, | |
522 | + { | |
523 | + title: "车辆", | |
524 | + dataIndex: "materialName", | |
525 | + key: "materialName", | |
526 | + width: "10%", | |
527 | + }, | |
528 | + { | |
529 | + title: "折让归属商家", | |
530 | + dataIndex: "belongDealerName", | |
531 | + key: "belongDealerName", | |
532 | + }, | |
533 | + { | |
534 | + title: "启票商家", | |
535 | + dataIndex: "dealerName", | |
536 | + key: "dealerName", | |
212 | 537 | }, |
213 | 538 | { |
214 | 539 | title: "启票日期", |
215 | - dataIndex: "ticketTime", | |
216 | - key: "ticketTime", | |
217 | - render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss') | |
540 | + dataIndex: "retailTime", | |
541 | + key: "retailTime", | |
542 | + render: (text: number) => moment(text).format("YYYY-MM-DD HH:mm:ss"), | |
543 | + }, | |
544 | + { | |
545 | + title: "应折让金额(元)", | |
546 | + dataIndex: "rebateAmount", | |
547 | + key: "rebateAmount", | |
548 | + }, | |
549 | + { | |
550 | + title: "实际折让金额(元)", | |
551 | + dataIndex: "actualRebateAmount", | |
552 | + key: "actualRebateAmount", | |
553 | + }, | |
554 | + { | |
555 | + title: "折让差异原因", | |
556 | + dataIndex: "reason", | |
557 | + key: "reason", | |
558 | + render: (text: any, record: FvmAllowance.CheckListItems) => text || "--", | |
559 | + }, | |
560 | + { | |
561 | + title: "操作", | |
562 | + width: 110, | |
563 | + key: "options", | |
564 | + fixed: 'right', | |
565 | + render: (text: any, record: FvmAllowance.CheckListItems) => ( | |
566 | + <> | |
567 | + <a | |
568 | + onClick={() => { | |
569 | + setDetailVisible(true); | |
570 | + setOrderId(record.id); | |
571 | + setDifferencetItem(record); | |
572 | + }} | |
573 | + > | |
574 | + 确认折让差异 | |
575 | + </a> | |
576 | + </> | |
577 | + ), | |
218 | 578 | }, |
219 | - // { | |
220 | - // title: "操作", | |
221 | - // width: "10%", | |
222 | - // key: "options", | |
223 | - // render: (text: any, record: FvmAllowance.OrderItemVo) => ( | |
224 | - // <> | |
225 | - // <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a> | |
226 | - // </> | |
227 | - // ) | |
228 | - // } | |
229 | 579 | ]; |
230 | - if (currentItem.rebateFundsType == 1) { | |
231 | - return FactoryColumn; | |
232 | - } | |
233 | - if (currentItem.rebateFundsType == 2) { | |
234 | - return CollectionColumn; | |
235 | - } | |
236 | - if (currentItem.rebateFundsType == 3) { | |
237 | - return CashColumn; | |
238 | - } | |
239 | - if (currentItem.rebateFundsType == 4) { | |
240 | - return PromotionColumn; | |
241 | - } | |
242 | - if (currentItem.rebateFundsType == 6) { | |
243 | - return CollectionColumn; | |
244 | - } | |
245 | - return []; | |
580 | + | |
581 | + const subsidyColumns = [waitCheckSubsidies, checkSubsidies]; | |
582 | + const inwardColumns = [waitCheckInward, checkInward]; | |
583 | + const PromotionColumns = [waitCheckPromotion, checkPromotion]; | |
584 | + const CashTicketColumns = [waitCashTicket, cashTicket]; | |
585 | + const res = { | |
586 | + 1: subsidyColumns, | |
587 | + 2: inwardColumns, | |
588 | + 3: PromotionColumns, | |
589 | + 4: CashTicketColumns, | |
590 | + }; | |
591 | + return res; | |
246 | 592 | } | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/TransferTable.tsx
0 → 100644
1 | +import React, { useEffect, useState } from "react"; | |
2 | +import { | |
3 | + Button, | |
4 | + Modal, | |
5 | + Form, | |
6 | + Select, | |
7 | + InputNumber, | |
8 | + Radio, | |
9 | + message, | |
10 | + Spin, | |
11 | + Input, | |
12 | + Table, | |
13 | + Row, | |
14 | + DatePicker, | |
15 | + Tabs, | |
16 | +} from "antd"; | |
17 | +import { getShopApi } from "@/common/api"; | |
18 | +import { useStore } from "../index"; | |
19 | +import _ from "lodash"; | |
20 | +import useInitail from "@/hooks/useInitail"; | |
21 | +import moment from "moment"; | |
22 | +import { DownOutlined, UpOutlined } from "@ant-design/icons"; | |
23 | +import { TablePaginationConfig } from 'antd/es/table/interface'; | |
24 | + | |
25 | +const { TextArea } = Input; | |
26 | +const { TabPane } = Tabs; | |
27 | +const Option = Select.Option; | |
28 | +const { RangePicker } = DatePicker; | |
29 | +interface Props { | |
30 | + upLoading: boolean; | |
31 | + dowmLoading: boolean; | |
32 | + dataSource1: FvmAllowance.WaitCheckListItems[]; | |
33 | + columns1: { [key: string]: any }[]; | |
34 | + columns2: { [key: string]: any }[]; | |
35 | + dataSource2: any[]; | |
36 | + paginationConfig: TablePaginationConfig; | |
37 | + checkPaginationConfig: TablePaginationConfig; | |
38 | + // 加入清单; | |
39 | + addList: (values: any[]) => void; | |
40 | + //移除清单 | |
41 | + removeList: (values: any[]) => void; | |
42 | + getConfirmOrder: (searchParams?: Search) => void; | |
43 | + getNotConfirmOrder: (searchParams?: Search) => void; | |
44 | +} | |
45 | +interface Search { | |
46 | + vin?: string; | |
47 | + retailShopId?: number; //下零售门店 | |
48 | + retailBegin?: any; //下零售开始时间 | |
49 | + retailEnd?: any; //下零售结束时间 | |
50 | + subsidyName?: string; //补贴类型 | |
51 | +} | |
52 | +export default function TransferTable({ | |
53 | + upLoading, | |
54 | + dowmLoading, | |
55 | + dataSource1, | |
56 | + columns1, | |
57 | + columns2, | |
58 | + dataSource2, | |
59 | + paginationConfig, | |
60 | + checkPaginationConfig, | |
61 | + addList, | |
62 | + removeList, | |
63 | + getConfirmOrder, | |
64 | + getNotConfirmOrder, | |
65 | +}: Props) { | |
66 | + const { | |
67 | + selectedRowKeys, | |
68 | + submitSelectedRowKeys, | |
69 | + setSelectedRowkeys, | |
70 | + setSubmitSelectedRowkeys, | |
71 | + subsidyTypeList, | |
72 | + readOnly, | |
73 | + currentItem, | |
74 | + setCarOrderTabkey, | |
75 | + carOrderTabkey | |
76 | + } = useStore(); | |
77 | + const { data: shopList } = useInitail< | |
78 | + CommonApi.OptionVO[], | |
79 | + CommonApi.ShopParam | |
80 | + >(getShopApi, [], { bizType: 1 }); | |
81 | + /** | |
82 | + * 未确认清单 ==》搜索参数 | |
83 | + */ | |
84 | + const [searchParams, setSearchParams] = useState<Search>({}); | |
85 | + /** | |
86 | + * 提交清单 ==》搜索参数 | |
87 | + */ | |
88 | + const [checkSearchParams, setCheckSearchParams] = useState<Search>({}); | |
89 | + const onSelectChange = ( | |
90 | + selectedRowKeys: React.Key[], | |
91 | + selectedRows: FvmAllowance.WaitCheckListItems[] | |
92 | + ) => { | |
93 | + setSelectedRowkeys(selectedRowKeys); | |
94 | + }; | |
95 | + | |
96 | + const onSelectChange2 = ( | |
97 | + selectedRowKeys: React.Key[], | |
98 | + selectedRows: FvmAllowance.CheckListItems[] | |
99 | + ) => { | |
100 | + setSubmitSelectedRowkeys([...selectedRowKeys]); | |
101 | + }; | |
102 | + const rowSelection = { | |
103 | + selectedRowKeys, | |
104 | + onChange: onSelectChange, | |
105 | + }; | |
106 | + const rowSelection2 = { | |
107 | + selectedRowKeys: submitSelectedRowKeys, | |
108 | + onChange: onSelectChange2, | |
109 | + }; | |
110 | + | |
111 | + // 加入清单 | |
112 | + const addManifest = () => { | |
113 | + let inwardName = ""; | |
114 | + if (carOrderTabkey === '2' && currentItem.dimension === 2) { | |
115 | + Modal.confirm({ | |
116 | + title: '请输入确认车辆代收款名称', | |
117 | + // icon: <ExclamationCircleOutlined />, | |
118 | + content: <Input placeholder="请输入" onChange={(v) => { inwardName = v.target.value; }} />, | |
119 | + onOk() { | |
120 | + console.log("🚀 ~ file: TransferTable.tsx ~ line 126 ~ returnnewPromise ~ inwardName", inwardName) | |
121 | + | |
122 | + return new Promise((resolve, reject) => { | |
123 | + // setTimeout(Math.random() > 0.5 ? resolve : reject, 1000); | |
124 | + inwardName ? resolve(addList && addList([{ id: selectedRowKeys[0], inwardName }])) : reject; | |
125 | + // inwardName ? resolve : reject; | |
126 | + // }).then(() => addList && addList([{ id: selectedRowKeys[0], inwardName }])) | |
127 | + }).catch((e) => message.error(e.message || '请输入确认车辆代收款名称后提交')); | |
128 | + }, | |
129 | + onCancel() { | |
130 | + console.log('Cancel'); | |
131 | + }, | |
132 | + }); | |
133 | + // addList && addList([{id: selectedRowKeys, inwardName }]); | |
134 | + return; | |
135 | + } | |
136 | + // 交集 | |
137 | + const res = dataSource1.filter((x) => | |
138 | + selectedRowKeys.find((y) => y === x.id) | |
139 | + ); | |
140 | + addList && addList(res); | |
141 | + }; | |
142 | + | |
143 | + // 移出清单 | |
144 | + const removeManifest = () => { | |
145 | + // 交集 | |
146 | + const res = dataSource2.filter((x) => | |
147 | + submitSelectedRowKeys.find((y) => y === x.id) | |
148 | + ); | |
149 | + removeList && removeList(res); | |
150 | + }; | |
151 | + | |
152 | + function callback(key: string) { | |
153 | + console.log("🚀 ~ file: TransferTable.tsx ~ line 130 ~ callback ~ key", key) | |
154 | + console.log(key); | |
155 | + setCarOrderTabkey(key); | |
156 | + } | |
157 | + | |
158 | + return ( | |
159 | + <> | |
160 | + {!readOnly && ( | |
161 | + <div> | |
162 | + | |
163 | + <Row | |
164 | + justify="space-between" | |
165 | + style={{ marginBottom: 16, flexWrap: "wrap" }} | |
166 | + > | |
167 | + <div> | |
168 | + <span>VIN:</span> | |
169 | + <Input | |
170 | + style={{ width: 200 }} | |
171 | + allowClear | |
172 | + placeholder="搜索VIN" | |
173 | + onChange={(e) => setSearchParams({ | |
174 | + ...searchParams, | |
175 | + vin: e.target.value || undefined, | |
176 | + })} | |
177 | + /> | |
178 | + </div> | |
179 | + <div> | |
180 | + <span style={{ marginLeft: 15 }}>门店:</span> | |
181 | + <Select | |
182 | + optionFilterProp="children" | |
183 | + showSearch | |
184 | + allowClear | |
185 | + style={{ width: 200, marginRight: 15 }} | |
186 | + placeholder="请选择门店" | |
187 | + onChange={(v) => | |
188 | + setSearchParams({ | |
189 | + ...searchParams, | |
190 | + retailShopId: v ? Number(v) : undefined, | |
191 | + }) | |
192 | + } | |
193 | + > | |
194 | + {shopList.map((shop) => ( | |
195 | + <Select.Option value={shop.id} key={shop.id}> | |
196 | + {shop.name} | |
197 | + </Select.Option> | |
198 | + ))} | |
199 | + </Select> | |
200 | + </div> | |
201 | + <div> | |
202 | + <span>下零售日期范围:</span> | |
203 | + <RangePicker | |
204 | + allowClear | |
205 | + format="YYYY-MM-DD" | |
206 | + onChange={(v) => | |
207 | + setSearchParams({ | |
208 | + ...searchParams, | |
209 | + retailBegin: v && v[0] && v[0].valueOf(), | |
210 | + retailEnd: v && v[1] && v[1].valueOf(), | |
211 | + }) | |
212 | + } | |
213 | + /> | |
214 | + </div> | |
215 | + {/* 补贴类型 */} | |
216 | + {currentItem.dimension == 1 && ( | |
217 | + <div> | |
218 | + <span style={{ marginLeft: 15 }}>补贴类型:</span> | |
219 | + <Select | |
220 | + optionFilterProp="children" | |
221 | + showSearch | |
222 | + allowClear | |
223 | + style={{ width: 200, marginRight: 15 }} | |
224 | + placeholder="请选择类型" | |
225 | + onChange={(v) => | |
226 | + setSearchParams({ | |
227 | + ...searchParams, | |
228 | + subsidyType: v ? Number(v) : undefined, | |
229 | + }) | |
230 | + } | |
231 | + > | |
232 | + {subsidyTypeList.map((item) => ( | |
233 | + <Select.Option value={item.subsidyType} key={item.subsidyType}> | |
234 | + {item.subsidyName} | |
235 | + </Select.Option> | |
236 | + ))} | |
237 | + </Select> | |
238 | + </div> | |
239 | + )} | |
240 | + <Button | |
241 | + type="primary" | |
242 | + onClick={() => getNotConfirmOrder && getNotConfirmOrder(searchParams)} | |
243 | + > | |
244 | + 查询 | |
245 | + </Button> | |
246 | + </Row> | |
247 | + <Tabs defaultActiveKey="1" onChange={callback}> | |
248 | + <TabPane tab="已有折让记录中选择" key="1"> | |
249 | + <Table | |
250 | + loading={upLoading} | |
251 | + pagination={paginationConfig} | |
252 | + bordered | |
253 | + size="small" | |
254 | + rowKey="id" | |
255 | + scroll={{ y: 500, x: 1500 }} | |
256 | + dataSource={dataSource1} | |
257 | + columns={columns1} | |
258 | + rowSelection={rowSelection} | |
259 | + /> | |
260 | + </TabPane> | |
261 | + <TabPane tab={`从${currentItem.dimension == 3 && currentItem.supportType == 1 ? "启票" : "下零售"}数据车辆选择`} key="2"> | |
262 | + <Table | |
263 | + loading={upLoading} | |
264 | + pagination={paginationConfig} | |
265 | + bordered | |
266 | + size="small" | |
267 | + rowKey="id" | |
268 | + scroll={{ y: 500, x: 1500 }} | |
269 | + dataSource={dataSource1} | |
270 | + columns={columns1} | |
271 | + rowSelection={{ ...rowSelection, type: 'radio' }} | |
272 | + /> | |
273 | + </TabPane> | |
274 | + </Tabs> | |
275 | + {/* <Table | |
276 | + loading={upLoading} | |
277 | + // pagination={false} | |
278 | + bordered | |
279 | + size="small" | |
280 | + rowKey="id" | |
281 | + scroll={{ y: 500, x: 1500 }} | |
282 | + dataSource={dataSource1} | |
283 | + columns={columns1} | |
284 | + rowSelection={rowSelection} | |
285 | + /> */} | |
286 | + <div | |
287 | + style={{ | |
288 | + height: 100, | |
289 | + margin: 20, | |
290 | + display: "flex", | |
291 | + alignItems: "center", | |
292 | + justifyContent: "center", | |
293 | + }} | |
294 | + > | |
295 | + <Button | |
296 | + style={{ marginRight: 50 }} | |
297 | + size="large" | |
298 | + icon={<UpOutlined />} | |
299 | + disabled={!submitSelectedRowKeys.length || readOnly} | |
300 | + onClick={() => removeManifest()} | |
301 | + > | |
302 | + 移除清单 | |
303 | + </Button> | |
304 | + | |
305 | + <Button | |
306 | + type="primary" | |
307 | + size="large" | |
308 | + icon={<DownOutlined />} | |
309 | + disabled={!selectedRowKeys.length || readOnly} | |
310 | + onClick={() => addManifest()} | |
311 | + > | |
312 | + 加入清单 | |
313 | + </Button> | |
314 | + </div> | |
315 | + </div> | |
316 | + )} | |
317 | + <Row | |
318 | + justify="space-between" | |
319 | + style={{ marginBottom: 16, flexWrap: "wrap" }} | |
320 | + > | |
321 | + <div> | |
322 | + <span>VIN:</span> | |
323 | + <Input | |
324 | + style={{ width: 200 }} | |
325 | + allowClear | |
326 | + placeholder="搜索VIN" | |
327 | + onChange={(e) => | |
328 | + setCheckSearchParams({ | |
329 | + ...checkSearchParams, | |
330 | + vin: e.target.value || undefined, | |
331 | + }) | |
332 | + } | |
333 | + /> | |
334 | + </div> | |
335 | + <div> | |
336 | + <span style={{ marginLeft: 15 }}>门店:</span> | |
337 | + <Select | |
338 | + optionFilterProp="children" | |
339 | + showSearch | |
340 | + allowClear | |
341 | + style={{ width: 200, marginRight: 15 }} | |
342 | + placeholder="请选择门店" | |
343 | + onChange={(v) => | |
344 | + setCheckSearchParams({ | |
345 | + ...checkSearchParams, | |
346 | + retailShopId: v ? Number(v) : undefined, | |
347 | + }) | |
348 | + } | |
349 | + > | |
350 | + {shopList.map((shop) => ( | |
351 | + <Select.Option value={shop.id} key={shop.id}> | |
352 | + {shop.name} | |
353 | + </Select.Option> | |
354 | + ))} | |
355 | + </Select> | |
356 | + </div> | |
357 | + <div> | |
358 | + <span>下零售日期范围:</span> | |
359 | + <RangePicker | |
360 | + allowClear | |
361 | + format="YYYY-MM-DD" | |
362 | + onChange={(v) => | |
363 | + setCheckSearchParams({ | |
364 | + ...checkSearchParams, | |
365 | + retailBegin: v && v[0] && v[0].valueOf(), | |
366 | + retailEnd: v && v[1] && v[1].valueOf(), | |
367 | + }) | |
368 | + } | |
369 | + /> | |
370 | + </div> | |
371 | + {/* 补贴类型 */} | |
372 | + {currentItem.dimension == 1 && ( | |
373 | + <div> | |
374 | + <span style={{ marginLeft: 15 }}>补贴类型:</span> | |
375 | + <Select | |
376 | + optionFilterProp="children" | |
377 | + showSearch | |
378 | + allowClear | |
379 | + style={{ width: 200, marginRight: 15 }} | |
380 | + placeholder="请选择类型" | |
381 | + onChange={(v) => | |
382 | + setCheckSearchParams({ | |
383 | + ...checkSearchParams, | |
384 | + subsidyType: v ? Number(v) : undefined, | |
385 | + }) | |
386 | + } | |
387 | + > | |
388 | + {subsidyTypeList.map((item) => ( | |
389 | + <Select.Option value={item.subsidyType} key={item.subsidyType}> | |
390 | + {item.subsidyName} | |
391 | + </Select.Option> | |
392 | + ))} | |
393 | + </Select> | |
394 | + </div> | |
395 | + )} | |
396 | + <Button | |
397 | + type="primary" | |
398 | + onClick={() => getConfirmOrder && getConfirmOrder(searchParams)} | |
399 | + > | |
400 | + 查询 | |
401 | + </Button> | |
402 | + </Row> | |
403 | + <Table | |
404 | + loading={dowmLoading} | |
405 | + pagination={checkPaginationConfig} | |
406 | + size="small" | |
407 | + bordered | |
408 | + rowKey="id" | |
409 | + scroll={{ y: 500, x: 1500 }} | |
410 | + dataSource={dataSource2} | |
411 | + columns={columns2} | |
412 | + rowSelection={rowSelection2} | |
413 | + /> | |
414 | + </> | |
415 | + ); | |
416 | +} | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/components/WaitConfirmList.tsx
0 → 100644
1 | +import React, { useEffect, useState } from "react"; | |
2 | +import { | |
3 | + message, | |
4 | + Modal, | |
5 | + DatePicker, | |
6 | + Input, | |
7 | + Row, | |
8 | + Select, | |
9 | + Button, | |
10 | + Table, | |
11 | +} from "antd"; | |
12 | +import { useStore } from "../index"; | |
13 | +import _ from "lodash"; | |
14 | +import { | |
15 | + AwardTypeEnum, | |
16 | + SupportTypeEnum, | |
17 | + SubjectTypeEnum, | |
18 | +} from "@/pages/stock/AllowanceConfirm/entity"; | |
19 | +import usePagination from "@/hooks/usePagination"; | |
20 | +import Dimission from "@/pages/cas/Dimission"; | |
21 | +import { | |
22 | + getSupportCheckListApi, | |
23 | + getSupportWaitCheckListApi, | |
24 | +} from "@/pages/stock/AllowanceConfirm/EditComfirm/Manufacturer/api"; | |
25 | + | |
26 | +import moment from "moment"; | |
27 | + | |
28 | +interface Props { | |
29 | + visible: boolean; | |
30 | + awardType: number; | |
31 | + onCancel: () => void; | |
32 | + onFinish: () => void; | |
33 | +} | |
34 | +const { RangePicker } = DatePicker; | |
35 | +interface Search { | |
36 | + supportType?: number; //1启票 2实销 | |
37 | + awardType?: number; //1正激励 2负激励 | |
38 | + supportName?: string; //促销政策名称 | |
39 | + rebateTimeBegin?: string; //折让兑现时间起 | |
40 | + rebateTimeEnd?: string; //折让对象时间止 | |
41 | + subjectType?: number; | |
42 | +} | |
43 | + | |
44 | +export default function WaitConfirmList(props: Props) { | |
45 | + const { visible, onCancel, onFinish, awardType } = props; | |
46 | + const { | |
47 | + subsidyTypeList, | |
48 | + rebateId, | |
49 | + setVisible, | |
50 | + data, | |
51 | + setLoading: setDetailLoading, | |
52 | + currentItem, | |
53 | + setOrderId, | |
54 | + commonOrderList, | |
55 | + orderId, | |
56 | + detailVisible, | |
57 | + setDetailVisible, | |
58 | + commonComfirmApi, | |
59 | + setSubmitSelectedRowkeys, | |
60 | + commonWaitCheckList, | |
61 | + commonCheckList, | |
62 | + commonRemoveCheckList, | |
63 | + commonEnterCheckList, | |
64 | + } = useStore(); | |
65 | + const { dimension } = currentItem; | |
66 | + const [comfrimloading, setComfirmLoading] = useState(false); | |
67 | + | |
68 | + const [delay, setDelay] = useState(true); | |
69 | + const [checkDelay, setCheckDelay] = useState(true); | |
70 | + /** | |
71 | + * 存储待确认促销活动列表 | |
72 | + */ | |
73 | + const [orderList, setOrderList] = useState< | |
74 | + FvmAllowance.SuportWaitCheckItems[] | |
75 | + >([]); | |
76 | + const [confirmOrderList, setConfirmOrderList] = useState([]); | |
77 | + /** | |
78 | + * 查询待确认促销活动列表 ==》搜索参数 | |
79 | + */ | |
80 | + const [searchParams, setSearchParams] = useState<Search>({}); | |
81 | + | |
82 | + /** 选中行 */ | |
83 | + const [selectedRowKeys, setSelectedRowkeys] = useState<React.Key[]>([]); | |
84 | + /** | |
85 | + * 查询待确认促销活动列表 | |
86 | + */ | |
87 | + const { | |
88 | + list, | |
89 | + loading, | |
90 | + setParams, | |
91 | + paginationConfig, | |
92 | + setLoading, | |
93 | + innerParams, | |
94 | + } = usePagination<FvmAllowance.SuportWaitCheckItems>( | |
95 | + getSupportWaitCheckListApi, | |
96 | + { rebateId }, | |
97 | + { delay } | |
98 | + ); | |
99 | + | |
100 | + useEffect(() => { | |
101 | + if (visible) { | |
102 | + fetchTableList(); | |
103 | + } | |
104 | + }, [rebateId, visible]); | |
105 | + | |
106 | + useEffect(() => { | |
107 | + if (list instanceof Array) { | |
108 | + setOrderList([...list]); | |
109 | + } | |
110 | + }, [list]); | |
111 | + | |
112 | + const fetchTableList = (paramas: Search) => { | |
113 | + //查询待确认促销活动列表 | |
114 | + if (rebateId) { | |
115 | + setParams( | |
116 | + { | |
117 | + rebateId, | |
118 | + ...paramas, | |
119 | + }, | |
120 | + true | |
121 | + ); | |
122 | + setDelay(false); | |
123 | + } | |
124 | + }; | |
125 | + | |
126 | + const columns = [ | |
127 | + { | |
128 | + title: "促销活动名称", | |
129 | + dataIndex: "supportName", | |
130 | + key: "supportName", | |
131 | + }, | |
132 | + { | |
133 | + title: "附件", | |
134 | + dataIndex: "promotionFid", | |
135 | + key: "promotionFid", | |
136 | + render: (text: string) => (text ? ( | |
137 | + <a | |
138 | + title="点击下载文档" | |
139 | + target="_blank" | |
140 | + rel="noreferrer" | |
141 | + href={`/api/file/show?fid=${text}`} | |
142 | + > | |
143 | + 查看 | |
144 | + </a> | |
145 | + ) : ( | |
146 | + "--" | |
147 | + )), | |
148 | + }, | |
149 | + { | |
150 | + title: "支持类型", | |
151 | + dataIndex: "supportType", | |
152 | + key: "supportType", | |
153 | + render: (text: number) => text && SupportTypeEnum[text], | |
154 | + }, | |
155 | + { | |
156 | + title: "激励类型", | |
157 | + dataIndex: "awardType", | |
158 | + key: "awardType", | |
159 | + render: (text: number) => text && AwardTypeEnum[text], | |
160 | + }, | |
161 | + { | |
162 | + title: "考核类型", | |
163 | + dataIndex: "subjectType", | |
164 | + key: "subjectType", | |
165 | + render: (text: number) => text && SubjectTypeEnum[text], | |
166 | + }, | |
167 | + { | |
168 | + title: "考核对象", | |
169 | + dataIndex: "subjectConfigName", | |
170 | + key: "subjectConfigName", | |
171 | + }, | |
172 | + { | |
173 | + title: "折让时间", | |
174 | + dataIndex: " rebateTime", | |
175 | + key: " rebateTime", | |
176 | + render: (text: number) => moment(text).format("YYYY-MM-DD"), | |
177 | + }, | |
178 | + { | |
179 | + title: "应折让金额(元)", | |
180 | + dataIndex: "rebateAmount", | |
181 | + key: "rebateAmount", | |
182 | + }, | |
183 | + ]; | |
184 | + const onSelectChange = ( | |
185 | + selectedRowKeys: React.Key[], | |
186 | + selectedRows: FvmAllowance.WaitCheckListItems[] | |
187 | + ) => { | |
188 | + setSelectedRowkeys([...selectedRowKeys]); | |
189 | + }; | |
190 | + const rowSelection = { | |
191 | + selectedRowKeys, | |
192 | + onChange: onSelectChange, | |
193 | + }; | |
194 | + | |
195 | + // 选中促销政策加入折让清单 | |
196 | + const onAdd = async () => { | |
197 | + const { success, result } = await getSupportCheckListApi({ | |
198 | + rebateId: Number(rebateId), | |
199 | + awardType, | |
200 | + // @ts-ignore; | |
201 | + promotionIds: selectedRowKeys, | |
202 | + }); | |
203 | + if (!success) { | |
204 | + message.error(result, 5); | |
205 | + return; | |
206 | + } | |
207 | + onCancel && onCancel(); | |
208 | + // 刷新厂家促销列表 | |
209 | + onFinish && onFinish(); | |
210 | + }; | |
211 | + return ( | |
212 | + <Modal | |
213 | + title="待确认促销活动列表" | |
214 | + visible={visible} | |
215 | + width="70%" | |
216 | + maskClosable={false} | |
217 | + confirmLoading={comfrimloading} | |
218 | + onCancel={() => onCancel && onCancel()} | |
219 | + onOk={() => onAdd()} | |
220 | + okText="加入" | |
221 | + > | |
222 | + <Row | |
223 | + justify="space-between" | |
224 | + align="middle" | |
225 | + style={{ marginBottom: 16, flexWrap: "wrap" }} | |
226 | + > | |
227 | + <div> | |
228 | + <span>促销政策名称:</span> | |
229 | + <Input | |
230 | + style={{ width: 200 }} | |
231 | + allowClear | |
232 | + placeholder="搜索促销政策名称" | |
233 | + onChange={(e) => setSearchParams({ | |
234 | + ...searchParams, | |
235 | + supportName: e.target.value || undefined, | |
236 | + })} | |
237 | + /> | |
238 | + </div> | |
239 | + <div> | |
240 | + {/* 支持类型 1启票支持 2实销支持 */} | |
241 | + <span style={{ marginLeft: 15 }}>支持类型:</span> | |
242 | + <Select | |
243 | + allowClear | |
244 | + style={{ width: 200, marginRight: 15 }} | |
245 | + placeholder="请选择支持类型" | |
246 | + onChange={(v) => setSearchParams({ | |
247 | + ...searchParams, | |
248 | + supportType: v ? Number(v) : undefined, | |
249 | + })} | |
250 | + > | |
251 | + {[1, 2].map((i) => ( | |
252 | + <Select.Option value={i} key={i}> | |
253 | + {SupportTypeEnum[i]} | |
254 | + </Select.Option> | |
255 | + ))} | |
256 | + </Select> | |
257 | + </div> | |
258 | + | |
259 | + <div> | |
260 | + {/* 激励类型 1正激励 2负激励 */} | |
261 | + <span style={{ marginLeft: 15 }}>激励类型:</span> | |
262 | + <Select | |
263 | + allowClear | |
264 | + style={{ width: 200, marginRight: 15 }} | |
265 | + placeholder="请选择支持类型" | |
266 | + onChange={(v) => setSearchParams({ | |
267 | + ...searchParams, | |
268 | + awardType: v ? Number(v) : undefined, | |
269 | + })} | |
270 | + > | |
271 | + {[1, 2].map((i) => ( | |
272 | + <Select.Option value={i} key={i}> | |
273 | + {AwardTypeEnum[i]} | |
274 | + </Select.Option> | |
275 | + ))} | |
276 | + </Select> | |
277 | + </div> | |
278 | + <div> | |
279 | + {/* 考核类型 1同一投资主体 2单一商家*/} | |
280 | + <span style={{ marginLeft: 15 }}>支持类型:</span> | |
281 | + <Select | |
282 | + allowClear | |
283 | + style={{ width: 200, marginRight: 15 }} | |
284 | + placeholder="请选择支持类型" | |
285 | + onChange={(v) => setSearchParams({ | |
286 | + ...searchParams, | |
287 | + subjectType: v ? Number(v) : undefined, | |
288 | + })} | |
289 | + > | |
290 | + {[1, 2].map((i) => ( | |
291 | + <Select.Option value={i} key={i}> | |
292 | + {SubjectTypeEnum[i]} | |
293 | + </Select.Option> | |
294 | + ))} | |
295 | + </Select> | |
296 | + </div> | |
297 | + <div style={{ marginTop: 20 }}> | |
298 | + <span>下零售日期范围:</span> | |
299 | + <RangePicker | |
300 | + allowClear | |
301 | + format="YYYY-MM-DD" | |
302 | + onChange={(v) => setSearchParams({ | |
303 | + ...searchParams, | |
304 | + rebateTimeBegin: v && v[0] && v[0].valueOf(), | |
305 | + rebateTimeEnd: v && v[1] && v[1].valueOf(), | |
306 | + })} | |
307 | + /> | |
308 | + </div> | |
309 | + | |
310 | + <Button | |
311 | + type="primary" | |
312 | + onClick={() => fetchTableList(searchParams)} | |
313 | + > | |
314 | + 查询 | |
315 | + </Button> | |
316 | + </Row> | |
317 | + <Table | |
318 | + loading={loading} | |
319 | + pagination={paginationConfig} | |
320 | + size="small" | |
321 | + rowKey="id" | |
322 | + scroll={{ y: 500 }} | |
323 | + dataSource={orderList} | |
324 | + columns={columns} | |
325 | + rowSelection={rowSelection} | |
326 | + /> | |
327 | + </Modal> | |
328 | + ); | |
329 | +} | ... | ... |
src/pages/stock/AllowanceConfirm/EditComfirm/index.less
0 → 100644
src/pages/stock/AllowanceConfirm/EditComfirm/index.tsx
1 | 1 | import React, { useEffect, useState } from "react"; |
2 | -import { Table, Card, Divider, Popconfirm, Row, Button, message, Upload, Result, Descriptions } from 'antd'; | |
3 | -import ComfirmTable from './Manufacturer'; | |
4 | -import RewardsList from './RewardsList'; | |
5 | -import PromotionConfig from './components/PromotionConfig'; | |
6 | -import { common } from '@/typing/common'; | |
7 | -import { getFidFile } from '@/utils'; | |
8 | -import { PlusOutlined } from '@ant-design/icons'; | |
9 | -import { commitRebateApi } from './api'; | |
10 | -import { PageHeaderWrapper } from '@ant-design/pro-layout'; | |
11 | -import { createStore } from '@/hooks/moz'; | |
12 | -import { UploadChangeParam, UploadFile } from 'antd/lib/upload/interface'; | |
13 | -import { history } from 'umi'; | |
14 | -import store from './store'; | |
2 | +import { | |
3 | + Table, | |
4 | + Card, | |
5 | + Divider, | |
6 | + Popconfirm, | |
7 | + Row, | |
8 | + Button, | |
9 | + message, | |
10 | + Upload, | |
11 | + Result, | |
12 | + Descriptions, | |
13 | + Tabs | |
14 | +} from "antd"; | |
15 | +import ComfirmTable from "./Manufacturer"; | |
16 | +import RewardsList from "./RewardsList"; | |
17 | +import PromotionConfig from "./components/PromotionConfig"; | |
18 | +import WaitConfirmList from "@/pages/stock/AllowanceConfirm/EditComfirm/components/waitConfirmLst"; | |
19 | +import { common } from "@/typing/common"; | |
20 | +import { getFidFile } from "@/utils"; | |
21 | +import { PlusOutlined, DoubleLeftOutlined, LeftCircleOutlined } from "@ant-design/icons"; | |
22 | +import { commitRebateApi, getSubsidyType, SubsidyTypeList } from "./api"; | |
23 | +import { PageHeaderWrapper } from "@ant-design/pro-layout"; | |
24 | +import { createStore } from "@/hooks/moz"; | |
25 | +import { UploadChangeParam, UploadFile } from "antd/lib/upload/interface"; | |
26 | +import { history } from "umi"; | |
27 | +import store from "./store"; | |
28 | +import './index.less'; | |
29 | +import useInitail from "@/hooks/useInitail"; | |
30 | +import { find } from "lodash"; | |
31 | +import rmb from '@/utils/rmb'; | |
15 | 32 | |
16 | -export const { Provider, useStore } = createStore(store); | |
33 | +const { TabPane } = Tabs; | |
17 | 34 | const { Column } = Table; |
18 | 35 | |
19 | -interface Props extends common.ConnectProps { | |
36 | +export const { Provider, useStore } = createStore(store); | |
37 | +interface Subsidy { | |
38 | + fundsName?: string; | |
39 | + rebateAmount?: number; | |
40 | + subsidyType?: number; | |
20 | 41 | } |
42 | +interface Props extends common.ConnectProps { } | |
43 | + | |
44 | +// 折让确认 | |
45 | +const dimensionMap = new Map([ | |
46 | + ["厂家补贴", 1], | |
47 | + ["厂家代收款", 2], | |
48 | + ["厂家促销", 3], | |
49 | + ["现金启票奖励", 4], | |
50 | +]); | |
51 | + | |
52 | +const awardType = { 1: "disCountOrder", 2: "rewardOrder" }; | |
21 | 53 | function Index(props: Props) { |
54 | + const { subsidyTypeList } = useStore(); | |
22 | 55 | const { match } = props; |
23 | 56 | const { id } = match.params; |
24 | 57 | const [addFileList, setAddFileList] = useState<UploadFile[]>([]); |
25 | - const { setId, data, loading, setVisible, setLoading, cancelSubsidy, saveLoading, detailError, setCurrentItem, setSaveLoading } = useStore(); | |
58 | + //选择待确认活动模块 | |
59 | + const [activityVisible, setActivityVisible] = useState<boolean>(false); | |
60 | + | |
61 | + const [defalutSubsidy, setDefaultSubsidy] = useState<Subsidy[]>([]); | |
62 | + | |
63 | + const { | |
64 | + readOnly, | |
65 | + setId, | |
66 | + data, | |
67 | + loading, | |
68 | + setVisible, | |
69 | + setLoading, | |
70 | + cancelSubsidy, | |
71 | + saveLoading, | |
72 | + detailError, | |
73 | + setCurrentItem, | |
74 | + setSaveLoading, | |
75 | + setRewardParams, | |
76 | + setDiscountParams, | |
77 | + } = useStore(); | |
26 | 78 | |
27 | 79 | useEffect(() => { |
80 | + if (subsidyTypeList.length > 0) { | |
81 | + const res = subsidyTypeList.map((item) => ({ | |
82 | + ...item, | |
83 | + fundsName: item.subsidyName, | |
84 | + rebateAmount: 0, | |
85 | + })); | |
86 | + setDefaultSubsidy([...res]); | |
87 | + } | |
88 | + }, [subsidyTypeList]); | |
89 | + | |
90 | + useEffect(() => { | |
91 | + if (data.subsidy && data.subsidy.length) { | |
92 | + const res1 = data.subsidy.filter((item) => | |
93 | + defalutSubsidy.find((y) => y.subsidyType === item.subsidyType) | |
94 | + ); | |
95 | + const res2 = defalutSubsidy.filter( | |
96 | + (item) => !data.subsidy.find((y) => y.subsidyType === item.subsidyType) | |
97 | + ); | |
98 | + const res = res1.concat(res2); | |
99 | + setDefaultSubsidy([...res]); | |
100 | + } | |
101 | + }, [data]); | |
102 | + useEffect(() => { | |
28 | 103 | setId(id); |
29 | 104 | }, [id]); |
30 | 105 | |
31 | 106 | useEffect(() => { |
32 | 107 | if (data.fid) { |
33 | - const img: any = data.fid.split(',').map((item: string, index: number) => ({ | |
34 | - uid: `${index}`, | |
35 | - name: "", | |
36 | - status: 'done', | |
37 | - url: '/api/file/show?fid=' + item, | |
38 | - response: { data: item, status: 'success' } | |
39 | - })); | |
108 | + const img: any = data.fid | |
109 | + .split(",") | |
110 | + .map((item: string, index: number) => ({ | |
111 | + uid: `${index}`, | |
112 | + name: "", | |
113 | + status: "done", | |
114 | + url: "/api/file/show?fid=" + item, | |
115 | + response: { data: item, status: "success" }, | |
116 | + })); | |
40 | 117 | setAddFileList(img); |
41 | 118 | } |
42 | 119 | }, [data.fid]); |
43 | 120 | |
44 | 121 | const _onChange = (info: UploadChangeParam<UploadFile<any>>) => { |
45 | - if (info.file.status === 'done') { | |
122 | + if (info.file.status === "done") { | |
46 | 123 | setAddFileList([...addFileList, info.file]); |
47 | 124 | } |
48 | 125 | }; |
49 | 126 | |
127 | + function callback(key) { | |
128 | + console.log(key); | |
129 | + } | |
130 | + | |
50 | 131 | function handSubmit() { |
51 | - if (data.promotionList && data.promotionList.find(i => i.actualRebateAmount == undefined)) { | |
52 | - message.error("请确认厂家促销折让金额后提交", 5); | |
53 | - return; | |
54 | - } | |
132 | + // if ( | |
133 | + // data.promotionList && | |
134 | + // data.promotionList.find((i) => i.actualRebateAmount == undefined) | |
135 | + // ) { | |
136 | + // message.error("请确认厂家促销折让金额后提交", 5); | |
137 | + // return; | |
138 | + // } | |
55 | 139 | const pa = { |
56 | 140 | id, |
57 | - fid: addFileList.map(i => i.response.data).join(','), | |
141 | + fid: addFileList.map((i) => i.response.data).join(","), | |
58 | 142 | }; |
59 | 143 | setSaveLoading(true); |
60 | - commitRebateApi(pa).then(res => { | |
61 | - setSaveLoading(false); | |
62 | - message.success("操作成功"); | |
63 | - setSaveLoading(false); | |
64 | - history.goBack(); | |
65 | - }).catch(e => { | |
66 | - setSaveLoading(false); | |
67 | - message.error(e.message); | |
68 | - } | |
69 | - ); | |
144 | + commitRebateApi(pa) | |
145 | + .then((res) => { | |
146 | + setSaveLoading(false); | |
147 | + message.success("操作成功"); | |
148 | + setSaveLoading(false); | |
149 | + history.goBack(); | |
150 | + }) | |
151 | + .catch((e) => { | |
152 | + setSaveLoading(false); | |
153 | + message.error(e.message); | |
154 | + }); | |
70 | 155 | } |
71 | 156 | |
72 | 157 | function handleDelete(record: FvmAllowance.FundsItemList) { |
73 | 158 | record.rebateFundsType && cancelSubsidy(record.rebateFundsType); |
74 | 159 | } |
160 | + | |
75 | 161 | return ( |
76 | 162 | <PageHeaderWrapper title="折让确认管理"> |
77 | 163 | <Card> |
... | ... | @@ -80,111 +166,222 @@ function Index(props: Props) { |
80 | 166 | status="warning" |
81 | 167 | title={detailError} |
82 | 168 | extra={ |
83 | - <Button type="primary" key="console" onClick={() => setLoading(true)}> | |
169 | + <Button | |
170 | + type="primary" | |
171 | + key="console" | |
172 | + onClick={() => setLoading(true)} | |
173 | + > | |
84 | 174 | 刷新 |
85 | 175 | </Button> |
86 | 176 | } |
87 | 177 | /> |
88 | 178 | ) : ( |
89 | - <div style={{ paddingLeft: '10%', paddingRight: '10%' }}> | |
179 | + <div style={{ paddingLeft: "10%", paddingRight: "10%" }}> | |
90 | 180 | <Descriptions |
91 | 181 | style={{ marginBottom: 35 }} |
92 | - title={data.totalAmount ? `折让合计: ${data.totalAmount || 0} 元` : ''} | |
182 | + title={ | |
183 | + <Row justify="space-between"> | |
184 | + <div> | |
185 | + {data.totalAmount ? `折让合计: ${rmb.p(data.totalAmount || 0)} 元` : ""} | |
186 | + </div> | |
187 | + <Button | |
188 | + type="link" | |
189 | + size="large" | |
190 | + onClick={() => history.goBack()} | |
191 | + loading={saveLoading} | |
192 | + // icon={<DoubleLeftOutlined />} | |
193 | + icon={<LeftCircleOutlined />} | |
194 | + // style={{ marginTop: -30 }} | |
195 | + > | |
196 | + 返回列表 | |
197 | + </Button> | |
198 | + </Row> | |
199 | + } | |
93 | 200 | bordered |
94 | 201 | column={{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }} |
95 | 202 | > |
96 | - <Descriptions.Item label="月度">{`${data.year || ''}年${data.month || ''}月`}</Descriptions.Item> | |
97 | - <Descriptions.Item label="品牌">{data.brandName}</Descriptions.Item> | |
98 | - <Descriptions.Item label="商家">{data.dealerName}</Descriptions.Item> | |
99 | - <Descriptions.Item label="新车采购供应商">{data.factoryName}</Descriptions.Item> | |
203 | + <Descriptions.Item label="月度"> | |
204 | + {`${data.year || ""}年${data.month || ""}月`} | |
205 | + </Descriptions.Item> | |
206 | + <Descriptions.Item label="品牌"> | |
207 | + {data.brandName} | |
208 | + </Descriptions.Item> | |
209 | + <Descriptions.Item label="商家"> | |
210 | + {data.dealerName} | |
211 | + </Descriptions.Item> | |
212 | + <Descriptions.Item label="新车采购供应商"> | |
213 | + {data.factoryName} | |
214 | + </Descriptions.Item> | |
100 | 215 | </Descriptions> |
101 | - <h3>1:补贴折让</h3> | |
102 | 216 | |
103 | - <Table | |
104 | - dataSource={data.fundsVos} | |
105 | - pagination={false} | |
106 | - bordered | |
107 | - rowKey="fundsName" | |
108 | - loading={loading} | |
109 | - > | |
110 | - <Column title="补贴名称" width="30%" dataIndex="fundsName" align="center" /> | |
111 | - <Column title="折让金额(元)" dataIndex="rebateAmount" align="center" /> | |
112 | - <Column title="实际折让金额(元)" dataIndex="actualRebateAmount" align="center" /> | |
113 | - <Column title="状态" dataIndex="status" align="center" render={(text) => ["待确认", "已确认"][text - 1]} /> | |
114 | - <Column | |
115 | - title="操作" | |
116 | - align="center" | |
117 | - width={150} | |
118 | - render={(text, record: FvmAllowance.FundsItemList) => ( | |
119 | - <> | |
120 | - {record.status == 1 && record.rebateFundsType !== 4 && data.status === 1 ? ( | |
121 | - <a onClick={() => { setVisible(true); setCurrentItem(record); }}>确认清单{'>'}</a> | |
122 | - ) : ( | |
123 | - <> | |
124 | - <a onClick={() => { setVisible(true); setCurrentItem(record); }}>查看清单</a> | |
125 | - {data.status === 1 ? ( | |
126 | - <> | |
127 | - <Divider type="vertical" /> | |
128 | - <Popconfirm | |
129 | - title={`是否撤销【${record.fundsName}】配置?`} | |
130 | - onConfirm={() => handleDelete(record)} | |
131 | - okText="确定" | |
132 | - cancelText="取消" | |
133 | - > | |
134 | - <a href="">撤销</a> | |
135 | - </Popconfirm> | |
136 | - </> | |
137 | - ) : null} | |
138 | - </> | |
217 | + <Tabs size="large" defaultActiveKey="1" onChange={callback}> | |
218 | + <TabPane tab="厂家补贴" key="1"> | |
219 | + <Table | |
220 | + dataSource={defalutSubsidy} | |
221 | + pagination={false} | |
222 | + bordered | |
223 | + rowKey="fundsName" | |
224 | + loading={loading} | |
225 | + > | |
226 | + <Column | |
227 | + title="补贴类型" | |
228 | + width="30%" | |
229 | + dataIndex="fundsName" | |
230 | + align="center" | |
231 | + /> | |
232 | + <Column | |
233 | + title="应折让金额(元)" | |
234 | + dataIndex="rebateAmount" | |
235 | + align="center" | |
236 | + /> | |
237 | + <Column | |
238 | + title="操作" | |
239 | + align="center" | |
240 | + width={150} | |
241 | + render={(text, record: FvmAllowance.SubsidyList) => ( | |
242 | + <a | |
243 | + onClick={() => { | |
244 | + setVisible(true); | |
245 | + setCurrentItem({ | |
246 | + ...record, | |
247 | + dimension: dimensionMap.get("厂家补贴"), | |
248 | + }); | |
249 | + }} | |
250 | + > | |
251 | + {`${readOnly ? "查看" : "确认"}清单 >`} | |
252 | + </a> | |
139 | 253 | )} |
140 | - </> | |
141 | - )} | |
142 | - /> | |
143 | - </Table> | |
144 | - <h3 style={{ marginTop: 60, marginBottom: 20 }}>2:厂家促销折让</h3> | |
145 | - <PromotionConfig /> | |
146 | - | |
147 | - {[1, 2].map(i => { | |
148 | - return <RewardsList key={`rewads+${i}`} rewardsType={i} />; | |
149 | - })} | |
150 | - <h3 style={{ marginTop: 40 }}><span style={{ color: 'red' }}>*</span>4:上传红字发票</h3> | |
151 | - <Upload | |
152 | - style={{ width: '100%' }} | |
153 | - accept="image/*" | |
154 | - fileList={data.status !== 1 ? addFileList : undefined} | |
155 | - defaultFileList={data.status === 1 ? addFileList : undefined} | |
156 | - disabled={data.status !== 1} | |
157 | - action="api/file/upload" | |
158 | - listType="picture-card" | |
159 | - onPreview={(file: UploadFile) => getFidFile(file.response.data || '')} | |
160 | - onChange={info => _onChange(info)} | |
161 | - onRemove={file => { | |
162 | - setAddFileList(addFileList.filter(_file => _file.response.data !== file.response.data)); | |
163 | - }} | |
164 | - > | |
165 | - {data.status === 1 && ( | |
254 | + /> | |
255 | + </Table> | |
256 | + </TabPane> | |
257 | + <TabPane tab="厂家代收款" key="2"> | |
258 | + <div> | |
259 | + <Descriptions layout="horizontal"> | |
260 | + <Descriptions.Item label="应折让金额" span={3}> | |
261 | + {data.inwardCollection?.rebateAmount || 0} | |
262 | + </Descriptions.Item> | |
263 | + <Descriptions.Item label="实际折让金额" span={3}> | |
264 | + {data.inwardCollection?.actualRebateAmount || 0} | |
265 | + </Descriptions.Item> | |
266 | + </Descriptions> | |
267 | + <a | |
268 | + onClick={() => { | |
269 | + setVisible(true); | |
270 | + setCurrentItem({ | |
271 | + ...data.inwardCollection, | |
272 | + dimension: dimensionMap.get("厂家代收款"), | |
273 | + }); | |
274 | + }} | |
275 | + > | |
276 | + {`${readOnly ? "查看" : "确认"}清单 >`} | |
277 | + </a> | |
278 | + </div> | |
279 | + </TabPane> | |
280 | + <TabPane tab="厂家促销" key="3"> | |
281 | + <PromotionConfig dimension={dimensionMap.get("厂家促销") || 3} /> | |
282 | + </TabPane> | |
283 | + <TabPane tab="现金启票奖励" key="4"> | |
166 | 284 | <div> |
167 | - <PlusOutlined /> | |
168 | - <div style={{ marginTop: 8 }}>上传</div> | |
285 | + {/* <h3 style={{ marginTop: 60, marginBottom: 20 }}> | |
286 | + 4:现金启票奖励 | |
287 | + </h3> */} | |
288 | + <Descriptions layout="horizontal"> | |
289 | + <Descriptions.Item label="应折让金额" span={3}> | |
290 | + {data.cashTicket?.rebateAmount || 0} | |
291 | + </Descriptions.Item> | |
292 | + <Descriptions.Item label="实际折让金额" span={3}> | |
293 | + {data.cashTicket?.actualRebateAmount || 0} | |
294 | + </Descriptions.Item> | |
295 | + </Descriptions> | |
296 | + <a | |
297 | + onClick={() => { | |
298 | + setVisible(true); | |
299 | + setCurrentItem({ | |
300 | + ...data.inwardCollection, | |
301 | + dimension: dimensionMap.get("现金启票奖励"), | |
302 | + }); | |
303 | + }} | |
304 | + > | |
305 | + {/* {`确认清单 >`} */} | |
306 | + {`${readOnly ? "查看" : "确认"}清单 >`} | |
307 | + </a> | |
169 | 308 | </div> |
170 | - )} | |
171 | - </Upload> | |
309 | + </TabPane> | |
310 | + <TabPane tab="奖励扣款清单" key="5"> | |
311 | + {[1, 2].map((i) => { | |
312 | + return <RewardsList key={`rewads+${i}`} rewardsType={i} />; | |
313 | + })} | |
314 | + </TabPane> | |
315 | + <TabPane tab="上传红字发票" key="6"> | |
316 | + <Upload | |
317 | + style={{ width: "100%" }} | |
318 | + accept="image/*" | |
319 | + fileList={data.status !== 1 ? addFileList : undefined} | |
320 | + defaultFileList={data.status === 1 ? addFileList : undefined} | |
321 | + disabled={data.status !== 1} | |
322 | + action="api/file/upload" | |
323 | + listType="picture-card" | |
324 | + onPreview={(file: UploadFile) => | |
325 | + getFidFile(file.response.data || "") | |
326 | + } | |
327 | + onChange={(info) => _onChange(info)} | |
328 | + onRemove={(file) => { | |
329 | + setAddFileList( | |
330 | + addFileList.filter( | |
331 | + (_file) => _file.response.data !== file.response.data | |
332 | + ) | |
333 | + ); | |
334 | + }} | |
335 | + > | |
336 | + {data.status === 1 && ( | |
337 | + <div> | |
338 | + <PlusOutlined /> | |
339 | + <div style={{ marginTop: 8 }}>上传</div> | |
340 | + </div> | |
341 | + )} | |
342 | + </Upload> | |
343 | + </TabPane> | |
344 | + </Tabs> | |
172 | 345 | </div> |
173 | 346 | )} |
347 | + | |
174 | 348 | <ComfirmTable /> |
175 | 349 | <Row justify="center" style={{ marginTop: 100 }}> |
176 | - <Button type="default" size="large" onClick={() => history.goBack()} loading={saveLoading} style={{ marginRight: 50, width: 200 }}>返回</Button> | |
350 | + {/* <Button | |
351 | + type="default" | |
352 | + size="large" | |
353 | + onClick={() => history.goBack()} | |
354 | + loading={saveLoading} | |
355 | + style={{ marginRight: 50, width: 200 }} | |
356 | + > | |
357 | + 返回 | |
358 | + </Button> */} | |
177 | 359 | <Popconfirm |
178 | 360 | title="确定完成该折让配置,提交后不可更改?" |
179 | 361 | onConfirm={handSubmit} |
180 | 362 | okText="确定" |
181 | 363 | cancelText="取消" |
182 | 364 | > |
183 | - {data.status === 1 ? (<Button type="primary" size="large" style={{ width: 200 }} loading={saveLoading}>提交折让</Button>) : <div />} | |
365 | + {data.status === 1 ? ( | |
366 | + <Button | |
367 | + type="primary" | |
368 | + size="large" | |
369 | + style={{ width: 200 }} | |
370 | + loading={saveLoading} | |
371 | + > | |
372 | + 提交折让 | |
373 | + </Button> | |
374 | + ) : ( | |
375 | + <div /> | |
376 | + )} | |
184 | 377 | </Popconfirm> |
185 | 378 | </Row> |
186 | 379 | </Card> |
187 | 380 | </PageHeaderWrapper> |
188 | 381 | ); |
189 | 382 | } |
190 | -export default (props: Props) => <Provider><Index {...props} /></Provider>; | |
191 | 383 | \ No newline at end of file |
384 | +export default (props: Props) => ( | |
385 | + <Provider> | |
386 | + <Index {...props} /> | |
387 | + </Provider> | |
388 | +); | ... | ... |