Commit 392814eb authored by LeeJiancong's avatar LeeJiancong

对接部分接口

parent ce445456
...@@ -66,7 +66,7 @@ const LogisticsRoute = { ...@@ -66,7 +66,7 @@ const LogisticsRoute = {
}, },
/** /**
* @description: 物流单管理模块 * @description: 物流单提交管理模块
* @param {type} * @param {type}
* @return: * @return:
*/ */
...@@ -76,12 +76,50 @@ const LogisticsRoute = { ...@@ -76,12 +76,50 @@ const LogisticsRoute = {
key: 'logisticsSubmit', key: 'logisticsSubmit',
routes: [ routes: [
{ {
path: '/memberCenter/logisticsAbility/logisticsSubmit/orderSearchList', path: '/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList',
name: 'orderSearchList', name: 'orderSubmitSearchList',
component: '@/pages/logistics/logisticsSubmit/orderSearchList', component: '@/pages/logistics/logisticsSubmit/orderSearchList',
},
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil',
name: 'orderSubmitDeatil',
component: '@/pages/logistics/components/orderSearchDetail',
hideInMenu: true
},
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList',
name: 'toOrderSumitList',
component: '@/pages/logistics/logisticsSubmit/toOrderSumitList',
}
]
},
/**
* @description: 物流单处理管理模块
* @param {type}
* @return:
*/
{
path: '/memberCenter/logisticsAbility/logisticsResult',
name: 'logisticsResult',
key: 'logisticsResult',
routes: [
{
path: '/memberCenter/logisticsAbility/logisticsResult/orderResultSearchList',
name: 'orderResultSearchList',
component: '@/pages/logistics/logisticsResult/orderSearchList',
},
{//物流结果详情处理
path: '/memberCenter/logisticsAbility/logisticsResult/orderResultDeatil',
name: 'orderResultDeatil',
component: '@/pages/logistics/components/orderSearchDetail',
hideInMenu: true
} }
] ]
} }
] ]
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50 * @Date: 2020-07-13 14:08:50
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-18 16:25:18 * @LastEditTime: 2020-07-23 14:02:07
*/ */
export default { export default {
...@@ -77,5 +77,11 @@ export default { ...@@ -77,5 +77,11 @@ export default {
'menu.logisticsAbility.logistics.templateForm': '新建运费模板', 'menu.logisticsAbility.logistics.templateForm': '新建运费模板',
'menu.logisticsAbility.logisticsSubmit': '物流单提交', 'menu.logisticsAbility.logisticsSubmit': '物流单提交',
'menu.logisticsAbility.logisticsSubmit.orderSearchList': '物流单查询' 'menu.logisticsAbility.logisticsSubmit.orderSubmitSearchList': '物流单查询',
'menu.logisticsAbility.logisticsSubmit.orderSubmitDeatil': '物流单详情',
'menu.logisticsAbility.logisticsSubmit.toOrderSumitList': '待提交物流单',
'menu.logisticsAbility.logisticsResult': '物流单处理',
'menu.logisticsAbility.logisticsResult.orderResultSearchList': '物流单查询',
'menu.logisticsAbility.logisticsResult.orderResultDeatil': '物流单详情'
}; };
\ No newline at end of file
@import "../../member/components/index.less";
.hidden{
display: none;
}
.block{
display: block;
}
.selectBtn {
margin: 0 16px;
}
.filter-btn{
width : 112px;
margin: 0 0 0 16px;
}
.select {
width : 160px;
margin: 0 16px 16px 0;
&:nth-last-of-type(1) {
margin-right: 0;
}
}
.mainCol {
background-color: #fff;
margin-bottom : 24px;
padding : 0 24px;
box-sizing : border-box;
&-title {
font-size : 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color : #172B4D;
padding : 20px 0;
}
&:nth-last-of-type(1) {
margin: 0;
}
&-row {
display : flex;
flex-wrap : wrap;
padding-bottom: 16px;
&-col {
display: flex;
width : calc(100% / 3);
padding: 16px 0;
&-option {
flex : 1;
font-size : 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color : #6B778C;
&:nth-last-of-type(1) {
flex : 3;
padding-right: 20px;
box-sizing : border-box;
color : #172B4D;
}
}
}
}
&-rows {
display : flex;
padding-bottom: 16px;
&-cols {
flex: 1;
.cols-main {
display: flex;
padding: 16px 0;
&:nth-last-of-type(1) {
padding-bottom: 0;
}
&-options {
flex : 1;
font-size : 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color : #6B778C;
&:nth-last-of-type(1) {
flex : 3;
padding-right: 20px;
box-sizing : border-box;
color : #172B4D;
}
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
import React, { useState, useEffect, useRef, ReactNode } from 'react'; import React, { useState, useEffect, useRef, ReactNode } from 'react';
import { Card, Button, Row, Col, Tooltip, Input, Select } from 'antd' import { Card, Button, Row, Col, Tooltip, Input, Select,Tag } from 'antd'
import { UpOutlined, DownOutlined } from '@ant-design/icons' import { UpOutlined, DownOutlined } from '@ant-design/icons'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { StandardTable } from 'god' import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType, TableRowSelection } from 'antd/lib/table/interface'
import style from './index.less'
import {history} from 'umi'
import { hidden } from 'chalk';
let { Option } = Select let { Option } = Select
interface listProps { export interface listProps {
title?: string, title?: ReactNode,
type: string,
fromPage?: string | number fromPage?: string | number
} }
...@@ -60,18 +64,66 @@ const fetchData = (params: any) => { ...@@ -60,18 +64,66 @@ const fetchData = (params: any) => {
}) })
} }
const orderSearchList: React.FC<listProps> = (props) => { const orderSearchList: React.FC<listProps> = (props) => {
console.log(props)
const ref = useRef({}) const ref = useRef({})
const [selectRow, setSelectRow] = useState<Item[]>([]) const [selectRow, setSelectRow] = useState<Item[]>([])
const TimeList = [
{
label:'单据时间(全部)',value: ''
},
{
label:'今天',value:1
},
{
label:'一周内',value:2
},
{
label:'一个月内',value:3
},
{
label:'三个月内',value:4
},
{
label:'六个月内',value:5
},
{
label:'一年内',value: 6
},
{
label:'一年前',value: 7
}
]
const outSideStatusList = [
{
label:'外部状态(全部)',value: ''
},
{
label:'待提交',value: 1
},
{
label:'待确认',value: 2
},
{
label:'接受物流单',value: 3
},
{
label:'不接受物流单',value: 4
}
]
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
let [isSearch, setIsSearch] = useState<boolean>(false) let [isSearch, setIsSearch] = useState<boolean>(false)
const [selectTableRow, setSelectTableRow] = useState<any>([])
let [selectedTableRowKeys, setSelectedTableRowKeys] = useState<Array<number>>([])
const [searchForm, setSearchForm] = useState({ const [searchForm, setSearchForm] = useState({
searName: '', searName: '',
buyer:'',//收货商
dateSelect: '', dateSelect: '',
outSideStatus: '', outSideStatus: '',
TimeRange: '' TimeRange: ''
}) })
const handleSee = () => { const handleSee = () => {
props.type === '1'? history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil`):
history.push('/memberCenter/logisticsAbility/logisticsResult/orderResultDeatil')
} }
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
...@@ -87,16 +139,18 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -87,16 +139,18 @@ const orderSearchList: React.FC<listProps> = (props) => {
key: 'key13' key: 'key13'
}, },
{ {
title: '收货方', title: '物流服务商',
align: 'left', align: 'center',
dataIndex: 'key12', dataIndex: 'key13',
key: 'key12' key: 'key13',
className:props.type == '1'? style['hidden'] :''
}, },
{ {
title: '物流单号', title: ' 收货方',
align: 'center', align: 'left',
dataIndex: 'key11', dataIndex: 'key1212',
key: 'key11' key: 'key1212'
}, },
{ {
title: '总箱数', title: '总箱数',
...@@ -130,7 +184,9 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -130,7 +184,9 @@ const orderSearchList: React.FC<listProps> = (props) => {
render: (_: any, reconds) => { render: (_: any, reconds) => {
let component: ReactNode = null let component: ReactNode = null
if (reconds.status == 0) { if (reconds.status == 0) {
component = <><span style={statuStyle.success}>接受物流</span></> component =
// <Tag color='success'>接受物流单</Tag>
<><span style={statuStyle.success}>接受物流单</span></>
} else if (reconds.status == 2) { } else if (reconds.status == 2) {
component = <><span style={statuStyle.warn}>不接受物流单</span></> component = <><span style={statuStyle.warn}>不接受物流单</span></>
} else if (reconds.status == 3) { } else if (reconds.status == 3) {
...@@ -147,15 +203,26 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -147,15 +203,26 @@ const orderSearchList: React.FC<listProps> = (props) => {
dataIndex: 'option', dataIndex: 'option',
render: (_: any, reconds) => { render: (_: any, reconds) => {
return ( return (
<>
{
props.type === '1' ? <Button type="link" onClick={handleSee}>确认</Button>:''
}
<Button type="link" onClick={handleSee}>查看</Button> <Button type="link" onClick={handleSee}>查看</Button>
</>
) )
} }
} }
] ]
const rowSelection = { const rowSelection : TableRowSelection<any> = {
type: 'checkbox',
selectedRowKeys: selectedTableRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectTableRow(selectedRows);
setSelectedTableRowKeys(selectedRowKeys);
console.log(selectedRowKeys, 'selected: ', selectedRows);
}
} }
const handleSearch = () => { const handleSearch = () => {
...@@ -180,7 +247,8 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -180,7 +247,8 @@ const orderSearchList: React.FC<listProps> = (props) => {
<> <>
<Row> <Row>
<Col span={12}> <Col span={12}>
<Tooltip trigger={['focus']} placement='top' title='输入物流单号、发货方进行搜索'> <Tooltip trigger={['focus']} placement='top'
title={props.type === '1'? '输入物流单号、订单号进行搜索':'输入物流单号、发货方进行搜索' }>
<Input.Search <Input.Search
style={{ width: '232px' }} style={{ width: '232px' }}
value={searchForm.searName} value={searchForm.searName}
...@@ -189,47 +257,65 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -189,47 +257,65 @@ const orderSearchList: React.FC<listProps> = (props) => {
onSearch={() => handleSearch} onSearch={() => handleSearch}
/> />
</Tooltip> </Tooltip>
<Button onClick={() => setIsSearch(isSearch = !isSearch) }> <Button className={style['filter-btn']} onClick={() => setIsSearch(isSearch = !isSearch) }>
高级筛选{isSearch ? <UpOutlined /> : <DownOutlined />} 高级筛选{isSearch ? <UpOutlined /> : <DownOutlined />}
</Button> </Button>
<Button onClick={() => handleReset()}>重置</Button> <Button className={style.selectBtn} onClick={() => handleReset()}>重置</Button>
</Col> </Col>
</Row> </Row>
<Row> <Row style={{margin: '16px 0'}}>
{ {
isSearch && isSearch &&
<Col> <Col>
{
props.type === '1'?
<Select <Select
value={searchForm.outSideStatus} className={style.select}
onChange={(val) => setSearchForm({ ...searchForm, outSideStatus: val })} value={searchForm.buyer}
> onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
<Option value=''>收货方(全部)</Option> >
<Option value='1'>待审核</Option> <Option value=''>物流服务商(全部)</Option>
<Option value='2'>审核通过</Option> <Option value='1'>待审核</Option>
<Option value='3'>审核不通过</Option> <Option value='2'>审核通过</Option>
</Select> <Option value='3'>审核不通过</Option>
</Select>
:
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>发货方(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
<Select <Select
className={style.select}
value={searchForm.TimeRange} value={searchForm.TimeRange}
onChange={(val) => setSearchForm({ ...searchForm, TimeRange: val })} onChange={(val) => setSearchForm({ ...searchForm, TimeRange: val })}
> >
<Option value=''>单据时间</Option> {
<Option value='1'>今天</Option> TimeList.map((item) => {
<Option value='2'>一周内</Option> return <Option value={item.value}>{item.label}</Option>
<Option value='3'>一个月内</Option> })
<Option value='4'>三个月内</Option> }
<Option value='5'>六个月内</Option>
<Option value='6'>一年内</Option>
<Option value='7'>一年前</Option>
</Select> </Select>
<Select <Select
className={style.select}
value={searchForm.outSideStatus} value={searchForm.outSideStatus}
onChange={(val) => setSearchForm({ ...searchForm, outSideStatus: val })} onChange={(val) => setSearchForm({ ...searchForm, outSideStatus: val })}
> >
<Option value=''>外部状态(全部)</Option> {
<Option value='1'>待审核</Option> outSideStatusList.map((item) => {
<Option value='2'>审核通过</Option> return <Option value={item.value}>{item.label}</Option>
<Option value='3'>审核不通过</Option> })
}
</Select> </Select>
</Col> </Col>
} }
...@@ -244,6 +330,7 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -244,6 +330,7 @@ const orderSearchList: React.FC<listProps> = (props) => {
) )
} }
orderSearchList.defaultProps = { orderSearchList.defaultProps = {
type: '1',
title:'123'
} }
export default orderSearchList export default orderSearchList
\ No newline at end of file
.ant-input-group-addon { .btn-wrap .ant-input-group .ant-input-group-addon {
padding: 0; padding: 0 !important;
} }
.ant-input-group-addon{ .btn-wrap{
padding: 0; .ant-input-group{
} .ant-input-group-addon{
\ No newline at end of file padding: 0 !important;
}
}
}
...@@ -9,7 +9,8 @@ import { history } from 'umi' ...@@ -9,7 +9,8 @@ import { history } from 'umi'
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import {PublicApi,CustomApi} from '@/services/api' import {PublicApi,CustomApi} from '@/services/api'
import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index' import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index'
import "./addCompany.less" import style from "./addCompany.less"
const { location } = history
export interface companyProps { export interface companyProps {
} }
...@@ -71,6 +72,7 @@ const company: React.FC<{}> = () => { ...@@ -71,6 +72,7 @@ const company: React.FC<{}> = () => {
//hook只能写在函数组件的顶级作用域 //hook只能写在函数组件的顶级作用域
const ref = useRef({}) const ref = useRef({})
const [menuForm] = Form.useForm(); const [menuForm] = Form.useForm();
const [headerTitle, setHeaderTitle] = useState('新建物流公司')
const [Code, setCode] = useState('') const [Code, setCode] = useState('')
const [codeDisabled, setCodeDisabled] = useState(false) const [codeDisabled, setCodeDisabled] = useState(false)
const [id, setId] = useState<string>(history.location.query.id || null) const [id, setId] = useState<string>(history.location.query.id || null)
...@@ -80,9 +82,10 @@ const company: React.FC<{}> = () => { ...@@ -80,9 +82,10 @@ const company: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据 const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
useEffect(() => { useEffect(() => {
const { location } = history let _title = location.query.id == 0? '新建':
console.log('id', id) location.query.isSee ? '查看': '编辑'
if (id) { setHeaderTitle(`${_title}物流公司`)
if (id !== '0') {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => { PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
const data = res.data const data = res.data
menuForm.setFieldsValue(data) menuForm.setFieldsValue(data)
...@@ -173,7 +176,7 @@ const company: React.FC<{}> = () => { ...@@ -173,7 +176,7 @@ const company: React.FC<{}> = () => {
<PageHeaderWrapper <PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description="返回" />}
title="新建物流公司" title={headerTitle}
> >
<Row gutter={[36, 36]}> <Row gutter={[36, 36]}>
<Col span={24}> <Col span={24}>
...@@ -198,7 +201,7 @@ const company: React.FC<{}> = () => { ...@@ -198,7 +201,7 @@ const company: React.FC<{}> = () => {
message: '合作类型为必须项!', message: '合作类型为必须项!',
}, },
]} ]}
initialValue="1" // initialValue={}
> >
<Select placeholder="请选择合作类型" value={companyType} onChange={onChangeType}> <Select placeholder="请选择合作类型" value={companyType} onChange={onChangeType}>
<Option value={1}>平台物流服务商</Option> <Option value={1}>平台物流服务商</Option>
...@@ -221,7 +224,7 @@ const company: React.FC<{}> = () => { ...@@ -221,7 +224,7 @@ const company: React.FC<{}> = () => {
} }
]} ]}
> >
<Input disabled maxLength={20} addonAfter={selectBtn}/> <Input className={style['btn-wrap']} disabled maxLength={20} addonAfter={selectBtn}/>
</Form.Item> </Form.Item>
: :
<Form.Item <Form.Item
......
/* /*
* @Date: 2020-07-13 15:01:40 * @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-22 11:07:17 * @LastEditTime: 2020-07-24 16:25:17
*/ */
import React, { ReactNode, useRef } from 'react' import React, { ReactNode, useRef } from 'react'
...@@ -73,7 +73,7 @@ const Company: React.FC<{}> = () => { ...@@ -73,7 +73,7 @@ const Company: React.FC<{}> = () => {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span> render: (text: any, record: any) => <span className="commonPickColor">{text}&nbsp;<EyeOutlined /></span>
}, },
{ {
title: '合作类型', title: '合作类型',
...@@ -94,17 +94,9 @@ const Company: React.FC<{}> = () => { ...@@ -94,17 +94,9 @@ const Company: React.FC<{}> = () => {
render: (text: any, record: any) => { render: (text: any, record: any) => {
let component: ReactNode = null let component: ReactNode = null
component = ( component = (
<Popconfirm <Button type="link" style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
title="确定要执行这个操作?" {record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
onConfirm={confirm} </Button>
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type="link" onClick={() => handleModify(record)} style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
{record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
</Button>
</Popconfirm>
) )
return component return component
} }
...@@ -118,12 +110,11 @@ const Company: React.FC<{}> = () => { ...@@ -118,12 +110,11 @@ const Company: React.FC<{}> = () => {
const title = `确定要${status}吗?` const title = `确定要${status}吗?`
return ( return (
<> <>
<Popconfirm title={title} okText="是" cancelText="否" onConfirm={() => handleChangeStatus(record.id,record.status)}>
<Popconfirm title={title} okText="是" cancelText="否" onConfirm={() => handleChangeStatus(record.id,record.status)}> <Button type='link'>
<Button type='link'> { record.status === 0?'启用':'停用'}
{ record.status === 0?'启用':'停用'} </Button>
</Button> </Popconfirm>
</Popconfirm>
{ record.status === 0 ? { record.status === 0 ?
<> <>
...@@ -135,7 +126,7 @@ const Company: React.FC<{}> = () => { ...@@ -135,7 +126,7 @@ const Company: React.FC<{}> = () => {
</Popconfirm> </Popconfirm>
</> </>
:''} :''}
<Button type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${record.id}&isSee=true`)}>查看</Button> <Button type='link' onClick={() => handleSee(record.id)}>查看</Button>
</> </>
) )
} }
...@@ -165,7 +156,6 @@ const Company: React.FC<{}> = () => { ...@@ -165,7 +156,6 @@ const Company: React.FC<{}> = () => {
const handleDelete = (id: any) => { const handleDelete = (id: any) => {
PublicApi.postLogisticsCompanyDelete({ id: id }).then(res => { PublicApi.postLogisticsCompanyDelete({ id: id }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
message.success(res.message)
ref.current.reload() ref.current.reload()
} }
}) })
...@@ -174,15 +164,14 @@ const Company: React.FC<{}> = () => { ...@@ -174,15 +164,14 @@ const Company: React.FC<{}> = () => {
let _status = status == 0 ? 1: 0 let _status = status == 0 ? 1: 0
PublicApi.postLogisticsCompanyEnable({id:id,status:_status}).then(res => { PublicApi.postLogisticsCompanyEnable({id:id,status:_status}).then(res => {
if(res.code === 1000){ if(res.code === 1000){
message.success(res.message)
console.log(ref) console.log(ref)
ref.current.reload() ref.current.reload()
} }
}) })
} }
const handleSee = (record: any) => { const handleSee = (id: number) => {
console.log('see') history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${id}&isSee=true`)
} }
const confirm = () => { const confirm = () => {
...@@ -208,7 +197,7 @@ const Company: React.FC<{}> = () => { ...@@ -208,7 +197,7 @@ const Company: React.FC<{}> = () => {
formilyChilds={{ formilyChilds={{
children: ( children: (
<> <>
<Button type="primary" onClick={() => history.push('/memberCenter/logisticsAbility/logistics/list/addCompany')}> <Button type="primary" onClick={() => history.push('/memberCenter/logisticsAbility/logistics/list/addCompany?id=0')}>
新建 <PlusOutlined /> 新建 <PlusOutlined />
</Button> </Button>
</> </>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34 * @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-22 11:47:39 * @LastEditTime: 2020-07-24 10:58:55
*/ */
import React, { Component, ReactNode, useRef, useState } from 'react' import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi' import { history } from 'umi'
...@@ -18,7 +18,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout' ...@@ -18,7 +18,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { StandardTable } from 'god' 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} from '@/services/api' import { PublicApi } from '@/services/api'
const data = [ const data = [
{ {
key: '1', key: '1',
...@@ -121,20 +121,18 @@ const AddressList: React.FC<ListProps> = (props) => { ...@@ -121,20 +121,18 @@ const AddressList: React.FC<ListProps> = (props) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [table, setTable] = useState([]) const [table, setTable] = useState([])
const [editingKey, setEditingKey] = useState(''); const [editingKey, setEditingKey] = useState('');
const edit = (record: Item) => { const toEdit = (id: number) => {
setEditingKey(record.key); history.push(`/memberCenter/logisticsAbility/logistics/list/addressForm?type=${props.type}&id=${id}`)
form.setFieldsValue({ code: '', ...record });
console.log(record.key)
}; };
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: '发货人姓名', title: props.type == '1' ? '发货人姓名' : '收货人姓名',
dataIndex: 'shipperName', dataIndex: props.type == '1' ? 'shipperName' : 'receiverName',
align: 'center', align: 'center',
key: 'shipperName', key: props.type == '1' ? 'shipperName' : 'receiverName',
}, },
{ {
title: '发货地址', title: props.type == '1' ? '发货地址' : '收货地址',
align: 'left', align: 'left',
dataIndex: 'address', dataIndex: 'address',
key: 'address', key: 'address',
...@@ -146,21 +144,21 @@ const AddressList: React.FC<ListProps> = (props) => { ...@@ -146,21 +144,21 @@ const AddressList: React.FC<ListProps> = (props) => {
}, },
{ {
title: '邮编', title: '邮编',
dataIndex: 'code', dataIndex: 'postalCode',
align: 'center', align: 'center',
key: 'code' key: 'postalCode'
}, },
{ {
title: '手机号码', title: '手机号码',
align: 'center', align: 'center',
dataIndex: 'phoneNO', dataIndex: 'phone',
key: 'phoneNO', key: 'phone',
}, },
{ {
title: '电话号码', title: '电话号码',
align: 'center', align: 'center',
dataIndex: 'telNO', dataIndex: 'tel',
key: 'telNO', key: 'tel'
}, },
{ {
title: '是否默认', title: '是否默认',
...@@ -168,7 +166,7 @@ const AddressList: React.FC<ListProps> = (props) => { ...@@ -168,7 +166,7 @@ const AddressList: React.FC<ListProps> = (props) => {
dataIndex: 'isDefault', dataIndex: 'isDefault',
key: 'isDefault', key: 'isDefault',
render: (_: any, record: any) => render: (_: any, record: any) =>
<Switch size='small' defaultChecked={record.isDefault == 0 ? false : true} <Switch size='small' disabled defaultChecked={record.isDefault == 0 ? false : true}
/>, />,
}, },
...@@ -179,18 +177,11 @@ const AddressList: React.FC<ListProps> = (props) => { ...@@ -179,18 +177,11 @@ const AddressList: React.FC<ListProps> = (props) => {
render: (_: any, record: any) => { render: (_: any, record: any) => {
return ( return (
<> <>
<Button type='link'>启用</Button> <><Button type="link" onClick={() => toEdit(record.id)}>编辑</Button>
{ <Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete(record.id)}>
record.status === 0 ? <Button type='link'>删除</Button>
<><Button type="link" onClick={() => edit(record)}>编辑</Button> </Popconfirm>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDelete}> </>
<Button type='link'>
删除
</Button>
</Popconfirm>
</> : ''
}
<Button type='link'>查看</Button>
</> </>
) )
} }
...@@ -198,20 +189,20 @@ const AddressList: React.FC<ListProps> = (props) => { ...@@ -198,20 +189,20 @@ const AddressList: React.FC<ListProps> = (props) => {
]; ];
// 模拟请求 // 模拟请求
const fetchData = (params: any) => { const fetchData = (params: any) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(props.type === '1'){//发货 if (props.type === '1') {//发货
PublicApi.getLogisticsShipperAddressPage({ current: params.page, pageSize: params.rows }).then(res => { PublicApi.getLogisticsShipperAddressPage({ current: params.page, pageSize: params.rows }).then(res => {
resolve(res.data) resolve(res.data)
}) })
}else{ } else {
PublicApi.getLogisticsReceiverAddressPage({ current: params.page, pageSize: params.rows }).then(res => { PublicApi.getLogisticsReceiverAddressPage({ current: params.page, pageSize: params.rows }).then(res => {
resolve(res.data) resolve(res.data)
}) })
} }
}) })
} }
//生命周期 //生命周期
// useEffect(() => { // useEffect(() => {
// effect // effect
...@@ -226,8 +217,17 @@ const fetchData = (params: any) => { ...@@ -226,8 +217,17 @@ const fetchData = (params: any) => {
}) })
} }
const handleDelete = () => { const handleDelete = (id:number) => {
console.log('delete') if(props.type === '1'){
PublicApi.postLogisticsShipperAddressDelete({id:id}).then(res => {
ref.current.reload()
})
}else{
PublicApi.postLogisticsReceiverAddressDelete({id:id}).then(res => {
ref.current.reload()
})
}
} }
const search: IFormFilter[] = [ const search: IFormFilter[] = [
{ {
...@@ -270,6 +270,7 @@ const fetchData = (params: any) => { ...@@ -270,6 +270,7 @@ const fetchData = (params: any) => {
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
tableProps={{rowKey:'id'}}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
...@@ -277,7 +278,7 @@ const fetchData = (params: any) => { ...@@ -277,7 +278,7 @@ const fetchData = (params: any) => {
formilyChilds={{ formilyChilds={{
children: ( children: (
<> <>
<Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/addressForm?addType=${props.type}`)}>新建</Button> <Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/addressForm?type=${props.type}&id=0`)}>新建</Button>
</> </>
) )
}} }}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55 * @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-22 11:23:30 * @LastEditTime: 2020-07-24 16:52:18
*/ */
import React, { Component, useState, useEffect } from 'react'; import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
...@@ -36,6 +36,7 @@ import gou from '../../../../../mockStatic/gou.png' ...@@ -36,6 +36,7 @@ import gou from '../../../../../mockStatic/gou.png'
import japenImg from '../../../../../mockStatic/japen.png' import japenImg from '../../../../../mockStatic/japen.png'
import korenImg from '../../../../../mockStatic/koren.png' import korenImg from '../../../../../mockStatic/koren.png'
import us from '../../../../../mockStatic/us.png' import us from '../../../../../mockStatic/us.png'
import { values } from 'mobx';
const _width: number = 24 const _width: number = 24
const _height: number = 17 const _height: number = 17
...@@ -57,7 +58,7 @@ export interface ListType { ...@@ -57,7 +58,7 @@ export interface ListType {
* @param {type} * @param {type}
* @return: * @return:
*/ */
const { location } = history
const actions = createFormActions() const actions = createFormActions()
const { ON_FORM_SUBMIT } = LifeCycleTypes //拿到Form提交API const { ON_FORM_SUBMIT } = LifeCycleTypes //拿到Form提交API
const onFormSubmit$ = FormEffectHooks const onFormSubmit$ = FormEffectHooks
...@@ -82,7 +83,7 @@ const dropdownRender = () => { ...@@ -82,7 +83,7 @@ const dropdownRender = () => {
// registerFormFields({ prefixSelect: connect()(CustomSelect) }) // registerFormFields({ prefixSelect: connect()(CustomSelect) })
const diaLogForm: React.FC<ListProps> = (props) => { const diaLogForm: React.FC<ListProps> = (props) => {
const type: string = history.location.query.addType const [provinceList, setProvinceList] = useState([])
const [state, setState] = useState({ editable: true }) const [state, setState] = useState({ editable: true })
const [headerTitle, setHeaderTitle] = useState('') const [headerTitle, setHeaderTitle] = useState('')
const [select, setSelect] = useState<countryItem>({ const [select, setSelect] = useState<countryItem>({
...@@ -106,8 +107,39 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -106,8 +107,39 @@ const diaLogForm: React.FC<ListProps> = (props) => {
const handleChangeSelect = () => { const handleChangeSelect = () => {
} }
/**
* @description: useEffect
* @param {type}
* @return:
*/
useEffect(() => { useEffect(() => {
setHeaderTitle('新建运费模板') let id = location.query.id
let _title = id == 0? '新建':
location.query.isSee ? '查看': '编辑'
setHeaderTitle(`${_title}运费模板`)
PublicApi.getWarehouseAreaByPcodeAll({ pcode: '100000' }).then(res => {
let list = []
res.data.forEach((item: any, index: number) => {
list.push({ label: item.name, value: item.code })
})
setProvinceList(list)
})
if(id != 0){
PublicApi.getLogisticsFreightTemplateGet({id:id}).then(res => {
if (res.code == 1000) {
let data = res.data
Object.keys(data).forEach(key => {
actions.setFieldState(key, state => {
state.value = data[key]
// if (key == 'isDefault') {
// state.value = data[key] === 0 ? false : true
// }
})
})
}
})
}
return () => { return () => {
} }
...@@ -121,7 +153,18 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -121,7 +153,18 @@ const diaLogForm: React.FC<ListProps> = (props) => {
{ label: <><img src={us} key='5' style={{ width: _width, height: 17 }} /> +86</>, value: '5' } { label: <><img src={us} key='5' style={{ width: _width, height: 17 }} /> +86</>, value: '5' }
] ]
const FormSumbit = (values: any) => { const FormSumbit = (values: any) => {
console.log(1111, values) let id = location.query.id
let value = { ...values }
if(id == 0){
PublicApi.postLogisticsFreightTemplateAdd(value).then(res => {})
}else{
value.id = Number(id)
PublicApi.postLogisticsFreightTemplateUpdate(value).then(res => {})
}
setTimeout(() => {
history.goBack()
},1000)
} }
const addStyle = { const addStyle = {
padding: '2px 0', padding: '2px 0',
...@@ -152,7 +195,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -152,7 +195,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
transportMode: '1', transportMode: '1',
designateList: [{}] designateList: [{}]
}} }}
onSubmit={FormSumbit} onSubmit={(values) => FormSumbit(values)}
components={{ components={{
Input, Select, TextArea: Input.TextArea, Switch, Radio, Input, Select, TextArea: Input.TextArea, Switch, Radio,
RadioGroup: Radio.Group, ArrayTable, ArrayCards, Transfer RadioGroup: Radio.Group, ArrayTable, ArrayCards, Transfer
...@@ -177,7 +220,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -177,7 +220,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
required required
x-component="RadioGroup" x-component="RadioGroup"
enum={[ enum={[
{ label: '按重量', value: '1' } { label: '按重量', value:1 }
]} ]}
/> />
<Field <Field
...@@ -186,7 +229,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -186,7 +229,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
required required
x-component="RadioGroup" x-component="RadioGroup"
enum={[ enum={[
{ label: '快递', value: '1' } { label: '快递', value:1 }
]} ]}
/> />
</FormMegaLayout> </FormMegaLayout>
...@@ -309,18 +352,13 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -309,18 +352,13 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component="Select" x-component="Select"
title="运送到" title="运送到"
name="areaIds" name="areaIds"
enum={[ enum={provinceList}
{ label: '广东省', value: '1', key: '1' },
{ label: '海南省', value: '2', key: '2' },
{ label: '广西省', value: '3', key: '3' },
{ label: 'Four', value: '4', key: '4' }
]}
x-component-props={{ x-component-props={{
showSearch: true, showSearch: true,
mode: 'tags',//"multiple", mode: 'tags',//"multiple",
onSearch: () => { onSearch } onSearch: () => { onSearch },
// optionLabelProp:"value"//指定回显
}} }}
/> />
<Field name="weight" <Field name="weight"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34 * @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-18 15:13:49 * @LastEditTime: 2020-07-24 16:20:16
*/ */
import React, { Component, ReactNode, useRef, useState } from 'react' import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi' import { history } from 'umi'
...@@ -18,6 +18,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout' ...@@ -18,6 +18,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { StandardTable } from 'god' 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} from '@/services/api'
const data = [ const data = [
{ {
...@@ -44,26 +45,11 @@ const data = [ ...@@ -44,26 +45,11 @@ const data = [
// 模拟请求 // 模拟请求
const fetchData = (params: any) => { const fetchData = (params: any) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords) PublicApi.getLogisticsFreightTemplatePage({current:params.page, pageSize: params.rows}).then(res=> {
setTimeout(() => { resolve(res.data)
resolve({ })
code: 200,
message: '',
data: queryResult ? [queryResult] : data
})
}, 1000)
}) })
} }
// const fetchData = (param: any) => {
// return new Promise((resolve) => {
// let reqParam = {
// ...param
// }
// getUserInfoList(reqParam).then(res => {
// resolve(res)
// })
// })
// }
interface Item { interface Item {
key: string key: string
} }
...@@ -143,15 +129,25 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -143,15 +129,25 @@ const Template: React.FC<ListProps> = (props) => {
}, },
{ {
title: '计价方式', title: '计价方式',
align: 'left', align: 'center',
dataIndex: 'pricingMode', dataIndex: 'pricingMode',
key: 'pricingMode', key: 'pricingMode',
render: (_:any,record:any) => {
return (
<>{record.transportMode === 1?'按重量':''}</>
)
}
}, },
{ {
title: '运送方式', title: '运送方式',
dataIndex: 'transportMode', dataIndex: 'transportMode',
align: 'center', align: 'center',
key: 'transportMode' key: 'transportMode',
render: (_:any,record:any) => {
return (
<>{record.transportMode === 1?'快递':''}</>
)
}
}, },
{ {
title: '运费说明', title: '运费说明',
...@@ -164,23 +160,12 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -164,23 +160,12 @@ const Template: React.FC<ListProps> = (props) => {
align: 'center', align: 'center',
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
render: (text: any, record: any) => { render: (_:any,record: any) => {
let component: ReactNode = null return (
component = ( <Button type="link" style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
<Popconfirm {record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
title="确定要执行这个操作?" </Button>
onConfirm={confirm}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type="link" onClick={() => handleModify(record)} style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
{record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
</Button>
</Popconfirm>
) )
return component
} }
}, },
{ {
...@@ -188,20 +173,27 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -188,20 +173,27 @@ const Template: React.FC<ListProps> = (props) => {
dataIndex: 'option', dataIndex: 'option',
align: 'center', align: 'center',
render: (_: any, record: any) => { render: (_: any, record: any) => {
const status = record.status === 0?'启用':'停用'
const title = `确定要${status}吗?`
return ( return (
<> <>
<Button type='link'>启用</Button> <Popconfirm title={title} okText="是" cancelText="否" onConfirm={() => handleChangeStatus(record.id,record.status)}>
<Button type='link'>
{ record.status === 0?'启用':'停用'}
</Button>
</Popconfirm>
{ {
record.status === 0 ? record.status === 0 ?
<><Button type="link" onClick={() => edit(record)}>编辑</Button> <>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDelete}> <Button type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?id=${record.id}`)}>编辑</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() =>handleDelete(record.id)}>
<Button type='link'> <Button type='link'>
删除 删除
</Button> </Button>
</Popconfirm> </Popconfirm>
</> : '' </> : ''
} }
<Button type='link'>查看</Button> <Button type='link' onClick={() => handleSee(record.id)}>查看</Button>
</> </>
) )
} }
...@@ -221,9 +213,21 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -221,9 +213,21 @@ const Template: React.FC<ListProps> = (props) => {
columns.forEach((v, index) => { columns.forEach((v, index) => {
}) })
} }
const handleChangeStatus = (id:any,status:any) => {
const handleDelete = () => { let _status = status == 0 ? 1: 0
console.log('delete') PublicApi.postLogisticsFreightTemplateEnable({id:id,status:_status}).then(res => {
if(res.code === 1000){
console.log(ref)
ref.current.reload()
}
})
}
const handleDelete = (id:number) => {
PublicApi.postLogisticsFreightTemplateDelete({id:id}).then(res => {
if(res.code === 1000){
ref.current.reload()
}
})
} }
const search: IFormFilter[] = [ const search: IFormFilter[] = [
{ {
...@@ -233,20 +237,8 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -233,20 +237,8 @@ const Template: React.FC<ListProps> = (props) => {
placeHolder: '输入属性名称' placeHolder: '输入属性名称'
} }
] ]
const handleSee = (id: number) => {
const searchBarActions: IButtonFilter[] = [ history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?id=${id}&isSee=true`)
{
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: () => {
history.push('/memberCenter/logisticsAbility/logistics/list/addCompany')
}
}
]
const handleSee = (record: any) => {
console.log('see')
} }
const confirm = () => { const confirm = () => {
...@@ -273,7 +265,7 @@ const Template: React.FC<ListProps> = (props) => { ...@@ -273,7 +265,7 @@ const Template: React.FC<ListProps> = (props) => {
formilyChilds={{ formilyChilds={{
children: ( children: (
<> <>
<Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?addType=${props.type}`)}> <Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?id=0`)}>
新建 新建
</Button> </Button>
</> </>
......
import React, { Component } from 'react'
import OrderList from '../components/orderSearchList'
const List = () => {
return (
<OrderList title='处理' type='2'/>
)
}
export default List
\ No newline at end of file
import React, { Component } from 'react' import React, { Component } from 'react'
import OrderList from '../components/orderSearchList' import OrderList from '../components/orderSearchList'
const orderList = () => { const List = () => {
return ( return (
<OrderList/> <OrderList title='提交' type='1'/>
) )
} }
export default OrderList export default List
\ No newline at end of file \ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-23 13:54:05
*/
import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
import { Modal, Card, Button, Form, InputNumber, Radio, Popconfirm, Switch, Input } from 'antd';
import {
PlayCircleOutlined,
PauseCircleOutlined,
PlusOutlined,
EyeOutlined,
PlusCircleOutlined
} from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import {PublicApi} from '@/services/api'
const data = [
{
key: '1',
shipperName: '采购商',
phone: '18819276235',
tel: '02020',
required: '平台物流服务商',
isDefault: 0,
code: 252525,
status: 1,
address: '地址'
},
{
key: '2',
shipperName: '采购商',
phone: '18819276235',
tel: '02020',
required: '平台物流服务商',
isDefault: 0,
code: 252525,
status: 0,
address: '地址32'
},
]
// const fetchData = (param: any) => {
// return new Promise((resolve) => {
// let reqParam = {
// ...param
// }
// getUserInfoList(reqParam).then(res => {
// resolve(res.data)
// })
// })
// }
interface Item {
key: string
}
//父页面传递来的参数
export interface ListProps {
title?: React.ReactNode,
type: string
}
export interface ListType {
checked: boolean //可选
}
interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
editing: boolean;
dataIndex: string;
title: any;
inputType: 'number' | 'text';
record: Item;
index: number;
children: React.ReactNode;
}
const EditableCell: React.FC<EditableCellProps> = ({
editing,
dataIndex,
title,
inputType,
record,
index,
children,
...restProps
}) => {
const inputNode = inputType === 'number' ? <InputNumber /> : <Input />;
return (
<td {...restProps}>
{editing ? (
<Form.Item
name={dataIndex}
style={{ margin: 0 }}
rules={[
{
required: true,
message: `Please Input ${title}!`,
},
]}
>
{inputNode}
</Form.Item>
) : (
children
)}
</td>
);
};
/**
* @description:
* @param {type}
* @return:
*/
const AddressList: React.FC<ListProps> = (props) => {
console.log(props)
const ref = useRef({})
const [form] = Form.useForm();
const [table, setTable] = useState([])
const [editingKey, setEditingKey] = useState('');
const edit = (record: Item) => {
setEditingKey(record.key);
form.setFieldsValue({ code: '', ...record });
console.log(record.key)
};
const columns: ColumnType<any>[] = [
{
title: '发货人姓名',
dataIndex: 'shipperName',
align: 'center',
key: 'shipperName',
},
{
title: '发货地址',
align: 'left',
dataIndex: 'address',
key: 'address',
render: (_: any, record: any) => (
<>
{record.fullAddress}
</>
)
},
{
title: '邮编',
dataIndex: 'code',
align: 'center',
key: 'code'
},
{
title: '手机号码',
align: 'center',
dataIndex: 'phoneNO',
key: 'phoneNO',
},
{
title: '电话号码',
align: 'center',
dataIndex: 'telNO',
key: 'telNO'
},
{
title: '是否默认',
align: 'center',
dataIndex: 'isDefault',
key: 'isDefault',
render: (_: any, record: any) =>
<Switch size='small' disabled defaultChecked={record.isDefault == 0 ? false : true}
/>,
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (_: any, record: any) => {
return (
<>
<Button type='link'>启用</Button>
{
record.status === 0 ?
<><Button type="link" onClick={() => edit(record)}>编辑</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDelete}>
<Button type='link'>
删除
</Button>
</Popconfirm>
</> : ''
}
<Button type='link'>查看</Button>
</>
)
}
}
];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
if(props.type === '1'){//发货
PublicApi.getLogisticsShipperAddressPage({ current: params.page, pageSize: params.rows }).then(res => {
resolve(res.data)
})
}else{
PublicApi.getLogisticsReceiverAddressPage({ current: params.page, pageSize: params.rows }).then(res => {
resolve(res.data)
})
}
})
}
//生命周期
// useEffect(() => {
// effect
// return () => {
// cleanup
// }
// }, [input])
const onDefaultChange = (id: any, checked: boolean) => {
console.log(id, checked)
columns.forEach((v, index) => {
})
}
const handleDelete = () => {
console.log('delete')
}
const search: IFormFilter[] = [
{
type: 'Input',
value: 'keywords',
col: 4,
placeHolder: '输入属性名称'
}
]
const searchBarActions: IButtonFilter[] = [
{
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: () => {
history.push('/logisticsAbility/logistics/list/addCompany')
}
}
]
const handleSee = (record: any) => {
console.log('see')
}
const confirm = () => {
console.log('confirm')
}
const cancel = () => {
console.log('cancel')
}
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record)
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
rowClassName="editable-row"
formilyChilds={{
children: (
<>
<Button type="primary" icon={<PlusOutlined />} onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/addressForm?addType=${props.type}`)}>新建</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
)
}
AddressList.defaultProps = {
}
export default AddressList
\ No newline at end of file
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
color : #6B778C; color : #6B778C;
&:nth-last-of-type(1) { &:nth-last-of-type(1) {
flex : 3; flex : 2.5;
padding-right: 20px; padding-right: 20px;
box-sizing : border-box; box-sizing : border-box;
color : #172B4D; color : #172B4D;
...@@ -201,4 +201,10 @@ ...@@ -201,4 +201,10 @@
color : #fff; color : #fff;
background : @main-color; background : @main-color;
margin-left: 10px; margin-left: 10px;
}
.count{
font-weight: 500;
color: #172B4D;
font-size: 24px;
} }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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