Commit 4d81c8500d3e0a49da236dd63be4b986ea2251cb
1 parent
227df3b1
分期优惠券抵扣设置
Showing
3 changed files
with
102 additions
and
1 deletions
config/routers/order3.ts
... | ... | @@ -206,8 +206,12 @@ export default [ |
206 | 206 | path: "/order3/retailTaskConfiguration", |
207 | 207 | component: "./order3/RetailTaskConfiguration", |
208 | 208 | }, |
209 | - { // 附加值任务配置 | |
209 | + { // 附加值任务配置 | |
210 | 210 | path: "/order3/addValueTaskConfig", |
211 | 211 | component: "./order3/AddValueTaskConfig", |
212 | 212 | }, |
213 | + {//分期优惠券抵扣设置 | |
214 | + path: "/order3/orderSetting/loanDiscountSetting", | |
215 | + component: "./order3/OrderSetting/LoanDiscountSetting", | |
216 | + }, | |
213 | 217 | ]; |
214 | 218 | \ No newline at end of file | ... | ... |
src/pages/order3/OrderSetting/LoanDiscountSetting/api.ts
0 → 100644
1 | +import { http } from '@/typing/http'; | |
2 | +import request from '@/utils/request'; | |
3 | +import { ORDER3 } from '@/utils/host'; | |
4 | + | |
5 | +interface Detail { | |
6 | + financeServiceFee?: boolean // 服务费抵扣 | |
7 | + mortgageRegisterFee?: boolean // 抵押上户费抵扣 | |
8 | + removeMortgageFee?: boolean // 解除抵押费抵扣 | |
9 | + gpsFee?: boolean // GPS费抵扣 | |
10 | +} | |
11 | +/** 查询分期优惠劵抵扣配置*/ | |
12 | +export function getSettingApi(): http.PromiseResp<Detail> { | |
13 | + return request.get(`${ORDER3}/erp/system/loan/coupon/deduct/config`); | |
14 | +} | |
15 | + | |
16 | +/** 保存分期优惠劵抵扣配置*/ | |
17 | +export function saveSettingApi(params?: Detail): http.PromiseResp<Detail> { | |
18 | + return request.post(`${ORDER3}/erp/system/loan/coupon/deduct/config/save`, params); | |
19 | +} | |
0 | 20 | \ No newline at end of file | ... | ... |
src/pages/order3/OrderSetting/LoanDiscountSetting/index.tsx
0 → 100644
1 | +import React, { useState, useEffect } from 'react'; | |
2 | +import { Card, Button, message, Checkbox } from 'antd'; | |
3 | +import { PageHeaderWrapper } from '@ant-design/pro-layout'; | |
4 | +import { getSettingApi, saveSettingApi } from './api'; | |
5 | +import { debounce } from 'lodash'; | |
6 | + | |
7 | +export default function InsuranceSetting() { | |
8 | + const option = [ | |
9 | + {label: "服务费", value: 'financeServiceFee'}, | |
10 | + {label: "抵押上户费", value: 'mortgageRegisterFee'}, | |
11 | + {label: "解除抵押费", value: 'removeMortgageFee'}, | |
12 | + {label: "GPS费", value: 'gpsFee'}]; | |
13 | + const [checked, setChecked] = useState<string[]>([]); | |
14 | + const [loading, setLoading] = useState<boolean>(false); | |
15 | + const [disabled, setDisabled] = useState<boolean>(false); | |
16 | + | |
17 | + useEffect(() => { | |
18 | + getData(); | |
19 | + }, []); | |
20 | + | |
21 | + function getData() { | |
22 | + setLoading(true); | |
23 | + getSettingApi() | |
24 | + .then(res => { | |
25 | + const data = res.data; | |
26 | + if (data) { | |
27 | + let _check = []; | |
28 | + for (let k in data) { | |
29 | + if (data[k]) { | |
30 | + _check.push(`${k}`); | |
31 | + } | |
32 | + } | |
33 | + setChecked(_check); | |
34 | + setLoading(false); | |
35 | + } | |
36 | + }) | |
37 | + .catch(e => { | |
38 | + message.error(e.message); | |
39 | + setLoading(false); | |
40 | + }); | |
41 | + } | |
42 | + | |
43 | + function onChange(value?: any) { | |
44 | + value && setChecked(value); | |
45 | + } | |
46 | + | |
47 | + const onSubmit = () => { | |
48 | + setDisabled(true); | |
49 | + const params = { | |
50 | + financeServiceFee: checked.includes('financeServiceFee'), | |
51 | + mortgageRegisterFee: checked.includes('mortgageRegisterFee'), | |
52 | + removeMortgageFee: checked.includes('removeMortgageFee'), | |
53 | + gpsFee: checked.includes('gpsFee') | |
54 | + }; | |
55 | + saveSettingApi(params) | |
56 | + .then(res => { | |
57 | + message.success(res.result); | |
58 | + getData(); | |
59 | + setDisabled(false); | |
60 | + }) | |
61 | + .catch(e => { | |
62 | + message.error(e.message); | |
63 | + setDisabled(false); | |
64 | + }); | |
65 | + } | |
66 | + return ( | |
67 | + <PageHeaderWrapper loading={loading} title="分期优惠券可抵扣订单款项设置"> | |
68 | + <Card> | |
69 | + <div style={{marginBottom: 20}}> | |
70 | + <Checkbox.Group defaultValue={checked} options={option} onChange={(value) => onChange(value)} /> | |
71 | + </div> | |
72 | + <div> | |
73 | + <Button loading={disabled} onClick={debounce(onSubmit, 380)} type="primary">确定</Button> | |
74 | + </div> | |
75 | + </Card> | |
76 | + </PageHeaderWrapper> | |
77 | + ); | |
78 | +} | |
0 | 79 | \ No newline at end of file | ... | ... |