Commit f0e03866 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 64f9b519 c7d00914
......@@ -288,7 +288,7 @@ const Detail: React.FC<{}> = () => {
const handleManualDeliver = (value) => {
const postData = {
produceNoticeOrderId: id,
manualDeliverBO: value,
manualDeliver: value,
}
PublicApi.postEnhanceProcessToBeDeliveryManualDeliver(postData)
.then(({data, code}) => {
......@@ -354,6 +354,11 @@ const Detail: React.FC<{}> = () => {
text={info.innerStatusName}></Badge>
</Descriptions.Item>
</Descriptions>
{
info?.cause
? <div style={{marginLeft: '32px'}}>不通过原因: {info.cause}</div>
: null
}
</Col>
<Col span={4}>
{
......@@ -376,10 +381,10 @@ const Detail: React.FC<{}> = () => {
<DeliverGood
mode="view"
deliveryType={info.deliveryType}
deliveryAddress={info.manualDeliverBO?.deliveryAddress}
deliveryTime={info.manualDeliverBO?.deliveryTime}
deliveryNo={info.manualDeliverBO?.deliveryNo}
logisticsName={info.manualDeliverBO?.logisticsName}
deliveryAddress={info.manualDeliver?.deliveryAddress}
deliveryTime={info.manualDeliver?.deliveryTime}
deliveryNo={info.manualDeliver?.deliveryNo}
logisticsName={info.manualDeliver?.logisticsName}
handleManualReceiver={handleManualReceiver}
>
<Button type="primary" >确认手工收货</Button>
......
......@@ -186,7 +186,7 @@ const AddLogistics: React.FC<{}> = () => {
relevanceOrderCode: res.data.orderNo,
voucherTime: res.data.transactionTime,
externalState: res.data.state,
shipmentOrderId: res.data.invoicesTypeId,
shipmentOrderId: res.data.id,
relevanceOrderId: res.data.relevanceInvoicesId,
}
form.setFieldsValue(obj);
......@@ -332,7 +332,7 @@ const AddLogistics: React.FC<{}> = () => {
case 1:
case 2:
case 3:
PublicApi.getWarehouseInvoicesProductList({ ...params, invoicesId: id }).then((res: any) => {
PublicApi.getWarehouseInvoicesProductList({ ...params, invoicesId: query.shipmentOrderId }).then((res: any) => {
if (res.code === 1000) {
res.data.data.forEach(item => {
item.category = item.categoryName
......@@ -344,21 +344,21 @@ const AddLogistics: React.FC<{}> = () => {
})
break;
case 4:
PublicApi.getAsReplaceGoodsPageReturnCommodityByLogistics({ ...params, dataId: id }).then(res => {
PublicApi.getAsReplaceGoodsPageReturnCommodityByLogistics({ ...params, dataId: query.relevanceOrderId }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
break;
case 5:
PublicApi.getAsReplaceGoodsPageReplaceCommodityByLogistics({ ...params, dataId: id }).then(res => {
PublicApi.getAsReplaceGoodsPageReplaceCommodityByLogistics({ ...params, dataId: query.relevanceOrderId}).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
break;
case 6:
PublicApi.getAsReturnGoodsPageCommodityByLogistics({ ...params, dataId: id }).then(res => {
PublicApi.getAsReturnGoodsPageCommodityByLogistics({ ...params, dataId: query.relevanceOrderId }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
......@@ -695,7 +695,7 @@ const AddLogistics: React.FC<{}> = () => {
}
</Select>
</Form.Item>
<Form.Item label="单据时间" name='voucherTime'><span>{query.voucherTime}</span></Form.Item>
<Form.Item label="单据时间" name='voucherTime'><span>{moment(query.voucherTime).format('YYYY-MM-DD HH:mm:ss')} </span></Form.Item>
<Form.Item label="外部状态" name='externalState'><span>{query.externalState}</span></Form.Item>
</Form>
</TabPane>
......
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, Radio, FormMegaLayout, NumberPicker } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import { PATTERN_MAPS } from '@/constants/regExp'
export interface Params {
id: number | string;
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
freightPrice?: any;
dontReceive?: boolean; //默认展示
}
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => {
}
const handletOk = (values: any) => {
let value = { ...values }
value.id = props.id
if(props.freightPrice) {
value.freightPrice = props.freightPrice
}
PublicApi.postLogisticsOrderWaitConfirmConfirm(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
})
}
useEffect(() => {
return () => {
}
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
onFieldChange$('status').subscribe(({ value }) => {
setFieldState('remark', state => {
if (value == 4) {
state.visible = false
} else {
state.visible = true
}
})
setFieldState('freightPrice', state => {
if (value != 4) {
state.visible = false
} else {
state.visible = true
}
})
})
}
return (
<>
<Modal
title='单据确认'
width={800}
visible={props.dialogVisible}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
okText='确定'
cancelText='取消'
>
<SchemaForm
labelCol={3}
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea, NumberPicker
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)}
initialValues={{
status: 4
}}
>
<Field
enum={
[
{ label: '接受物流单', value: 4 },
{ label: '不接受物流单', value: 3 }
]}
name='status'
required
x-component="Radio"
/>
{props.dontReceive &&
<>
{/* <FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top"> */}
<Field
title='不接受原因'
name="remark"
x-component="TextArea"
required
x-component-props={{
placeholder: '在此输入你的内容,最多60个汉字'
}}
x-mega-prop={{
labelAlign: 'left'
}}
x-rules={{
max: 60,
// maximum:10,//最大数值
message: '原因最多60个汉字'
}}
/>
</>
}
</SchemaForm>
</Modal>
</>
)
}
comfirmDialog.defaultProps = {
dontReceive: true
}
export default comfirmDialog
\ No newline at end of file
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, Radio, FormMegaLayout, NumberPicker } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import { PATTERN_MAPS } from '@/constants/regExp'
export interface Params {
id: number | string;
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
freightPrice?: any;
dontReceive?: boolean; //默认展示
}
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => {
}
const handletOk = (values: any) => {
let value = { ...values }
value.id = props.id
if(props.freightPrice) {
value.freightPrice = props.freightPrice
}
PublicApi.postLogisticsOrderWaitConfirmConfirm(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
}).catch(error => {
console.log(error)
props.onOK()
})
}
useEffect(() => {
return () => {
}
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
onFieldChange$('status').subscribe(({ value }) => {
setFieldState('remark', state => {
if (value == 4) {
state.visible = false
} else {
state.visible = true
}
})
setFieldState('freightPrice', state => {
if (value != 4) {
state.visible = false
} else {
state.visible = true
}
})
})
}
return (
<>
<Modal
title='单据确认'
width={800}
visible={props.dialogVisible}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
okText='确定'
cancelText='取消'
>
<SchemaForm
labelCol={3}
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea, NumberPicker
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)}
initialValues={{
status: 4
}}
>
<Field
enum={
[
{ label: '接受物流单', value: 4 },
{ label: '不接受物流单', value: 3 }
]}
name='status'
required
x-component="Radio"
/>
{props.dontReceive &&
<>
{/* <FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top"> */}
<Field
title='不接受原因'
name="remark"
x-component="TextArea"
required
x-component-props={{
placeholder: '在此输入你的内容,最多60个汉字'
}}
x-mega-prop={{
labelAlign: 'left'
}}
x-rules={{
max: 60,
// maximum:10,//最大数值
message: '原因最多60个汉字'
}}
/>
</>
}
</SchemaForm>
</Modal>
</>
)
}
comfirmDialog.defaultProps = {
dontReceive: true
}
export default comfirmDialog
......@@ -180,6 +180,7 @@ const company: React.FC<parmas> = (props) => {
let { memberId, roleId, name } = selectRow
menuForm.setFieldsValue({
companyMemberId: memberId,
companyRoleId: roleId,
name: name
})
setsVisible(false)
......
import React, { ReactText, useRef, useEffect, useLayoutEffect, useState } from 'react';
import { StandardTable } from 'god';
import { ISchema } from '@formily/antd';
import NestTable from '@/components/NestTable';
import { IStandardTableProps } from 'god/dist/src/standard-table';
import { Row, Col, Modal, Form, Radio } from 'antd';
import Search from '@/components//NiceForm/components/Search';
import SearchSelect from '@/components//NiceForm/components/SearchSelect';
import Submit from '@/components//NiceForm/components/Submit';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import DateSelect from '@/components//NiceForm/components/DateSelect';
import { PublicApi } from '@/services/api';
export interface ModalTableProps extends IStandardTableProps<any> {
width?: number,
confirm?: Function,
cancel?(),
visible?: boolean,
resetModal?: object,
useNestTable?: boolean, // 是否使用嵌套表格
nestColumns?: any[],
nestTableProps?: any,
// fix: 新增参数, 为true时每次开启弹窗都会重新reload接口
forceRender?: boolean,
invoicesNo?: string, // 对应订单号/售后单号
relevanceType?: number, //对应单据类型
}
export const logisticsDeliverySearchSchema: ISchema = {
type: 'object',
properties: {
invoicesNo: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '单据号',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
orderNo: {
type: 'string',
"x-component-props": {
placeholder: '会员名称',
style: {
width: 160
}
}
},
invoicesAbstract: {
type: 'string',
"x-component-props": {
placeholder: '单据摘要',
style: {
width: 160
}
}
},
"[startTransactionTime,endTransactionTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
export const otherSearchSchema: ISchema = {
type: 'object',
properties: {
applyNo: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '申请单号',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
properties: {
memberName: {
type: 'string',
"x-component-props": {
placeholder: '会员名称',
style: {
width: 160
}
}
},
applyAbstract: {
type: 'string',
"x-component-props": {
placeholder: '单据摘要',
style: {
width: 160
}
}
},
"[startTime,endTime]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
const { width = 704, confirm, cancel, visible, currentRef, resetModal, forceRender, useNestTable = false, nestColumns, nestTableProps, invoicesNo, relevanceType=1, ...resetTable } = props
const selfRef = currentRef || useRef<any>({})
useEffect(() => {
if (visible && forceRender) {
// 重新开启时需reload接口
// fix: 去掉自动reload接口, 防止重复请求
// fix: 新增forceRender接口, 用于控制弹窗是否需要reload
selfRef.current.reload && selfRef.current.reload()
} else {
selfRef.current.resetField && selfRef.current.resetField({
validate: false
})
}
}, [visible])
const [form] = Form.useForm();
const [type, setType] = useState<number>(1);
const [modalTitle, setmodalTitle] = useState<string>('订单');
useEffect(() => {
console.log(relevanceType)
setType(relevanceType)
}, [relevanceType])
useEffect(() => {
form.setFieldsValue({
radio: type
})
}, [type])
const fetchData = (parmas?: any) => {
return new Promise(resolve => {
switch (type) {
case 1:
PublicApi.getOrderLogisticsOrderList({...parmas}).then(res => {
if(res.code === 1000) {
resolve(res.data)
}
})
break;
case 2:
PublicApi.getAsReplaceGoodsPageToBeAddReturnByLogistics({...parmas}).then(res => {
if(res.code === 1000) {
resolve(res.data)
}
})
break;
case 3:
PublicApi.getAsReplaceGoodsPageToBeAddReplaceByLogistics({...parmas}).then(res => {
if(res.code === 1000) {
resolve(res.data)
}
})
break;
case 4:
PublicApi.getAsReturnGoodsPageByLogistics({...parmas}).then(res => {
if(res.code === 1000) {
resolve(res.data)
}
})
break;
}
})
}
return (
<Modal
width={width}
title={modalTitle}
onOk={() => confirm(type)}
onCancel={cancel}
visible={visible}
{...resetModal}
maskClosable={false}
>
{
useNestTable ? (
<NestTable
NestColumns={nestColumns}
className="common_tb"
rowClassName={(_, index) => (index % 2) === 0 && "tb_bg"}
{...nestTableProps}
/>
) : (
<StandardTable
tableType='small'
currentRef={selfRef}
fetchTableData={(params) => fetchData(params)}
formRender={(child, ps) => <Row justify='space-between' style={{ marginBottom: 16 }}>
<Col span={18} style={{ zIndex: 99 }}>
<Form form={form}>
<Form.Item name='radio' label='单据选择'>
<Radio.Group onChange={(e) => { setType(e.target.value); selfRef.current.reload(); }}>
<Radio value={1}>订单</Radio>
<Radio value={2}>换货申请单(退货发货)</Radio>
<Radio value={3}>换货申请单(换货发货)</Radio>
<Radio value={4}>退货申请单</Radio>
</Radio.Group>
</Form.Item>
</Form>
</Col>
<Col style={{ marginTop: 4 }}>{ps}</Col>
<Col span={18} style={{ zIndex: 99 }}>{child}</Col>
</Row >}
formilyProps={
{
ctx: {
schema: type === 1 ? logisticsDeliverySearchSchema : otherSearchSchema,
components: { ModalSearch: Search, SearchSelect, Submit, DateSelect },
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
type === 1 ? 'invoicesNo' : 'applyNo',
FORM_FILTER_PATH,
);
}
}
}
}
{...resetTable}
/>
)
}
</Modal>
)
}
ModalTableOrder.defaultProps = {}
export default ModalTableOrder
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';
import ModalTable from '@/components/ModalTable'
import { PublicApi } from '@/services/api';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
interface goodsParamsProps {
currentRef?: any,
set?: any,
onGet?: Function,
onBadge?: Function,
addId?: Number,
createType?: any
}
const AddGoods: React.FC<goodsParamsProps> = (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' });
const [data, setdata] = useState<Array<any>>([]);
const columns: ColumnType<any>[] = [
{
title: 'ID',
key: 'productId',
dataIndex: 'productId'
},
{
title: '商品名称',
key: 'productName',
dataIndex: 'productName'
},
{
title: '品类',
key: 'categoryName',
dataIndex: 'categoryName'
},
{
title: '品牌',
key: 'brandName',
dataIndex: 'brandName'
},
{
title: '单位',
key: 'unitName',
dataIndex: 'unitName'
},
{
title: '数量',
key: 'amount',
width: 120,
dataIndex: 'amount',
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>
},
{
title: '箱数',
key: 'carton',
width: 120,
dataIndex: 'carton',
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>
},
{
title: '重量 (KG)',
key: 'weight',
width: 120,
dataIndex: 'weight',
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>
},
{
title: '体积 (M3)',
key: 'volume',
width: 120,
dataIndex: 'volume',
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>
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any, index: number) => <Button type='link' onClick={() => onHandleDelect(index)}>删除</Button>
}
]
/** 删除 */
const onHandleDelect = (idx: number) => {
const list = [...data];
list.splice(idx, 1);
SelectionRowCtl.setSelectRow(list)
SelectionRowCtl.setSelectedRowKeys(list.map(v => v.productId));
setdata([...list])
form.resetFields();
console.log(idx)
}
/**选择商品弹框表头 */
const columnsTable: ColumnType<any>[] = [
{
title: 'ID',
key: 'productId',
dataIndex: 'productId'
},
{
title: '商品名称',
key: 'productName',
dataIndex: 'productName'
},
{
title: '品类',
key: 'categoryName',
dataIndex: 'categoryName'
},
{
title: '品牌',
key: 'brandName',
dataIndex: 'brandName'
}
]
/**获取商品列表 */
const fetchProductList = (params: any) => {
return new Promise(resolve => {
PublicApi.getOrderProcurementOrderProductPageList({ id: set.shipmentOrderId, ...params }).then(res => {
if (res.code === 1000) {
const arr: any = [];
res.data.data.forEach((item: any) => {
arr.push({
productId: item.productId,
productName: item.productName,
categoryName: item.category,
brandName: item.brand,
unitName: item.unit,
amount: item.amount,
carton: item.carton,
weight: item.weight,
volume: item.volume
})
})
res.data.data = arr
resolve(res.data)
}
})
})
}
/**用户循环改变列表返回的字段 */
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 };
if (Object.keys(dataInfo).length > 0 && dataInfo.shipmentOrderId) {
if (data.length > 0) {
SelectionRowCtl.setSelectRow([...data])
}
setvisible(true)
} else {
message.error('请先选择要操作的对应发货单号或对应订单号/售后单')
}
}
/** 确定添加商品 */
const onconfirm = () => {
const list = SelectionRowCtl.selectRow;
const arr: any[] = []
list.forEach((item: any) => {
arr.push({
productId: item.productId,
productName: item.productName,
categoryName: item.categoryName,
brandName: item.brandName,
unitName: item.unitName,
amount: item.amount,
carton: item.carton,
weight: item.weight,
volume: item.volume
})
})
setdata([...arr])
setvisible(false)
}
/**输入框输入 */
const inputOnchange = (id, e, name) => {
const { value } = e.target
data.forEach(v => {
if (v.productId === id) {
v[name] = value
}
})
onGet([...data]) // 返回给父级
setdata([...data])
countTotal(name)
}
/** 计算总数 */
const countTotal = (name?: string) => {
let num: any = 0
data.forEach((item: any, idx: number) => {
if (name === 'carton') {
num += item.carton ? Number(item.carton) : 0
} else if (name === 'weight') {
num += item.weight ? Number(item.weight) : 0
} else if (name === 'volume') {
num += item.volume ? Number(item.volume) : 0
}
})
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])
/**别处单据过来 */
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 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>
<Row gutter={[24, 24]} style={{ margin: '0 0 0 65%', width: '35%' }}>
<Col span={8}><Statistic title="总箱数(箱)" value={countTotal('carton')} /></Col>
<Col span={8}><Statistic title="总重量(KG)" value={countTotal('weight')} /></Col>
<Col span={8}><Statistic title="总体积(M3)" value={countTotal('volume')} /></Col>
</Row>
{/* 选择商品弹框 */}
<ModalTable
width={900}
modalTitle='选择商品'
columns={columnsTable}
visible={visible}
rowSelection={rowSelection}
fetchTableData={params => fetchProductList(params)}
resetModal={{ destroyOnClose: true }}
tableProps={{ rowKey: 'productId' }}
cancel={() => setvisible(false)}
confirm={() => onconfirm()}
/>
</>
)
}
export default AddGoods;
.revise_style {
:global {
.ant-form-item-label {
width: 174px;
label {
color:#6B778C
}
}
.ant-form-item-control {
width: 500px;
.ant-form-item-control-input-content {
position: relative;
.ant-btn-link {
position: absolute;
right: -120px;
}
.ant-picker {
width: 100%;
}
}
.ant-input-group-addon {
.ant-input-search-button {
background-color: #6B778C;
border-color: #6B778C;
}
}
}
.ant-radio-group-solid {
.ant-radio-button-wrapper-checked {
background: #6B778C;
border-color: #6B778C;
&:hover {
background: #6B778C;
border-color: #6B778C;
}
}
}
}
.upload_item {
padding: 5px 8px;
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #FAFBFC;
.upload_left {
display: flex;
align-items: center;
color: #303133;
:global {
.anticon-file-word {
color: #4279df;
font-size: 20px;
margin-right: 8px;
}
}
}
.upload_right {
color: #00B37A;
cursor: pointer;
:global {
.anticon-delete {
margin-left: 19px;
color: #C0C4CC;
}
}
}
}
}
\ No newline at end of file
/**
* @Name: 新增编辑 - 待提交物流单 - 流转记录
* @Date: 2020-11-06
* @Author: HJX
*/
import React from 'react';
import { Table } from 'antd';
import {ColumnType} from 'antd/lib/table/interface'
const TableLOG:React.FC<{}> = () => {
const columns: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'operatorRoleId'
},{
title: '操作角色',
dataIndex: 'operatorRoleName'
},{
title: '状态',
dataIndex: 'status'
},{
title: '操作',
dataIndex: 'type'
},{
title: '操作时间',
dataIndex: 'operateTime'
},{
title: '审核意见',
dataIndex: 'remark'
}
]
return(
<Table columns={columns} />
)
}
export default TableLOG
\ No newline at end of file
/**
* @Name: 新增编辑 - 待提交物流单
* @Date: 2020-11-06
* @Author: HJX
*/
import React, { useState, useRef, useEffect } from 'react';
import { Button, Card, Tabs, Form, message, Badge } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReturnEle from '@/components/ReturnEle';
import { history } from 'umi';
import Table from './components/table';//流转记录
import BasicInfo from './components/basicInfo';//基本信息
import Goods from './components/goods';//物流单明细
import { PublicApi } from '@/services/api';
const { TabPane } = Tabs
const layout: any = {
colon: false,
labelCol: { style: { width: '174px' } },
wrapperCol: { span: 9 },
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: '',//单据摘要
companyId: '',//物流服务商id
shipmentOrderId: '',//发货单id 1
shipmentOrderCode: '',//发货单号 1
relevanceOrderId: '',//对应订单id
relevanceOrderCode: '',//对应单据编号 1
relevanceType: 1,//对应单据类型 1-订单 2-换货申请单(退货发货) 3-换货申请单(换货发货) 4-退货申请单
receiverName: '',//收货方名称1
receiverAddressId: '',//收货方id 1
shipperAddressId: '',//发货方id
receiverFullAddress: '',
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]);
const { pathname, query } = history.location;
const type = pathname.split('/')[pathname.split('/').length - 1];
const [addId, setAddId] = useState<number>(0);
// 提交数据
const handleSubmit = async () => {
const basicRef = await basic.current.get();
const goodsRef = await goods.current.get();
if (basicRef.state && goodsRef.state) {
if (parmas.detailList.length > 0) {
const data = { ...basicRef.data };
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;
if (type === 'add') {
PublicApi.postLogisticsOrderWaitSubmitAdd({ ...data }).then(res => {
if (res.code === 1000) {
history.goBack()
}
})
} else {
data.id = parmas.id;
PublicApi.postLogisticsOrderWaitSubmitUpdate({...data }).then(res => {
if (res.code === 1000) {
history.goBack()
}
})
}
}
} 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
setmemberInfo({ memberId: value.memberid, roleId: value.roleid })
} else if (index === 2) {
data.shipmentOrderId = value.id
data.shipmentOrderCode = value.shipmentOrderCode;//发货单号
data.receiverPhone = value.phone;
data.receiverName = value.receiverName;//收货方名称
data.receiverFullAddress = value.fullAddress;
data.receiverMemberName = value.memberName;
} 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
}
setParmas(data)
}
/**必填没填写出现角标 */
const getError = (num: number, idx: number) => {
const data = [...badge];
data[idx] = num;
setbadge(data);
}
const getGoodsList = (list: any) => {
const data = { ...parmas }
data.detailList = list;
setParmas(data);
}
useEffect(() => {
if (Object.keys(memberInfo).length > 0) {
PublicApi.getSettleAccountsPlatformConfigGetSettlementWay({ ...memberInfo }).then(res => {
if (res.code === 1000) {
console.log(res.data)
}
}).catch(error => {
message.error(error.message)
})
}
}, [memberInfo])
useEffect(() => {
const { id, createType, shipmentOrderCode, invoicesNo, relevanceType } = query;
if (id && type === 'edit') {
PublicApi.getLogisticsOrderWaitSubmitGet({ id }).then(res => {
if (res.code === 1000) {
setParmas(res.data)
}
})
} else if (id && type === 'add') {
const data = { ...parmas };
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 (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReturnEle description='返回' />}
extra={<Button type="primary" onClick={handleSubmit}> 保存</Button>}
>
<Card>
<Tabs type="card">
<TabPane key='tab-1' tab={<TabFormErrors dot={badge[0]}>基本信息</TabFormErrors>} forceRender>
<BasicInfo
addId={addId}
currentRef={basic}
set={parmas}
onBadge={getError}
onGet={getBasicInfo}
/>
</TabPane>
<TabPane key='tab-2' tab={<TabFormErrors dot={badge[1]}>物流单明细</TabFormErrors>} forceRender>
<Goods
addId={addId}
createType={query.createType}
currentRef={goods}
set={parmas}
onBadge={getError}
onGet={getGoodsList}
/>
</TabPane>
<TabPane key='tab-3' tab='运费' forceRender>
<Form {...layout}>
<Form.Item label='运费'>
<span></span>
</Form.Item>
<Form.Item label='结算方式'>
<span></span>
</Form.Item>
</Form>
</TabPane>
<TabPane key='tab-4' tab='流转记录' forceRender>
<Table />
</TabPane>
</Tabs>
</Card>
</PageHeaderWrapper>
)
}
export default AddEditLogistics
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