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

修改物流路由

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