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

Merge branch 'dev' into test

parents 7f44cb57 4ad13e89
...@@ -127,13 +127,6 @@ const LogisticsRoute: RouterChild = { ...@@ -127,13 +127,6 @@ const LogisticsRoute: RouterChild = {
path: '/memberCenter/logisticsAbility/logisticsSubmit', path: '/memberCenter/logisticsAbility/logisticsSubmit',
name: 'logisticsSubmit', name: 'logisticsSubmit',
routes: [ routes: [
// 新增
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/addLogistics',
name: 'addToOrderSubmit',
component: '@/pages/logistics/addLogistics',
hideInMenu: true
},
// 快递单查询 // 快递单查询
{ {
path: '/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList', path: '/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList',
...@@ -154,31 +147,17 @@ const LogisticsRoute: RouterChild = { ...@@ -154,31 +147,17 @@ const LogisticsRoute: RouterChild = {
component: '@/pages/logistics/logisticsSubmit/toOrderSumitList', 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', path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add',
name: 'addToOrderSubmit', name: 'addToOrderSubmit',
component: '@/pages/logistics/logisticsSubmit/detail', component: '@/pages/logistics/addLogistics',
hideInMenu: true hideInMenu: true
}, },
// 待提交物流单-编辑
// {
// path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit',
// name: 'editToOrderSubmit',
// component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
// hideInMenu: true
// },
// 待提交物流单-编辑 // 待提交物流单-编辑
{ {
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit', path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit',
name: 'editToOrderSubmit', name: 'editToOrderSubmit',
component: '@/pages/logistics/logisticsSubmit/detail', component: '@/pages/logistics/addLogistics',
hideInMenu: true hideInMenu: true
}, },
] ]
......
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, ...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)
}, [visible])
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) {
res.data.data.forEach((item:any) => {
item.applyNo = item.orderNo
item.applyAbstract = item.orderThe
item.applyTime = item.createTime
})
resolve(res.data)
}
})
break;
case 2:
PublicApi.getAsReplaceGoodsPageToBeAddReturnByLogistics({ ...parmas }).then((res:any) => {
if (res.code === 1000) {
res.data.data.forEach((item:any) => {
item.id = item.applyId
})
resolve(res.data)
}
})
break;
case 3:
PublicApi.getAsReplaceGoodsPageToBeAddReplaceByLogistics({ ...parmas }).then((res:any) => {
if (res.code === 1000) {
res.data.data.forEach((item:any) => {
item.id = item.applyId
})
resolve(res.data)
}
})
break;
case 4:
PublicApi.getAsReturnGoodsPageByLogistics({ ...parmas }).then((res:any) => {
if (res.code === 1000) {
res.data.data.forEach((item:any) => {
item.id = item.applyId
})
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
This diff is collapsed.
...@@ -156,7 +156,7 @@ export const otherSearchSchema: ISchema = { ...@@ -156,7 +156,7 @@ export const otherSearchSchema: ISchema = {
} }
} }
const ModalTableOrder: React.FC<ModalTableProps> = (props) => { const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
const { width = 704, confirm, cancel, visible, currentRef, resetModal, forceRender, useNestTable = false, nestColumns, nestTableProps, invoicesNo, relevanceType, ...resetTable } = props const { width = 704, confirm, cancel, visible, currentRef, resetModal, forceRender, useNestTable = false, nestColumns, nestTableProps, invoicesNo, relevanceType=1, ...resetTable } = props
const selfRef = currentRef || useRef<any>({}) const selfRef = currentRef || useRef<any>({})
useEffect(() => { useEffect(() => {
if (visible && forceRender) { if (visible && forceRender) {
......
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