You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
956 lines
37 KiB
JavaScript
956 lines
37 KiB
JavaScript
import {makeAutoObservable, runInAction} from "mobx";
|
|
import moment from "moment";
|
|
import { NavLink } from "react-router-dom";
|
|
import * as config from "../config";
|
|
import * as req from '../utils/request';
|
|
import { groupBy, prepareUrl, isEmpty, show_vs_tag, formatPercent, percentToDecimal } from '../utils/commons';
|
|
|
|
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 = 'departureDate';
|
|
this.inProgress = false;
|
|
this.selectedAgent = '';
|
|
this.selectedTeam = '';
|
|
this.selectedCountry = '';
|
|
this.selectedOrderStatus = '-1';
|
|
makeAutoObservable(this);
|
|
}
|
|
|
|
fetchAllAgent() {
|
|
this.inProgress = true;
|
|
req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetVEIName')
|
|
.then(json => {
|
|
if (json.errcode === 0) {
|
|
runInAction(() => {
|
|
this.agentList = json.result1;
|
|
});
|
|
}
|
|
})
|
|
.then(() => {
|
|
this.inProgress = false;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @deprecated 已迁移到zustand
|
|
*/
|
|
fetchAgentGroupCount() {
|
|
this.inProgress = true;
|
|
const fetchUrl = prepareUrl(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfoALL')
|
|
.append('DateType', this.dateType)
|
|
.append('Date1', this.startDateString)
|
|
.append('Date2', this.endDateString)
|
|
.append('OldDate1', this.startDateDiffString)
|
|
.append('OldDate2', this.endDateDiffString)
|
|
.append('VEI_SN', this.selectedAgent)
|
|
.append('DepList', this.selectedTeam)
|
|
.append('Country', this.selectedCountry)
|
|
.build();
|
|
req.fetchJSON(fetchUrl)
|
|
.then(json => {
|
|
if (json.errcode === 0) {
|
|
runInAction(() => {
|
|
if (isEmpty(json.result2)){
|
|
const splitTotalList = groupBy(json.result1, row => row.EOI_ObjSN === -1 ? '0' : '1');
|
|
this.agentGroupList = splitTotalList['1'];
|
|
const total1 = splitTotalList['0']?.[0] || {}; // json.total1;
|
|
this.agentGroupListColumns = [
|
|
{
|
|
title: '地接社名称',
|
|
dataIndex: 'VendorName',
|
|
fixed: 'left',
|
|
children: [{
|
|
// title: this.startDate.format(config.DATE_FORMAT) + '~' + this.endDate.format(config.DATE_FORMAT),
|
|
dataIndex: 'VendorName',
|
|
fixed: 'left',
|
|
render: (text, record) => <NavLink to={`/agent/${record.EOI_ObjSN}/group/list`}>{record.VendorName}</NavLink>
|
|
}
|
|
]
|
|
},
|
|
{
|
|
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: 'qianqin',
|
|
sorter: (a, b) => a.qianqin - b.qianqin,
|
|
children: [{
|
|
title: total1.qianqin,
|
|
dataIndex: 'qianqin'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
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'
|
|
}
|
|
]
|
|
}
|
|
];
|
|
|
|
}
|
|
else{
|
|
const splitTotalList1 = groupBy(json.result1, row => row.EOI_ObjSN === -1 ? '0' : '1');
|
|
const splitTotalList2 = groupBy(json.result2, row => row.EOI_ObjSN === -1 ? '0' : '1');
|
|
const result = [];
|
|
for (const item1 of splitTotalList1['1']) {
|
|
for (const item2 of splitTotalList2['1']) {
|
|
if (item1.EOI_ObjSN === item2.EOI_ObjSN) {
|
|
const goodRate1 = percentToDecimal(item1.GoodRate);
|
|
const goodRate2 = percentToDecimal(item2.GoodRate);
|
|
const badRate1 = percentToDecimal(item1.BadRate);
|
|
const badRate2 = percentToDecimal(item2.BadRate);
|
|
result.push({
|
|
EOI_ObjSN: item1.EOI_ObjSN,
|
|
VendorName: item1.VendorName,
|
|
GroupCount: show_vs_tag(formatPercent((item1.GroupCount-item2.GroupCount)/(item2.GroupCount===0?1:item2.GroupCount)),
|
|
item1.GroupCount-item2.GroupCount,item1.GroupCount,item2.GroupCount),
|
|
PersonNum: show_vs_tag(formatPercent((item1.PersonNum-item2.PersonNum)/(item2.PersonNum===0?1:item2.PersonNum)),
|
|
item1.PersonNum-item2.PersonNum,item1.PersonNum,item2.PersonNum),
|
|
GroupDays: show_vs_tag(formatPercent((item1.GroupDays-item2.GroupDays)/(item2.GroupDays===0?1:item2.GroupDays)),
|
|
item1.GroupDays-item2.GroupDays,item1.GroupDays,item2.GroupDays),
|
|
totalcost: show_vs_tag(formatPercent((item1.totalcost-item2.totalcost)/(item2.totalcost===0?1:item2.totalcost)),
|
|
(item1.totalcost-item2.totalcost).toFixed(2),item1.totalcost,item2.totalcost),
|
|
GoodCount: show_vs_tag(formatPercent((item1.GoodCount-item2.GoodCount)/(item2.GoodCount===0?1:item2.GoodCount)),
|
|
item1.GoodCount-item2.GoodCount,item1.GoodCount,item2.GoodCount),
|
|
GoodRate: show_vs_tag(formatPercent((goodRate1-goodRate2)/(goodRate2===0?1:goodRate2)),
|
|
formatPercent(goodRate1-goodRate2),item1.GoodRate,item2.GoodRate),
|
|
BadCount: show_vs_tag(formatPercent((item1.BadCount-item2.BadCount)/(item2.BadCount===0?1:item2.BadCount)),
|
|
item1.BadCount-item2.BadCount,item1.BadCount,item2.BadCount),
|
|
BadRate: show_vs_tag(formatPercent((badRate1-badRate2)/(badRate2===0?1:badRate2)),
|
|
formatPercent(badRate1-badRate2),item1.BadRate,item2.BadRate),
|
|
qianqin: show_vs_tag(formatPercent((item1.qianqin-item2.qianqin)/(item2.qianqin===0?1:item2.qianqin)),
|
|
(item1.qianqin-item2.qianqin).toFixed(2),item1.qianqin,item2.qianqin),
|
|
key:item1.key,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
this.agentGroupList = result;
|
|
const total1 = splitTotalList1['0']?.[0] || {};
|
|
const total2 = splitTotalList2['0']?.[0] || {};
|
|
this.agentGroupListColumns = [
|
|
{
|
|
title: '地接社名称',
|
|
dataIndex: 'VendorName',
|
|
fixed: 'left',
|
|
children: [{
|
|
// title: this.startDate.format(config.DATE_FORMAT) + '~' + this.endDate.format(config.DATE_FORMAT),
|
|
dataIndex: 'VendorName',
|
|
fixed: 'left',
|
|
render: (text, record) => <NavLink to={`/agent/${record.EOI_ObjSN}/group/list`}>{record.VendorName}</NavLink>
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '团数',
|
|
dataIndex: 'GroupCount',
|
|
sorter: (a, b) => a.GroupCount - b.GroupCount,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.GroupCount-total2.GroupCount)/total2.GroupCount),total1.GroupCount-total2.GroupCount,total1.GroupCount,total2.GroupCount),
|
|
titleX: [total1.GroupCount, total2.GroupCount].join(' vs '),
|
|
dataIndex: 'GroupCount'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '人数',
|
|
dataIndex: 'PersonNum',
|
|
sorter: (a, b) => a.PersonNum - b.PersonNum,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.PersonNum-total2.PersonNum)/total2.PersonNum),total1.PersonNum-total2.PersonNum,total1.PersonNum,total2.PersonNum),
|
|
titleX: [total1.PersonNum, total2.PersonNum].join(' vs '),
|
|
dataIndex: 'PersonNum'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '团天数',
|
|
dataIndex: 'GroupDays',
|
|
sorter: (a, b) => a.GroupDays - b.GroupDays,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.GroupDays-total2.GroupDays)/total2.GroupDays),total1.GroupDays-total2.GroupDays,total1.GroupDays,total2.GroupDays),
|
|
titleX: [total1.GroupDays, total2.GroupDays].join(' vs '),
|
|
dataIndex: 'GroupDays'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '交易额',
|
|
dataIndex: 'totalcost',
|
|
sorter: (a, b) => a.totalcost - b.totalcost,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.totalcost-total2.totalcost)/total2.totalcost),(total1.totalcost-total2.totalcost).toFixed(2),total1.totalcost,total2.totalcost),
|
|
titleX: [total1.totalcost, total2.totalcost].join(' vs '),
|
|
dataIndex: 'totalcost'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '前勤分',
|
|
dataIndex: 'qianqin',
|
|
sorter: (a, b) => a.qianqin - b.qianqin,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.qianqin-total2.qianqin)/total2.qianqin),(total1.qianqin-total2.qianqin).toFixed(2),total1.qianqin,total2.qianqin),
|
|
titleX: [total1.qianqin, total2.qianqin].join(' vs '),
|
|
dataIndex: 'qianqin'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '好评数',
|
|
dataIndex: 'GoodCount',
|
|
sorter: (a, b) => a.GoodCount - b.GoodCount,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.GoodCount-total2.GoodCount)/total2.GoodCount),total1.GoodCount-total2.GoodCount,total1.GoodCount,total2.GoodCount),
|
|
titleX: [total1.GoodCount, total2.GoodCount].join(' vs '),
|
|
dataIndex: 'GoodCount'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '好评率',
|
|
dataIndex: 'GoodRate',
|
|
sorter: (a, b) => parseInt(a.GoodRate) - parseInt(b.GoodRate),
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((percentToDecimal(total1.GoodRate)-percentToDecimal(total2.GoodRate))/percentToDecimal(total2.GoodRate)),
|
|
formatPercent(percentToDecimal(total1.GoodRate)-percentToDecimal(total2.GoodRate)),total1.GoodRate,total2.GoodRate),
|
|
titleX: [total1.GoodRate, total2.GoodRate].join(' vs '),
|
|
dataIndex: 'GoodRate'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '差评数',
|
|
dataIndex: 'BadCount',
|
|
sorter: (a, b) => a.BadCount - b.BadCount,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.BadCount-total2.BadCount)/total2.BadCount),total1.BadCount-total2.BadCount,total1.BadCount,total2.BadCount),
|
|
titleX: [total1.BadCount, total2.BadCount].join(' vs '),
|
|
dataIndex: 'BadCount'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '差评率',
|
|
dataIndex: 'BadRate',
|
|
sorter: (a, b) => parseInt(a.BadRate) - parseInt(b.BadRate),
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((percentToDecimal(total1.BadRate)-percentToDecimal(total2.BadRate))/percentToDecimal(total2.GoodRate)),
|
|
formatPercent(percentToDecimal(total1.BadRate)-percentToDecimal(total2.BadRate)),total1.BadRate,total2.BadRate),
|
|
titleX: [total1.BadRate, total2.BadRate].join(' vs '),
|
|
dataIndex: 'BadRate'
|
|
}
|
|
]
|
|
}
|
|
];
|
|
}
|
|
});
|
|
}
|
|
})
|
|
.then(() => {
|
|
this.inProgress = false;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @deprecated 已迁移到zustand
|
|
*/
|
|
fetchGroupListByAgentId(agentId) {
|
|
this.inProgress = true;
|
|
this.agentCompany = '...';
|
|
this.groupList = [];
|
|
this.groupListColumns = [];
|
|
const fetchUrl = prepareUrl(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfo')
|
|
.append('VEI_SN', agentId)
|
|
.append('DateType', this.dateType)
|
|
.append('Date1', this.startDateString)
|
|
.append('Date2', this.endDateString)
|
|
.append('OldDate1', this.startDateString)
|
|
.append('OldDate2', this.endDateString)
|
|
.append('DepList', this.selectedTeam)
|
|
.build();
|
|
req.fetchJSON(fetchUrl)
|
|
.then(json => {
|
|
if (json.errcode === 0) {
|
|
runInAction(() => {
|
|
this.groupList = json.result1;
|
|
if (json.result1.length > 0) {
|
|
this.agentCompany = json.result1[0].VendorName;
|
|
}
|
|
const total1 = json.total1;
|
|
this.groupListColumns = [
|
|
{
|
|
title: '团名',
|
|
dataIndex: 'GRI_Name',
|
|
children: [{
|
|
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: 'totalcost',
|
|
sorter: (a, b) => a.totalcost - b.totalcost,
|
|
children: [{
|
|
title: total1.totalcost,
|
|
dataIndex: 'totalcost'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '导游',
|
|
dataIndex: 'GuideName',
|
|
children: [{
|
|
title: '-',
|
|
dataIndex: 'GuideName'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '前勤分',
|
|
dataIndex: 'qianqin',
|
|
children: [{
|
|
title: total1.qianqin,
|
|
dataIndex: 'qianqin'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
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'
|
|
}
|
|
]
|
|
}
|
|
];
|
|
});
|
|
}
|
|
})
|
|
.then(() => {
|
|
this.inProgress = false;
|
|
});
|
|
}
|
|
|
|
fetchDistGroupInfoByCountry(destinationId) {
|
|
this.nationality_count_data.loading = true;
|
|
const fetchUrl = prepareUrl(config.HT_HOST + '/service-web/QueryData/GetDistGroupInfoALLByCountry')
|
|
.append('city', destinationId)
|
|
.append('DateType', this.dateType)
|
|
.append('Date1', this.startDateString)
|
|
.append('Date2', this.endDateString)
|
|
.append('OldDate1', this.startDateString)
|
|
.append('OldDate2', this.endDateString)
|
|
.append('DepList', this.selectedTeam)
|
|
.append('Country', this.selectedCountry)
|
|
.append('OrderStatus', this.selectedOrderStatus)
|
|
.build();
|
|
req.fetchJSON(fetchUrl)
|
|
.then((json) => {
|
|
if (json.errcode === 0) {
|
|
runInAction(() => {
|
|
const splitTotalList = groupBy(json.result1, row => row.COLD_ServiceCity === -1 ? '0' : '1');
|
|
this.nationality_count_data.destinationGroupByCountryList = splitTotalList['1'];
|
|
const total1 = splitTotalList['0']?.[0] || {};
|
|
this.nationality_count_data.destinationGroupByCountryListColumns =[
|
|
{
|
|
title: '国籍',
|
|
dataIndex: 'COLD_ServiceCityName',
|
|
children: [{
|
|
title: total1.COLD_ServiceCityName,
|
|
dataIndex: 'COLD_ServiceCityName'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
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: 'TotalPrice',
|
|
sorter: (a, b) => a.TotalPrice - b.TotalPrice,
|
|
children: [{
|
|
title: total1.TotalPrice,
|
|
dataIndex: 'TotalPrice'
|
|
}
|
|
]
|
|
}
|
|
];
|
|
});
|
|
}
|
|
})
|
|
.then(() => {
|
|
this.nationality_count_data.loading = false;
|
|
});
|
|
}
|
|
|
|
fetchDestinationGroupCount() {
|
|
this.inProgress = true;
|
|
const fetchUrl = prepareUrl(config.HT_HOST + '/service-web/QueryData/GetdistGroupInfoAll')
|
|
.append('DateType', this.dateType)
|
|
.append('Date1', this.startDateString)
|
|
.append('Date2', this.endDateString)
|
|
.append('OldDate1', this.startDateDiffString)
|
|
.append('OldDate2', this.endDateDiffString)
|
|
.append('DepList', this.selectedTeam)
|
|
.append('Country', this.selectedCountry)
|
|
.append('OrderStatus', this.selectedOrderStatus)
|
|
.build();
|
|
req.fetchJSON(fetchUrl)
|
|
.then(json => {
|
|
if (json.errcode === 0) {
|
|
runInAction(() => {
|
|
if (isEmpty(json.result2)){
|
|
const splitTotalList = groupBy(json.result1, row => row.COLD_ServiceCity === -1 ? '0' : '1');
|
|
this.agentGroupList = splitTotalList['1'];
|
|
const total1 = splitTotalList['0']?.[0] || {}; // json.total1;
|
|
this.destinationGroupCount = splitTotalList['1'];
|
|
this.destinationGroupCountColumns = [
|
|
{
|
|
title: '城市',
|
|
dataIndex: 'COLD_ServiceCityName',
|
|
fixed: 'left',
|
|
children: [{
|
|
dataIndex: 'COLD_ServiceCityName',
|
|
fixed: 'left',
|
|
render: (text, record) => <NavLink to={`/destination/${record.COLD_ServiceCity}/group/list`}>{record.COLD_ServiceCityName}</NavLink>
|
|
}
|
|
]
|
|
},
|
|
{
|
|
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: 'TotalPrice',
|
|
sorter: (a, b) => a.TotalPrice - b.TotalPrice,
|
|
children: [{
|
|
title: total1.TotalPrice,
|
|
dataIndex: 'TotalPrice'
|
|
}
|
|
]
|
|
}
|
|
];
|
|
}
|
|
else{
|
|
const splitTotalList1 = groupBy(json.result1, row => row.COLD_ServiceCity === -1 ? '0' : '1');
|
|
const splitTotalList2 = groupBy(json.result2, row => row.COLD_ServiceCity === -1 ? '0' : '1');
|
|
const result = [];
|
|
for (const item1 of splitTotalList1['1']) {
|
|
for (const item2 of splitTotalList2['1']) {
|
|
if (item1.COLD_ServiceCity === item2.COLD_ServiceCity) {
|
|
result.push({
|
|
COLD_ServiceCity: item1.COLD_ServiceCity,
|
|
COLD_ServiceCityName: item1.COLD_ServiceCityName,
|
|
GroupCount: show_vs_tag(formatPercent((item1.GroupCount-item2.GroupCount)/(item2.GroupCount===0?1:item2.GroupCount)),
|
|
item1.GroupCount-item2.GroupCount,item1.GroupCount,item2.GroupCount),
|
|
PersonNum: show_vs_tag(formatPercent((item1.PersonNum-item2.PersonNum)/(item2.PersonNum===0?1:item2.PersonNum)),
|
|
item1.PersonNum-item2.PersonNum,item1.PersonNum,item2.PersonNum),
|
|
GroupDays: show_vs_tag(formatPercent((item1.GroupDays-item2.GroupDays)/(item2.GroupDays===0?1:item2.GroupDays)),
|
|
item1.GroupDays-item2.GroupDays,item1.GroupDays,item2.GroupDays),
|
|
TotalCost: show_vs_tag(formatPercent((item1.TotalCost-item2.TotalCost)/(item2.TotalCost===0?1:item2.TotalCost)),
|
|
(item1.TotalCost-item2.TotalCost).toFixed(2),item1.TotalCost,item2.TotalCost),
|
|
TotalPrice: show_vs_tag(formatPercent((item1.TotalPrice-item2.TotalPrice)/(item2.TotalPrice===0?1:item2.TotalPrice)),
|
|
item1.TotalPrice-item2.TotalPrice,item1.TotalPrice,item2.TotalPrice),
|
|
key:item1.key,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
this.destinationGroupCount = result;
|
|
const total1 = splitTotalList1['0']?.[0] || {};
|
|
const total2 = splitTotalList2['0']?.[0] || {};
|
|
this.destinationGroupCountColumns = [
|
|
{
|
|
title: '城市',
|
|
dataIndex: 'COLD_ServiceCityName',
|
|
fixed: 'left',
|
|
children: [{
|
|
dataIndex: 'COLD_ServiceCityName',
|
|
fixed: 'left',
|
|
render: (text, record) => <NavLink to={`/destination/${record.COLD_ServiceCity}/group/list`}>{record.COLD_ServiceCityName}</NavLink>
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '团数',
|
|
dataIndex: 'GroupCount',
|
|
sorter: (a, b) => a.GroupCount - b.GroupCount,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.GroupCount-total2.GroupCount)/total2.GroupCount),total1.GroupCount-total2.GroupCount,total1.GroupCount,total2.GroupCount),
|
|
dataIndex: 'GroupCount'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '人数',
|
|
dataIndex: 'PersonNum',
|
|
sorter: (a, b) => a.PersonNum - b.PersonNum,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.PersonNum-total2.PersonNum)/total2.PersonNum),total1.PersonNum-total2.PersonNum,total1.PersonNum,total2.PersonNum),
|
|
dataIndex: 'PersonNum'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '团天数',
|
|
dataIndex: 'GroupDays',
|
|
sorter: (a, b) => a.GroupDays - b.GroupDays,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.GroupDays-total2.GroupDays)/total2.GroupDays),total1.GroupDays-total2.GroupDays,total1.GroupDays,total2.GroupDays),
|
|
dataIndex: 'GroupDays'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '交易额',
|
|
dataIndex: 'TotalCost',
|
|
sorter: (a, b) => a.TotalCost - b.TotalCost,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.TotalCost-total2.TotalCost)/total2.TotalCost),
|
|
(total1.TotalCost-total2.TotalCost).toFixed(2),total1.TotalCost,total2.TotalCost),
|
|
dataIndex: 'TotalCost'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '报价',
|
|
dataIndex: 'TotalPrice',
|
|
sorter: (a, b) => a.TotalPrice - b.TotalPrice,
|
|
children: [{
|
|
title: show_vs_tag(formatPercent((total1.TotalPrice-total2.TotalPrice)/total2.TotalPrice),
|
|
(total1.TotalPrice-total2.TotalPrice).toFixed(2),total1.TotalPrice,total2.TotalPrice),
|
|
dataIndex: 'TotalPrice'
|
|
}
|
|
]
|
|
}
|
|
];
|
|
}
|
|
});
|
|
}
|
|
})
|
|
.then(() => {
|
|
this.inProgress = false;
|
|
});
|
|
}
|
|
|
|
fetchGroupListByDestinationId(destinationId) {
|
|
this.inProgress = true;
|
|
this.destinationName = '...';
|
|
const fetchUrl = prepareUrl(config.HT_HOST + '/service-web/QueryData/GetdistGroupInfo')
|
|
.append('city', destinationId)
|
|
.append('DateType', this.dateType)
|
|
.append('Date1', this.startDateString)
|
|
.append('Date2', this.endDateString)
|
|
.append('OldDate1', this.startDateString)
|
|
.append('OldDate2', this.endDateString)
|
|
.append('DepList', this.selectedTeam)
|
|
.append('Country', this.selectedCountry)
|
|
.append('OrderStatus', this.selectedOrderStatus)
|
|
.build();
|
|
req.fetchJSON(fetchUrl)
|
|
.then(json => {
|
|
if (json.errcode === 0) {
|
|
runInAction(() => {
|
|
this.destinationGroupList = json.result1;
|
|
if (json.result1.length > 0) {
|
|
// this.destinationName = json.result1[0].VendorName;
|
|
}
|
|
const total1 = json.total1;
|
|
this.destinationGroupListColumns = [
|
|
{
|
|
title: '团名',
|
|
dataIndex: 'GRI_Name',
|
|
children: [{
|
|
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: 'COLD_TotalCost',
|
|
sorter: (a, b) => a.COLD_TotalCost - b.COLD_TotalCost,
|
|
children: [{
|
|
title: total1.COLD_TotalCost,
|
|
dataIndex: 'COLD_TotalCost'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '确认日期',
|
|
dataIndex: 'COLI_ConfirmDate',
|
|
children: [{
|
|
title: '-',
|
|
dataIndex: 'COLI_ConfirmDate'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: '出发日期',
|
|
dataIndex: 'COLI_OrderStartDate',
|
|
children: [{
|
|
title: '-',
|
|
dataIndex: 'COLI_OrderStartDate'
|
|
}
|
|
]
|
|
}
|
|
];
|
|
});
|
|
}
|
|
})
|
|
.then(() => {
|
|
this.inProgress = false;
|
|
});
|
|
}
|
|
|
|
searchValues = {
|
|
DateType: { key: 'departureDate', label: '抵达日期'},
|
|
// departureDateType: { key: 'departureDate', label: '抵达日期'},
|
|
};
|
|
|
|
setSearchValues(obj, values) {
|
|
this.dateType = obj.DateType;
|
|
this.selectedAgent = obj.agency;
|
|
this.startDateString = obj.Date1;
|
|
this.endDateString = obj.Date2;
|
|
this.startDateDiffString = obj.DateDiff1;
|
|
this.endDateDiffString = obj.DateDiff2;
|
|
this.selectedCountry = obj.countryArea;
|
|
this.selectedTeam = (obj.DepartmentList || '').replace('ALL', '');
|
|
this.selectedOrderStatus = obj.orderStatus;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
selectTeam(team) {
|
|
this.selectedTeam = team;
|
|
}
|
|
|
|
selectCountry(country) {
|
|
this.selectedCountry = country;
|
|
}
|
|
|
|
selectStatus(status) {
|
|
this.selectedOrderStatus = status;
|
|
}
|
|
|
|
startDate;
|
|
endDate;
|
|
startDateString;
|
|
endDateString;
|
|
dateType;
|
|
selectedAgent;
|
|
selectedTeam;
|
|
selectedCountry;
|
|
selectedOrderStatus;
|
|
inProgress;
|
|
|
|
agentList = [];
|
|
|
|
groupList = [];
|
|
|
|
groupListColumns = [];
|
|
|
|
destinationGroupCount = [];
|
|
destinationGroupCountColumns =[];
|
|
|
|
destinationGroupList = [];
|
|
destinationGroupListColumns = [];
|
|
// 国籍统计
|
|
nationality_count_data = {
|
|
loading: false,
|
|
destinationGroupByCountryList:[],
|
|
destinationGroupByCountryListColumns:[]
|
|
};
|
|
|
|
agentGroupList = [{
|
|
EOI_ObjSN: 1,
|
|
VendorName: '---',
|
|
GroupCount: 0,
|
|
PersonNum: 0,
|
|
GroupDays: 0,
|
|
totalcost: 0,
|
|
GoodCount: 0,
|
|
GoodRate: '-',
|
|
BadCount: 0,
|
|
BadRate: '-',
|
|
key: 1
|
|
}];
|
|
|
|
agentGroupListColumns = [
|
|
{
|
|
title: '地接社名称',
|
|
dataIndex: 'VendorName',
|
|
fixed: 'left',
|
|
render: (text, record) => {
|
|
if (record.EOI_ObjSN === -1) {
|
|
return text;
|
|
} else {
|
|
return <a>{text}</a>;
|
|
}
|
|
}
|
|
},
|
|
{
|
|
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;
|