Commit 3067085a authored by XieZhiXiong's avatar XieZhiXiong

feat: 修改售后详情UI

parent 444b2467
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 09:54:04 * @Date: 2020-11-06 09:54:04
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-19 20:33:36 * @LastEditTime: 2021-05-13 16:09:56
* @Description: 换货收货地址 * @Description: 换货收货地址
*/ */
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
...@@ -26,7 +26,48 @@ export interface Values { ...@@ -26,7 +26,48 @@ export interface Values {
sendAddress: string | undefined, sendAddress: string | undefined,
sendUserName: string | undefined, sendUserName: string | undefined,
sendUserTel: string | undefined, sendUserTel: string | undefined,
}; }
interface AddressData {
/**
* id
*/
id?: number;
/**
* 配送方式
*/
deliveryType?: number;
/**
* 收件人名字
*/
name: string,
/**
* 收件人电话号码
*/
phone: string,
/**
* 收件地址
*/
fullAddress: string,
}
interface AddressProps {
value: AddressData,
}
const Address: React.FC<AddressProps> = ({ value }) => (
<div>
<p>{value.name || ''} / {value.phone || ''}</p>
<p>{value.fullAddress || ''}</p>
</div>
);
const ShippingAddress: React.FC<AddressProps> = ({ value }) => (
<div>
<p>{value.name || ''} / {value.phone || ''}</p>
<p>{value.fullAddress || ''}</p>
</div>
);
interface ExchangeAddressInfo extends MellowCardProps { interface ExchangeAddressInfo extends MellowCardProps {
/** /**
...@@ -90,7 +131,7 @@ interface ExchangeAddressInfo extends MellowCardProps { ...@@ -90,7 +131,7 @@ interface ExchangeAddressInfo extends MellowCardProps {
* 提交事件 * 提交事件
*/ */
onFormSubmit: (values: Values) => void; onFormSubmit: (values: Values) => void;
}; }
const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
isEdit = false, isEdit = false,
...@@ -188,20 +229,6 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({ ...@@ -188,20 +229,6 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
}); });
}; };
const Address = (
<div>
<p>{deliveryAddress.name || ''} / {deliveryAddress.phone || ''}</p>
<p>{deliveryAddress.fullAddress || ''}</p>
</div>
);
const ShippingAddress = (
<div>
<p>{shippingAddress.name || ''} / {shippingAddress.phone || ''}</p>
<p>{shippingAddress.fullAddress || ''}</p>
</div>
);
return ( return (
<MellowCard <MellowCard
title="换货收货地址" title="换货收货地址"
...@@ -212,12 +239,10 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({ ...@@ -212,12 +239,10 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
deliveryType: shippingAddress.deliveryType, deliveryType: shippingAddress.deliveryType,
shippingAddress: shippingAddress.id, shippingAddress: shippingAddress.id,
pickupAddress: shippingAddress.id, pickupAddress: shippingAddress.id,
deliveryAddress,
shippingAddressShow: shippingAddress,
}} }}
previewPlaceholder=" " previewPlaceholder=" "
expressionScope={{
Address,
ShippingAddress,
}}
effects={($, { getFieldValue }) => { effects={($, { getFieldValue }) => {
useAsyncSelect('*(shippingAddress,pickupAddress)', fetchShipperAddress, ['label', 'value']); useAsyncSelect('*(shippingAddress,pickupAddress)', fetchShipperAddress, ['label', 'value']);
...@@ -285,6 +310,10 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({ ...@@ -285,6 +310,10 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
} }
}); });
}} }}
components={{
Address,
ShippingAddress,
}}
editable={isEdit} editable={isEdit}
actions={modalFormActions} actions={modalFormActions}
schema={schema} schema={schema}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-09 15:56:35 * @Date: 2020-11-09 15:56:35
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-21 14:14:26 * @LastEditTime: 2021-05-13 16:18:24
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -15,9 +15,10 @@ export const schema: ISchema = { ...@@ -15,9 +15,10 @@ export const schema: ISchema = {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'mega-layout',
'x-component-props': { 'x-component-props': {
labelCol: 6, labelWidth: 106,
wrapperCol: 16, labelAlign: 'left',
labelAlign: 'left', grid: true,
full: true
}, },
properties: { properties: {
deliveryType: { deliveryType: {
...@@ -37,14 +38,6 @@ export const schema: ISchema = { ...@@ -37,14 +38,6 @@ export const schema: ISchema = {
}, },
], ],
}, },
deliveryAddress: {
type: 'object',
title: '换货收货地址',
'x-component': 'Children',
'x-component-props': {
children: '{{Address}}',
},
},
shippingAddress: { shippingAddress: {
type: 'string', type: 'string',
title: '换货发货地址', title: '换货发货地址',
...@@ -81,14 +74,16 @@ export const schema: ISchema = { ...@@ -81,14 +74,16 @@ export const schema: ISchema = {
}, },
], ],
}, },
deliveryAddress: {
type: 'object',
title: '换货收货地址',
'x-component': 'Address',
},
shippingAddressShow: { shippingAddressShow: {
type: 'object', type: 'object',
title: '换货发货地址', title: '换货发货地址',
visible: false, visible: false,
'x-component': 'Children', 'x-component': 'ShippingAddress',
'x-component-props': {
children: '{{ShippingAddress}}',
},
}, },
}, },
}, },
......
.detailedWrap { .detailedWrap {
padding: 25px 24px 9px; padding: 25px 24px 9px;
margin: 16px 0; margin: 16px 0;
background-color: #F7F8FA; background-color: #FAFBFC;
} }
\ No newline at end of file
.detailedWrap { .detailedWrap {
padding: 25px 24px 9px; padding: 25px 24px 9px;
margin: 16px 0; margin: 16px 0;
background-color: #F7F8FA; background-color: #FAFBFC;
} }
\ No newline at end of file
.file {
:global {
.ant-upload-list-item {
margin-top: 0;
}
}
}
\ No newline at end of file
...@@ -2,16 +2,11 @@ ...@@ -2,16 +2,11 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-03 11:49:34 * @Date: 2020-11-03 11:49:34
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-12 15:10:10 * @LastEditTime: 2021-05-13 15:38:46
* @Description: 附件列表 * @Description: 附件列表
*/ */
import React from 'react'; import React from 'react';
import { Empty } from 'antd'; import { Empty, Descriptions, Upload } from 'antd';
import {
SchemaForm,
SchemaMarkupField as Field,
} from '@formily/antd';
import { Upload, FormMegaLayout } from '@formily/antd-components';
import { FileData } from '@/utils'; import { FileData } from '@/utils';
import MellowCard, { MellowCardProps } from '@/components/MellowCard'; import MellowCard, { MellowCardProps } from '@/components/MellowCard';
import styles from './index.less'; import styles from './index.less';
...@@ -33,18 +28,27 @@ const FileList: React.FC<FileListProps> = ({ ...@@ -33,18 +28,27 @@ const FileList: React.FC<FileListProps> = ({
{...rest} {...rest}
> >
{fileList && fileList.length ? ( {fileList && fileList.length ? (
<SchemaForm // <SchemaForm
components={{ Upload }} // components={{ Upload }}
value={{ // value={{
files: fileList, // files: fileList,
}} // }}
editable={false} // editable={false}
previewPlaceholder=" " // previewPlaceholder=" "
> // >
<FormMegaLayout full> // <FormMegaLayout full>
<Field name="files" title="相关不良原因举证附件" x-component="Upload" /> // <Field name="files" title="相关不良原因举证附件" x-component="Upload" />
</FormMegaLayout> // </FormMegaLayout>
</SchemaForm> // </SchemaForm>
<Descriptions column={1}>
<Descriptions.Item label="相关不良原因举证附件">
<Upload
className={styles.file}
fileList={fileList}
disabled
/>
</Descriptions.Item>
</Descriptions>
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)} )}
......
...@@ -30,30 +30,40 @@ export interface Values { ...@@ -30,30 +30,40 @@ export interface Values {
}; };
interface AddressData { interface AddressData {
value: { /**
/** * id
* 收件人名字 */
*/ id?: number;
name: string, /**
/** * 配送方式
* 收件人电话号码 */
*/ deliveryType?: number;
phone: string, /**
/** * 收件人名字
* 收件地址 */
*/ name: string,
fullAddress: string, /**
} * 收件人电话号码
*/
phone: string,
/**
* 收件地址
*/
fullAddress: string,
}
interface AddressProps {
value: AddressData,
} }
const Address: React.FC<AddressData> = ({ value }) => ( const Address: React.FC<AddressProps> = ({ value }) => (
<div> <div>
<p>{value.name || ''} / {value.phone || ''}</p> <p>{value.name || ''} / {value.phone || ''}</p>
<p>{value.fullAddress || ''}</p> <p>{value.fullAddress || ''}</p>
</div> </div>
); );
const DeliveryAddress: React.FC<AddressData> = ({ value }) => ( const DeliveryAddress: React.FC<AddressProps> = ({ value }) => (
<div> <div>
<p>{value.name || ''} / {value.phone || ''}</p> <p>{value.name || ''} / {value.phone || ''}</p>
<p>{value.fullAddress || ''}</p> <p>{value.fullAddress || ''}</p>
...@@ -69,54 +79,12 @@ interface ReturnAddressInfo extends MellowCardProps { ...@@ -69,54 +79,12 @@ interface ReturnAddressInfo extends MellowCardProps {
/** /**
* 退货收货地址 * 退货收货地址
*/ */
deliveryAddress: { deliveryAddress: AddressData,
/**
* id
*/
id?: number;
/**
* 配送方式
*/
deliveryType?: number;
/**
* 收件人姓名
*/
name: string;
/**
* phone
*/
phone: string;
/**
* 完整地址
*/
fullAddress: string;
},
/** /**
* 退货发货地址 * 退货发货地址
*/ */
shippingAddress: { shippingAddress: AddressData,
/**
* id
*/
id?: number;
/**
* 配送方式
*/
deliveryType?: number;
/**
* 收件人姓名
*/
name: string;
/**
* phone
*/
phone: string;
/**
* 完整地址
*/
fullAddress: string;
},
/** /**
* 表单提交事件 * 表单提交事件
......
.detailedWrap { .detailedWrap {
padding: 25px 24px 9px; padding: 25px 24px 9px;
margin: 16px 0; margin: 16px 0;
background-color: #F7F8FA; background-color: #FAFBFC;
} }
\ No newline at end of file
@import '~antd/es/style/themes/default.less';
.evaluate {
.score {
position: absolute;
&-left {
padding-right: 90px;
}
&-right {
position: absolute;
top: -50%;
right: 0;
width: 80px;
flex-shrink: 0;
}
&-star {
font-size: @font-size-lg;
font-weight: 500;
}
}
}
\ No newline at end of file
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-03 14:12:34 * @Date: 2020-11-03 14:12:34
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-20 14:28:19 * @LastEditTime: 2021-05-13 15:30:21
* @Description: 评价 * @Description: 评价
*/ */
import React from 'react'; import React from 'react';
import { Row, Col, Descriptions } from 'antd';
import MellowCard, { MellowCardProps } from '@/components/MellowCard'; import MellowCard, { MellowCardProps } from '@/components/MellowCard';
import { Gauge } from '@/components/Charts'; import { Gauge } from '@/components/Charts';
import styles from './index.less';
// 满分 5分 // 满分 5分
const FULL_SCORE = 5; const FULL_SCORE = 5;
...@@ -47,19 +49,46 @@ const Score: React.FC<ScoreProps> = ({ ...@@ -47,19 +49,46 @@ const Score: React.FC<ScoreProps> = ({
return ( return (
<MellowCard <MellowCard
title="售后评价" title="售后评价"
className={styles.evaluate}
{...rest} {...rest}
> >
<Gauge <Row gutter={40}>
title={`${score}分`} <Col span={8}>
height={170} <div className={styles.score}>
percent={+(score/FULL_SCORE * 100).toFixed(2)} <div className={styles['score-left']}>
formatter={() => ''} <Descriptions column={1}>
formatContent={(val) => `${TITLE_MAP[score]}`} <Descriptions.Item
color={COLOR_MAP[score]} label="售后满意度"
/> >
<p style={{ color: '#909399' }}> <span className={styles['score-star']}>
售后评价: {content} {`${score}分`}
</p> </span>
</Descriptions.Item>
</Descriptions>
</div>
<div className={styles['score-right']}>
<Gauge
title=""
height={90}
percent={+(score/FULL_SCORE * 100).toFixed(2)}
formatter={() => ''}
formatContent={() => ''}
color={COLOR_MAP[score]}
strokeWidth={5}
/>
</div>
</div>
</Col>
<Col span={16}>
<Descriptions column={1}>
<Descriptions.Item
label="售后评价"
>
{content}
</Descriptions.Item>
</Descriptions>
</Col>
</Row>
</MellowCard> </MellowCard>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment