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 => { if (json.errcode === 0) { runInAction(() => { this.agentList = json.result1; const total1 = json.total1; this.agentListColumns = [ { title: '地接社名称', dataIndex: 'VendorName', children: [{ // title: this.startDate.format(config.DATE_FORMAT) + '~' + this.endDate.format(config.DATE_FORMAT), dataIndex: 'VendorName', render: (text, record) => {text} } ] }, { title: '团数', dataIndex: 'GroupCount', sorter: (a, b) => a.GroupCount - b.GroupCount, children: [{ title: total1.GroupCount, dataIndex: 'GroupCount' } ] }, { title: '人数', dataIndex: 'PersonNum', sorter: (a, b) => a.PersonNum - b.PersonNum, children: [{ title: total1.PersonNum, dataIndex: 'PersonNum' } ] }, { title: '团天数', dataIndex: 'GroupDays', sorter: (a, b) => a.GroupDays - b.GroupDays, children: [{ title: total1.GroupDays, dataIndex: 'GroupDays' } ] }, { title: '交易额', dataIndex: 'totalcost', sorter: (a, b) => a.totalcost - b.totalcost, children: [{ title: total1.totalcost, dataIndex: 'totalcost' } ] }, { title: '好评数', dataIndex: 'GoodCount', sorter: (a, b) => a.GoodCount - b.GoodCount, children: [{ title: total1.GoodCount, dataIndex: 'GoodCount' } ] }, { title: '好评率', dataIndex: 'GoodRate', sorter: (a, b) => parseInt(a.GoodRate) - parseInt(b.GoodRate), children: [{ title: total1.GoodRate, dataIndex: 'GoodRate' } ] }, { title: '差评数', dataIndex: 'BadCount', sorter: (a, b) => a.BadCount - b.BadCount, children: [{ title: total1.BadCount, dataIndex: 'BadCount' } ] }, { title: '差评率', dataIndex: 'BadRate', sorter: (a, b) => parseInt(a.BadRate) - parseInt(b.BadRate), children: [{ title: total1.BadRate, dataIndex: 'BadRate' } ] } ]; }); } }); } 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 => { if (json.errcode === 0) { runInAction(() => { this.groupList = json.result1; const total1 = json.total1; this.groupListColumns = [ { title: '团名', dataIndex: 'GRI_Name' }, { title: '人数', dataIndex: 'COLI_PersonNum', sorter: (a, b) => a.COLI_PersonNum - b.COLI_PersonNum, children: [{ title: total1.COLI_PersonNum, dataIndex: 'COLI_PersonNum' } ] }, { title: '天数', dataIndex: 'COLI_Days', sorter: (a, b) => a.COLI_Days - b.COLI_Days, children: [{ title: total1.COLI_Days, dataIndex: 'COLI_Days' } ] }, { title: '经过城市', dataIndex: 'PassCity' }, { title: '地接社名称', dataIndex: 'VendorName' }, { title: '导游', dataIndex: 'GuideName' }, { title: '好评', dataIndex: 'Good', sorter: (a, b) => a.Good - b.Good, children: [{ title: total1.Good, dataIndex: 'Good' } ] }, { title: '差评', dataIndex: 'Bad', sorter: (a, b) => a.Bad - b.Bad, children: [{ title: total1.Bad, dataIndex: 'Bad' } ] }, { title: '评论内容', dataIndex: 'ECI_Content' }, { title: '交易额', dataIndex: 'totalcost', sorter: (a, b) => a.totalcost - b.totalcost, children: [{ title: total1.totalcost, dataIndex: 'totalcost' } ] } ]; }); } }); } 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', sorter: (a, b) => a.COLI_PersonNum - b.COLI_PersonNum }, { title: '天数', dataIndex: 'COLI_Days', sorter: (a, b) => a.COLI_Days - b.COLI_Days }, { title: '经过城市', dataIndex: 'PassCity' }, { title: '地接社名称', dataIndex: 'VendorName' }, { title: '导游', dataIndex: 'GuideName' }, { title: '好评', dataIndex: 'Good', sorter: (a, b) => a.Good - b.Good }, { title: '差评', dataIndex: 'Bad', sorter: (a, b) => a.Bad - b.Bad }, { title: '评论内容', dataIndex: 'ECI_Content' }, { title: '交易额', dataIndex: 'totalcost', sorter: (a, b) => a.totalcost - b.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', render: (text, record) => { if (record.EOI_ObjSN === -1) { return text; } else { return {text} } } }, { title: '团数', dataIndex: 'GroupCount', sorter: (a, b) => a.GroupCount - b.GroupCount }, { title: '人数', dataIndex: 'PersonNum', sorter: (a, b) => a.PersonNum - b.PersonNum }, { title: '团天数', dataIndex: 'GroupDays', sorter: (a, b) => a.GroupDays - b.GroupDays }, { title: '交易额', dataIndex: 'totalcost', sorter: (a, b) => a.totalcost - b.totalcost }, { title: '好评数', dataIndex: 'GoodCount', sorter: (a, b) => a.GoodCount - b.GoodCount }, { title: '好评率', dataIndex: 'GoodRate', sorter: (a, b) => parseInt(a.GoodRate) - parseInt(b.GoodRate) }, { title: '差评数', dataIndex: 'BadCount', sorter: (a, b) => a.BadCount - b.BadCount }, { title: '差评率', dataIndex: 'BadRate', sorter: (a, b) => parseInt(a.BadRate) - parseInt(b.BadRate) } ]; } export default CustomerServices;