Commit 8a6f7658 authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加 AsAddressCard 售后收发货地址展示及处理组件

parent 84f75ebf
...@@ -578,12 +578,21 @@ export const RETURN_OUTER_STATUS = { ...@@ -578,12 +578,21 @@ export const RETURN_OUTER_STATUS = {
[RETURN_OUTER_STATUS_FINISHED]: '售后完成', [RETURN_OUTER_STATUS_FINISHED]: '售后完成',
} }
/**
* 物流
*/
export const DELIVERY_TYPE_EXPRESS = 1;
/**
* 自提
*/
export const DELIVERY_TYPE_SELF_LIFTING = 2;
/**
* 无需配送
*/
export const DELIVERY_TYPE_NO_DISTRIBUTION = 3;
export const DELIVERY_TYPE_ENUM = [ export const DELIVERY_TYPE_ENUM = [
{ label: intl.formatMessage({ id: 'afterService.constants.DELIVERY_TYPE_ENUM_1' }, { default: '物流' }), value: 1 }, { label: intl.formatMessage({ id: 'afterService.constants.DELIVERY_TYPE_ENUM_1' }, { default: '物流' }), value: DELIVERY_TYPE_EXPRESS },
{ label: intl.formatMessage({ id: 'afterService.constants.DELIVERY_TYPE_ENUM_2' }, { default: '自提' }), value: 2 }, { label: intl.formatMessage({ id: 'afterService.constants.DELIVERY_TYPE_ENUM_2' }, { default: '自提' }), value: DELIVERY_TYPE_SELF_LIFTING },
{ label: intl.formatMessage({ id: 'afterService.constants.DELIVERY_TYPE_ENUM_3' }, { default: '无需配送' }), value: 3 }, { label: intl.formatMessage({ id: 'afterService.constants.DELIVERY_TYPE_ENUM_3' }, { default: '无需配送' }), value: DELIVERY_TYPE_NO_DISTRIBUTION },
] ];
\ No newline at end of file
@import '~antd/es/style/themes/default.less';
.addressInfo {
&-head {
margin-bottom: @margin-xss;
line-height: @height-base;
}
&-foot {
margin-bottom: 0;
}
}
\ No newline at end of file
/**
* @Description: 地址卡片组件
*/
import React from 'react';
import styles from './index.less';
export type AsAddressType = {
/**
* 地址id
*/
id: number,
/**
* 姓名
*/
name: string,
/**
* 联系电话
*/
phone: string,
/**
* 详细地址
*/
detailed: string,
};
interface AddressInfoProps {
/**
* 数据
*/
data: AsAddressType,
}
const AddressInfo: React.FC<AddressInfoProps> = (props: AddressInfoProps) => {
const { data } = props;
return (
<div className={styles.addressInfo}>
<p className={styles['addressInfo-head']}>{data?.name || ''} / {data?.phone || ''}</p>
<p className={styles['addressInfo-foot']}>{data?.detailed || ''}</p>
</div>
);
};
export default AddressInfo;
@import '~antd/es/style/themes/default.less';
.as-address-card {
:global {
.ant-form-item {
margin-bottom: @card-head-padding;
}
}
}
\ No newline at end of file
This diff is collapsed.
import { Reducer } from 'react';
export type AsAddressType = {
/**
* 地址id
*/
id: number,
/**
* 姓名
*/
name: string,
/**
* 联系电话
*/
phone: string,
/**
* 详细地址
*/
detailed: string,
}
export type AsAddressValue = {
/**
* 配送方式
*/
deliveryType: number,
/**
* 发货地址
*/
deliveryAddress: AsAddressType | null,
/**
* 收货地址
*/
shippingAddress: AsAddressType | null,
}
export const initialState: AsAddressValue = {
deliveryType: undefined,
deliveryAddress: null,
shippingAddress: null,
}
type ReducerActionType = {
/**
* 类型
*/
type: string,
/**
* 额外的参数
*/
payload: Partial<AsAddressValue>,
}
export const reducer: Reducer<AsAddressValue, ReducerActionType> = (state: AsAddressValue, action: ReducerActionType) => {
switch (action.type) {
case 'setAsAddress':
return { ...state, ...action.payload };
default:
throw new Error();
}
}
...@@ -20,4 +20,16 @@ export const isMaterialOrder = (orderType: number) => { ...@@ -20,4 +20,16 @@ export const isMaterialOrder = (orderType: number) => {
|| orderType === ORDER_TYPE_TENDER_CONTRACT || orderType === ORDER_TYPE_TENDER_CONTRACT
|| orderType === ORDER_TYPE_REQUISITION || orderType === ORDER_TYPE_REQUISITION
) )
}; };
\ No newline at end of file
/**
* 售后类型
* 售后换货:2 售后退货: 3 售后维修:4
*/
export type AsType = 2 | 3 | 4;
/**
* 售后地址角色
* 寄件人 'sender' 收件人 'receiver'
*/
export type AsAddressRole = 'sender' | 'receiver'
\ No newline at end of file
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