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

修改物流路由

parent ba68398e
...@@ -28,21 +28,21 @@ const LogisticsRoute: RouterChild = { ...@@ -28,21 +28,21 @@ const LogisticsRoute: RouterChild = {
{ {
path: '/memberCenter/logisticsAbility/logistics/company/add', path: '/memberCenter/logisticsAbility/logistics/company/add',
name: 'addCompany', name: 'addCompany',
component: '@/pages/logistics/list/addCompany', component: '@/pages/logistics/logisticsCompany/add',
hideInMenu: true hideInMenu: true
}, },
// 物流公司管理-编辑 // 物流公司管理-编辑
{ {
path: '/memberCenter/logisticsAbility/logistics/company/edit', path: '/memberCenter/logisticsAbility/logistics/company/edit',
name: 'editCompany', name: 'editCompany',
component: '@/pages/logistics/list/addCompany', component: '@/pages/logistics/logisticsCompany/edit',
hideInMenu: true hideInMenu: true
}, },
// 物流公司管理-详情 // 物流公司管理-详情
{ {
path: '/memberCenter/logisticsAbility/logistics/company/detail', path: '/memberCenter/logisticsAbility/logistics/company/detail',
name: 'companyDetail', name: 'companyDetail',
component: '@/pages/logistics/list/addCompany', component: '@/pages/logistics/logisticsCompany/detail',
hideInMenu: true hideInMenu: true
}, },
// 发货地址 // 发货地址
...@@ -55,14 +55,14 @@ const LogisticsRoute: RouterChild = { ...@@ -55,14 +55,14 @@ const LogisticsRoute: RouterChild = {
{ {
path: '/memberCenter/logisticsAbility/logistics/deliveryAddress/add', path: '/memberCenter/logisticsAbility/logistics/deliveryAddress/add',
name: 'addDeliveryAddress', name: 'addDeliveryAddress',
component: '@/pages/logistics/list/components/addressForm', component: '@/pages/logistics/shippingAddress/add',
hideInMenu: true hideInMenu: true
}, },
// 发货地址-编辑 // 发货地址-编辑
{ {
path: '/memberCenter/logisticsAbility/logistics/deliveryAddress/edit', path: '/memberCenter/logisticsAbility/logistics/deliveryAddress/edit',
name: 'editDeliveryAddress', name: 'editDeliveryAddress',
component: '@/pages/logistics/list/components/addressForm', component: '@/pages/logistics/shippingAddress/edit',
hideInMenu: true hideInMenu: true
}, },
// 收货地址 // 收货地址
...@@ -75,14 +75,14 @@ const LogisticsRoute: RouterChild = { ...@@ -75,14 +75,14 @@ const LogisticsRoute: RouterChild = {
{ {
path: '/memberCenter/logisticsAbility/logistics/receivingAddress/add', path: '/memberCenter/logisticsAbility/logistics/receivingAddress/add',
name: 'addReceivingAddress', name: 'addReceivingAddress',
component: '@/pages/logistics/list/components/addressForm', component: '@/pages/logistics/receiptAddress/add',
hideInMenu: true hideInMenu: true
}, },
// 收货地址-编辑 // 收货地址-编辑
{ {
path: '/memberCenter/logisticsAbility/logistics/receivingAddress/edit', path: '/memberCenter/logisticsAbility/logistics/receivingAddress/edit',
name: 'editReceivingAddress', name: 'editReceivingAddress',
component: '@/pages/logistics/list/components/addressForm', component: '@/pages/logistics/receiptAddress/edit',
hideInMenu: true hideInMenu: true
}, },
// 运费模板 // 运费模板
......
...@@ -86,10 +86,15 @@ const fetchData = async (params) => { ...@@ -86,10 +86,15 @@ const fetchData = async (params) => {
const { Option } = Select; const { Option } = Select;
const defaultValue = 'lucy' const defaultValue = 'lucy'
const company: React.FC<{}> = () => { interface parmas {
pageStatus?: any,
id?: any,
isSee?: any
}
const company: React.FC<parmas> = (props) => {
//hook只能写在函数组件的顶级作用域 //hook只能写在函数组件的顶级作用域
const ref = useRef<any>({}) const ref = useRef<any>({})
const { pageStatus, id } = usePageStatus() const { pageStatus, id, isSee } = props
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio', customKey: 'memberId' }) const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio', customKey: 'memberId' })
const [menuForm] = Form.useForm(); const [menuForm] = Form.useForm();
const [headerTitle, setHeaderTitle] = useState('新建物流公司') const [headerTitle, setHeaderTitle] = useState('新建物流公司')
...@@ -266,7 +271,7 @@ const company: React.FC<{}> = () => { ...@@ -266,7 +271,7 @@ const company: React.FC<{}> = () => {
]} ]}
// initialValue={} // initialValue={}
> >
<Select placeholder="请选择合作类型" value={companyType} onChange={onChangeType}> <Select disabled={isSee} placeholder="请选择合作类型" value={companyType} onChange={onChangeType}>
<Option value={1}>平台物流服务商</Option> <Option value={1}>平台物流服务商</Option>
<Option value={2}>商户合作物流公司</Option> <Option value={2}>商户合作物流公司</Option>
</Select> </Select>
...@@ -287,7 +292,7 @@ const company: React.FC<{}> = () => { ...@@ -287,7 +292,7 @@ const company: React.FC<{}> = () => {
} }
]} ]}
> >
<Input className="input_addonAfter" disabled maxLength={20} addonAfter={selectBtn} /> <Input disabled={isSee} className="input_addonAfter" disabled maxLength={20} addonAfter={selectBtn} />
</Form.Item> </Form.Item>
: :
<Form.Item <Form.Item
...@@ -300,7 +305,7 @@ const company: React.FC<{}> = () => { ...@@ -300,7 +305,7 @@ const company: React.FC<{}> = () => {
} }
]} ]}
> >
<Input maxLength={20} /> <Input disabled={isSee} maxLength={20} />
</Form.Item> </Form.Item>
} }
</Col> </Col>
...@@ -315,7 +320,7 @@ const company: React.FC<{}> = () => { ...@@ -315,7 +320,7 @@ const company: React.FC<{}> = () => {
}, },
]} ]}
> >
<Input maxLength={40} disabled={companyType === 2 ? false : true} placeholder="输入物流公司名称" /> <Input maxLength={40} disabled={isSee ? isSee : (companyType === 2 ? false : true)} placeholder="输入物流公司名称" />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={18}> <Col span={18}>
...@@ -323,7 +328,7 @@ const company: React.FC<{}> = () => { ...@@ -323,7 +328,7 @@ const company: React.FC<{}> = () => {
name='remark' name='remark'
label='备注' label='备注'
> >
<TextArea rows={4} maxLength={60} /> <TextArea disabled={isSee} rows={4} maxLength={60} />
</Form.Item> </Form.Item>
</Col> </Col>
{ {
......
...@@ -18,7 +18,7 @@ import { StandardTable } from 'god' ...@@ -18,7 +18,7 @@ import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController' import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import {PublicApi,CustomApi} from '@/services/api' import { PublicApi, CustomApi } from '@/services/api'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import StatusSwitch from '@/components/StatusSwitch' import StatusSwitch from '@/components/StatusSwitch'
const data = [ const data = [
...@@ -41,14 +41,14 @@ const data = [ ...@@ -41,14 +41,14 @@ const data = [
] ]
// 模拟请求 // 模拟请求
const fetchData = (params?: any) => { const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数 console.log(params)//可以直接打印参数
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
PublicApi.getLogisticsCompanyPage({ ...params }).then(res => { PublicApi.getLogisticsCompanyPage({ ...params }).then(res => {
resolve(res.data) resolve(res.data)
}) })
}) })
} }
// const fetchData = async (params?: any) => { // const fetchData = async (params?: any) => {
// console.log(params)//可以直接打印参数 // console.log(params)//可以直接打印参数
...@@ -82,8 +82,8 @@ const Company: React.FC<{}> = () => { ...@@ -82,8 +82,8 @@ const Company: React.FC<{}> = () => {
align: 'left', align: 'left',
key: 'name', key: 'name',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<EyePreview url={`/memberCenter/logisticsAbility/logistics/company/detail?id=${record.id}&preview=1`}>{text}</EyePreview> <EyePreview url={`/memberCenter/logisticsAbility/logistics/company/detail?id=${record.id}`}>{text}</EyePreview>
) )
}, },
{ {
title: '合作类型', title: '合作类型',
...@@ -102,7 +102,7 @@ const Company: React.FC<{}> = () => { ...@@ -102,7 +102,7 @@ const Company: React.FC<{}> = () => {
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id,record.status)} record={record}/> <StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id, record.status)} record={record} />
) )
}, },
{ {
...@@ -112,17 +112,13 @@ const Company: React.FC<{}> = () => { ...@@ -112,17 +112,13 @@ const Company: React.FC<{}> = () => {
render: (text: any, record: any) => { render: (text: any, record: any) => {
const title = `确定要${status}吗?` const title = `确定要${status}吗?`
return ( return (
<> <>
{ record.status === 0 ? <Button disabled={record.status !== 0} type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/company/edit?id=${record.id}`)}>编辑</Button>
<> <Popconfirm disabled={record.status !== 0} title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete(record.id)}>
<Button type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/company/edit?id=${record.id}`)}>编辑</Button> <Button disabled={record.status !== 0} type='link'>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete(record.id)}> 删除
<Button type='link'>
删除
</Button> </Button>
</Popconfirm> </Popconfirm>
</>
:''}
</> </>
) )
} }
...@@ -156,9 +152,9 @@ const Company: React.FC<{}> = () => { ...@@ -156,9 +152,9 @@ const Company: React.FC<{}> = () => {
} }
}) })
} }
const handleChangeStatus = async (id:any,status:any) => { const handleChangeStatus = async (id: any, status: any) => {
let _status = status == 1 ? 0: 1 let _status = status == 1 ? 0 : 1
await PublicApi.postLogisticsCompanyEnable({id:id,status:_status}) await PublicApi.postLogisticsCompanyEnable({ id: id, status: _status })
ref.current.reload() ref.current.reload()
} }
...@@ -183,7 +179,7 @@ const Company: React.FC<{}> = () => { ...@@ -183,7 +179,7 @@ const Company: React.FC<{}> = () => {
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
tableProps={{rowKey:'id'}} tableProps={{ rowKey: 'id' }}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
......
...@@ -39,7 +39,9 @@ interface countryItem { ...@@ -39,7 +39,9 @@ interface countryItem {
} }
//列表带来的参数 //列表带来的参数
export interface ListProps { export interface ListProps {
title?: React.ReactNode title?: React.ReactNode,
type?: any,
id?: any
} }
export interface ListType { export interface ListType {
checked: boolean //可选 checked: boolean //可选
...@@ -61,7 +63,7 @@ for (let i = 10; i < 36; i++) { ...@@ -61,7 +63,7 @@ for (let i = 10; i < 36; i++) {
} }
const diaLogForm: React.FC<ListProps> = (props) => { const diaLogForm: React.FC<ListProps> = (props) => {
const type: string = history.location.query.page_type const { type, id} = props
const [areaCode, setAreaCode] = useState<number>(null) const [areaCode, setAreaCode] = useState<number>(null)
const [loading, setloading] = useState<boolean>(false) const [loading, setloading] = useState<boolean>(false)
const [Options, setOptions] = useState([]) const [Options, setOptions] = useState([])
...@@ -90,7 +92,6 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -90,7 +92,6 @@ const diaLogForm: React.FC<ListProps> = (props) => {
const formSubmit = (values) => { const formSubmit = (values) => {
console.log(values) console.log(values)
let id = history.location.query.id //0新建 let id = history.location.query.id //0新建
let type = history.location.query.page_type //'1' 发货 '2'收货
let value = { ...values } let value = { ...values }
value.isDefault = values.isDefault ? 1 : 0 value.isDefault = values.isDefault ? 1 : 0
value.provinceCode = value.provinceCode.split('-').length > 1 ? value.provinceCode.split('-')[0] : value.provinceCode value.provinceCode = value.provinceCode.split('-').length > 1 ? value.provinceCode.split('-')[0] : value.provinceCode
...@@ -176,7 +177,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -176,7 +177,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
const id = Number(history.location.query.id) const id = Number(history.location.query.id)
console.log(typeof(id)) console.log(typeof(id))
let title = id === 0 ? '新建' : '编辑' let title = id === 0 ? '新建' : '编辑'
history.location.query.page_type == '1' ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`) type === 1 ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`)
PublicApi.getManageCountryAreaGetTelCode().then(res => { PublicApi.getManageCountryAreaGetTelCode().then(res => {
res.data.forEach((item,index) => { res.data.forEach((item,index) => {
TelCodeList.push({ label: item, value: (index).toString() }) TelCodeList.push({ label: item, value: (index).toString() })
...@@ -194,7 +195,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -194,7 +195,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
}) })
},1000) },1000)
if (id != 0 && history.location.query.page_type == '1') { if (id != 0 && type === 1) {
PublicApi.getLogisticsShipperAddressGet({ id: id.toString() }).then(res => { PublicApi.getLogisticsShipperAddressGet({ id: id.toString() }).then(res => {
if (res.code == 1000) { if (res.code == 1000) {
let data = res.data let data = res.data
...@@ -218,7 +219,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -218,7 +219,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
} }
//收货 //收货
if (id != 0 && history.location.query.page_type == '2') { if (id != 0 && type === 2) {
PublicApi.getLogisticsReceiverAddressGet({ id: id.toString() }).then(res => { PublicApi.getLogisticsReceiverAddressGet({ id: id.toString() }).then(res => {
if (res.code == 1000) { if (res.code == 1000) {
let data = res.data let data = res.data
...@@ -326,7 +327,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -326,7 +327,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
> >
<FormMegaLayout labelCol={4} labelAlign="left"> <FormMegaLayout labelCol={4} labelAlign="left">
{ {
history.location.query.page_type == '1' ? type === 1 ?
<Field <Field
required required
title="发货人" title="发货人"
...@@ -362,7 +363,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -362,7 +363,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
/> />
} }
<FormMegaLayout label={history.location.query.page_type == '1' ? '发货地区' : '收货地区'} grid full autoRow required> <FormMegaLayout label={type === 1 ? '发货地区' : '收货地区'} grid full autoRow required>
<Field <Field
x-mega-props={{ span: 1 }} x-mega-props={{ span: 1 }}
x-component="Select" x-component="Select"
......
...@@ -62,7 +62,8 @@ interface Item { ...@@ -62,7 +62,8 @@ interface Item {
//父页面传递来的参数 //父页面传递来的参数
export interface ListProps { export interface ListProps {
title?: React.ReactNode, title?: React.ReactNode,
type: string type: string,
} }
export interface ListType { export interface ListType {
checked: boolean //可选 checked: boolean //可选
...@@ -124,11 +125,10 @@ const AddressList: React.FC<ListProps> = (props) => { ...@@ -124,11 +125,10 @@ const AddressList: React.FC<ListProps> = (props) => {
const toEdit = (id: number) => { const toEdit = (id: number) => {
// 发货地址管理列表,否则是收件地址管理列表 // 发货地址管理列表,否则是收件地址管理列表
if (props.type == '1') { if (props.type == '1') {
// history.push(`/memberCenter/logisticsAbility/logistics/addressForm?page_type=${props.type}&id=${id}`) history.push(`/memberCenter/logisticsAbility/logistics/deliveryAddress/edit?id=${id}`)
history.push(`/memberCenter/logisticsAbility/logistics/deliveryAddress/edit?page_type=${props.type}&id=${id}`)
} else { } else {
// history.push(`/memberCenter/logisticsAbility/logistics/addressForm?page_type=${props.type}&id=${id}`) // history.push(`/memberCenter/logisticsAbility/logistics/addressForm?page_type=${props.type}&id=${id}`)
history.push(`/memberCenter/logisticsAbility/logistics/receivingAddress/edit?page_type=${props.type}&id=${id}`) history.push(`/memberCenter/logisticsAbility/logistics/receivingAddress/edit?id=${id}`)
} }
}; };
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
...@@ -294,10 +294,10 @@ const AddressList: React.FC<ListProps> = (props) => { ...@@ -294,10 +294,10 @@ const AddressList: React.FC<ListProps> = (props) => {
// 发货地址管理列表,否则是收件地址管理列表 // 发货地址管理列表,否则是收件地址管理列表
if (props.type == '1') { if (props.type == '1') {
// history.push(`/memberCenter/logisticsAbility/logistics/addressForm?page_type=${props.type}&id=0`) // history.push(`/memberCenter/logisticsAbility/logistics/addressForm?page_type=${props.type}&id=0`)
history.push(`/memberCenter/logisticsAbility/logistics/deliveryAddress/add?page_type=${props.type}&id=0`) history.push(`/memberCenter/logisticsAbility/logistics/deliveryAddress/add`)
} else { } else {
// history.push(`/memberCenter/logisticsAbility/logistics/addressForm?page_type=${props.type}&id=0`) // history.push(`/memberCenter/logisticsAbility/logistics/addressForm?page_type=${props.type}&id=0`)
history.push(`/memberCenter/logisticsAbility/logistics/receivingAddress/add?page_type=${props.type}&id=0`) history.push(`/memberCenter/logisticsAbility/logistics/receivingAddress/add`)
} }
}} }}
> >
......
import React from 'react';
import { history } from 'umi';
import CompanyTemplate from '../list/addCompany';
const AddCompany: React.FC<{}> = () => {
return(
<CompanyTemplate />
)
}
export default AddCompany;
\ No newline at end of file
import React from 'react';
import { history } from 'umi';
import CompanyTemplate from '../list/addCompany';
const DetailCompany: React.FC<{}> = () => {
const { id } = history.location.query;
return(
<CompanyTemplate
pageStatus={'PREVIEW'}
id={id}
isSee={true}
/>
)
}
export default DetailCompany;
\ No newline at end of file
import React from 'react';
import { history } from 'umi';
import CompanyTemplate from '../list/addCompany';
const EditCompany: React.FC<{}> = () => {
const { id } = history.location.query;
return(
<CompanyTemplate
pageStatus={'EDIT'}
id={id}
/>
)
}
export default EditCompany;
\ No newline at end of file
import React from 'react';
import { history } from 'umi';
import AddressTemplate from '../list/components/addressForm';
const AddShipingAddress:React.FC<{}> = () => {
return(
<AddressTemplate
type={2}
id={0}
/>
)
}
export default AddShipingAddress;
\ No newline at end of file
import React from 'react';
import { history } from 'umi';
import AddressTemplate from '../list/components/addressForm';
const EditShipingAddress:React.FC<{}> = () => {
const { id } = history.location.query;
return(
<AddressTemplate
type={2}
id={id}
/>
)
}
export default EditShipingAddress;
\ No newline at end of file
import React from 'react';
import { history } from 'umi';
import AddressTemplate from '../list/components/addressForm';
const AddShipingAddress:React.FC<{}> = () => {
return(
<AddressTemplate
type={1}
id={0}
/>
)
}
export default AddShipingAddress;
\ No newline at end of file
import React from 'react';
import { history } from 'umi';
import AddressTemplate from '../list/components/addressForm';
const EditShipingAddress:React.FC<{}> = () => {
const { id } = history.location.query;
return(
<AddressTemplate
type={1}
id={id}
/>
)
}
export default EditShipingAddress;
\ No newline at end of file
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