Commit 898804f0 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修改销售订单点击跳带新增物流单传参的问题

parent e6925110
...@@ -24,7 +24,9 @@ export interface ModalTableProps extends IStandardTableProps<any> { ...@@ -24,7 +24,9 @@ export interface ModalTableProps extends IStandardTableProps<any> {
nestTableProps?: any, nestTableProps?: any,
// fix: 新增参数, 为true时每次开启弹窗都会重新reload接口 // fix: 新增参数, 为true时每次开启弹窗都会重新reload接口
forceRender?: boolean, forceRender?: boolean,
searchName?: string searchName?: string,
invoicesNo?: string, // 对应订单号/售后单号
relevanceType?: number, //对应单据类型
} }
export const logisticsDeliverySearchSchema: ISchema = { export const logisticsDeliverySearchSchema: ISchema = {
...@@ -93,7 +95,7 @@ export const logisticsDeliverySearchSchema: ISchema = { ...@@ -93,7 +95,7 @@ export const logisticsDeliverySearchSchema: ISchema = {
} }
const ModalTableOrder: React.FC<ModalTableProps> = (props) => { const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
const { width = 704, confirm, cancel, visible, currentRef, resetModal, modalType = 'none', forceRender, useNestTable = false, nestColumns, nestTableProps, searchName, ...resetTable } = props const { width = 704, confirm, cancel, visible, currentRef, resetModal, modalType = 'none', forceRender, useNestTable = false, nestColumns, nestTableProps, searchName, invoicesNo, relevanceType, ...resetTable } = props
const selfRef = currentRef || useRef<any>({}) const selfRef = currentRef || useRef<any>({})
useEffect(() => { useEffect(() => {
if (visible && forceRender) { if (visible && forceRender) {
...@@ -121,9 +123,15 @@ const ModalTableOrder: React.FC<ModalTableProps> = (props) => { ...@@ -121,9 +123,15 @@ const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
} }
useEffect(() => { useEffect(() => {
console.log(relevanceType)
setType(relevanceType)
}, [relevanceType])
useEffect(() => {
form.setFieldsValue({ form.setFieldsValue({
radio: type radio: type
}) })
console.log('执行')
fetchData() fetchData()
}, [type]) }, [type])
...@@ -138,6 +146,7 @@ const ModalTableOrder: React.FC<ModalTableProps> = (props) => { ...@@ -138,6 +146,7 @@ const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
}) })
break; break;
case 2: case 2:
break; break;
case 3: case 3:
break; break;
......
...@@ -25,10 +25,11 @@ export interface interfaceinfo { ...@@ -25,10 +25,11 @@ export interface interfaceinfo {
currentRef?: any, currentRef?: any,
onGet?: Function, onGet?: Function,
onBadge?: Function, onBadge?: Function,
addId?: Number,
} }
const BasicInfo: React.FC<interfaceinfo> = (props) => { const BasicInfo: React.FC<interfaceinfo> = (props) => {
const { set, currentRef, onGet, onBadge } = props; const { set, currentRef, onGet, onBadge, addId } = props;
const [listcompany, setlistcompany] = useState<any>([]);//物流服务商 const [listcompany, setlistcompany] = useState<any>([]);//物流服务商
const [shipperaddress, setshipperaddress] = useState<any>([]);//发货地址 const [shipperaddress, setshipperaddress] = useState<any>([]);//发货地址
const [shippingvisible, setshippingvisible] = useState<boolean>(false); const [shippingvisible, setshippingvisible] = useState<boolean>(false);
...@@ -176,43 +177,85 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => { ...@@ -176,43 +177,85 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
}) })
} }
/**编辑是调用选择对应发货单 */
const getShipmentOrder = () => {
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);
})
}
/** 编辑是调用对应订单号/售后单 */
const getInvoicesOrder = (type: number) => {
switch (type) {
case 1:
PublicApi.getOrderLogisticsOrderList({orderNo: set.invoicesNo}).then((res:any) => {
if (res.code === 1000) {
const {data} = res.data;
invoicesRowCtl.setSelectRow(data);
invoicesRowCtl.setSelectedRowKeys(data.map(v => v.id));
onGet(data[0], 3);
}
})
break;
case 2:
break;
case 3:
break;
case 4:
break;
}
}
useEffect(() => { useEffect(() => {
/**编辑回显数据 */ /**编辑回显数据 */
if (set.id) { if (set.id) {
form.setFieldsValue({ form.setFieldsValue({
digest: set.digest, digest: set.digest,
companyId: set.companyId, companyId: set.companyId,
shipmentOrderCode: set.shipmentOrderCode shipmentOrderCode: set.shipmentOrderCode,
invoicesNo: set.invoicesNo,
}) })
if (set.shipmentOrderCode) { if (set.shipmentOrderCode) {
const params = { getShipmentOrder()
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]) }, [set.id])
/**从别处来新增的 */
useEffect(() => {
if (addId) {
form.setFieldsValue({
shipmentOrderCode: set.shipmentOrderCode,
invoicesNo: set.invoicesNo,
})
if (set.shipmentOrderCode) {
getShipmentOrder()
getInvoicesOrder(Number(set.relevanceType))
}
}
}, [addId])
return ( return (
<> <>
<Form <Form
...@@ -277,6 +320,8 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => { ...@@ -277,6 +320,8 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
width={900} width={900}
visible={invoicesvisible} visible={invoicesvisible}
columns={invoicesColumns} columns={invoicesColumns}
invoicesNo={set.invoicesNo}
relevanceType={set.relevanceType}
resetModal={{ destroyOnClose: true }} resetModal={{ destroyOnClose: true }}
tableProps={{ rowKey: 'id' }} tableProps={{ rowKey: 'id' }}
modalType='none' modalType='none'
......
...@@ -50,15 +50,16 @@ const AddEditLogistics: React.FC<{}> = () => { ...@@ -50,15 +50,16 @@ const AddEditLogistics: React.FC<{}> = () => {
}) })
const [settlementMethod, setSettlementMethod] = useState<any>(); const [settlementMethod, setSettlementMethod] = useState<any>();
const [memberInfo, setmemberInfo] = 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 { pathname, query } = history.location;
const type = pathname.split('/')[pathname.split('/').length - 1]; const type = pathname.split('/')[pathname.split('/').length - 1];
const [addId, setAddId] = useState<number>(0);
// 提交数据 // 提交数据
const handleSubmit = async () => { const handleSubmit = async () => {
const basicRef = await basic.current.get(); const basicRef = await basic.current.get();
const goodsRef = await goods.current.get(); const goodsRef = await goods.current.get();
if (basicRef.state && goodsRef.state) { if (basicRef.state && goodsRef.state) {
if( parmas.detailList.length > 0 ) { if (parmas.detailList.length > 0) {
const data = { ...basicRef.data }; const data = { ...basicRef.data };
data.invoicesNo = parmas.invoicesNo; data.invoicesNo = parmas.invoicesNo;
data.receiverMemberId = parmas.receiverMemberId; data.receiverMemberId = parmas.receiverMemberId;
...@@ -67,9 +68,9 @@ const AddEditLogistics: React.FC<{}> = () => { ...@@ -67,9 +68,9 @@ const AddEditLogistics: React.FC<{}> = () => {
data.detailList = parmas.detailList; data.detailList = parmas.detailList;
data.createType = parmas.createType; data.createType = parmas.createType;
console.log(data) console.log(data)
if(type === 'add') { if (type === 'add') {
PublicApi.postLogisticsOrderWaitSubmitAdd({...data}).then(res => { PublicApi.postLogisticsOrderWaitSubmitAdd({ ...data }).then(res => {
if(res.code === 1000) { if (res.code === 1000) {
history.goBack() history.goBack()
} }
}) })
...@@ -78,7 +79,7 @@ const AddEditLogistics: React.FC<{}> = () => { ...@@ -78,7 +79,7 @@ const AddEditLogistics: React.FC<{}> = () => {
console.log(data) console.log(data)
} }
} }
} else if(!goodsRef.state) { } else if (!goodsRef.state) {
setbadge(badge[1] = 1) setbadge(badge[1] = 1)
message.error('请先添加商品') message.error('请先添加商品')
} }
...@@ -89,7 +90,7 @@ const AddEditLogistics: React.FC<{}> = () => { ...@@ -89,7 +90,7 @@ const AddEditLogistics: React.FC<{}> = () => {
const data = { ...parmas }; const data = { ...parmas };
if (index === 1) { if (index === 1) {
data.companyName = value.children data.companyName = value.children
setmemberInfo({memberId: value.memberid,roleId: value.roleid}) setmemberInfo({ memberId: value.memberid, roleId: value.roleid })
} else if (index === 2) { } else if (index === 2) {
data.shipmentOrderCode = value.invoicesNo;//发货单号 data.shipmentOrderCode = value.invoicesNo;//发货单号
data.receiverPhone = value.phone; data.receiverPhone = value.phone;
...@@ -111,22 +112,22 @@ const AddEditLogistics: React.FC<{}> = () => { ...@@ -111,22 +112,22 @@ const AddEditLogistics: React.FC<{}> = () => {
} }
/**必填没填写出现角标 */ /**必填没填写出现角标 */
const getError = (num:number, idx:number) => { const getError = (num: number, idx: number) => {
const data = [...badge]; const data = [...badge];
data[idx] = num; data[idx] = num;
setbadge(data); setbadge(data);
} }
const getGoodsList = (list:any) => { const getGoodsList = (list: any) => {
const data = {...parmas} const data = { ...parmas }
data.detailList = list; data.detailList = list;
setParmas(data); setParmas(data);
} }
useEffect(() => { useEffect(() => {
if(Object.keys(memberInfo).length > 0) { if (Object.keys(memberInfo).length > 0) {
PublicApi.getSettleAccountsPlatformConfigGetSettlementWay({...memberInfo}).then(res => { PublicApi.getSettleAccountsPlatformConfigGetSettlementWay({ ...memberInfo }).then(res => {
if(res.code === 1000) { if (res.code === 1000) {
console.log(res.data) console.log(res.data)
} }
}).catch(error => { }).catch(error => {
...@@ -136,15 +137,25 @@ const AddEditLogistics: React.FC<{}> = () => { ...@@ -136,15 +137,25 @@ const AddEditLogistics: React.FC<{}> = () => {
}, [memberInfo]) }, [memberInfo])
useEffect(() => { useEffect(() => {
const id = query.id const { id, createType, shipmentOrderCode, invoicesNo, relevanceType } = query;
if(id && type === 'edit') { if (id && type === 'edit') {
PublicApi.getLogisticsOrderWaitSubmitGet({id}).then(res => { PublicApi.getLogisticsOrderWaitSubmitGet({ id }).then(res => {
if(res.code === 1000) { if (res.code === 1000) {
setParmas(res.data) setParmas(res.data)
} }
}) })
} else if(id && type === 'add') {
const data = { ...parmas };
if (createType && shipmentOrderCode && invoicesNo && relevanceType) {
data.createType = Number(createType);
data.shipmentOrderCode = shipmentOrderCode;
data.invoicesNo = invoicesNo;
data.relevanceType = Number(relevanceType);
setParmas(data);
setAddId(Number(id));
}
} }
},[]) }, [])
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
...@@ -156,6 +167,7 @@ const AddEditLogistics: React.FC<{}> = () => { ...@@ -156,6 +167,7 @@ const AddEditLogistics: React.FC<{}> = () => {
<Tabs type="card"> <Tabs type="card">
<TabPane key='tab-1' tab={<TabFormErrors dot={badge[0]}>基本信息</TabFormErrors>} forceRender> <TabPane key='tab-1' tab={<TabFormErrors dot={badge[0]}>基本信息</TabFormErrors>} forceRender>
<BasicInfo <BasicInfo
addId={addId}
currentRef={basic} currentRef={basic}
set={parmas} set={parmas}
onBadge={getError} onBadge={getError}
......
...@@ -101,12 +101,11 @@ export const useSelfTable = () => { ...@@ -101,12 +101,11 @@ export const useSelfTable = () => {
const handleConfirm = async (record) => { const handleConfirm = async (record) => {
const params = { const params = {
orderId: record.id, id: record.id,
invoicesTypeId: 2, createType: 2,// 创建方式
shipmentOrderCode: record.invoiceNumber, shipmentOrderCode: record.invoiceNumber,// 发货单号
orderDeliveryDetailsId: record.orderDeliveryDetailsId, invoicesNo: record.orderNo, // 对应订单号/售后单
invoicesNo: record.orderNo, relevanceType: 1
invoicesId: record.id
} }
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?${qs.stringify(params)}`) history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add?${qs.stringify(params)}`)
} }
......
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