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) => {
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(() => {})
......@@ -150,17 +176,12 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
/** 添加一条地址 */
const addFormAddress = (idx: number) => {
const address: any = {
provinceCode: '',
provinceCode: '0',
province: '',
cityCode: '',
city: ''
cityCode: '0',
city: intl.formatMessage({ id: 'components.suoyou' })
}
if (requisitionFormAddress[idx].provinceCode && requisitionFormAddress[idx].cityCode) {
setrequisitionFormAddress([...requisitionFormAddress, address])
} else {
message.error(intl.formatMessage({ id: 'detail.purchase.message35' }))
}
}
/** 删除一条地址 */
const removeFormAddress = (idx: any) => {
......@@ -182,8 +203,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 +224,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 [selAddress, setSelAddress] = useState<any>({});
/** 选择地址 */
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);
}
......@@ -122,7 +110,7 @@ const Condition: React.FC<Iprops> = (props: any) => {
<Form.Item
label={intl.formatMessage({ id: 'table.purchase.deliveryTime' })}
name="deliveryTime"
rules={[{ required: true, message: intl.formatMessage({ id: 'detail.purchase.message38' }) }]}
rules={[{ required: true, message: intl.formatMessage({ id: 'detail.purchase.message54' }) }]}
>
<DatePicker
showTime={{ format: 'HH:mm' }}
......@@ -135,15 +123,22 @@ const Condition: React.FC<Iprops> = (props: any) => {
<Form.Item
label={intl.formatMessage({ id: 'detail.purchase.address' })}
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}
>
{address.map(v => (
<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
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