Commit 98c89f77 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 07c98310 abdcfd3d
import React from 'react'
import { Popconfirm, Button } from 'antd'
import { PlayCircleOutlined } from '@ant-design/icons'
import { PlayCircleOutlined,PauseCircleOutlined } from '@ant-design/icons'
export interface StatusSwitchProps {
record: any,
......@@ -20,7 +20,21 @@ const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
okText="是"
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>
)
}
......
......@@ -6,7 +6,6 @@ import { Row } from 'antd';
import { GlobalConfig } from '@/global/config';
import Logo from '../../mockStatic/logo.png'
/**
* 登录、注册等用户界面布局
* @author xjm
......
......@@ -334,8 +334,8 @@ const detailInfo: React.FC<{}> = () => {
{
dataInfo.status == 1?<><span style={statuStyle.default}>待提交</span></>:
dataInfo.status == 2?<><span style={statuStyle.confirm}>待确认</span></>:
dataInfo.status == 3?<><span style={statuStyle.success}>接受物流单</span></>:
<><span style={statuStyle.warn}>接受物流单</span></>
dataInfo.status == 3?<><span style={statuStyle.success}>接受物流单</span></>:
<><span style={statuStyle.warn}>接受物流单</span></>
}
</div>
</div>
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-18 15:55:51
* @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 { Card, Button, Row, Col, Tooltip, Input, Select, Tag, Space } from 'antd'
......@@ -224,9 +224,9 @@ const orderSearchList: React.FC<listProps> = (props) => {
if (reconds.status == 3) {
component =
// <Tag color='success'>接受物流单</Tag>
<><span style={statuStyle.success}>接受物流单</span></>
<><span style={statuStyle.success}>接受物流单</span></>
} else if (reconds.status == 4) {
component = <><span style={statuStyle.warn}>接受物流单</span></>
component = <><span style={statuStyle.warn}>接受物流单</span></>
} else if (reconds.status == 2) {
component = <><span style={statuStyle.confirm}>待确认</span></>
} else if (reconds.status == 1) {
......
......@@ -8,6 +8,7 @@ import { StandardTable } from 'god'
import { history } from 'umi'
import ReutrnEle from '@/components/ReturnEle';
import {PublicApi,CustomApi} from '@/services/api'
import {usePageStatus,PageStatus} from '@/hooks/usePageStatus'
import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index'
import style from "./addCompany.less"
export interface companyProps {
......@@ -70,21 +71,20 @@ const defaultValue = 'lucy'
const company: React.FC<{}> = () => {
//hook只能写在函数组件的顶级作用域
const ref = useRef<any>({})
const {pageStatus,id} = usePageStatus()
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 ? '查看': '编辑'
let _title = pageStatus === PageStatus.PREVIEW ?'查看': id ?'编辑':'新建'
setHeaderTitle(`${_title}物流公司`)
if (id !== '0') {
if (id) {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
const data = res.data
menuForm.setFieldsValue(data)
......@@ -102,15 +102,10 @@ const company: React.FC<{}> = () => {
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()
}
......@@ -263,6 +258,8 @@ const company: React.FC<{}> = () => {
<TextArea rows={4} maxLength={60} />
</Form.Item>
</Col>
{
(pageStatus === PageStatus.PREVIEW) &&
<Col span={18}>
<Row>
<Col span={6}></Col>
......@@ -276,6 +273,7 @@ const company: React.FC<{}> = () => {
</Col>
</Row>
</Col>
}
</Row>
</Form>)
}
......
/*
EyePreview/*
* @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 16:52:53
......@@ -18,6 +18,8 @@ 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 EyePreview from '@/components/EyePreview'
import StatusSwitch from '@/components/StatusSwitch'
import { getCompanyList, delCompany,updateCompanyStatus } from '@/services/logistics/index'
const data = [
......@@ -73,7 +75,9 @@ const Company: React.FC<{}> = () => {
dataIndex: 'name',
align: 'center',
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: '合作类型',
......@@ -91,31 +95,18 @@ const Company: React.FC<{}> = () => {
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>
render: (text: any, record: any) => (
<StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id,record.status)} record={record}/>
)
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>
......@@ -159,15 +150,11 @@ const Company: React.FC<{}> = () => {
}
})
}
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)
const handleChangeStatus = async (id:any,status:any) => {
let _status = status == 1 ? 0: 1
await PublicApi.postLogisticsCompanyEnable({id:id,status:_status})
ref.current.reload()
}
})
}
const handleSee = (id: number) => {
history.push(`/memberCenter/logisticsAbility/logistics/list/addCompany?id=${id}&isSee=true`)
......@@ -197,7 +184,7 @@ const Company: React.FC<{}> = () => {
formilyChilds={{
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 />
</Button>
</>
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-03 17:59:56
* @LastEditTime: 2020-08-05 16:36:51
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -168,7 +168,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
console.log(typeof(id))
let title = id === 0 ? '新建' : '编辑'
history.location.query.type == '1' ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`)
PublicApi.getLogisticsShipperAddressGetTelCode().then(res => {
PublicApi.getManageGetTelCode().then(res => {
res.data.forEach((item,index) => {
TelCodeList.push({ label: item, value: (index).toString() })
})
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @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 { history } from 'umi'
......@@ -208,9 +208,9 @@ const OrderList: React.FC<ListProps> = (props) => {
render: (text: any, record: any) => {
let component: ReactNode = null
if (text == 3) {
component = <><span style={statuStyle.success}>接受物流单</span></>
component = <><span style={statuStyle.success}>接受物流单</span></>
} else if (text == 4) {
component = <><span style={statuStyle.warn}>接受物流单</span></>
component = <><span style={statuStyle.warn}>接受物流单</span></>
} else if (text == 2) {
component = <><span style={statuStyle.confirm}>待确认</span></>
} else if (text == 1) {
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-28 11:25:30
* @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 { Card, Row, Col, Tabs, Button, Input as SelectInput, Badge } from 'antd'
......@@ -89,8 +89,8 @@ const Deatail: React.FC<{}> = () => {
let component: ReactNode = null;
text === 1 ? component = <Badge status='default' text="待提交" />:
text === 2 ? component = <Badge status='processing' text="待确认" />:
text === 3 ? component = <Badge status='success' text="接受物流单" />:
component = <Badge status='error' text="不接受物流单" />
text === 3 ? component = <Badge status='error' text="不接受物流单" />:
component = <Badge status='success' text="接受物流单" />
return component;
},
},
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @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 { history } from 'umi'
......@@ -168,9 +168,9 @@ const OrderList: React.FC<ListProps> = (props) => {
render: (text: any, reconds: any) => {
let component: ReactNode = null
if (text == 3) {
component = <><span style={statuStyle.success}>接受物流单</span></>
component = <><span style={statuStyle.success}>接受物流单</span></>
} else if (text == 4) {
component = <><span style={statuStyle.warn}>接受物流单</span></>
component = <><span style={statuStyle.warn}>接受物流单</span></>
} else if (text == 2) {
component = <><span style={statuStyle.confirm}>待确认</span></>
} 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