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

重构物流管理

parent e86e7d0d
......@@ -13,12 +13,12 @@ const router = {
{
path: '/logisticsManager/logisticsList',
name: 'logisticsList',
component: '@/pages/logistics/logisticsResult/orderSearchList',
component: '@/pages/logistics',
},
{
path: '/logisticsManager/logisticsDetail',
name: 'logisticsList',
component: '@/pages/logistics/components/orderSearchDetail',
component: '@/pages/logistics/detail',
hideInMenu: true,
hidePageHeader: true
},
......
import EyePreview from '@/components/EyePreview';
import { DownOutlined } from '@ant-design/icons';
import { TimeList } from '@/pages/logistics/statusList';
import { TimeList } from '../../statusList';
import moment from 'moment';
import React from 'react';
import {ADVERTISE_COLUMN_TYPE} from '../../utils/utils';
......
import EyePreview from '@/components/EyePreview';
import { DownOutlined } from '@ant-design/icons';
import { TimeList } from '@/pages/logistics/statusList';
import { TimeList } from '../../statusList';
import moment from 'moment';
import React from 'react';
import { ANNOUNCE_COLUMN_TYPE, transfer2Options } from '../../utils/utils';
......
import EyePreview from '@/components/EyePreview';
import { DownOutlined, DeleteOutlined, UpOutlined } from '@ant-design/icons';
import { timeRange } from '@/utils/index';
import { TimeList } from '@/pages/logistics/statusList';
import { TimeList } from '../../statusList';
import moment from 'moment';
import React from 'react';
......
......@@ -27,5 +27,11 @@ export default {
padding: '2px 5px',
background: 'rgba(255,235,230,1)',
borderRadius: '4px'
},
error: {
color: '#ff0404',
padding: '2px 5px',
background: 'rgba(247,235,235,1)',
borderRadius: '4px'
}
}
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import {PATTERN_MAPS} from '@/constants/regExp'
export interface Params {
id: number | string;
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
dontReceive?: boolean; //默认展示
}
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => {
}
const handletOk = (values: any) => {
let value = { ...values }
value.id = props.id
console.log(values)
PublicApi.postLogisticsOrderWaitConfirmConfirm(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
})
}
useEffect(() => {
return () => {
}
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
onFieldChange$('status').subscribe(({ value }) => {
setFieldState('remark', state => {
if (value == 3) {
state.visible = false
} else {
state.visible = true
}
})
setFieldState('freightPrice', state => {
if (value == 3) {
state.visible = false
} else {
state.visible = true
}
})
})
}
return (
<>
<Modal
title='单据确认'
width={800}
visible={props.dialogVisible}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
okText='确定'
cancelText='取消'
>
<SchemaForm
labelCol={3}
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)}
initialValues={{
status: 3
}}
>
<Field
enum={
[
{ label: '接受物流单', value: 3 },
{ label: '不接受物流单', value: 4 }
]}
name='status'
required
x-component="Radio"
/>
{props.dontReceive &&
<>
<Field
title='运费'
name="freightPrice"
x-component="Input"
required
x-component-props={{
placeholder:'运费',
// addonBefore: ' '
}}
x-rules ={{
pattern: PATTERN_MAPS.money,
message:'数字类型,币制为当前站点对应的币制,保留2位小数'
}}
/>
{/* <FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top"> */}
<Field
title='不接受原因'
name="remark"
x-component="TextArea"
required
x-component-props={{
placeholder: '在此输入你的内容,最多60个汉字'
}}
x-rules ={{
max:60,
// maximum:10,//最大数值
message:'原因最多60个汉字'
}}
/>
</>
}
</SchemaForm>
</Modal>
</>
)
}
comfirmDialog.defaultProps = {
dontReceive: true
}
export default comfirmDialog
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
@import "../../member/components/index.less";
@import "../member/components/index.less";
.count{
font-size: 24px;
color: #303133;
......
/* @Author: H_Jiax */
import React, { ReactNode, useRef } from 'react';
import { Card } from 'antd';
import { StandardTable } from 'god';
import { logisticsSearchSchema } from './schema'
import { ColumnType } from 'antd/lib/table/interface';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import statuStyle from './colorTag';
import moment from 'moment';
import NiceForm from '@/components/NiceForm';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { createFormActions } from '@formily/antd';
import { EyeOutlined } from '@ant-design/icons';
const formActions = createFormActions();
const OrderSearchList: React.FC<{}> = (props) => {
const ref = useRef<any>({})
const fetchData = (params: any) => {
return new Promise(resolve => {
PublicApi.getLogisticsPlatformOrderPage({...params}).then(res => {
if(res.code === 1000) {
resolve(res.data)
}
})
})
}
const columns: ColumnType<any>[] = [
{
title: '物流单号',
key: 'logisticsOrderNo',
dataIndex: 'logisticsOrderNo',
render: (text: any, reconds: any) =>
<span className="commonPickColor" onClick={() => history.push(`/logisticsManager/logisticsDetail?id=${reconds.id}`)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '对应订单号',
key: 'relevanceOrderCode',
dataIndex: 'relevanceOrderCode'
},
{
title: '发货方',
key: 'shipperMemberName',
dataIndex: 'shipperMemberName'
},
{
title: '收货方',
key: 'receiverMemberName',
dataIndex: 'receiverMemberName'
},
{
title: '总箱数',
key: 'totalCarton',
dataIndex: 'totalCarton'
},
{
title: '总重量',
key: 'totalWeight',
dataIndex: 'totalWeight'
},
{
title: '总体积',
key: 'totalVolume',
dataIndex: 'totalVolume'
},
{
title: '单据时间',
key: 'invoicesTime',
dataIndex: 'invoicesTime',
render: (text: any) => <>{moment(text).format('YYYY-MM-DD HH:mm:ss')}</>
},
{
title: '外部状态',
dataIndex: 'status',
key: 'status',
render: (_: any, reconds) => {
let component: ReactNode = null
if (reconds.status == 4) {
component = <span style={statuStyle.success}>接受物流单</span>
} else if (reconds.status == 3) {
component = <span style={statuStyle.error}>不接受物流单</span>
} else if (reconds.status == 2) {
component = <span style={statuStyle.confirm}>待确认</span>
} else if (reconds.status == 1) {
component = <span style={statuStyle.default}>待提交</span>
}
return component
}
}
]
const search = (values: any) => {
ref.current.reload(values)
}
return (
<Card>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={columns}
currentRef={ref}
fetchTableData={params => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => search(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'logisticsOrderNo', FORM_FILTER_PATH)
}}
schema={logisticsSearchSchema}
>
</NiceForm>
}
/>
</Card>
)
}
export default OrderSearchList
.selectBtn {
padding: 0 !important;
}
.ant-form-item-control .ant-form-item-control-input .ant-form-item-control-input-content .ant-input-group-wrapper .ant-input-wrapper .ant-input-group-addon,
.ant-form-item-control .ant-form-item-control-input .ant-form-item-control-input-content .selectBtn .ant-input-wrapper .ant-input-group-addon,
.ant-form-item-control .ant-form-item-control-input .ant-form-item-control-input-content .ant-input-group-wrapper .ant-input-group .ant-input-group-addon,
.ant-form-item-control .ant-form-item-control-input .ant-form-item-control-input-content .selectBtn .ant-input-group .ant-input-group-addon {
padding: 0 !important;
}
.selectBtn{
padding: 0 !important;
}
.ant-form-item-control{
.ant-form-item-control-input{
.ant-form-item-control-input-content{
.ant-input-group-wrapper, .selectBtn{
.ant-input-wrapper ,.ant-input-group{
.ant-input-group-addon{
padding: 0 !important;
}
}
}
}
}
}
\ No newline at end of file
import * as React from 'react';
import { useState, useRef, useEffect } from 'react';
import { Row, Col, Tooltip, Form, Input, Select, Popconfirm, Button, Card, message, Modal } from 'antd';
import { DeleteOutlined, FormOutlined, PlusCircleOutlined, LoadingOutlined, PlusOutlined, LinkOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { ColumnType } from 'antd/lib/table/interface'
import { StandardTable } from 'god'
import { history } from 'umi'
import ReutrnEle from '@/components/ReturnEle';
import { PublicApi, CustomApi } from '@/services/api'
import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index'
import style from "./addCompany.less"
export interface companyProps {
}
export interface companyState {
}
interface Item {
key: string;
}
const { TextArea } = Input;
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
};
const data = [
{
key: '1',
Name: '山东万达橡胶集团有限公司',
address: '广东省广州市海珠区新港东路1068号'
}]
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'key',
align: 'center',
key: 'key',
},
{
title: '会员名称',
dataIndex: 'Name',
align: 'center'
},
{
title: '公司地址',
dataIndex: 'address',
align: 'center'
}
]
// 模拟请求
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)
})
}
const { Option } = Select;
const defaultValue = 'lucy'
const company: React.FC<{}> = () => {
//hook只能写在函数组件的顶级作用域
const ref = useRef<any>({})
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)
const [companyType, setCompanyType] = useState<number>(null)
const [memberId, setMemberId] = useState<number>(null)
const [visible, setsVisible] = useState(false) //state hook写法
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
useEffect(() => {
let _title = history.location.query.id == 0 ? '新建' :
history.location.query.isSee ? '查看' : '编辑'
setHeaderTitle(`${_title}物流公司`)
if (id !== '0') {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
const data = res.data
menuForm.setFieldsValue(data)
let type = data.cooperateType === 2 ? 2 : 1
setCompanyType(type)
})
}
return () => {
}
}, [])
const handleSubmitAllSetting = () => {
menuForm.validateFields().then((values: any) => {
if (id) {
PublicApi.postLogisticsCompanyUpdate(values).then(res => {
if (res.code === 1000) {
message.success(res.message)
}
})
} else {
PublicApi.postLogisticsCompanyAdd(values).then(res => {
if (res.code === 1000) {
message.success(res.message)
menuForm.resetFields()
history.goBack()
}
})
}
}).catch(error => {
console.error(error)
})
}
const handleCancel = () => {
history.go(-1)
}
const handleLink = () => {
setsVisible(true)
}
//改变code
const onCodeChange = (e: any) => {
const value = e.target.value
setCode(value)
console.log(value);
}
const onChangeType = (value: any) => {
setCompanyType(value)
if (value == 2) {
setCodeDisabled(true)
} else {
setCodeDisabled(false)
}
}
const handleSelectOk = () => {
console.log('数据', selectRow);
let IDS = selectRow.map(v => v.key)
console.log('数据', IDS.join(','));
setCode(IDS.join(','))
setsVisible(false)
}
const handleSelectCancel = () => {
setsVisible(false)
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
const selectBtn = (
<Button style={{ backgroundColor: '#909399', borderColor: '#909399', color: 'white' }} onClick={handleLink}>
<LinkOutlined />选择
</Button>
)
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={headerTitle}
>
<Row gutter={[36, 36]}>
<Col span={24}>
<Card>
{
(<Form
form={menuForm}
colon={false}
name="edit_infomation"
layout="horizontal"
labelAlign="left"
{...layout}
>
<Row gutter={24}>
<Col span={18}>
<Form.Item
name='cooperateType'
label='合作类型'
rules={[
{
required: true,
message: '合作类型为必须项!',
},
]}
// initialValue={}
>
<Select placeholder="请选择合作类型" value={companyType} onChange={onChangeType}>
<Option value={1}>平台物流服务商</Option>
<Option value={2}>商户合作物流公司</Option>
</Select>
</Form.Item>
</Col>
<Col span={18}>
{
companyType === 1 ?
<Form.Item
name='memberId'
label='物流公司代码/
平台会员ID'
rules={[
{
required: true,
message: '物流公司代码/平台会员ID为必须项!',
}
]}
>
<Input className="input_addonAfter" disabled maxLength={20} addonAfter={selectBtn} />
</Form.Item>
:
<Form.Item
name='code'
label='物流公司代码/平台会员ID'
rules={[
{
required: true,
message: '物流公司代码/平台会员ID为必须项!',
}
]}
>
<Input maxLength={20} />
</Form.Item>
}
</Col>
<Col span={18}>
<Form.Item
name='name'
label='物流公司名称'
rules={[
{
required: true,
message: '输入物流公司名称!',
},
]}
>
<Input maxLength={40} disabled={companyType === 2 ? false : true} placeholder="输入物流公司名称" />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='remark'
label='备注'
>
<TextArea rows={4} maxLength={60} />
</Form.Item>
</Col>
<Col span={18}>
<Row>
<Col span={6}></Col>
<Col span={18}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
保存
</Button>
<Button onClick={handleCancel} style={{ marginTop: 32, marginBottom: 16 }}>
取消
</Button>
</Col>
</Row>
</Col>
</Row>
</Form>)
}
</Card>
</Col>
</Row>
<Modal
title="选择平台物流服务商"
width='800px'
visible={visible}
onOk={handleSelectOk}
onCancel={handleSelectCancel}
okText="确认"
cancelText="取消"
>
<Row>
<Col span={10}> <Input.Search placeholder="输入关键字进行搜索" /></Col>
<Col span={14}></Col>
</Row>
<StandardTable
columns={columns}
currentRef={ref}
rowSelection={{
type: 'radio',
...rowSelection
}}
fetchTableData={(params: any) => fetchData(params)}
/>
</Modal>
</PageHeaderWrapper>
);
}
export default company;
\ No newline at end of file
/*
* @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 16:52:53
*/
import React, { ReactNode, useRef } from 'react'
import { history } from 'umi'
import { Button, Popconfirm, Card, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
PlayCircleOutlined,
PauseCircleOutlined,
EyeOutlined
} from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import {PublicApi,CustomApi} from '@/services/api'
import { getCompanyList, delCompany,updateCompanyStatus } from '@/services/logistics/index'
const data = [
{
key: '1',
attrName: '采购商',
attrGroup: '采购',
displayType: '单选',
required: '平台物流服务商',
status: 1,
},
{
key: '2',
attrName: '供应商',
attrGroup: '供应',
displayType: '双选',
required: '商户合作物流公司',
status: 0,
},
]
// 模拟请求
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
return new Promise((resolve, reject) => {
PublicApi.getLogisticsCompanyPage({ current: params.page, pageSize: params.rows }).then(res => {
resolve(res.data)
})
})
}
const Company: React.FC<{}> = () => {
const ref = useRef<any>({})
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '物流公司编码/平台会员ID',
align: 'center',
dataIndex: 'memberId',
key: "memberId",
render: (value: any, recond: any) =>
<>{recond.memberId ? recond.memberId : recond.code}</>
},
{
title: '属性名称',
dataIndex: 'name',
align: 'center',
key: 'name',
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record.id)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '合作类型',
align: 'center',
dataIndex: 'cooperateType',
key: 'cooperateType',
render: (value: any, recode: any) =>
<>
{value == 1 ? '平台物流服务商' : '商户合作物流公司'}
</>
},
{
title: '状态',
align: 'center',
dataIndex: 'status',
key: 'status',
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Button type="link" style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
{record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
</Button>
)
return component
}
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text: any, record: any) => {
const status = record.status === 0?'启用':'停用'
const title = `确定要${status}吗?`
return (
<>
<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={() => history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${record.id}`)}>编辑</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete(record.id)}>
<Button type='link'>
删除
</Button>
</Popconfirm>
</>
:''}
</>
)
}
}
];
const search: IFormFilter[] = [
{
type: 'Input',
value: 'keywords',
col: 4,
placeHolder: '输入属性名称'
}
]
const searchBarActions: IButtonFilter[] = [
{
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: () => {
history.push('/memberCenter/logisticsAbility/logistics/list/addCompany')
}
}
]
const handleDelete = (id: any) => {
PublicApi.postLogisticsCompanyDelete({ id: id }).then(res => {
if (res.code === 1000) {
ref.current.reload()
}
})
}
const handleChangeStatus = (id:any,status:any) => {
let _status = status == 0 ? 1: 0
PublicApi.postLogisticsCompanyEnable({id:id,status:_status}).then(res => {
if(res.code === 1000){
console.log(ref)
ref.current.reload()
}
})
}
const handleSee = (id: number) => {
history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${id}&isSee=true`)
}
const confirm = () => {
console.log('confirm')
}
const cancel = () => {
console.log('cancel')
}
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record)
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
tableProps={{rowKey:'id'}}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
formilyChilds={{
children: (
<>
<Button type="primary" onClick={() => history.push('/memberCenter/logisticsAbility/logistics/list/addCompany?id=0')}>
新建 <PlusOutlined />
</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
)
}
export default Company
This diff is collapsed.
/*
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-29 20:37: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 toEdit = (id: number) => {
history.push(`/memberCenter/logisticsAbility/logistics/list/addressForm?type=${props.type}&id=${id}`)
};
const columns: ColumnType<any>[] = [
{
title: props.type == '1' ? '发货人姓名' : '收货人姓名',
dataIndex: props.type == '1' ? 'shipperName' : 'receiverName',
align: 'center',
key: props.type == '1' ? 'shipperName' : 'receiverName',
},
{
title: props.type == '1' ? '发货地址' : '收货地址',
align: 'left',
dataIndex: 'address',
key: 'address',
render: (_: any, record: any) => (
<>
{record.fullAddress}
</>
)
},
{
title: '邮编',
dataIndex: 'postalCode',
align: 'center',
key: 'postalCode'
},
{
title: '手机号码',
align: 'center',
dataIndex: 'phone',
key: 'phone',
},
{
title: '电话号码',
align: 'center',
dataIndex: 'tel',
key: 'tel'
},
{
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" onClick={() => toEdit(record.id)}>编辑</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete(record.id)}>
<Button type='link'>删除</Button>
</Popconfirm>
</>
</>
)
}
}
];
// 模拟请求
const fetchData = (params: any) => {
console.log(params);
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 = (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[] = [
{
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
tableProps={{rowKey:'id'}}
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?type=${props.type}&id=0`)}>新建</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
)
}
AddressList.defaultProps = {
}
export default AddressList
\ No newline at end of file
This diff is collapsed.
import React, { useState } from 'react';
import AddressList from './components/addressList'
const List = () => {
return (
<AddressList title='发货地址管理' type='1'/>
)
}
export default List
\ No newline at end of file
import React, { useState } from 'react';
import AddressList from './components/addressList'
const List = () => {
return (
<AddressList title='收货地址管理' type='2'/>
)
}
export default List
\ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 11:19:53
*/
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',
name: '采购商',
pricingMode: '计价方式',
transportMode: '运费方式',
explain: '运费说明',
code: 252525,
status: 1
},
{
key: '2',
name: '采购商',
pricingMode: '计价方式',
transportMode: '运费方式',
explain: '运费说明',
code: 252525,
status: 2
}
]
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getLogisticsFreightTemplatePage({current:params.page, pageSize: params.rows}).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 Template: React.FC<ListProps> = (props) => {
console.log(props)
const ref = useRef<any>({})
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: 'name',
align: 'center',
key: 'name',
},
{
title: '计价方式',
align: 'center',
dataIndex: 'pricingMode',
key: 'pricingMode',
render: (_:any,record:any) => {
return (
<>{record.transportMode === 1?'按重量':''}</>
)
}
},
{
title: '运送方式',
dataIndex: 'transportMode',
align: 'center',
key: 'transportMode',
render: (_:any,record:any) => {
return (
<>{record.transportMode === 1?'快递':''}</>
)
}
},
{
title: '运费说明',
align: 'center',
dataIndex: 'explain',
key: 'explain',
},
{
title: '状态',
align: 'center',
dataIndex: 'status',
key: 'status',
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>
)
}
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (_: any, record: any) => {
const status = record.status === 0?'启用':'停用'
const title = `确定要${status}吗?`
return (
<>
<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={() => 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' onClick={() => handleSee(record.id)}>查看</Button>
</>
)
}
}
];
//生命周期
// useEffect(() => {
// effect
// return () => {
// cleanup
// }
// }, [input])
const onDefaultChange = (id: any, checked: boolean) => {
console.log(id, checked)
columns.forEach((v, index) => {
})
}
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[] = [
{
type: 'Input',
value: 'keywords',
col: 4,
placeHolder: '输入属性名称'
}
]
const handleSee = (id: number) => {
history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?id=${id}&isSee=${true}`)
}
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/templateForm?id=0`)}>
新建
</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
)
}
Template.defaultProps = {
}
export default Template
\ No newline at end of file
import React, { Component } from 'react'
import OrderList from '../components/orderSearchList'
const List = () => {
return (
<OrderList title='处理' type='1'/>
)
}
export default List
\ No newline at end of file
import { ISchema} from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PublicApi } from '@/services/api';
/**
* @description: 询价单
* @param {type}
* @return {type}
*/
export const logisticsSearchSchema: ISchema = {
type:'object',
properties:{
megalayout:{
type:'object',
"x-component":'mega-layout',
properties:{
logisticsOrderNo:{
type:'string',
"x-component":"Search",
"x-mega-props":{
},
"x-component-props":{
placeholder:'物流单号',
align: 'flex-left',
}
}
}
},
[FORM_FILTER_PATH]:{
type:'object',
"x-component":"flex-layout",
"x-component-props":{
rowStyle:{
justifyContent: 'flex-start',
flexWrap:'nowrap'
},
colStyle:{//改变间隔
marginRight: 20
}
},
properties:{
PRO_LAYOUT:{
type:'object',
"x-component":'mega-layout',
"x-mega-props":{
span: 5
},
"x-component-props":{
inline: true
},
properties:{
relevanceOrderCode:{
type:'string',
"x-component-props":{
placeholder:'订单号'
}
},
companyId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '物流服务商',
className: 'fixed-ant-selected-down',
fetchSearch: PublicApi.getLogisticsSelectListMemberCompanyQuery,
style: {
width: 160
}
},
},
shipperMemberName:{
type:'string',
"x-component-props":{
placeholder:'发货方'
}
},
"[invoicesTimeStart,invoicesTimeEnd]": {
type: 'string',
"x-component": "dateSelect",
"x-component-props": {
placeholder: '单据时间(全部)',
}
},
status:{
type:'string',
"x-component-props":{
placeholder:'外部状态'
},
enum: [
{
label: '待提交', value: 1
},
{
label: '待确认', value: 2
},
{
label: '不接受物流单', value: 3
},
{
label: '接受物流单', value: 4
}
]
},
}
},
sumbit:{
"x-component":'Submit',
"x-mega-props":{
span: 1
},
"x-component-props":{
children:'查询'
}
}
}
}
}
}
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