Commit 98c89f77 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 07c98310 abdcfd3d
import React from 'react' import React from 'react'
import { Popconfirm, Button } from 'antd' import { Popconfirm, Button } from 'antd'
import { PlayCircleOutlined } from '@ant-design/icons' import { PlayCircleOutlined,PauseCircleOutlined } from '@ant-design/icons'
export interface StatusSwitchProps { export interface StatusSwitchProps {
record: any, record: any,
...@@ -20,7 +20,21 @@ const StatusSwitch:React.FC<StatusSwitchProps> = (props) => { ...@@ -20,7 +20,21 @@ const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
okText="是" okText="是"
cancelText="否" cancelText="否"
> >
<Button type="link" style={record[fieldNames] === expectTrueValue?{color:'#00B37A'}:{color:'red'}}>{record[fieldNames] === expectTrueValue?'有效':'无效'} <PlayCircleOutlined /></Button> <Button
type="link"
style={
record[fieldNames] === expectTrueValue
? { color: '#00B37A' }
: { color: 'red' }
}
>
{record[fieldNames] === expectTrueValue ? '有效' : '无效'}
{record[fieldNames] === expectTrueValue ? (
<PlayCircleOutlined />
) : (
<PauseCircleOutlined />
)}
</Button>
</Popconfirm> </Popconfirm>
) )
} }
......
...@@ -6,7 +6,6 @@ import { Row } from 'antd'; ...@@ -6,7 +6,6 @@ import { Row } from 'antd';
import { GlobalConfig } from '@/global/config'; import { GlobalConfig } from '@/global/config';
import Logo from '../../mockStatic/logo.png' import Logo from '../../mockStatic/logo.png'
/** /**
* 登录、注册等用户界面布局 * 登录、注册等用户界面布局
* @author xjm * @author xjm
......
...@@ -334,8 +334,8 @@ const detailInfo: React.FC<{}> = () => { ...@@ -334,8 +334,8 @@ const detailInfo: React.FC<{}> = () => {
{ {
dataInfo.status == 1?<><span style={statuStyle.default}>待提交</span></>: dataInfo.status == 1?<><span style={statuStyle.default}>待提交</span></>:
dataInfo.status == 2?<><span style={statuStyle.confirm}>待确认</span></>: dataInfo.status == 2?<><span style={statuStyle.confirm}>待确认</span></>:
dataInfo.status == 3?<><span style={statuStyle.success}>接受物流单</span></>: dataInfo.status == 3?<><span style={statuStyle.success}>接受物流单</span></>:
<><span style={statuStyle.warn}>接受物流单</span></> <><span style={statuStyle.warn}>接受物流单</span></>
} }
</div> </div>
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-18 15:55:51 * @Date: 2020-07-18 15:55:51
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 15:56:17 * @LastEditTime: 2020-08-18 14:13:08
*/ */
import React, { useState, useEffect, useRef, ReactNode } from 'react'; import React, { useState, useEffect, useRef, ReactNode } from 'react';
import { Card, Button, Row, Col, Tooltip, Input, Select, Tag, Space } from 'antd' import { Card, Button, Row, Col, Tooltip, Input, Select, Tag, Space } from 'antd'
...@@ -224,9 +224,9 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -224,9 +224,9 @@ const orderSearchList: React.FC<listProps> = (props) => {
if (reconds.status == 3) { if (reconds.status == 3) {
component = component =
// <Tag color='success'>接受物流单</Tag> // <Tag color='success'>接受物流单</Tag>
<><span style={statuStyle.success}>接受物流单</span></> <><span style={statuStyle.success}>接受物流单</span></>
} else if (reconds.status == 4) { } else if (reconds.status == 4) {
component = <><span style={statuStyle.warn}>接受物流单</span></> component = <><span style={statuStyle.warn}>接受物流单</span></>
} else if (reconds.status == 2) { } else if (reconds.status == 2) {
component = <><span style={statuStyle.confirm}>待确认</span></> component = <><span style={statuStyle.confirm}>待确认</span></>
} else if (reconds.status == 1) { } else if (reconds.status == 1) {
......
...@@ -8,6 +8,7 @@ import { StandardTable } from 'god' ...@@ -8,6 +8,7 @@ import { StandardTable } from 'god'
import { history } from 'umi' import { history } from 'umi'
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import {PublicApi,CustomApi} from '@/services/api' import {PublicApi,CustomApi} from '@/services/api'
import {usePageStatus,PageStatus} from '@/hooks/usePageStatus'
import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index' import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index'
import style from "./addCompany.less" import style from "./addCompany.less"
export interface companyProps { export interface companyProps {
...@@ -70,21 +71,20 @@ const defaultValue = 'lucy' ...@@ -70,21 +71,20 @@ const defaultValue = 'lucy'
const company: React.FC<{}> = () => { const company: React.FC<{}> = () => {
//hook只能写在函数组件的顶级作用域 //hook只能写在函数组件的顶级作用域
const ref = useRef<any>({}) const ref = useRef<any>({})
const {pageStatus,id} = usePageStatus()
const [menuForm] = Form.useForm(); const [menuForm] = Form.useForm();
const [headerTitle, setHeaderTitle] = useState('新建物流公司') const [headerTitle, setHeaderTitle] = useState('新建物流公司')
const [Code, setCode] = useState('') const [Code, setCode] = useState('')
const [codeDisabled, setCodeDisabled] = useState(false) const [codeDisabled, setCodeDisabled] = useState(false)
const [id, setId] = useState<string>(history.location.query.id || null)
const [companyType, setCompanyType] = useState<number>(null) const [companyType, setCompanyType] = useState<number>(null)
const [memberId, setMemberId] = useState<number>(null) const [memberId, setMemberId] = useState<number>(null)
const [visible, setsVisible] = useState(false) //state hook写法 const [visible, setsVisible] = useState(false) //state hook写法
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据 const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
useEffect(() => { useEffect(() => {
let _title = history.location.query.id == 0? '新建': let _title = pageStatus === PageStatus.PREVIEW ?'查看': id ?'编辑':'新建'
history.location.query.isSee ? '查看': '编辑'
setHeaderTitle(`${_title}物流公司`) setHeaderTitle(`${_title}物流公司`)
if (id !== '0') { if (id) {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => { PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
const data = res.data const data = res.data
menuForm.setFieldsValue(data) menuForm.setFieldsValue(data)
...@@ -102,15 +102,10 @@ const company: React.FC<{}> = () => { ...@@ -102,15 +102,10 @@ const company: React.FC<{}> = () => {
menuForm.validateFields().then((values: any) => { menuForm.validateFields().then((values: any) => {
if (id) { if (id) {
PublicApi.postLogisticsCompanyUpdate(values).then(res => { PublicApi.postLogisticsCompanyUpdate(values).then(res => {
if (res.code === 1000) {
message.success(res.message)
}
}) })
} else { } else {
PublicApi.postLogisticsCompanyAdd(values).then(res => { PublicApi.postLogisticsCompanyAdd(values).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
message.success(res.message)
menuForm.resetFields() menuForm.resetFields()
history.goBack() history.goBack()
} }
...@@ -263,6 +258,8 @@ const company: React.FC<{}> = () => { ...@@ -263,6 +258,8 @@ const company: React.FC<{}> = () => {
<TextArea rows={4} maxLength={60} /> <TextArea rows={4} maxLength={60} />
</Form.Item> </Form.Item>
</Col> </Col>
{
(pageStatus === PageStatus.PREVIEW) &&
<Col span={18}> <Col span={18}>
<Row> <Row>
<Col span={6}></Col> <Col span={6}></Col>
...@@ -276,6 +273,7 @@ const company: React.FC<{}> = () => { ...@@ -276,6 +273,7 @@ const company: React.FC<{}> = () => {
</Col> </Col>
</Row> </Row>
</Col> </Col>
}
</Row> </Row>
</Form>) </Form>)
} }
......
/* EyePreview/*
* @Date: 2020-07-13 15:01:40 * @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 16:52:53 * @LastEditTime: 2020-08-03 16:52:53
...@@ -18,6 +18,8 @@ import { StandardTable } from 'god' ...@@ -18,6 +18,8 @@ import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController' import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import {PublicApi,CustomApi} from '@/services/api' import {PublicApi,CustomApi} from '@/services/api'
import EyePreview from '@/components/EyePreview'
import StatusSwitch from '@/components/StatusSwitch'
import { getCompanyList, delCompany,updateCompanyStatus } from '@/services/logistics/index' import { getCompanyList, delCompany,updateCompanyStatus } from '@/services/logistics/index'
const data = [ const data = [
...@@ -73,7 +75,9 @@ const Company: React.FC<{}> = () => { ...@@ -73,7 +75,9 @@ const Company: React.FC<{}> = () => {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record.id)}>{text}&nbsp;<EyeOutlined /></span> render: (text: any, record: any) => (
<EyePreview url={`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${record.id}&preview=1`}>{text}</EyePreview>
)
}, },
{ {
title: '合作类型', title: '合作类型',
...@@ -91,31 +95,18 @@ const Company: React.FC<{}> = () => { ...@@ -91,31 +95,18 @@ const Company: React.FC<{}> = () => {
align: 'center', align: 'center',
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
render: (text: any, record: any) => { render: (text: any, record: any) => (
let component: ReactNode = null <StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id,record.status)} record={record}/>
component = (
<Button type="link" style={record.status === 1 ? { color: '#00B37A' } : { color: 'red' }}>{record.status === 1 ? '有效' : '无效'}
{record.status === 1 ? <PlayCircleOutlined /> : <PauseCircleOutlined />}
</Button>
) )
return component
}
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'option', dataIndex: 'option',
align: 'center', align: 'center',
render: (text: any, record: any) => { render: (text: any, record: any) => {
const status = record.status === 0?'启用':'停用'
const title = `确定要${status}吗?` const title = `确定要${status}吗?`
return ( return (
<> <>
<Popconfirm title={title} okText="是" cancelText="否" onConfirm={() => handleChangeStatus(record.id,record.status)}>
<Button type='link'>
{ record.status === 0?'启用':'停用'}
</Button>
</Popconfirm>
{ record.status === 0 ? { record.status === 0 ?
<> <>
<Button type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${record.id}`)}>编辑</Button> <Button type='link' onClick={() => history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${record.id}`)}>编辑</Button>
...@@ -159,15 +150,11 @@ const Company: React.FC<{}> = () => { ...@@ -159,15 +150,11 @@ const Company: React.FC<{}> = () => {
} }
}) })
} }
const handleChangeStatus = (id:any,status:any) => { const handleChangeStatus = async (id:any,status:any) => {
let _status = status == 0 ? 1: 0 let _status = status == 1 ? 0: 1
PublicApi.postLogisticsCompanyEnable({id:id,status:_status}).then(res => { await PublicApi.postLogisticsCompanyEnable({id:id,status:_status})
if(res.code === 1000){
console.log(ref)
ref.current.reload() ref.current.reload()
} }
})
}
const handleSee = (id: number) => { const handleSee = (id: number) => {
history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${id}&isSee=true`) history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${id}&isSee=true`)
...@@ -197,7 +184,7 @@ const Company: React.FC<{}> = () => { ...@@ -197,7 +184,7 @@ const Company: React.FC<{}> = () => {
formilyChilds={{ formilyChilds={{
children: ( children: (
<> <>
<Button type="primary" onClick={() => history.push('/memberCenter/logisticsAbility/logistics/list/addCompany?id=0')}> <Button type="primary" onClick={() => history.push('/memberCenter/logisticsAbility/logistics/list/addCompany')}>
新建 <PlusOutlined /> 新建 <PlusOutlined />
</Button> </Button>
</> </>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55 * @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 17:59:56 * @LastEditTime: 2020-08-05 16:36:51
*/ */
import React, { Component, useState, useEffect } from 'react'; import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
...@@ -168,7 +168,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -168,7 +168,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
console.log(typeof(id)) console.log(typeof(id))
let title = id === 0 ? '新建' : '编辑' let title = id === 0 ? '新建' : '编辑'
history.location.query.type == '1' ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`) history.location.query.type == '1' ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`)
PublicApi.getLogisticsShipperAddressGetTelCode().then(res => { PublicApi.getManageGetTelCode().then(res => {
res.data.forEach((item,index) => { res.data.forEach((item,index) => {
TelCodeList.push({ label: item, value: (index).toString() }) TelCodeList.push({ label: item, value: (index).toString() })
}) })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34 * @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 15:48:15 * @LastEditTime: 2020-08-18 14:15:07
*/ */
import React, { Component, ReactNode, useRef, useState, useEffect } from 'react' import React, { Component, ReactNode, useRef, useState, useEffect } from 'react'
import { history } from 'umi' import { history } from 'umi'
...@@ -208,9 +208,9 @@ const OrderList: React.FC<ListProps> = (props) => { ...@@ -208,9 +208,9 @@ const OrderList: React.FC<ListProps> = (props) => {
render: (text: any, record: any) => { render: (text: any, record: any) => {
let component: ReactNode = null let component: ReactNode = null
if (text == 3) { if (text == 3) {
component = <><span style={statuStyle.success}>接受物流单</span></> component = <><span style={statuStyle.success}>接受物流单</span></>
} else if (text == 4) { } else if (text == 4) {
component = <><span style={statuStyle.warn}>接受物流单</span></> component = <><span style={statuStyle.warn}>接受物流单</span></>
} else if (text == 2) { } else if (text == 2) {
component = <><span style={statuStyle.confirm}>待确认</span></> component = <><span style={statuStyle.confirm}>待确认</span></>
} else if (text == 1) { } else if (text == 1) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-28 11:25:30 * @Date: 2020-07-28 11:25:30
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 18:28:38 * @LastEditTime: 2020-08-18 14:17:46
*/ */
import React, { Component, useEffect, useRef, useState,ReactNode } from 'react' import React, { Component, useEffect, useRef, useState,ReactNode } from 'react'
import { Card, Row, Col, Tabs, Button, Input as SelectInput, Badge } from 'antd' import { Card, Row, Col, Tabs, Button, Input as SelectInput, Badge } from 'antd'
...@@ -89,8 +89,8 @@ const Deatail: React.FC<{}> = () => { ...@@ -89,8 +89,8 @@ const Deatail: React.FC<{}> = () => {
let component: ReactNode = null; let component: ReactNode = null;
text === 1 ? component = <Badge status='default' text="待提交" />: text === 1 ? component = <Badge status='default' text="待提交" />:
text === 2 ? component = <Badge status='processing' text="待确认" />: text === 2 ? component = <Badge status='processing' text="待确认" />:
text === 3 ? component = <Badge status='success' text="接受物流单" />: text === 3 ? component = <Badge status='error' text="不接受物流单" />:
component = <Badge status='error' text="不接受物流单" /> component = <Badge status='success' text="接受物流单" />
return component; return component;
}, },
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34 * @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 15:49:51 * @LastEditTime: 2020-08-18 14:14:13
*/ */
import React, { Component, ReactNode, useRef, useState, useEffect } from 'react' import React, { Component, ReactNode, useRef, useState, useEffect } from 'react'
import { history } from 'umi' import { history } from 'umi'
...@@ -168,9 +168,9 @@ const OrderList: React.FC<ListProps> = (props) => { ...@@ -168,9 +168,9 @@ const OrderList: React.FC<ListProps> = (props) => {
render: (text: any, reconds: any) => { render: (text: any, reconds: any) => {
let component: ReactNode = null let component: ReactNode = null
if (text == 3) { if (text == 3) {
component = <><span style={statuStyle.success}>接受物流单</span></> component = <><span style={statuStyle.success}>接受物流单</span></>
} else if (text == 4) { } else if (text == 4) {
component = <><span style={statuStyle.warn}>接受物流单</span></> component = <><span style={statuStyle.warn}>接受物流单</span></>
} else if (text == 2) { } else if (text == 2) {
component = <><span style={statuStyle.confirm}>待确认</span></> component = <><span style={statuStyle.confirm}>待确认</span></>
} else if (text == 1) { } else if (text == 1) {
......
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