Commit 56d32757 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 采购-待新增商城采购需求单-交易条件中交付地址缺少更改地址入口

parent a5f05f3f
......@@ -106,7 +106,33 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
if (res.code === 1000) {
result[idx].provinceCode = val;
result[idx].province = item.name;
city[idx] = { citydata: res.data }
if (val === '0') {
result[idx].cityCode = '0';
result[idx].city = intl.formatMessage({ id: 'components.suoyou' });
city[idx] = {
citydata: [{
code: '0',
name: intl.formatMessage({ id: 'components.suoyou' }),
pcode: '0',
}]
}
} else {
const tempCityList = []
tempCityList.push({
code: '0',
name: intl.formatMessage({ id: 'components.suoyou' }),
pcode: '0',
})
for (const cityItem of res.data) {
tempCityList.push({ ...cityItem })
}
city[idx] = {
citydata: tempCityList
}
}
form.setFieldsValue({
['city_' + idx]: '0'
})
setcity([...city])
}
}).catch(() => {})
......@@ -182,8 +208,17 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
}
}
useEffect(() => {
manageProvince().then(data => {
setprovince(data)
manageProvince().then((data: any[]) => {
const tempProvinceData = []
tempProvinceData.push({
code: '0',
name: intl.formatMessage({ id: 'components.suoyou' }),
pcode: '0',
})
for (const item of data) {
tempProvinceData.push({ ...item })
}
setprovince(tempProvinceData)
}).catch(error => {
console.warn(error)
})
......@@ -194,8 +229,19 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
fetchdata.areas.forEach((item: any, index: number) => {
getManageAreaByPcodeAll({ pcode: item.provinceCode }).then((res: any) => {
if (res.code === 1000) {
const tempCityList = []
tempCityList.push({
code: '0',
name: intl.formatMessage({ id: 'components.suoyou' }),
pcode: '0',
})
if (item.provinceCode !== '0') {
for (const cityItem of res.data) {
tempCityList.push({ ...cityItem })
}
}
const citydata = {
citydata: res.data
citydata: tempCityList
}
city[index] = { ...citydata }
Promise.resolve().then(() => {
......
......@@ -3,6 +3,7 @@ import { Form, Row, Col, Input, DatePicker, Select } from 'antd';
import moment from 'moment';
import { getLogisticsSelectListReceiverAddress } from '@/services/LogisticsV2Api';
import { getIntl } from 'umi';
import AddressSelect from '@/components/AddressSelect';
const { TextArea } = Input;
const { Option } = Select;
......@@ -30,27 +31,14 @@ const Condition: React.FC<Iprops> = (props: any) => {
fetchdata,
onBadge
} = props;
const [address, setAddress] = useState<Array<any>>([]);
const [deliveryTime, setDeliveryTime] = useState<any>()
const [selAddress, setSelAddress] = useState<ADDRESS_TYPE>();
/** 获取交付地址 */
const handleGetLogistics = async () => {
const service = getLogisticsSelectListReceiverAddress;
const res = await service();
if (res.code === 1000) {
setAddress(res.data);
}
}
useEffect(() => {
handleGetLogistics();
}, [])
/** 选择地址 */
const handleSelectAddress = (val: any, option: any) => {
const handleSelectAddress = (info) => {
const params: ADDRESS_TYPE = {
address: option.children,
addressId: option.value,
address: `${info.name} ${info.fullAddress} ${info.phone}`,
addressId: info.id,
}
setSelAddress(params);
}
......@@ -137,13 +125,23 @@ const Condition: React.FC<Iprops> = (props: any) => {
name='addressId'
rules={[{ required: true, message: intl.formatMessage({ id: 'detail.purchase.message55' }) }]}
>
<Select
{/* <Select
onSelect={handleSelectAddress}
>
{address.map(v => (
<Option key={v.id} value={v.id}>{v.fullAddress}</Option>
))}
</Select>
</Select> */}
{
selAddress?.address &&
<AddressSelect
value={selAddress.address as any}
isDefaultAddress
addressType={1}
disabled={false}
onChange={handleSelectAddress}
/>
}
</Form.Item>
<Form.Item
label={intl.formatMessage({ id: 'table.purchase.quotedPriceTime1' })}
......
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