Commit c2c90bae authored by GuanHua's avatar GuanHua

Merge branch 'v2-220418' into fix-0418-order

parents 0b242de3 8e5516a1
...@@ -106,7 +106,33 @@ const BasicInfo: React.FC<Iprops> = (props: any) => { ...@@ -106,7 +106,33 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
if (res.code === 1000) { if (res.code === 1000) {
result[idx].provinceCode = val; result[idx].provinceCode = val;
result[idx].province = item.name; 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]) setcity([...city])
} }
}).catch(() => {}) }).catch(() => {})
...@@ -150,17 +176,12 @@ const BasicInfo: React.FC<Iprops> = (props: any) => { ...@@ -150,17 +176,12 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
/** 添加一条地址 */ /** 添加一条地址 */
const addFormAddress = (idx: number) => { const addFormAddress = (idx: number) => {
const address: any = { const address: any = {
provinceCode: '', provinceCode: '0',
province: '', province: '',
cityCode: '', cityCode: '0',
city: '' city: intl.formatMessage({ id: 'components.suoyou' })
} }
if (requisitionFormAddress[idx].provinceCode && requisitionFormAddress[idx].cityCode) { setrequisitionFormAddress([...requisitionFormAddress, address])
setrequisitionFormAddress([...requisitionFormAddress, address])
} else {
message.error(intl.formatMessage({ id: 'detail.purchase.message35' }))
}
} }
/** 删除一条地址 */ /** 删除一条地址 */
const removeFormAddress = (idx: any) => { const removeFormAddress = (idx: any) => {
...@@ -182,8 +203,17 @@ const BasicInfo: React.FC<Iprops> = (props: any) => { ...@@ -182,8 +203,17 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
} }
} }
useEffect(() => { useEffect(() => {
manageProvince().then(data => { manageProvince().then((data: any[]) => {
setprovince(data) 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 => { }).catch(error => {
console.warn(error) console.warn(error)
}) })
...@@ -194,8 +224,19 @@ const BasicInfo: React.FC<Iprops> = (props: any) => { ...@@ -194,8 +224,19 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
fetchdata.areas.forEach((item: any, index: number) => { fetchdata.areas.forEach((item: any, index: number) => {
getManageAreaByPcodeAll({ pcode: item.provinceCode }).then((res: any) => { getManageAreaByPcodeAll({ pcode: item.provinceCode }).then((res: any) => {
if (res.code === 1000) { 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 = { const citydata = {
citydata: res.data citydata: tempCityList
} }
city[index] = { ...citydata } city[index] = { ...citydata }
Promise.resolve().then(() => { Promise.resolve().then(() => {
......
...@@ -3,6 +3,7 @@ import { Form, Row, Col, Input, DatePicker, Select } from 'antd'; ...@@ -3,6 +3,7 @@ import { Form, Row, Col, Input, DatePicker, Select } from 'antd';
import moment from 'moment'; import moment from 'moment';
import { getLogisticsSelectListReceiverAddress } from '@/services/LogisticsV2Api'; import { getLogisticsSelectListReceiverAddress } from '@/services/LogisticsV2Api';
import { getIntl } from 'umi'; import { getIntl } from 'umi';
import AddressSelect from '@/components/AddressSelect';
const { TextArea } = Input; const { TextArea } = Input;
const { Option } = Select; const { Option } = Select;
...@@ -30,27 +31,14 @@ const Condition: React.FC<Iprops> = (props: any) => { ...@@ -30,27 +31,14 @@ const Condition: React.FC<Iprops> = (props: any) => {
fetchdata, fetchdata,
onBadge onBadge
} = props; } = props;
const [address, setAddress] = useState<Array<any>>([]);
const [deliveryTime, setDeliveryTime] = useState<any>() const [deliveryTime, setDeliveryTime] = useState<any>()
const [selAddress, setSelAddress] = useState<ADDRESS_TYPE>(); const [selAddress, setSelAddress] = useState<any>({});
/** 获取交付地址 */
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 = { const params: ADDRESS_TYPE = {
address: option.children, address: `${info.name} ${info.fullAddress} ${info.phone}`,
addressId: option.value, addressId: info.id,
} }
setSelAddress(params); setSelAddress(params);
} }
...@@ -122,7 +110,7 @@ const Condition: React.FC<Iprops> = (props: any) => { ...@@ -122,7 +110,7 @@ const Condition: React.FC<Iprops> = (props: any) => {
<Form.Item <Form.Item
label={intl.formatMessage({ id: 'table.purchase.deliveryTime' })} label={intl.formatMessage({ id: 'table.purchase.deliveryTime' })}
name="deliveryTime" name="deliveryTime"
rules={[{ required: true, message: intl.formatMessage({ id: 'detail.purchase.message38' }) }]} rules={[{ required: true, message: intl.formatMessage({ id: 'detail.purchase.message54' }) }]}
> >
<DatePicker <DatePicker
showTime={{ format: 'HH:mm' }} showTime={{ format: 'HH:mm' }}
...@@ -135,15 +123,22 @@ const Condition: React.FC<Iprops> = (props: any) => { ...@@ -135,15 +123,22 @@ const Condition: React.FC<Iprops> = (props: any) => {
<Form.Item <Form.Item
label={intl.formatMessage({ id: 'detail.purchase.address' })} label={intl.formatMessage({ id: 'detail.purchase.address' })}
name='addressId' name='addressId'
rules={[{ required: true, message: intl.formatMessage({ id: 'detail.purchase.message38' }) }]} rules={[{ required: true, message: intl.formatMessage({ id: 'detail.purchase.message55' }) }]}
> >
<Select {/* <Select
onSelect={handleSelectAddress} onSelect={handleSelectAddress}
> >
{address.map(v => ( {address.map(v => (
<Option key={v.id} value={v.id}>{v.fullAddress}</Option> <Option key={v.id} value={v.id}>{v.fullAddress}</Option>
))} ))}
</Select> </Select> */}
<AddressSelect
value={selAddress.address && selAddress.address as any}
isDefaultAddress
addressType={1}
disabled={false}
onChange={handleSelectAddress}
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={intl.formatMessage({ id: 'table.purchase.quotedPriceTime1' })} 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