Commit 60109d24 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修改待新增物流单

parent fb311c84
......@@ -146,7 +146,11 @@ const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
})
break;
case 2:
PublicApi.getAsreplaceGoodspageToBeAddReturnByLogistics({...parmas}).then(res => {
if(res.code === 1000) {
resolve(res.data)
}
})
break;
case 3:
break;
......
......@@ -121,13 +121,18 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
// 确定
const handleShipping = () => {
const selectRow = shippingRowCtl.selectRow[0]
console.log(selectRow)
form.setFieldsValue({
shipmentOrderCode: selectRow.invoicesNo
})
onGet(selectRow, 2);
setshippingvisible(false);
}
const handleInvoices = (type: number) => {
const selectRow = invoicesRowCtl.selectRow[0]
form.setFieldsValue({
invoicesNo: selectRow.orderNo
relevanceOrderCode: selectRow.orderNo
})
onGet(selectRow, 3, type);
setinvoicesvisible(false);
......@@ -234,27 +239,24 @@ const BasicInfo: React.FC<interfaceinfo> = (props) => {
digest: set.digest,
companyId: set.companyId,
shipmentOrderCode: set.shipmentOrderCode,
invoicesNo: set.invoicesNo,
relevanceOrderCode: set.relevanceOrderCode,
shipperAddressId: set.shipperAddressId
})
if (set.shipmentOrderCode) {
getShipmentOrder()
}
if(set.relevanceOrderCode) {
getInvoicesOrder(Number(set.relevanceType))
}
}
}, [set.id])
/**从别处来新增的 */
useEffect(() => {
if (addId) {
if(addId) {
console.log(set, 960)
form.setFieldsValue({
shipmentOrderCode: set.shipmentOrderCode,
invoicesNo: set.invoicesNo,
relevanceOrderCode: set.relevanceOrderCode,
})
if (set.shipmentOrderCode) {
getShipmentOrder()
getInvoicesOrder(Number(set.relevanceType))
}
}
}, [addId])
}, [set.id, addId])
return (
<>
......@@ -276,11 +278,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 disabled={!!addId} readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={() => setshippingvisible(true)} />
{/* <Button type='link'>查看单号详情</Button> */}
</Form.Item>
<Form.Item label='对应订单号/售后单' name='invoicesNo'>
<Search readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={() => setinvoicesvisible(true)} />
<Form.Item label='对应订单号/售后单' name='relevanceOrderCode'>
<Search disabled={!!addId} readOnly enterButton={<><LinkOutlined /> 选择</>} onSearch={() => setinvoicesvisible(true)} />
{/* <Button type='link'>查看单号详情</Button> */}
</Form.Item>
<Form.Item label="收货方" name='receiverName'><span>{set.receiverName}</span></Form.Item>
......
......@@ -11,10 +11,12 @@ interface goodsParamsProps {
set?: any,
onGet?: Function,
onBadge?: Function,
addId?: Number,
createType?: any
}
const AddGoods: React.FC<goodsParamsProps> = (props) => {
const { currentRef, set, onGet, onBadge } = props;
const { currentRef, set, onGet, onBadge, addId, createType } = props;
const [form] = Form.useForm();
const [visible, setvisible] = useState<boolean>(false);
const [rowSelection, SelectionRowCtl] = useRowSelectionTable({ customKey: 'productId' });
......@@ -50,7 +52,7 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'amount',
width: 120,
dataIndex: 'amount',
render: (text: any, record: any, index:number) =>
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,7 +63,7 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'carton',
width: 120,
dataIndex: 'carton',
render: (text: any, record: any, index:number) =>
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,7 +73,7 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'weight',
width: 120,
dataIndex: 'weight',
render: (text: any, record: any, index:number) =>
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,7 +83,7 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
key: 'volume',
width: 120,
dataIndex: 'volume',
render: (text: any, record: any, index:number) =>
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>
......@@ -154,6 +156,25 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
})
}
/**用户循环改变列表返回的字段 */
const forKeyValue = (data: any) => {
const arr: any = [];
data.forEach((item:any) => {
arr.push({
productId: item.id,
productName: item.productName,
categoryName: item.category,
brandName: item.brand,
unitName: item.unit,
amount: item.productCount,
carton: item.carton,
weight: item.weight,
volume: item.volume
})
})
setdata([...arr])
}
/** 打开添加商品 */
const openModal = () => {
const dataInfo = { ...set };
......@@ -234,7 +255,7 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
onBadge(1, 1)
}
}).catch(error => {
if(error && error.errorFields) {
if (error && error.errorFields) {
onBadge(error.errorFields.length, 1)
}
})
......@@ -244,16 +265,33 @@ const AddGoods: React.FC<goodsParamsProps> = (props) => {
/**编辑回显 */
useEffect(() => {
if(set.id) {
if (set.id) {
setdata([...set.detailList])
SelectionRowCtl.setSelectRow(set.detailList);
SelectionRowCtl.setSelectedRowKeys(set.detailList.map(v => v = v.productId))
}
}, [set.id])
/**别处单据过来 */
useEffect(() => {
switch (Number(createType)) {
case 2:
PublicApi.getWarehouseInvoicesDetailsList({invoicesId: addId.toString()}).then(res => {
if(res.code === 1000) {
forKeyValue(res.data)
}
})
break
case 3:
break
case 4:
break
}
}, [addId])
return (
<>
<Button block type='dashed' style={{ marginBottom: '24px' }} onClick={openModal}><PlusOutlined />添加商品</Button>
<Button disabled={!!addId} block type='dashed' style={{ marginBottom: '24px' }} onClick={openModal}><PlusOutlined />添加商品</Button>
<Form form={form}>
<Table columns={columns} dataSource={data} rowKey={'productId'} pagination={false} />
</Form>
......
......@@ -39,7 +39,7 @@ const AddEditLogistics: React.FC<{}> = () => {
shipmentOrderId: '',//发货单id 1
shipmentOrderCode: '',//发货单号 1
relevanceOrderId: '',//对应订单id
invoicesNo: '',//对应单据编号 1
relevanceOrderCode: '',//对应单据编号 1
relevanceType: 1,//对应单据类型 1-订单 2-换货申请单(退货发货) 3-换货申请单(换货发货) 4-退货申请单
receiverName: '',//收货方名称1
receiverAddressId: '',//收货方id 1
......@@ -48,6 +48,7 @@ const AddEditLogistics: React.FC<{}> = () => {
createType: 1,
detailList: [],//物流单明细列表 ,LogisticsOrderDetailRequest
})
const parmasRef = useRef(parmas)
const [settlementMethod, setSettlementMethod] = useState<any>();
const [memberInfo, setmemberInfo] = useState<any>({});
const [badge, setbadge] = useState<any>([0, 0, 0]);
......@@ -61,13 +62,13 @@ const AddEditLogistics: React.FC<{}> = () => {
if (basicRef.state && goodsRef.state) {
if (parmas.detailList.length > 0) {
const data = { ...basicRef.data };
data.invoicesNo = parmas.invoicesNo;
data.relevanceOrderCode = parmas.relevanceOrderCode;
data.receiverMemberId = parmas.receiverMemberId;
data.receiverMemberName = parmas.receiverMemberName;
data.relevanceOrderId = parmas.relevanceOrderId;
data.relevanceType = parmas.relevanceType;
data.detailList = parmas.detailList;
data.createType = parmas.createType;
console.log(data)
if (type === 'add') {
PublicApi.postLogisticsOrderWaitSubmitAdd({ ...data }).then(res => {
if (res.code === 1000) {
......@@ -76,7 +77,11 @@ const AddEditLogistics: React.FC<{}> = () => {
})
} else {
data.id = parmas.id;
console.log(data)
PublicApi.postLogisticsOrderWaitSubmitUpdate({...data }).then(res => {
if (res.code === 1000) {
history.goBack()
}
})
}
}
} else if (!goodsRef.state) {
......@@ -92,18 +97,21 @@ const AddEditLogistics: React.FC<{}> = () => {
data.companyName = value.children
setmemberInfo({ memberId: value.memberid, roleId: value.roleid })
} else if (index === 2) {
data.shipmentOrderCode = value.invoicesNo;//发货单号
data.receiverPhone = value.phone;
data.receiverName = value.receiverName;//收货方名称
data.receiverFullAddress = value.fullAddress;
data.receiverMemberName = value.memberName;
data.shipmentOrderId = value.id
} else if (index === 3 && !data.shipmentOrderId) {
data.shipmentOrderCode = value.shipmentOrderCode;//发货单号
data.receiverPhone = value.phone;
data.receiverName = value.receiverName;//收货方名称
data.receiverFullAddress = value.fullAddress;
data.receiverMemberName = value.memberName;
data.shipmentOrderId = value.id
} else if (index === 3) {
if (!data.shipmentOrderId) {
data.receiverPhone = value.phone;
data.receiverName = value.receiverName;//收货方名称
data.receiverFullAddress = value.fullAddress;
data.receiverMemberName = value.memberName;
}
data.relevanceOrderId = value.id
data.relevanceOrderCode = value.orderNo
data.relevanceType = type;
} else {
data.shipperFullAddress = value.children
......@@ -144,17 +152,41 @@ const AddEditLogistics: React.FC<{}> = () => {
setParmas(res.data)
}
})
} else if(id && type === 'add') {
} 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));
data.createType = Number(createType);
data.relevanceType = Number(relevanceType);
data.shipmentOrderCode = shipmentOrderCode;
data.relevanceOrderCode = invoicesNo;
switch (Number(relevanceType)) {
case 1:
new Promise(resolve => {
PublicApi.getWarehouseInvoicesDetails({ invoicesId: id }).then((res: any) => {
resolve(res.data)
})
}).then((res: any) => {
data.relevanceOrderId = res.relevanceInvoicesId
data.receiverPhone = res.phone;
data.receiverName = res.receiverName;//收货方名称
data.receiverFullAddress = res.fullAddress;
data.receiverMemberName = res.memberName;
}).catch(error => {
console.log(error)
})
break;
case 2:
break;
case 3:
break;
case 4:
break;
}
parmasRef.current = data
setParmas(parmasRef.current);
setAddId(Number(id));
}
}, [])
return (
......@@ -176,6 +208,8 @@ const AddEditLogistics: React.FC<{}> = () => {
</TabPane>
<TabPane key='tab-2' tab={<TabFormErrors dot={badge[1]}>物流单明细</TabFormErrors>} forceRender>
<Goods
addId={addId}
createType={query.createType}
currentRef={goods}
set={parmas}
onBadge={getError}
......
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form,Radio } from 'antd'
import React from 'react';
import { Modal, Radio } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, FormMegaLayout } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import { Input, Select } from '@formily/antd-components'
import usePayTypeEnum from './usePayTypeEnum';
export interface Params {
id?: any,
mode:number,
type?: number|string,
mode: number,
type?: number | string,
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
......@@ -20,32 +20,29 @@ export interface Params {
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
const handleCancel = () => {
}
const { payTypeEnum } = usePayTypeEnum()
const handletOk = (values: any) => {
let value = { ...values }
if(props.type){
payTypeEnum.forEach(v => {
if(v.value === value.code) {
value.name = v.label
}
})
console.log(value, 100086)
if (props.type) {
value.type = props.type
}
console.log('列表',value)
props.onOK(value)
}
useEffect(() => {
return () => {
}
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
}
return (
<>
<Modal
title={ props.mode === 0 ?'新增参数配置':'编辑参数配置'}
title={props.mode === 0 ? '新增参数配置' : '编辑参数配置'}
width={800}
visible={props.dialogVisible}
onOk={() => actions.submit()}
......@@ -56,10 +53,11 @@ const comfirmDialog: React.FC<Params> = (props) => {
cancelText='取消'
>
<SchemaForm
labelCol={3}
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea
Input, Radio: Radio.Group, TextArea: Input.TextArea,
Select
}}
actions={actions}
effects={() => useFormEffects()}
......@@ -69,14 +67,14 @@ const comfirmDialog: React.FC<Params> = (props) => {
}
>
<Field
name='code'
name='payWayCodeTypeEnum'
title='参数代码'
required
x-component-props={{
placeholder: '',
}}
x-component="Input"
enum={payTypeEnum}
x-component="Select"
/>
<>
<Field
......@@ -86,7 +84,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
required
x-component-props={{
placeholder: '',
// addonBefore: ' '
// addonBefore: ' '
}}
x-rules={{
......@@ -117,7 +115,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
}
comfirmDialog.defaultProps = {
dontReceive: true,
type:1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
type: 1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
}
export default comfirmDialog
\ No newline at end of file
export default comfirmDialog
import { PublicApi } from '@/services/api';
import React, { useState, useEffect, useRef } from 'react';
const usePayTypeEnum = () => {
const [payTypeEnum, setPayTypeEnum] = useState<any>([])
const ref = useRef(payTypeEnum);
useEffect(() => {
const getPayWayType = async () => {
await PublicApi.getPayGetPayWayCodeTypeEnum().then(res => {
if(res.code === 1000) {
const { data } = res;
const payWay: any[] = []
data.forEach(v => {
payWay.push({
label: v.name,
value: v.type
})
})
ref.current = payWay
setPayTypeEnum(ref.current)
}
})
}
getPayWayType();
},[])
return { payTypeEnum };
}
export default usePayTypeEnum;
......@@ -149,7 +149,7 @@ const PaySetting: React.FC<{}> = () => {
}
const tableColumns: ColumnType<any>[] = [
{ dataIndex: 'code', title: '参数代码', align: 'center' },
{ dataIndex: 'code', title: '参数代码', align: 'center', render:(text:any, record:any) => <span>{record.name}</span> },
{ dataIndex: 'value', align: 'center', title: '参数值' },
{ dataIndex: 'describe', title: '参数描述', align: 'center' },
{
......
......@@ -9,6 +9,7 @@ import { Button, Card, Tabs } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import PayWayRadio from './components/payWayRadio';
import { set } from 'mobx';
const { TabPane } = Tabs
const PayWaySetTemplate:React.FC<{}> = () => {
......@@ -16,6 +17,7 @@ const PayWaySetTemplate:React.FC<{}> = () => {
const [name, setname] = useState<string>('');
const [isPitchOn, setisPitchOn] = useState<number>(0);
const [selectId, setselectId] = useState<number>(1);
const [step, setStep] = useState<Array<number>>([]);
const payWayConfigInfo = () => {
// 支付配置信息
return new Promise(resolve => {
......@@ -27,25 +29,34 @@ const PayWaySetTemplate:React.FC<{}> = () => {
})
}
const initPayWayStart = async (id:any) => {
await PublicApi.getPayMemberQueryPlatformIsStart({id}).then(res => {
if(res.code === 1000) {
setisPitchOn(res.data.isPitchOn)
setname(res.data.way);
setselectId(res.data.id)
}
})
const data = [...step,Number(id)];
let arr = [...new Set(data)]
setStep(arr)
const conditions = arr.find(v => v === Number(id))
console.log(conditions)
if(!conditions) {
await PublicApi.getPayMemberQueryPlatformIsStart({id}).then(res => {
if(res.code === 1000) {
setisPitchOn(res.data.isPitchOn)
setname(res.data.way);
setselectId(res.data.id)
}
})
}
}
const handleTabClick = (e:any) => {
initPayWayStart(e)
const handleTabClick = (key:any) => {
initPayWayStart(key)
}
const handleChangeRadio = (e:any) => {
setisPitchOn(e.target.value)
}
useEffect(() => {
// 支付配置信息
payWayConfigInfo().then(res => {
payWayConfigInfo().then((res:any) => {
setconfig(res);
initPayWayStart(res[0].id);
const id = res[0].id;
setStep([...step, id])
initPayWayStart(id);
})
}, [])
......@@ -55,7 +66,7 @@ const PayWaySetTemplate:React.FC<{}> = () => {
>
<Card>
<Tabs type="card" onTabClick={handleTabClick}>
{config.map(item =>
{config.map(item =>
<TabPane tab={item.way} key={item.id} forceRender>
<PayWayRadio
name={name}
......@@ -70,4 +81,4 @@ const PayWaySetTemplate:React.FC<{}> = () => {
</PageHeaderWrapper>
)
};
export default PayWaySetTemplate;
\ No newline at end of file
export default PayWaySetTemplate;
......@@ -101,7 +101,7 @@ export const useSelfTable = () => {
const handleConfirm = async (record) => {
const params = {
id: record.id,
id: record.orderDeliveryDetailsId,
createType: 2,// 创建方式
shipmentOrderCode: record.invoiceNumber,// 发货单号
invoicesNo: record.orderNo, // 对应订单号/售后单
......
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