Commit 1e9fcb4c authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

Merge branch 'dev' into dev-srm

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