把 Class 组件转换为 Function 组件

feature/2.0-sales-trade
LiaoYijun 3 years ago
parent c54fccb964
commit d438adde67

@ -1,6 +1,6 @@
import {makeAutoObservable, runInAction} from "mobx"
import moment from "moment";
import { NavLink, useParams } from "react-router-dom";
import { NavLink } from "react-router-dom";
import * as config from "../config";
import * as req from '../utils/request';
@ -123,18 +123,25 @@ class CustomerServices {
}
fetchGroupListByAgentId(agentId) {
console.info('agentId: ' + agentId);
this.selectedAgent = {VendorName: '...'};
req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfo?VEI_SN=' + agentId + '&DateType=' + this.dateType + '&Date1=' + this.startDateString + '&Date2=' + this.endDateString + '&OldDate1=' + this.startDateString + '&OldDate2=' + this.endDateString)
.then(json => {
if (json.errcode === 0) {
runInAction(() => {
this.groupList = json.result1;
if (json.result1.length > 0) {
this.selectedAgent = {VendorName: json.result1[0].VendorName};
}
const total1 = json.total1;
this.groupListColumns = [
{
title: '团名',
dataIndex: 'GRI_Name',
children: [{
title: '',
dataIndex: 'GRI_Name'
}
]
},
{
title: '人数',
@ -158,15 +165,21 @@ class CustomerServices {
},
{
title: '经过城市',
dataIndex: 'PassCity',
children: [{
title: '-',
dataIndex: 'PassCity'
},
{
title: '地接社名称',
dataIndex: 'VendorName'
}
]
},
{
title: '导游',
dataIndex: 'GuideName'
dataIndex: 'GuideName',
children: [{
title: '-',
dataIndex: 'PassCity'
}
]
},
{
title: '好评',
@ -190,7 +203,12 @@ class CustomerServices {
},
{
title: '评论内容',
dataIndex: 'ECI_Content'
dataIndex: 'ECI_Content',
children: [{
title: '-',
dataIndex: 'PassCity'
}
]
},
{
title: '交易额',

@ -1,4 +1,4 @@
import React, {Component} from 'react';
import React, {useContext} from 'react';
import { Row, Col, Typography, Space, DatePicker, Button, Select, Table } from 'antd';
import {
SearchOutlined,
@ -10,30 +10,17 @@ import 'moment/locale/zh-cn';
import moment from "moment";
import zhCNlocale from 'antd/es/date-picker/locale/zh_CN';
class AgentList extends Component {
const AgentList = () => {
static contextType = stores_Context;
constructor(props) {
super(props);
}
componentDidMount() {
}
handleSearchClick() {
const {customerServicesStore} = this.context;
customerServicesStore.fetchAgentList();
}
render() {
const {customerServicesStore} = this.context;
const { customerServicesStore } = useContext(stores_Context);
const agentList = customerServicesStore.agentList;
const agentListColumns = customerServicesStore.agentListColumns;
const groupList = customerServicesStore.groupList;
const groupListColumns = customerServicesStore.groupListColumns;
const { startDate, endDate, dateType } = customerServicesStore;
const handleSearchClick = () => {
customerServicesStore.fetchAgentList();
}
return (
<>
<Space direction="vertical" style={{ width: '100%' }}>
@ -72,7 +59,7 @@ class AgentList extends Component {
icon={<SearchOutlined />}
loading={false}
onClick={() => {
this.handleSearchClick();
handleSearchClick();
}}>
统计
</Button>
@ -96,6 +83,5 @@ class AgentList extends Component {
</>
);
}
}
export default observer(AgentList);
Loading…
Cancel
Save