Commit 392814eb authored by LeeJiancong's avatar LeeJiancong

对接部分接口

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