Commit 5549b8ad authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加 展示地址相关 逻辑

parent 1b6fb77c
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-05 10:28:06
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-11 20:05:50
* @LastEditTime: 2021-08-19 17:23:30
* @Description: 地址选择 FormItem
*/
import React, { useState, useEffect, useMemo, useRef } from 'react';
......@@ -49,7 +49,11 @@ interface IProps {
/**
* 是否禁用
*/
disabled: boolean,
disabled?: boolean,
/**
* 是否可编辑的
*/
editable?: boolean,
}
export type SubmitValuesType = {
......@@ -106,6 +110,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
onChange,
isDefaultAddress = false,
disabled = false,
editable = true,
} = props;
const [list, setList] = useState<AddressValueType[]>([]);
const [internalValue, setInternalValue] = useState<AddressValueType>();
......@@ -151,7 +156,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
triggerChange(undefined);
}
if (isDefaultAddress && defaultItem && !disabled && !actionFlagRef.current) {
if (isDefaultAddress && defaultItem && !disabled && !editable && !actionFlagRef.current) {
const { shipperName, receiverName, ...rest } = defaultItem;
const next = {
name: shipperName || receiverName,
......@@ -449,6 +454,15 @@ const AddressSelect: React.FC<IProps> = (props) => {
}));
}, [list]);
if (!editable) {
const current = list.find((item) => item.id === value);
const full = current ? `${current.name} ${current.fullAddress} ${current.phone}` : null;
return (
<div>{full || value}</div>
);
}
return (
<AddressSelectContextProvider
value={{
......
......@@ -2,14 +2,37 @@
* @Author: XieZhiXiong
* @Date: 2021-08-05 11:26:43
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-10 16:49:14
* @LastEditTime: 2021-08-19 17:34:18
* @Description:
*/
import React from 'react';
import { connect } from '@formily/antd';
import AddressSelect from '@/components/AddressSelect';
const CustomAddressSelect = connect()((props) => {
const mapTextComponent = (
Target: React.JSXElementConstructor<any>,
props: any = {},
fieldProps: any = {}
): React.JSXElementConstructor<any> => {
const { editable, value } = fieldProps;
const xComponentProps = fieldProps.props['x-component-props'] || {};
if (editable !== undefined) {
if (editable === false) {
return () => (
<AddressSelect
value={value}
editable={false}
{...xComponentProps}
/>
);
}
}
return Target;
}
const CustomAddressSelect = connect({
getComponent: mapTextComponent,
})((props) => {
const {
dataSource,
value,
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 15:18:15
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-19 13:57:25
* @LastEditTime: 2021-08-19 17:24:00
* @Description: 退货收货统计、退货发货明细
*/
import React, { useState } from 'react';
......@@ -473,7 +473,7 @@ const ReturnInfo: React.FC<ReturnInfoProps> = ({
subCount: item.differenceCount,
count: item.deliveryCount,
})),
returnDeliverAddress: 0, // 缺少
returnDeliverAddress: currentDetailed?.logisticsReceiveAddress,
deliveryTime: currentDetailed?.deliveryTime,
logisticsOrderNo: currentDetailed?.logisticsOrderNo,
logisticsName: currentDetailed?.logisticsName,
......
......@@ -152,4 +152,8 @@ export interface Detailed {
* 发货明细 ,DeliveryGoodsDetailVO
*/
detailList: DetailedListItem[]
/**
* 物流收货地址
*/
logisticsReceiveAddress: string,
}
\ 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