Commit 16adb735 authored by XieZhiXiong's avatar XieZhiXiong

chore: 删除无用组件及引用

parent 0b255b50
.addressList {
padding: 0;
margin: 0;
&-item {
padding: 8px 14px;
width: 549px;
margin-bottom: 20px;
position: relative;
line-height: 28px;
list-style: none;
border: 1px solid #EEF0F3;
color: #303133;
cursor: pointer;
&-detail {
color: #909399;
}
&.active {
border: 1px solid #00B382;
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid #00B37A;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
}
&.disabled {
cursor: not-allowed;
}
&.hide {
display: none;
}
}
}
.more {
text-align: center;
cursor: pointer;
}
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2020-11-05 10:30:54
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-06 14:18:10
* @Description: 地址 Form Item
*/
import React, { useEffect, useState } from 'react';
import { ISchemaFieldComponentProps } from '@formily/antd';
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
import classNames from 'classnames';
import styles from './index.less';
interface AddressItem {
id: string;
// 收件人
receiverName?: string;
// 收件人
shipperName?: string;
// 电话
phone: string;
// 详细地址
fullAddress: string;
};
interface AddressFormItemProps {
value: AddressItem;
dataSource: AddressItem[];
// 默认展示的条数
showCount?: number;
onChange: (id: string) => {};
// 禁用的
disabled?: boolean;
/**
* 只读的
*/
readOnly?: boolean;
};
const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: boolean } = (props) => {
const {
value,
showCount = 3,
dataSource = [],
onChange,
disabled = false,
readOnly,
} = props;
const [showMore, setShowMore] = useState(false);
// useEffect(() => {
// // 默认选中第一个
// if (dataSource && dataSource.length && !value) {
// if (onChange) {
// onChange(dataSource[0].id);
// }
// }
// }, [dataSource]);
const showDataSource = !showMore && !readOnly ? [...dataSource].splice(0, showCount) : dataSource;
const handleToogleMore = () => {
setShowMore(!showMore)
};
const handleSelectItem = record => {
if (onChange && !disabled) {
onChange(record);
}
};
return (
<div className={styles.addressee}>
<ul className={styles.addressList}>
{showDataSource.map(item => (
<li
className={classNames(styles['addressList-item'], {
[styles.active]: item.id === (value && value.id),
[styles.disabled]: disabled,
[styles.hide]: readOnly && item.id !== (value && value.id),
})}
onClick={() => handleSelectItem(item)}
key={item.id}
>
<div>
{`${item.receiverName || item.shipperName} / ${item.phone}`}
</div>
<div className={styles['addressList-item-detail']}>
{item.fullAddress}
</div>
</li>
))}
</ul>
{(dataSource.length > showCount) && !readOnly && (
<div
className={styles.more}
onClick={handleToogleMore}
>
{!showMore ? '显示更多' : '隐藏更多'}
{!showMore ? <CaretDownOutlined /> : <CaretUpOutlined />}
</div>
)}
</div>
);
};
AddressFormItem.defaultProps = {};
AddressFormItem.isFieldComponent = false;
export default AddressFormItem;
\ No newline at end of file
......@@ -20,7 +20,6 @@ import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../../../../components/GoodsDrawer';
import { OrderListRes } from '../../../../components/GoodsDrawer/interface';
import AddressFormItem from '../../../../components/AddressFormItem';
import { addSchema } from './schema';
import { createEffects } from './effects';
import {
......@@ -759,7 +758,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
}}
components={{
ArrayTable,
AddressFormItem,
OrderNo,
}}
editable={isEdit || !id}
......
......@@ -29,7 +29,6 @@ import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../../components/GoodsDrawer';
import { OrderListRes } from '../../components/GoodsDrawer/interface';
import AddressFormItem from '../../components/AddressFormItem';
import { addSchema } from './schema';
import { createEffects } from './effects';
import {
......@@ -619,7 +618,6 @@ const ExchangeValetApply: React.FC<BillsFormProps> = () => {
}}
components={{
ArrayTable,
AddressFormItem,
OrderNo,
}}
effects={($, actions) => {
......
......@@ -12,17 +12,11 @@ import BigNumber from 'bignumber.js';
import { getOrderBuyerDetail, getOrderCommonAfterSalePage } from '@/services/OrderNewV2Api';
import { getAsReturnGoodsGetDetailByConsumer, postAsReturnGoodsSave } from '@/services/AfterServiceV2Api';
import { normalizeFiledata, FileData } from '@/utils';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
import ReutrnEle from '@/components/ReturnEle';
import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../../../../components/GoodsDrawer';
import { OrderListRes } from '../../../../components/GoodsDrawer/interface';
import AddressFormItem from '../../../../components/AddressFormItem';
import ReturnInfoDrawer, { ReturnApplyInfo } from '../../../../components/ReturnInfoDrawer';
import { addSchema } from './schema';
import { createEffects } from './effects';
......@@ -828,7 +822,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}}
components={{
ArrayTable,
AddressFormItem,
OrderNo,
}}
editable={isEdit || !id}
......
......@@ -26,7 +26,6 @@ import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../../components/GoodsDrawer';
import { OrderListRes } from '../../components/GoodsDrawer/interface';
import AddressFormItem from '../../components/AddressFormItem';
import ReturnInfoDrawer, { ReturnApplyInfo } from '../../components/ReturnInfoDrawer';
import { addSchema } from './schema';
import { createEffects } from './effects';
......@@ -683,7 +682,6 @@ const ReturnValetApply: React.FC<BillsFormProps> = () => {
}}
components={{
ArrayTable,
AddressFormItem,
OrderNo,
}}
effects={($, actions) => {
......
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