Commit e88aab74 authored by XieZhiXiong's avatar XieZhiXiong
parents d3938b76 e6925110
......@@ -147,24 +147,31 @@ const LogisticsRoute: RouterChild = {
component: '@/pages/logistics/logisticsSubmit/toOrderSumitList',
},
// 待提交物流单-新增
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add',
name: 'addToOrderSubmit',
component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
hideInMenu: true
},
// {
// path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add',
// name: 'addToOrderSubmit',
// component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
// hideInMenu: true
// },
// 待提交物流单-新增
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/newAdd',
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add',
name: 'addToOrderSubmit',
component: '@/pages/logistics/logisticsSubmit/detail',
hideInMenu: true
},
// 待提交物流单-编辑
{
// {
// path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit',
// name: 'editToOrderSubmit',
// component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
// hideInMenu: true
// },
// 待提交物流单-编辑
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit',
name: 'editToOrderSubmit',
component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
component: '@/pages/logistics/logisticsSubmit/detail',
hideInMenu: true
},
]
......
......@@ -44,6 +44,11 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
resolve(res.data)
}
})
// PublicApi.getLogisticsSelectListMemberCompany({}).then(res => {
// if (res.code === 1000) {
// resolve(res.data)
// }
// })
})
return company
}
......@@ -65,7 +70,7 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
})
}, [])
// 对应发货单 columns
const shippingColumns:ColumnType<any>[] = [
const shippingColumns: ColumnType<any>[] = [
{
title: '发货单号',
dataIndex: 'invoicesNo',
......@@ -93,7 +98,7 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
}
]
// 对应订单 columns
const invoicesColumns:ColumnType<any>[] = [
const invoicesColumns: ColumnType<any>[] = [
{
title: '单据号',
dataIndex: 'orderNo',
......@@ -115,9 +120,6 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
// 确定
const handleShipping = () => {
const selectRow = shippingRowCtl.selectRow[0]
form.setFieldsValue({
shipmentOrderCode: selectRow.invoicesNo
})
onGet(selectRow, 2);
setshippingvisible(false);
}
......@@ -153,24 +155,64 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
}
})
onBadge(0, 0)
}).catch(error => {
console.log(error)
if (error && error.errorFields) {
onBadge(error.errorFields.length, 0)
}
})
})
}
})
/** 选择发货单 列表数据 */
const fetchShippingData = (params:any) => {
const fetchShippingData = (params: any) => {
return new Promise(resolve => {
PublicApi.getWarehouseInvoicesList({ ...params }).then(res => {
if(res.code === 1000) {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
useEffect(() => {
/**编辑回显数据 */
if (set.id) {
form.setFieldsValue({
digest: set.digest,
companyId: set.companyId,
shipmentOrderCode: set.shipmentOrderCode
})
if (set.shipmentOrderCode) {
const params = {
invoicesNo: set.shipmentOrderCode,
invoicesType: '',
invoicesAbstract: '',
memberName: '',
inventoryId: '',
startTransactionTime: '',
endTransactionTime: '',
orderNo: '',
state: '',
current: '1',
pageSize: '1'
}
new Promise(resolve => {
PublicApi.getWarehouseInvoicesList({ ...params }).then((res: any) => {
if (res.code === 1000) {
resolve(res.data)
}
})
}).then((res:any) => {
shippingRowCtl.setSelectRow(res.data);
shippingRowCtl.setSelectedRowKeys(res.data.map(v => v.id));
onGet(res.data[0], 2);
})
}
}
}, [set.id])
return (
<>
<Form
......@@ -191,11 +233,11 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
</Form.Item>
<Form.Item label="物流单号" name='receiverName1'><span></span></Form.Item>
<Form.Item label='对应发货单号' name='shipmentOrderCode'>
<Search readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={()=>setshippingvisible(true)} />
<Search readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={() => setshippingvisible(true)} />
{/* <Button type='link'>查看单号详情</Button> */}
</Form.Item>
<Form.Item label='对应订单号/售后单' name='invoicesNo'>
<Search readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={()=>setinvoicesvisible(true)} />
<Search readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={() => setinvoicesvisible(true)} />
{/* <Button type='link'>查看单号详情</Button> */}
</Form.Item>
<Form.Item label="收货方" name='receiverName'><span>{set.receiverName}</span></Form.Item>
......@@ -212,8 +254,8 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
}
</Select>
</Form.Item>
<Form.Item label="单据时间" name='voucherTime'><span></span></Form.Item>
<Form.Item label="外部状态" name='externalState'><span></span></Form.Item>
<Form.Item label="单据时间" name='voucherTime'><span>{set.invoicesTime && set.invoicesTime}</span></Form.Item>
<Form.Item label="外部状态" name='externalState'><span>{set.status && set.status}</span></Form.Item>
</Form>
{/* 选择发货单弹框 */}
<ModalTable
......@@ -225,8 +267,8 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
cancel={() => setshippingvisible(false)}
confirm={handleShipping}
fetchTableData={params => fetchShippingData(params)}
resetModal={{destroyOnClose: true}}
tableProps={{rowKey: 'id'}}
resetModal={{ destroyOnClose: true }}
tableProps={{ rowKey: 'id' }}
modalType='logisticsDelivery'
searchName='invoicesNo'
/>
......@@ -235,8 +277,8 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
width={900}
visible={invoicesvisible}
columns={invoicesColumns}
resetModal={{destroyOnClose: true}}
tableProps={{rowKey: 'id'}}
resetModal={{ destroyOnClose: true }}
tableProps={{ rowKey: 'id' }}
modalType='none'
searchName='invoicesNo'
rowSelection={invoicesRowSelection}
......
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Button, Input, Table, Row, Col, Statistic, message, Form } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { PlusOutlined } from '@ant-design/icons';
......@@ -50,8 +50,8 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'amount',
width: 120,
dataIndex: 'amount',
render: (text: any, record: any) =>
<Form.Item noStyle initialValue={record.amount} rules={[{ required: true, message: '请输入数量' }]}>
render: (text: any, record: any, index:number) =>
<Form.Item noStyle name={`amount${index}`} initialValue={record.amount} rules={[{ required: true, message: '请输入数量' }]}>
<Input type='number' min={1} onBlur={(e) => inputOnchange(record.productId, e, 'amount')} />
</Form.Item>
......@@ -61,8 +61,8 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'carton',
width: 120,
dataIndex: 'carton',
render: (text: any, record: any) =>
<Form.Item noStyle initialValue={record.carton} rules={[{ required: true, message: '请输入箱数' }]}>
render: (text: any, record: any, index:number) =>
<Form.Item noStyle name={`carton${index}`} initialValue={record.carton} rules={[{ required: true, message: '请输入箱数' }]}>
<Input type='number' min={1} onBlur={(e) => inputOnchange(record.productId, e, 'carton')} />
</Form.Item>
},
......@@ -71,8 +71,8 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'weight',
width: 120,
dataIndex: 'weight',
render: (text: any, record: any) =>
<Form.Item noStyle initialValue={record.weight} rules={[{ required: true, message: '请输入重量 (KG)' }]}>
render: (text: any, record: any, index:number) =>
<Form.Item noStyle name={`weight${index}`} initialValue={record.weight} rules={[{ required: true, message: '请输入重量 (KG)' }]}>
<Input type='number' min={1} onBlur={(e) => inputOnchange(record.productId, e, 'weight')} />
</Form.Item>
},
......@@ -81,8 +81,8 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'volume',
width: 120,
dataIndex: 'volume',
render: (text: any, record: any) =>
<Form.Item noStyle initialValue={record.volume} rules={[{ required: true, message: '请输入体积 (M3)' }]}>
render: (text: any, record: any, index:number) =>
<Form.Item noStyle name={`volume${index}`} initialValue={record.volume} rules={[{ required: true, message: '请输入体积 (M3)' }]}>
<Input type='number' min={1} onBlur={(e) => inputOnchange(record.productId, e, 'volume')} />
</Form.Item>
},
......@@ -100,7 +100,8 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
list.splice(idx, 1);
SelectionRowCtl.setSelectRow(list)
SelectionRowCtl.setSelectedRowKeys(list.map(v => v.productId));
setdata(list)
setdata([...list])
form.resetFields();
console.log(idx)
}
/**选择商品弹框表头 */
......@@ -160,7 +161,6 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
if (data.length > 0) {
SelectionRowCtl.setSelectRow([...data])
}
console.log(SelectionRowCtl.selectRow)
setvisible(true)
} else {
message.error('请先选择要操作的对应发货单号或对应订单号/售后单')
......@@ -216,6 +216,41 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
return num
}
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
form.validateFields().then(res => {
if (data.length > 0) {
resolve({
state: true,
name: 'goods',
})
onBadge(0, 1)
} else {
resolve({
state: false,
name: 'goods',
})
onBadge(1, 1)
}
}).catch(error => {
if(error && error.errorFields) {
onBadge(error.errorFields.length, 1)
}
})
})
}
})
/**编辑回显 */
useEffect(() => {
if(set.id) {
setdata([...set.detailList])
SelectionRowCtl.setSelectRow(set.detailList);
SelectionRowCtl.setSelectedRowKeys(set.detailList.map(v => v = v.productId))
}
}, [set.id])
return (
<>
<Button block type='dashed' style={{ marginBottom: '24px' }} onClick={openModal}><PlusOutlined />添加商品</Button>
......
......@@ -21,8 +21,17 @@ const layout: any = {
labelAlign: "left"
};
const TabFormErrors = (props) => {
return (
<Badge size="small" count={props.dot} offset={[6, -5]}>
{props.children}
</Badge>
)
}
const AddEditLogistics: React.FC<{}> = () => {
const basic = useRef<any>();
const goods = useRef<any>();
// 用于提交的
const [parmas, setParmas] = useState<any>({
digest: '',//单据摘要
......@@ -36,29 +45,47 @@ const AddEditLogistics: React.FC<{}> = () => {
receiverAddressId: '',//收货方id 1
shipperAddressId: '',//发货方id
receiverFullAddress: '',
createType: 1,
detailList: [],//物流单明细列表 ,LogisticsOrderDetailRequest
})
const [settlementMethod, setSettlementMethod] = useState<any>();
const [memberInfo, setmemberInfo] = useState<any>({});
const [badge, setbadge] = useState<any>([0,0,0])
const [badge, setbadge] = useState<any>([0,0,0]);
const { pathname, query } = history.location;
const type = pathname.split('/')[pathname.split('/').length - 1];
// 提交数据
const handleSubmit = async () => {
const basicRef = await basic.current.get();
if (basicRef.state) {
if( parmas.detailList.length > 0) {
const goodsRef = await goods.current.get();
if (basicRef.state && goodsRef.state) {
if( parmas.detailList.length > 0 ) {
const data = { ...basicRef.data };
data.invoicesNo = parmas.invoicesNo;
data.receiverMemberId = parmas.receiverMemberId;
data.receiverMemberName = parmas.receiverMemberName;
data.relevanceType = parmas.relevanceType;
data.detailList = parmas.detailList;
console.log(data, '提交的数据源');
data.createType = parmas.createType;
console.log(data)
if(type === 'add') {
PublicApi.postLogisticsOrderWaitSubmitAdd({...data}).then(res => {
if(res.code === 1000) {
history.goBack()
}
})
} else {
data.id = parmas.id;
console.log(data)
}
}
} else if(!goodsRef.state) {
setbadge(badge[1] = 1)
message.error('请先添加商品')
}
}
const getBasicInfo = (value: any, index: number, type?: number) => {
console.log(value, index, 85)
const data = { ...parmas };
if (index === 1) {
data.companyName = value.children
......@@ -88,7 +115,6 @@ const AddEditLogistics: React.FC<{}> = () => {
const data = [...badge];
data[idx] = num;
setbadge(data);
console.log(num, idx)
}
const getGoodsList = (list:any) => {
......@@ -109,13 +135,16 @@ const AddEditLogistics: React.FC<{}> = () => {
}
}, [memberInfo])
const TabFormErrors = (props) => {
return (
<Badge count={props.dot} offset={[5, -5]}>
{props.children}
</Badge>
)
}
useEffect(() => {
const id = query.id
if(id && type === 'edit') {
PublicApi.getLogisticsOrderWaitSubmitGet({id}).then(res => {
if(res.code === 1000) {
setParmas(res.data)
}
})
}
},[])
return (
<PageHeaderWrapper
......@@ -125,7 +154,7 @@ const AddEditLogistics: React.FC<{}> = () => {
>
<Card>
<Tabs type="card">
<TabPane key='tab-1' tab={<TabFormErrors dot={badge[0]}>基本信息</TabFormErrors>}>
<TabPane key='tab-1' tab={<TabFormErrors dot={badge[0]}>基本信息</TabFormErrors>} forceRender>
<BasicInfo
currentRef={basic}
set={parmas}
......@@ -133,14 +162,15 @@ const AddEditLogistics: React.FC<{}> = () => {
onGet={getBasicInfo}
/>
</TabPane>
<TabPane key='tab-2' tab={<TabFormErrors dot={badge[1]}>物流单明细</TabFormErrors>}>
<TabPane key='tab-2' tab={<TabFormErrors dot={badge[1]}>物流单明细</TabFormErrors>} forceRender>
<Goods
currentRef={goods}
set={parmas}
onBadge={getError}
onGet={getGoodsList}
/>
</TabPane>
<TabPane key='tab-3' tab='运费'>
<TabPane key='tab-3' tab='运费' forceRender>
<Form {...layout}>
<Form.Item label='运费'>
<span></span>
......@@ -150,7 +180,7 @@ const AddEditLogistics: React.FC<{}> = () => {
</Form.Item>
</Form>
</TabPane>
<TabPane key='tab-4' tab='流转记录'>
<TabPane key='tab-4' tab='流转记录' forceRender>
<Table />
</TabPane>
</Tabs>
......
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