Commit 1df445f9 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents bd3fa41a a0b913b6
......@@ -57,6 +57,7 @@ const AddLogistics: React.FC<{}> = () => {
const [memberInfo, setmemberInfo] = useState<any>({});
const [form] = Form.useForm();
const [goodsForm] = Form.useForm();
const [loading, setLoading] = useState<boolean>(false)
/**输入框输入 */
const inputOnchange = (id, e, name) => {
const { value } = e.target
......@@ -603,6 +604,7 @@ const AddLogistics: React.FC<{}> = () => {
/** 提交数据 */
const handleSubmit = async () => {
setLoading(true);
const data = [...badge]
const params = { ...query };
const basicRef = await form.validateFields().then(res => { console.log(res); params.digest = res.digest; return true }).catch(error => { return error });
......@@ -611,6 +613,7 @@ const AddLogistics: React.FC<{}> = () => {
if (basicRef.errorFields) {
data[0] = basicRef.errorFields.length;
setbadge(data);
setLoading(false);
} else {
data[0] = 0;
setbadge(data)
......@@ -626,20 +629,25 @@ const AddLogistics: React.FC<{}> = () => {
params.detailList = detailList
if (path === 'edit') {
PublicApi.postLogisticsOrderWaitSubmitUpdate({ ...params }).then(res => {
if (res.code === 1000) {
history.goBack()
if (res.code !== 1000) {
setLoading(false);
return
}
history.goBack()
})
} else {
PublicApi.postLogisticsOrderWaitSubmitAdd({ ...params }).then(res => {
if (res.code === 1000) {
history.goBack()
if (res.code !== 1000) {
setLoading(false);
return
}
history.goBack()
})
}
}
} else {
message.error('请先添加商品')
setLoading(false);
}
}
......@@ -707,7 +715,7 @@ const AddLogistics: React.FC<{}> = () => {
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReturnEle description='返回' />}
extra={<Button type="primary" onClick={handleSubmit}> 保存</Button>}
extra={<Button type="primary" onClick={handleSubmit} loading={loading}> 保存</Button>}
>
<Card>
<Tabs type="card">
......@@ -756,21 +764,21 @@ const AddLogistics: React.FC<{}> = () => {
</Select>
</Form.Item>
<Form.Item label="单据时间" name='voucherTime'><span>{query.voucherTime && moment(query.voucherTime).format('YYYY-MM-DD HH:mm:ss')} </span></Form.Item>
{(createType === 2 || createType === 3 ) ?
{(createType === 2 || createType === 3) ?
<Form.Item label="外部状态" name='externalState'>
{
query.externalState === 1 ? <Badge status="warning" text='待提交' /> :
query.externalState === 2 ? <Badge status="processing" text='待确认' /> :
query.externalState === 3 ? <Badge status="error" text='不接收物流单' /> :
query.externalState === 4 ? <Badge status="success" text='接收物流单' /> : ''
query.externalState === 2 ? <Badge status="processing" text='待确认' /> :
query.externalState === 3 ? <Badge status="error" text='不接收物流单' /> :
query.externalState === 4 ? <Badge status="success" text='接收物流单' /> : ''
}
</Form.Item>
:
(createType === 4 || createType === 5 || createType === 6) ?
<Form.Item label="外部状态" name='externalState'>
<Badge status="warning" text={query.outerStatusName} />
</Form.Item>
: <></>
<Form.Item label="外部状态" name='externalState'>
<Badge status="warning" text={query.outerStatusName} />
</Form.Item>
: <></>
}
</Form>
</TabPane>
......
......@@ -66,7 +66,7 @@ const company: React.FC<parmas> = (props) => {
//hook只能写在函数组件的顶级作用域
const ref = useRef<any>({})
const { pageStatus, id, isSee } = props
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio', customKey: 'memberId' })
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio', customKey: 'id' })
const [menuForm] = Form.useForm();
const [headerTitle, setHeaderTitle] = useState('新建物流公司')
const [loading, setLoading] = useState<boolean>(false)
......@@ -320,7 +320,7 @@ const company: React.FC<parmas> = (props) => {
fetchTableData={params => fetchData(params)}
modalType="SelectLogisticsService"
tableProps={{
rowKey: 'memberId'
rowKey: 'id'
}}
>
</ModalTable>
......
......@@ -91,13 +91,16 @@ const AddQuotes: React.FC<parmas> = (props) => {
}
}, [])
//提交
const onSumbit = async (params: any) => {
const onSumbit = async () => {
setloading(true);
const basicInfo = await basicInfoRef.current.validateFields();
const tradingConditions = await tradingConditionsRef.current.validateFields();
const basicInfoData = basicInfo.data;
const tradingConditionsData = tradingConditions.data;
console.log(basicInfo, tradingConditions, 100086)
if (!basicInfo.state || !tradingConditions.state) {
setloading(false);
return
}
if (basicInfo.state && tradingConditions.state) {
if (goodsList.length === 0) {
message.error('请添加一个询价商品!');
......@@ -139,7 +142,6 @@ const AddQuotes: React.FC<parmas> = (props) => {
// 获取到会员信息
const getMemberList = (list: any) => {
setmember(list);
console.log(list, '会员信息')
}
// 获取添加的商品列表
const getGoodsList = (list: any) => {
......
......@@ -35,7 +35,7 @@ const BasicInfo: React.FC<queryProps> = (props) => {
const [memberName, setmemberName] = useState<any>();
const [memberId, setmemberId] = useState<any>();
const [roleId, setroleId] = useState<any>();
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId', type: 'radio' });
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio' });
const handleOkAddMember = () => {
if (memberRowCtl.selectRow.length > 0) {
setVisibleChannelMember(false)
......@@ -62,8 +62,8 @@ const BasicInfo: React.FC<queryProps> = (props) => {
const columnsSetMember: any[] = [
{
title: 'ID',
dataIndex: 'memberId',
key: 'memberId',
dataIndex: 'id',
key: 'id',
},
{
title: '会员名称',
......@@ -169,7 +169,7 @@ const BasicInfo: React.FC<queryProps> = (props) => {
</Form.Item>
<Form.Item label='被询价会员' name='memberId' rules={[{ required: true, message: '请选择被询价会员' }]}>
<Search disabled={type === 3 || type === 2} value={memberName ? memberName : undefined} readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={() => setVisibleChannelMember(true)} />
{memberName && <Button type='link' onClick={() => window.open(`/shop?roleId=${roleId}shopId=${btoa(JSON.stringify({ memberId, roleId }))}`)}>查看会员详情</Button>}
{memberName && <Button type='link' onClick={() => window.open(`/shop?shopId=${btoa(JSON.stringify({ memberId, roleId }))}`)}>查看会员详情</Button>}
</Form.Item>
<Form.Item label='询价单号' name='orderNumber'>
<span>{(Object.keys(editData).length > 0 && editData.inquiryListNo) ? editData.inquiryListNo : '-'}</span>
......@@ -201,7 +201,7 @@ const BasicInfo: React.FC<queryProps> = (props) => {
}
}
tableProps={{
rowKey: 'memberId',
rowKey: 'id',
}}
/>
</>
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import moment from 'moment';
import { Form, Input, Select, Row, Col, DatePicker, message } from 'antd';
import { PublicApi } from '@/services/api';
interface queryProps {
currentRef?: any,
editData: any,
getAddress?: Function
}
const layout: any = {
colon: false,
labelCol: { style: { width: '174px' } },
wrapperCol: { span: 24 },
labelAlign: "left"
};
const TradingConditions: React.FC<queryProps> = (props) => {
const { currentRef, editData, getAddress } = props;
const [TradingConditionsForm] = Form.useForm();
const [address, setAddress] = useState([]);
const hadnleValidateFields = () => {
return new Promise((resolve) => {
TradingConditionsForm.validateFields().then(values => {
resolve({
state: true,
data: {
deliveryTime: moment(values.deliveryTime).format('x'),
quotationAsTime: moment(values.quotationAsTime).format('x'),
offer: values.offer,
paymentType: values.paymentType,
taxes: values.taxes,
logistics: values.logistics,
packRequire: values.packRequire,
otherRequire: values.otherRequire,
}
})
}).catch(errorInfo => {
resolve({state: false})
})
})
}
useEffect(() => {
if (currentRef) {
const userAction = {
validateFields: () => hadnleValidateFields()
}
if (currentRef && typeof currentRef === 'function') {
currentRef(userAction);
}
if (currentRef && typeof currentRef !== 'function') {
currentRef.current = userAction;
}
}
// 获取交付地址
PublicApi.getLogisticsSelectListReceiverAddress().then(res => {
setAddress(res.data)
})
}, [])
useEffect(() => {
// 编辑时回显的数据
if(Object.keys(editData).length > 0) {
TradingConditionsForm.setFieldsValue({
paymentType: editData.paymentType,
taxes: editData.taxes,
logistics: editData.logistics,
packRequire: editData.packRequire,
otherRequire: editData.otherRequire,
offer: editData.offer,
quotationAsTime: moment(editData.quotationAsTime),
deliveryTime: moment(editData.deliveryTime),
fullAddressId: editData.fullAddressId,
})
}
}, [editData])
const addressOnChange = (value:any, option:any) => {
getAddress(option)
}
const disabledDate = (current) => {
return current && current < moment().endOf('day');
}
return (
<Form
{...layout}
form={TradingConditionsForm}
className={styles.revise_style}
>
<Row gutter={70}>
<Col span={12}>
<Form.Item label='交付日期' name='deliveryTime' rules={[{ required: true, message: '请选择交付日期' }]}>
<DatePicker
disabledDate={disabledDate}
format="YYYY-MM-DD HH:mm:ss"
/>
</Form.Item>
<Form.Item label='交付地址' name='fullAddressId' rules={[{ required: true, message: '请选择交付地址' }]}>
<Select onChange={addressOnChange}>
{address.map(v => (
<Select.Option key={v.id} value={v.id}>{v.fullAddress}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}>
<DatePicker
format="YYYY-MM-DD HH:mm:ss"
disabledDate={disabledDate}
/>
</Form.Item>
<Form.Item label='报价要求' name='offer'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='付款方式' name='paymentType'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='税费要求' name='taxes'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='物流要求' name='logistics'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label='包装要求' name='packRequire'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='其他要求' name='otherRequire'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
</Col>
</Row>
</Form>
)
}
export default TradingConditions
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import moment from 'moment';
import { Form, Input, Select, Row, Col, DatePicker, message } from 'antd';
import { PublicApi } from '@/services/api';
interface queryProps {
currentRef?: any,
editData: any,
getAddress?: Function
}
const layout: any = {
colon: false,
labelCol: { style: { width: '174px' } },
wrapperCol: { span: 24 },
labelAlign: "left"
};
const TradingConditions: React.FC<queryProps> = (props) => {
const { currentRef, editData, getAddress } = props;
const [TradingConditionsForm] = Form.useForm();
const [address, setAddress] = useState([]);
const hadnleValidateFields = () => {
return new Promise((resolve) => {
TradingConditionsForm.validateFields().then(values => {
resolve({
state: true,
data: {
deliveryTime: moment(values.deliveryTime).format('x'),
quotationAsTime: moment(values.quotationAsTime).format('x'),
offer: values.offer,
paymentType: values.paymentType,
taxes: values.taxes,
logistics: values.logistics,
packRequire: values.packRequire,
otherRequire: values.otherRequire,
}
})
}).catch(errorInfo => {
resolve({ state: false })
})
})
}
useEffect(() => {
if (currentRef) {
const userAction = {
validateFields: () => hadnleValidateFields()
}
if (currentRef && typeof currentRef === 'function') {
currentRef(userAction);
}
if (currentRef && typeof currentRef !== 'function') {
currentRef.current = userAction;
}
}
// 获取交付地址
PublicApi.getLogisticsSelectListReceiverAddress().then(res => {
setAddress(res.data)
})
}, [])
useEffect(() => {
// 编辑时回显的数据
if (Object.keys(editData).length > 0) {
TradingConditionsForm.setFieldsValue({
paymentType: editData.paymentType,
taxes: editData.taxes,
logistics: editData.logistics,
packRequire: editData.packRequire,
otherRequire: editData.otherRequire,
offer: editData.offer,
quotationAsTime: editData.quotationAsTime ? moment(editData.quotationAsTime) : undefined,
deliveryTime: editData.deliveryTime ? moment(editData.deliveryTime) : undefined,
fullAddressId: editData.fullAddressId,
})
}
}, [editData])
const addressOnChange = (value: any, option: any) => {
getAddress(option)
}
const disabledDate = (current) => {
return current && current < moment().endOf('day');
}
return (
<Form
{...layout}
form={TradingConditionsForm}
className={styles.revise_style}
>
<Row gutter={70}>
<Col span={12}>
<Form.Item label='交付日期' name='deliveryTime' rules={[{ required: true, message: '请选择交付日期' }]}>
<DatePicker
disabledDate={disabledDate}
format="YYYY-MM-DD HH:mm:ss"
/>
</Form.Item>
<Form.Item label='交付地址' name='fullAddressId' rules={[{ required: true, message: '请选择交付地址' }]}>
<Select onChange={addressOnChange}>
{address.map(v => (
<Select.Option key={v.id} value={v.id}>{v.fullAddress}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}>
<DatePicker
format="YYYY-MM-DD HH:mm:ss"
disabledDate={disabledDate}
/>
</Form.Item>
<Form.Item label='报价要求' name='offer'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='付款方式' name='paymentType'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='税费要求' name='taxes'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='物流要求' name='logistics'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label='包装要求' name='packRequire'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='其他要求' name='otherRequire'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
</Col>
</Row>
</Form>
)
}
export default TradingConditions
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