import {makeAutoObservable, runInAction} from "mobx" import moment from "moment"; import * as config from "../config"; import * as req from '../utils/request'; class CustomerServices { constructor(rootStore) { this.rootStore = rootStore; this.startDate = moment().startOf('week').subtract(7, 'days'); this.endDate = moment().endOf('week').subtract(7, 'days'); this.startDateString = this.startDate.format(config.DATE_FORMAT); this.endDateString = this.endDate.format(config.DATE_FORMAT) + '%2023:59'; this.dateType = 'startDate'; this.selectedAgent = {VendorName: '请选择地接社'}; makeAutoObservable(this); } fetchAgentList() { req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfoALL?DateType=' + this.dateType + '&Date1=' + this.startDateString + '&Date2=' + this.endDateString + '&OldDate1=' + this.startDateString + '&OldDate2=' + this.endDateString) .then(json => { console.info(json); if (json.errcode === 0) { runInAction(() => { this.agentList = json.result1; }); } }); } fetchGroupListByAgent() { req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfo?VEI_SN=' + this.selectedAgent.EOI_ObjSN + '&DateType=' + this.dateType + '&Date1=' + this.startDateString + '&Date2=' + this.endDateString + '&OldDate1=' + this.startDateString + '&OldDate2=' + this.endDateString) .then(json => { console.info(json); if (json.errcode === 0) { runInAction(() => { this.groupList = json.result1; }); } }); } selectDateRange(startDate, endDate) { this.startDate = startDate; this.endDate = endDate; this.startDateString = startDate.format(config.DATE_FORMAT); this.endDateString = endDate.format(config.DATE_FORMAT) + '%2023:59'; } selectDateType(dateType) { this.dateType = dateType; } selectAgent(agent) { this.selectedAgent = agent; this.fetchGroupListByAgent(); } startDate; endDate; startDateString; endDateString; dateType; selectedAgent; groupList = [{ EOI_ObjSN: 1, GRI_SN: '---', GRI_Name: 0, COLI_PersonNum: 0, COLI_Days: 0, PassCity: 0, VendorName: 0, GuideName: '-', Good: 0, Bad: '-', ECI_Content: '-', totalcost: 0, key: 1 }]; groupListColumns = [ { title: '团名', dataIndex: 'GRI_Name' }, { title: '人数', dataIndex: 'COLI_PersonNum' }, { title: '天数', dataIndex: 'COLI_Days' }, { title: '经过城市', dataIndex: 'PassCity' }, { title: '地接社名称', dataIndex: 'VendorName' }, { title: '导游', dataIndex: 'GuideName' }, { title: '好评', dataIndex: 'Good' }, { title: '差评', dataIndex: 'Bad' }, { title: '评论内容', dataIndex: 'ECI_Content' }, { title: '交易额', dataIndex: 'totalcost' } ]; agentList = [{ EOI_ObjSN: 1, VendorName: '---', GroupCount: 0, PersonNum: 0, GroupDays: 0, totalcost: 0, GoodCount: 0, GoodRate: '-', BadCount: 0, BadRate: '-', key: 1 }]; agentListColumns = [ { title: '地接社名称', dataIndex: 'VendorName' }, { title: '团数', dataIndex: 'GroupCount' }, { title: '人数', dataIndex: 'PersonNum' }, { title: '团天数', dataIndex: 'GroupDays' }, { title: '交易额', dataIndex: 'totalcost' }, { title: '好评数', dataIndex: 'GoodCount' }, { title: '好评率', dataIndex: 'GoodRate' }, { title: '差评数', dataIndex: 'BadCount' }, { title: '差评率', dataIndex: 'BadRate' } ]; } export default CustomerServices;