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
import React, { Component, useEffect, useState, ReactNode, useRef } from 'react';
import { Row, Col, Modal, Tooltip, Input, Select, Button, Popconfirm, Card, Tag, Badge, Steps, } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { EyeOutlined, ClockCircleOutlined, UpOutlined, DownOutlined, StopOutlined, CheckSquareOutlined } from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import style from './index.less'
const { Step } = Steps
const data = [
{
key: '1',
id: '1',
role: '采购商',
operation: '申请会员',
opTime: '2020-05-12 08:08',
suggest: '',
status: 2,
},
];
const detailInfo: React.FC<{}> = () => {
const ref = useRef({})
const [detailData, setDetailData] = useState<any>({
step: {
current: 0,
title: '外部流转',
items: [
{
title: '提交物流单',
desc: '供应商',
},
{
title: '确认物流单',
desc: '物流服务商',
},
{
title: '完成',
desc: '',
},
],
}
})
const infoTem = {
base: {
title: '基本信息',
leftElem: [
{ title: '对应发货单号:', key: '' },
{ title: '对应订单号/售后单:', key: '' }
],
centerElem: [
{ title: '收货方:', key: '' },
{ title: '收货地址:', key: '' }
],
rightElem: [
{ title: '发货地址:', key: '' }
],
elem: [
]
},
freight: {
title: '运费',
leftElem: [
{ title: '运费:', key: 'freight' },
{ title: '结算方式:', key: '' }
]
}
}
const columns1: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '商品名称',
dataIndex: 'role',
align: 'center',
key: 'role',
width: 240
},
{
title: '品类',
dataIndex: 'role2',
align: 'center',
key: 'role3',
},
{
title: '品牌',
dataIndex: 'role1',
align: 'center',
key: 'role2',
},
{
title: '单位',
dataIndex: 'role3',
align: 'center',
key: 'role3',
},
{
title: '数量',
dataIndex: 'role3',
align: 'center',
key: 'role3',
},
{
title: '箱数',
dataIndex: 'role3',
align: 'center',
key: 'role3',
},
{
title: '重量 (KG)',
dataIndex: 'role3',
align: 'center',
key: 'role3',
},
{
title: '体积 (M3)',
dataIndex: 'role3',
align: 'center',
key: 'role3',
}
];
const columns: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '操作角色',
dataIndex: 'role',
align: 'center',
key: 'role',
},
{
title: '状态',
dataIndex: 'status',
align: 'center',
key: 'status',
render: (text: any, record: any) => {
let component: ReactNode = null;
component = <Badge color="#FFC400" text="待审核" />;
return component;
},
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
key: 'operation',
},
{
title: '操作时间',
dataIndex: 'opTime',
align: 'center',
key: 'opTime',
},
{
title: '审核意见',
dataIndex: 'suggest',
align: 'center',
key: 'suggest',
width: 300
},
];
//在这做逻辑判断 判断路由 是由哪个页面进来的
// useEffect(() => {
// effect
// return () => {
// cleanup
// }
// }, [])
// 模拟请求
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,
});
}, 1000);
});
};
return (
<PageHeaderWrapper
onBack={() => window.history.back()}
title={
<>
<div className={style['headerTop']}>
<div className={style['headerTop-prefix']}></div>
<div className={style['headerTop-name']}>
物流单号:WL0954548
</div>
<div className={style[`levelIcon${'1'}`]}></div>
</div>
</>
}
extra={
<>
<Button>
<StopOutlined />
不接受物流单
</Button>
<Button className={style['saveBtn']}>
<CheckSquareOutlined />
接受物流单
</Button>
</>
}
content={
<div className={style['headerMain']}>
<div className={style['headerMain-left']}>
<div className={style['headerMain-left-option']}>
<div>单据摘要:</div>
<div>xxxx</div>
</div>
<div className={style['headerMain-left-option']}>
<div>物流服务商:</div>
<div>xxx</div>
</div>
<div className={style['headerMain-left-option']}>
<div>单据时间:</div>
<div>
<Tag color="green">2020-09-09 12:58:25</Tag>
</div>
</div>
<div className={style['headerMain-left-option']}>
<div>外部状态:</div>
<div>
<Tag color="gold">待审核</Tag>
</div>
</div>
</div>
</div>
}
>
<Row>
<Col className={style['mainCol']} span={24}>
<div className={style['mainCol-title']}>
{detailData.step.title}
</div>
<Steps
style={{ padding: '34px 0' }}
progressDot
current={detailData.step.current}
>
{detailData.step.items.map((item, index) => {
return (
<Step
key={index}
title={item.title}
description={item.desc}
/>
);
})}
</Steps>
</Col>
<Col className={style['mainCol']} span={24}>
<div className={style['mainCol-title']}>
{infoTem['base'].title}
</div>
<div className={style['mainCol-rows']}>
<div className={style['mainCol-rows-cols']}>
{infoTem['base'].leftElem.map(
(item: any, index: number) => {
return (
<div className={style['cols-main']} key={index}>
<div className={style['cols-main-options']}>
{item.title}
</div>
<div className={style['cols-main-options']}>张三</div>
</div>
);
},
)}
</div>
<div className={style['mainCol-rows-cols']}>
{infoTem['base'].centerElem.map(
(item: any, index: number) => {
return (
<div className={style['cols-main']} key={index}>
<div className={style['cols-main-options']}>
{item.title}
</div>
<div className={style['cols-main-options']}>张三</div>
</div>
);
},
)}
</div>
<div className={style['mainCol-rows-cols']}>
{infoTem['base'].rightElem.map(
(item: any, index: number) => {
return (
<div className={style['cols-main']} key={index}>
<div className={style['cols-main-options']}>
{item.title}
</div>
<div className={style['cols-main-options']}>张三</div>
</div>
);
},
)}
</div>
</div>
{/* <div className={style['mainCol-row']}>
{infoTem['base'].elem.map((item: any, index: number) => {
return (
<div className={style['mainCol-row-col']} key={index}>
<div className={style['mainCol-row-col-option']}>
{item.title}
</div>
<div className={style['mainCol-row-col-option']}>
185 2929 6547
</div>
</div>
);
})}
</div> */}
</Col>
<Col className={style['mainCol']} span={24}>
<div className={style['mainCol-title']}>
物流单明细
</div>
<StandardTable
tableProps={{
pagination: false,
}}
columns={columns1}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
/>
<Row style={{ marginTop: '26px' }}>
<Col span={9} push={15}>
<Row align='middle' justify='center' gutter={[16, 16]}>
<Col span={8} >
<div>总箱数(箱)</div>
<div className={style.count}>700</div>
</Col>
<Col span={8} >
<div>总重量(KG)</div>
<div className={style.count}>700</div>
</Col>
<Col span={8} >
<div>总体积(M3)</div>
<div className={style.count}>700</div>
</Col>
</Row>
</Col>
</Row>
</Col>
<Col className={style['mainCol']} span={24}>
<div className={style['mainCol-title']}>
{infoTem['freight'].title}
</div>
<div className={style['mainCol-rows']}>
<div className={style['mainCol-rows-cols']}>
{infoTem['freight'].leftElem.map(
(item: any, index: number) => {
return (
<div className={style['cols-main']} key={index}>
<div className={style['cols-main-options']}>
{item.title}
</div>
{
item.key === 'freight' ?
<div className={style['cols-main-options']}>
1000.00
<Input addonBefore=" ¥ " defaultValue="1000" />
</div>
: <div className={style['cols-main-options']}>
张三
</div>
}
</div>
);
},
)}
</div>
<div className={style['mainCol-rows-cols']}></div>
<div className={style['mainCol-rows-cols']}></div>
</div>
</Col>
<Col className={style['mainCol']} span={24}>
<div className={style['mainCol-title']}>
外部流转记录
</div>
<StandardTable
tableProps={{
}}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
/>
</Col>
</Row>
</PageHeaderWrapper>
)
}
export default detailInfo
\ No newline at end of file
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,9 +2,9 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-18 11:47:19
* @LastEditTime: 2020-07-24 16:31:22
*/
import React, { Component, useState,useEffect } from 'react';
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
import {
SchemaForm,
......@@ -12,23 +12,26 @@ import {
createFormActions,
FormButtonGroup,
registerFormFields,
FormEffectHooks,
FormPath,
Submit,
Reset,
connect
} from '@formily/antd'
import { history } from 'umi'
import { Row, Col, Card, Button, Popconfirm, Select as ISelect } from 'antd';
import { Row, Col, Card, Button, Popconfirm, Select as ISelect, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { MegaLayout, Input, Switch, Select, FormMegaLayout } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import ReutrnEle from '@/components/ReturnEle'
import ChinaImg from '../../../../../mockStatic/china.png'
import gou from '../../../../../mockStatic/gou.png'
import japenImg from '../../../../../mockStatic/japen.png'
import korenImg from '../../../../../mockStatic/koren.png'
import us from '../../../../../mockStatic/us.png'
const _width:number = 24
const _height:number = 17
const _width: number = 24
const _height: number = 17
const { location } = history
interface countryItem {
name: string,
key: string,
......@@ -49,6 +52,9 @@ export interface ListType {
* @return:
*/
const { Option } = ISelect;
const actions = createFormActions()
const { onFieldValueChange$ } = FormEffectHooks
const children: any = [];
for (let i = 10; i < 36; i++) {
children.push(<Option value={i} key={i.toString(36) + i}>{i.toString(36) + i}</Option>);
......@@ -67,11 +73,17 @@ const dropdownRender = () => {
// )
// }
// registerFormFields({ prefixSelect: connect()(CustomSelect) })
const diaLogForm: React.FC<ListProps> = (props) => {
const type:string = history.location.query.addType
const [Options,setOptions] = useState([])
const type: string = history.location.query.type
const [Options, setOptions] = useState([])
const [state, setState] = useState({ editable: true })
const [headerTitle,setHeaderTitle] = useState('')
const [headerTitle, setHeaderTitle] = useState('')
const [provinceList, setProvinceList] = useState([])
const [cityList, setCityList] = useState([])
const [select, setSelect] = useState<countryItem>({
key: 'cn',
name: '简体中文-ZH',
......@@ -82,39 +94,174 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<span><img src={ChinaImg} alt="" /></span>
)
}
const confirm = () => {
console.log('confirm')
history.go(-1)
/**
* @description:
* @param {type}
* @return:
*/
const formSubmit = (values) => {
console.log(values)
let id = location.query.id //0新建
let type = location.query.type //'1' 发货 '2'收货
let value = { ...values }
value.isDefault = values.isDefault ? 1 : 0
if (type == 1) {
if (id == 0) {
PublicApi.postLogisticsShipperAddressAdd(value).then(res => {
if (res.code == 1000) {
}
})
} else {
PublicApi.postLogisticsShipperAddressUpdate(value).then(res => {
if (res.code == 1000) {
}
})
}
} else {
if (id == 0) {
PublicApi.postLogisticsReceiverAddressAdd(value).then(res => {
if (res.code == 1000) {
}
})
} else {
PublicApi.postLogisticsReceiverAddressUpdate(value).then(res => {
if (res.code == 1000) {
}
})
}
}
setTimeout(() => {
history.goBack()
}, 1000);
}
const cancel = () => {
console.log('cancel')
}
const confirm = () => {
// message.error(`未保存地址信息`)
setTimeout(() => {
history.goBack()
}, 1000)
}
const handleChangeSelect = () => {
}
const List:any = [ChinaImg,gou,japenImg,korenImg,us]
const List: any = [ChinaImg, gou, japenImg, korenImg, us]
const selectList: any = [
{ label: <><img src={ChinaImg} key='1' style={{width: _width, height: 17}}/> +86</>, value: '1' },
{ label: <><img src={gou} key='2' style={{width: _width, height: 17}}/> +86</>, value: '2' },
{ label: <><img src={japenImg} key='3' style={{width: _width, height: 17}}/> +86</>, value: '3' },
{ label: <><img src={korenImg} key='4' style={{width: _width, height: 17}}/> +86</>, value: '4' },
{ label: <><img src={us} key='5' style={{width: _width, height: 17}}/> +86</>, value: '5' }
{ label: <><img src={ChinaImg} key='1' style={{ width: _width, height: 17 }} /> +86</>, value: '1' },
{ label: <><img src={gou} key='2' style={{ width: _width, height: 17 }} /> +86</>, value: '2' },
{ label: <><img src={japenImg} key='3' style={{ width: _width, height: 17 }} /> +86</>, value: '3' },
{ label: <><img src={korenImg} key='4' style={{ width: _width, height: 17 }} /> +86</>, value: '4' },
{ label: <><img src={us} key='5' style={{ width: _width, height: 17 }} /> +86</>, value: '5' }
]
let _Options:any = []
List.forEach((item:any,index:number) => {
let tem = <><img src={item} key={'item' + index} style={{width: _width, height: _height}}/> +86</>
_Options.push({label:tem,value:index+1})
let _Options: any = []
List.forEach((item: any, index: number) => {
let tem = <><img src={item} key={'item' + index} style={{ width: _width, height: _height }} /> +86</>
_Options.push({ label: tem, value: index + 1 })
})
/**
* @description: formilyjs表单赋值方法 actions.setFieldState(key,state=> {state.value= **})
* @param {type}
* @return:
*/
useEffect(() => {
history.location.query.addType == '1'? setHeaderTitle('新建发货地址') : setHeaderTitle('新建收货地址')
const id = history.location.query.id
let title = id == 0 ? '新建' : '编辑'
history.location.query.type == '1' ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`)
setOptions(_Options)
PublicApi.getLogisticsShipperAddressGetTelCode().then(res => {})
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 (location.query.id != 0 && location.query.type == '1') {
PublicApi.getLogisticsShipperAddressGet({ 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
}
})
})
}
})
}
//收货
if (location.query.id != 0 && location.query.type == '2') {
PublicApi.getLogisticsReceiverAddressGet({ 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 () => {
}
}, [])
/**
* @description: 自定义HOOK
* @param {type}
* @return:
*/
const useAreaEffects = () => {
const { setFieldState } = createFormActions()
onFieldValueChange$('provinceId').subscribe(({ value }) => {
console.log(value)
setFieldState('districtId', state => {
state.value = ''
})
setFieldState('*(cityId)', state => {
state.value = ''
let list = []
PublicApi.getWarehouseAreaByPcodeAll({ pcode: value }).then(res => {
res.data.forEach((item: any, index: number) => {
list.push({ label: item.name, value: item.code })
})
// setCityList(list)
})
FormPath.setIn(state, 'props.enum', list)
})
})
onFieldValueChange$('cityId').subscribe(({ value }) => {
console.log(value)
setFieldState('*(districtId)', state => {
state.value = ''
let list = []
PublicApi.getWarehouseAreaByPcodeAll({ pcode: value }).then(res => {
res.data.forEach((item: any, index: number) => {
list.push({ label: item.name, value: item.code })
})
})
FormPath.setIn(state, 'props.enum', list)
})
})
}
},[])
return (
<PageHeaderWrapper
......@@ -126,33 +273,51 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<Row>
<Col span={16}>
<SchemaForm editable={state.editable}
initialValues={{
provic: '广东省',
phoneHead: 1
}}
// initialValues={{
// provinceId: '',
// cityId:'111120',
// districtId:'121212'
// }}
actions={actions}//要传递
components={{
Input, Select, TextArea: Input.TextArea, Switch
}}
effects={() => useAreaEffects()}
onSubmit={(values) => formSubmit(values)}
>
<FormMegaLayout labelCol={4} labelAlign="left">
{
location.query.type == '1' ?
<Field
required
title="发货人"
name="user"
name="shipperName"
maxLength={40}
x-component="Input"
x-component-props={{
placeholder: '请输入发货人'
}}
/>
:
<Field
required
title="收货人"
name="receiverName"
maxLength={40}
x-component="Input"
x-component-props={{
placeholder: '请输入收货人'
}}
/>
<FormMegaLayout label='发货地区' grid full autoRow required>
}
<FormMegaLayout label={location.query.type == '1' ? '发货地区' : '收货地区'} grid full autoRow required>
<Field
x-mega-props={{ span: 1 }}
x-component="Select"
enum={selectList}
enum={provinceList}
required
name="provic"
name="provinceId"
x-component-props={{
placeholder: '-省份/直辖市-'
}}
......@@ -160,9 +325,9 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<Field
x-mega-props={{ span: 1 }}
x-component="Select"
enum={selectList}
enum={cityList}
required
name="city"
name="cityId"
x-component-props={{
placeholder: '-市-'
}}
......@@ -172,7 +337,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component="Select"
enum={selectList}
required
name="area"
name="districtId"
x-component-props={{
placeholder: '-区-'
}}
......@@ -181,7 +346,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<Field
required
title="详细地址"
name="addressInfo"
name="address"
maxLength={60}
x-component="TextArea"
x-component-props={{
......@@ -190,7 +355,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
/>
<Field
title="邮编"
name="code"
name="postalCode"
maxLength={12}
x-component="Input"
x-component-props={{
......@@ -200,7 +365,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<FormMegaLayout label='手机号码' grid required full>
<Field
x-mega-props={{ span: 1 }}
name="phoneHead"
name="areaCode"
required
x-component="Select"
enum={Options}
......@@ -217,7 +382,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
</ISelect>, */}
<Field
x-mega-props={{ span: 5 }}
name="mobiePhone"
name="phone"
required
x-component="Input"
x-component-props={{
......@@ -226,17 +391,17 @@ const diaLogForm: React.FC<ListProps> = (props) => {
/>
</FormMegaLayout>
<FormMegaLayout label='电话号码' grid full>
<Field
{/* <Field
x-mega-props={{ span: 1 }}
name="phoneHead"
x-component="Input"
x-component-props={{
placeholder: '区号'
}}
/>
/> */}
<Field
x-mega-props={{ span: 5 }}
name="telphone"
name="tel"
x-component="Input"
x-component-props={{
placeholder: ''
......
......@@ -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