Commit 3ddf9fd3190534f97a2ac05dcfd98e1038d52e13

Authored by 徐欣
1 parent a1d06749

feat(carinsur): 保险返利保险明细字段显示优化

src/pages/carinsur/Rebate/api.ts
... ... @@ -120,6 +120,19 @@ export interface ListV0 {
120 120 rebateAccountList?: rebateAccountList[]; // 资金账户信息
121 121 fid?: string;
122 122 approvalOrderNo?: string;
  123 + daiRebateMethod: number; // 驾意险返利方式
  124 + tradTciRebateRate: number;
  125 + newTciRebateRate: number;
  126 + tradVciRebateRate: number;
  127 + newVciRebateRate: number;
  128 + repairMarginRebateRate: number;
  129 + daiFixedRebateRate: number;
  130 + vciChallengeRebateRate: number;
  131 + tradVciChallengeCalRate: number;
  132 + tradVciChallengeRebateAmount: number;
  133 + newVciChallengeCalRate: number;
  134 + repairRateRepair: number;
  135 + repairRateSale: number;
123 136 }
124 137  
125 138 export interface rebateAccountList {
... ...
src/pages/carinsur/Rebate/subpages/RebateConfirm/Second/components/Card.tsx
1   -import React, { CSSProperties } from 'react';
2   -import { QuestionCircleOutlined } from '@ant-design/icons';
3   -import { Tooltip } from 'antd';
  1 +import React from 'react';
  2 +import { Row, Tag } from 'antd';
  3 +import st from './card.less';
4 4  
5 5 interface Props {
6 6 value?: number;
  7 + title: string;
7 8 unit?: string;
8   - description?: string;
9   - style?: CSSProperties;
10   - valueStyle?: CSSProperties;
11   - onClick?: Function;
12   - tip?: string;
  9 + type?: 1 | 2;
  10 + tags?: string[];
  11 + ratio?: number;
  12 + centerData?: any;
  13 + rightData?: any;
  14 + centerDataEle?: React.ReactNode;
  15 + rightDataEle?: React.ReactNode;
  16 + onClick?: () => void;
13 17 }
14 18 export default function Card(props: Props) {
15   - const { value, unit = '元', description, style, valueStyle, onClick, tip } = props;
  19 + const { value = 0.0, title, unit = '万元', type = 1, tags = [], ratio, centerData, rightData, centerDataEle, rightDataEle, onClick } = props;
16 20 return (
17   - <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', ...style }}>
18   - <div>
19   - <span
20   - style={{ fontSize: 14, fontWeight: 'bold', color: onClick ? '#4189FD' : '#333333', cursor: 'pointer', ...valueStyle }}
21   - onClick={() => onClick?.()}
22   - >
23   - {value ? value.toFixed(2) : 0}
24   - </span>
25   - <span style={{ color: '#999999', fontSize: 12 }}>{`(${unit})`}</span>
  21 + <Row align="middle" justify="space-between" className={st.card} onClick={onClick}>
  22 + <div className={st.left}>
  23 + <div>
  24 + <span className={st.spanAmount}>{value}</span>
  25 + <span className={st.spanUnit}>({unit})</span>
  26 + </div>
  27 + <div className={st.spanTitle}>{title}</div>
  28 + {tags?.map((i) => (
  29 + <div key={i}>
  30 + <Tag>{i}</Tag>
  31 + </div>
  32 + ))}
  33 + {ratio && <div style={{ fontSize: 16, color: '#999999' }}>返利比例:{ratio}%</div>}
26 34 </div>
27   - <div>
28   - {description}
29   - {!!tip && (
30   - <Tooltip title={tip} placement="right" style={{ color: '#CCCCCC' }}>
31   - <QuestionCircleOutlined style={{ marginLeft: 5 }} />
32   - </Tooltip>
33   - )}
34   - </div>
35   - </div>
  35 + {type === 1 && centerData && (
  36 + <div className={st.center}>
  37 + <div>
  38 + 燃油车出保:
  39 + <span className={st.spanOut}>
  40 + {centerData.data1}
  41 + {unit}
  42 + </span>
  43 + </div>
  44 + <div>
  45 + 燃油车返利比例:<span className={st.spanRatio}>{centerData.data2 * 100}%</span>
  46 + </div>
  47 + <div>
  48 + 燃油车返利:
  49 + <span className={st.spanIn}>
  50 + {centerData.data3}
  51 + {unit}
  52 + </span>
  53 + </div>
  54 + </div>
  55 + )}
  56 + {type === 1 && rightData && (
  57 + <div className={st.right}>
  58 + <div>
  59 + 新能源车出保:
  60 + <span className={st.spanOut}>
  61 + {rightData.data1}
  62 + {unit}
  63 + </span>
  64 + </div>
  65 + <div>
  66 + 新能源车返利比例:<span className={st.spanRatio}>{rightData.data2 * 100}%</span>
  67 + </div>
  68 + <div>
  69 + 新能源车返利:
  70 + <span className={st.spanIn}>
  71 + {rightData.data3}
  72 + {unit}
  73 + </span>
  74 + </div>
  75 + </div>
  76 + )}
  77 + {type === 2 && centerData && (
  78 + <div className={st.center}>
  79 + <div>
  80 + 返利比例:<span className={st.spanRatio}>{centerData.data1 * 100}%</span>
  81 + </div>
  82 + <div>
  83 + 送修差额合计:
  84 + <span className={st.spanIn}>
  85 + {centerData.data2}
  86 + {unit}
  87 + </span>
  88 + </div>
  89 + <div>
  90 + 签约送修比:<span className={st.spanRatio}>{centerData.data3}</span>
  91 + </div>
  92 + </div>
  93 + )}
  94 + {type === 2 && rightData && (
  95 + <div className={st.right}>
  96 + <div>
  97 + 出保金额合计:
  98 + <span className={st.spanOut}>
  99 + {rightData.data1}
  100 + {unit}
  101 + </span>
  102 + </div>
  103 + <div>
  104 + 送修金额合计:
  105 + <span className={st.spanOut}>
  106 + {rightData.data2}
  107 + {unit}
  108 + </span>
  109 + </div>
  110 + </div>
  111 + )}
  112 + {centerDataEle && <div className={st.center}>{centerDataEle}</div>}
  113 + {rightDataEle && <div className={st.center}>{rightDataEle}</div>}
  114 + </Row>
36 115 );
37 116 }
... ...
src/pages/carinsur/Rebate/subpages/RebateConfirm/Second/components/card.less 0 → 100644
  1 +.card {
  2 + background-color: #fff;
  3 + border-radius: 6px;
  4 + padding: 15px 20px;
  5 +
  6 + .left, .center, .right {
  7 + color: #666;
  8 + font-size: 16px;
  9 + }
  10 + .left {
  11 + width: 20%;
  12 + text-align: left;
  13 + }
  14 + .center, .right {
  15 + width: 40%;
  16 + text-align: left;
  17 + }
  18 + .spanOut {
  19 + color: #1589FF;
  20 + font-weight: 700;
  21 + }
  22 + .spanIn {
  23 + color: #666;
  24 + font-weight: 700;
  25 + }
  26 + .spanAmount {
  27 + color: #FF8B00;
  28 + font-size: 24px;
  29 + font-weight: 700;
  30 + }
  31 + .spanTitle {
  32 + color: #333333;
  33 + font-size: 16px;
  34 + font-weight: 700;
  35 + }
  36 + .spanUnit {
  37 + color: #999999;
  38 + font-size: 14px;
  39 + }
  40 +}
0 41 \ No newline at end of file
... ...
src/pages/carinsur/Rebate/subpages/RebateConfirm/Second/index.less
1 1 .container {
2   - margin-top: 45px;
3   -
4   - .card {
5   - display: flex;
6   - margin-bottom: 50px;
7   -
8   - .item {
9   - display: grid;
10   - flex: 1;
11   - grid-template-rows: repeat(3, 1fr);
12   - grid-template-columns: repeat(2, 1fr);
13   - gap: 5px;
14   - border-left: 1px solid #ccc;
15   - &:first-child {
16   - border-left: none;
17   - }
18   - }
19   -
20   - .ant-divider-vertical {
21   - height: auto;
22   - background-color: #999;
23   - }
  2 + .item {
  3 + background-color: #F4F4F4;
  4 + padding: 15px;
  5 + display: grid;
  6 + flex: 1;
  7 + grid-template-rows: repeat(3, 1fr);
  8 + grid-template-columns: repeat(2, 1fr);
  9 + gap: 20px;
24 10 }
25 11 .rebateinfo {
26 12 margin-top: 20px;
... ...
src/pages/carinsur/Rebate/subpages/RebateConfirm/Second/index.tsx
... ... @@ -2,16 +2,24 @@ import React, { useState } from &#39;react&#39;;
2 2 import rebateStore from '../store';
3 3 import { observer } from 'mobx-react-lite';
4 4 import Card from './components/Card';
5   -import { Divider, InputNumber, Form, Input, Button } from 'antd';
  5 +import { Divider, InputNumber, Form, Input, Button, Tabs, Row } from 'antd';
6 6 import AccountChoose from './components/AccountChoose';
7 7 import { history } from 'umi';
8 8 import styles from './index.less';
  9 +import st from './components/card.less';
9 10 import rmb from '@/utils/rmb';
10 11 import FeeweeUploadAttachment from '@/components/FeeweeUploadAttachment';
11 12 import { UploadOutlined } from '@ant-design/icons';
12 13  
13 14 const TextArea = Input.TextArea;
14 15  
  16 +enum DaiRebateMethod {
  17 + '不返利' = 1,
  18 + '计入商业险',
  19 + '固定比例返利',
  20 + '保费阶梯返利',
  21 +}
  22 +
15 23 interface Props {
16 24 form: any;
17 25 }
... ... @@ -30,29 +38,123 @@ function Index({ form }: Props) {
30 38 }
31 39 };
32 40  
33   - return (
34   - <div className={styles.container}>
35   - <div className={styles.card}>
36   - <div className={styles.item} style={{ flex: 1.1 }}>
  41 + const TabItems = [
  42 + {
  43 + key: '1',
  44 + label: '返利明细',
  45 + children: (
  46 + <div className={styles.item}>
37 47 <Card
38 48 value={data?.tciRebateAmount}
39   - description="交强险返利"
40   - style={{ gridColumnStart: 1, gridColumnEnd: 3 }}
41   - valueStyle={{ fontSize: 16 }}
  49 + title="交强险返利"
  50 + tags={data?.afterSettleInsuranceTypes?.includes('1') ? ['税后计算'] : []}
  51 + centerData={{
  52 + data1: data?.tradTciOutputValue,
  53 + data2: data?.tradTciRebateRate,
  54 + data3: data?.tradTciRebateAmount,
  55 + }}
  56 + rightData={{
  57 + data1: data?.newTciOutputValue,
  58 + data2: data?.newTciRebateRate,
  59 + data3: data?.newTciRebateAmount,
  60 + }}
  61 + />
  62 + <Card
  63 + value={data?.vciRebateAmount}
  64 + title="商业险返利"
  65 + tags={data?.afterSettleInsuranceTypes?.includes('2') ? ['税后计算'] : []}
  66 + centerData={{
  67 + data1: data?.tradVciOutputValue,
  68 + data2: data?.tradVciRebateRate,
  69 + data3: data?.tradVciRebateAmount,
  70 + }}
  71 + rightData={{
  72 + data1: data?.newVciOutputValue,
  73 + data2: data?.newVciRebateRate,
  74 + data3: data?.newVciRebateAmount,
  75 + }}
42 76 />
43   - <Card value={data?.tradTciRebateAmount} description="燃油车交强险返利" tip={data?.tradTciRebateCalFormula} />
44   - <Card value={data?.newTciRebateAmount} description="新能源车交强险返利" tip={data?.newTciRebateCalFormula} />
  77 + {/* 【不返利】不显示 */}
  78 + {data?.daiRebateMethod === 2 && (
  79 + <Card
  80 + value={data?.daiRebateAmount}
  81 + title="驾意险返利 todo"
  82 + tags={[DaiRebateMethod[data?.daiRebateMethod ?? 1]]}
  83 + centerData={{
  84 + data1: data?.tradVciOutputValue, // todo
  85 + data2: data?.tradVciRebateRate,
  86 + data3: data?.tradVciRebateAmount, // todo
  87 + }}
  88 + rightData={{
  89 + data1: data?.newVciOutputValue, // todo
  90 + data2: data?.newVciRebateRate,
  91 + data3: data?.newVciRebateAmount, // todo
  92 + }}
  93 + />
  94 + )}
  95 + {(data?.daiRebateMethod === 3 || data?.daiRebateMethod === 4) && (
  96 + <Card
  97 + value={data?.daiRebateAmount}
  98 + title="驾意险返利"
  99 + tags={[DaiRebateMethod[data?.daiRebateMethod ?? 1]]}
  100 + centerDataEle={
  101 + <div>
  102 + 出保:
  103 + <span className={st.spanOut}>{data.daiRebateAmount}</span>
  104 + </div>
  105 + }
  106 + rightDataEle={
  107 + data?.daiRebateMethod === 3 ? (
  108 + <div>
  109 + 返利比例:
  110 + <span className={st.spanOut}>{data.daiFixedRebateRate}</span>
  111 + </div>
  112 + ) : (
  113 + <></>
  114 + )
  115 + }
  116 + />
  117 + )}
45 118 <Card
46   - value={data?.tradTciOutputValue}
47   - description="燃油车交强险保费"
48   - onClick={() => history.push(`/angel/insurancerebate/insurancePolicy?rebateId=${data?.id}&carType=1&insuranceType=1`)}
  119 + value={data?.repairMarginRebateAmount}
  120 + title="送修差额返利"
  121 + type={2}
  122 + centerData={{
  123 + data1: data?.repairMarginRebateRate,
  124 + data2: data?.repairMarginRebateAmount, // todo
  125 + data3: `${data?.repairRateRepair}:${data?.repairRateSale}`,
  126 + }}
  127 + rightData={{
  128 + data1: data?.saleAmount,
  129 + data2: data?.repairAmount,
  130 + }}
  131 + // onClick={() => history.push(`/angel/insurancerebate/insurancePolicy?rebateId=${data?.id}&carType=1&insuranceType=1`)}
49 132 />
50 133 <Card
51   - value={data?.newTciOutputValue}
52   - description="新能源车交强险保费"
53   - onClick={() => history.push(`/angel/insurancerebate/insurancePolicy?rebateId=${data?.id}&carType=2&insuranceType=1`)}
  134 + value={data?.vciChallengeRebateAmount}
  135 + title="商业险挑战返利"
  136 + ratio={data?.vciChallengeRebateRate}
  137 + centerData={{
  138 + data1: data?.tradVciOutputValue,
  139 + data2: data?.tradVciChallengeCalRate,
  140 + data3: data?.tradVciChallengeRebateAmount,
  141 + }}
  142 + rightData={{
  143 + data1: data?.newVciOutputValue,
  144 + data2: data?.newVciChallengeCalRate,
  145 + data3: data?.newVciChallengeRebateAmount,
  146 + }}
  147 + // onClick={() => history.push(`/angel/insurancerebate/insurancePolicy?rebateId=${data?.id}&carType=2&insuranceType=1`)}
54 148 />
55 149 </div>
  150 + ),
  151 + },
  152 + ];
  153 +
  154 + return (
  155 + <div className={styles.container}>
  156 + <Tabs type="card" items={TabItems} />
  157 + {/* <div className={styles.card}>
56 158 <div className={styles.item} style={{ flex: 1.1 }}>
57 159 <Card
58 160 value={data?.vciRebateAmount}
... ... @@ -112,7 +214,7 @@ function Index({ form }: Props) {
112 214 <Card value={data?.tradVciChallengeRebateAmount} description="燃油车商业险挑战返利" tip={data?.tradVciChallengeRebateCalFormula} />
113 215 <Card value={data?.newVciChallengeRebateAmount} description="新能源车商业险挑战返利" tip={data?.newVciChallengeRebateCalFormula} />
114 216 </div>
115   - </div>
  217 + </div> */}
116 218 <div>
117 219 <Divider orientation="left" orientationMargin="0" />
118 220 <div style={{ fontWeight: 'bold', fontSize: 20, color: '#333', marginTop: 30, marginBottom: 20 }}>
... ...
src/pages/carinsur/Rebate/subpages/RebateConfirm/index.tsx
1 1 import React, { useEffect, useState } from 'react';
2 2 import { PageHeaderWrapper } from '@ant-design/pro-layout';
3   -import { Card, Steps, Button, Descriptions, message, Popconfirm, Form } from 'antd';
  3 +import { Card, Steps, Button, message, Popconfirm, Form, Input, Row } from 'antd';
4 4 import { history } from 'umi';
5 5 import First from './First';
6 6 import Second from './Second';
... ... @@ -23,6 +23,7 @@ const { Step } = Steps;
23 23 function Index() {
24 24 const query = history?.location?.query;
25 25 const [form] = Form.useForm();
  26 + const [titleForm] = Form.useForm();
26 27 const { data, loading, uploadResult, getDetail, current, setCurrent, setUploadResult, setFileList } = rebateStore;
27 28 const [btnLoading, setBtnLoading] = useState(false);
28 29  
... ... @@ -32,6 +33,13 @@ function Index() {
32 33 }
33 34 }, [query]);
34 35  
  36 + useEffect(() => {
  37 + titleForm.setFieldsValue({
  38 + insurerShortName: data?.insurerShortName,
  39 + month: data?.month,
  40 + });
  41 + }, [data]);
  42 +
35 43 // 数据回显
36 44 useEffect(() => {
37 45 if (data?.fid) {
... ... @@ -80,10 +88,16 @@ function Index() {
80 88 ))}
81 89 </Steps>
82 90 </div>
83   - <Descriptions column={1} labelStyle={{ fontWeight: 'bold' }} contentStyle={{ fontWeight: 'bold' }}>
84   - <Descriptions.Item label="保险公司">{data?.insurerShortName}</Descriptions.Item>
85   - <Descriptions.Item label="返利月度">{data?.month}</Descriptions.Item>
86   - </Descriptions>
  91 + <Form disabled form={titleForm}>
  92 + <Row align="middle" justify="space-between">
  93 + <Form.Item required style={{ width: '48%' }} name="insurerShortName" label="保险公司">
  94 + <Input />
  95 + </Form.Item>
  96 + <Form.Item required style={{ width: '48%' }} name="month" label="返利月度">
  97 + <Input />
  98 + </Form.Item>
  99 + </Row>
  100 + </Form>
87 101 <div>{current === 0 ? <First /> : <Second form={form} />}</div>
88 102 <div className="steps-action">
89 103 <Button className="button" loading={btnLoading} onClick={() => cancel()}>
... ...