|
|
|
@ -7,24 +7,25 @@ import moment from 'moment';
|
|
|
|
|
|
|
|
|
|
const fetchHotelData = async (param) => {
|
|
|
|
|
const defaultParam = {
|
|
|
|
|
DEI_SN:'',
|
|
|
|
|
City:'',
|
|
|
|
|
OrderState:'',
|
|
|
|
|
BookingType:'-1',
|
|
|
|
|
RecommendedLevel:'-1',
|
|
|
|
|
Star:'-1',
|
|
|
|
|
ArriveDateCheck:'0',
|
|
|
|
|
ArriveDateStart:'',
|
|
|
|
|
ArriveDateEnd:'',
|
|
|
|
|
ConfirmDateCheck:'0',
|
|
|
|
|
ConfirmDateStart:'',
|
|
|
|
|
ConfirmDateEnd:'',
|
|
|
|
|
Compare:'0',
|
|
|
|
|
CompareDateStart:'',
|
|
|
|
|
CompareDateEnd:'',
|
|
|
|
|
DEI_SN: '',
|
|
|
|
|
City: '',
|
|
|
|
|
OrderState: '',
|
|
|
|
|
BookingType: '-1',
|
|
|
|
|
RecommendedLevel: '-1',
|
|
|
|
|
Star: '-1',
|
|
|
|
|
ArriveDateCheck: '0',
|
|
|
|
|
ArriveDateStart: '',
|
|
|
|
|
ArriveDateEnd: '',
|
|
|
|
|
ConfirmDateCheck: '0',
|
|
|
|
|
ConfirmDateStart: '',
|
|
|
|
|
ConfirmDateEnd: '',
|
|
|
|
|
Compare: '0',
|
|
|
|
|
CompareDateStart: '',
|
|
|
|
|
CompareDateEnd: '',
|
|
|
|
|
Area: '-1',
|
|
|
|
|
};
|
|
|
|
|
const json = await fetchJSON('/service-Analyse2/HotelReservation', { ...defaultParam, ...param });
|
|
|
|
|
return json.errcode === 0 ? json.result : [];
|
|
|
|
|
return json.errcode === 0 ? json.result || [] : [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const fetchCruiseData = async (param) => {
|
|
|
|
@ -47,21 +48,27 @@ const fetchCruiseData = async (param) => {
|
|
|
|
|
Country: '-1',
|
|
|
|
|
};
|
|
|
|
|
const json = await fetchJSON('/service-Analyse2/CruiseReservation', { ...defaultParam, ...param });
|
|
|
|
|
return json.errcode === 0 ? json.result : [];
|
|
|
|
|
return json.errcode === 0 ? json.result || [] : [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const keyMapped = {
|
|
|
|
|
'applyDate': { key: '' },
|
|
|
|
|
'startDate': { key: 'ArriveDateCheck'},
|
|
|
|
|
'comfirmDate': { key: 'ConfirmDateCheck'},
|
|
|
|
|
const paramKeyMapped = {
|
|
|
|
|
'DateType': [
|
|
|
|
|
{ key: 'ArriveDateCheck', transform: (val) => (val === 'startDate' ? '1' : '0') },
|
|
|
|
|
{ key: 'ConfirmDateCheck', transform: (val) => (val === 'confirmDate' ? '1' : '0') },
|
|
|
|
|
// { key: 'ApplyDateCheck', transform: (val) => (val === 'applyDate' ? '1' : '0') },
|
|
|
|
|
],
|
|
|
|
|
'DepartmentList': { key: 'DEI_SN' },
|
|
|
|
|
'orderStatus': { key: 'OrderState' },
|
|
|
|
|
'Date1': { key: 'ArriveDateStart' },
|
|
|
|
|
'Date2': { key: 'ArriveDateEnd' },
|
|
|
|
|
'Date1': [{ key: 'ArriveDateStart' }, { key: 'ConfirmDateStart' }],
|
|
|
|
|
'Date2': [{ key: 'ArriveDateEnd' }, { key: 'ConfirmDateEnd' }],
|
|
|
|
|
'DateDiff1': { key: 'CompareDateStart' },
|
|
|
|
|
'DateDiff2': { key: 'CompareDateEnd' },
|
|
|
|
|
'keyword': { key: 'ProductName' },
|
|
|
|
|
'cruiseDirection': { key: 'Direction' },
|
|
|
|
|
'hotelStar': { key: 'Star' },
|
|
|
|
|
'hotelRecommandRate': { key: 'RecommendedLevel' },
|
|
|
|
|
'hotelBookType': { key: 'BookingType' },
|
|
|
|
|
'countryArea': { key: 'Area', transform: (val) => (val === 'china' ? '1' : val === 'foreign' ? '0' : '-1') },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class HotelCruise {
|
|
|
|
@ -73,16 +80,7 @@ class HotelCruise {
|
|
|
|
|
async getCruiseData(param = {}) {
|
|
|
|
|
this.cruise.loading = true;
|
|
|
|
|
this.cruise.dataSource = [];
|
|
|
|
|
const _queryParam = objectMapper(param, {
|
|
|
|
|
'DepartmentList': { key: 'DEI_SN' },
|
|
|
|
|
'orderStatus': { key: 'OrderState' },
|
|
|
|
|
'Date1': { key: 'ArriveDateStart' },
|
|
|
|
|
'Date2': { key: 'ArriveDateEnd' },
|
|
|
|
|
'DateDiff1': { key: 'CompareDateStart' },
|
|
|
|
|
'DateDiff2': { key: 'CompareDateEnd' },
|
|
|
|
|
'keyword': { key: 'ProductName' },
|
|
|
|
|
'cruiseDirection': { key: 'Direction' },
|
|
|
|
|
});
|
|
|
|
|
const _queryParam = objectMapper(param, paramKeyMapped);
|
|
|
|
|
const queryParam = omit({ ...this.searchValuesToSub, ..._queryParam }, ['DepartmentList', 'orderStatus', 'keyword', 'Date1', 'Date2', 'DateDiff1', 'DateDiff2', 'cruiseDirection']);
|
|
|
|
|
queryParam.Compare = isEmpty(param.DateDiff1) ? '' : '1';
|
|
|
|
|
const res = await fetchCruiseData(queryParam);
|
|
|
|
@ -104,16 +102,34 @@ class HotelCruise {
|
|
|
|
|
async getHotelData(param = {}) {
|
|
|
|
|
this.hotel.loading = true;
|
|
|
|
|
this.hotel.dataSource = [];
|
|
|
|
|
const res = await fetchHotelData({ ...this.searchValuesToSub, ...param });
|
|
|
|
|
const _queryParam = objectMapper(param, paramKeyMapped);
|
|
|
|
|
const queryParam = omit({ ...this.searchValuesToSub, ..._queryParam }, [
|
|
|
|
|
'DepartmentList','orderStatus','keyword','Date1','Date2','DateDiff1','DateDiff2','DateType',
|
|
|
|
|
'hotelStar','hotelRecommandRate','hotelBookType','countryArea',
|
|
|
|
|
]);
|
|
|
|
|
queryParam.Compare = isEmpty(param.DateDiff1) ? '0' : '1';
|
|
|
|
|
const _res = await fetchHotelData(queryParam);
|
|
|
|
|
const res = (_res || []).map((ele) => ({ ...ele, RecommendRate_100: fixTo2Decimals(ele.RecommendRate * 100) + '%' }));
|
|
|
|
|
const resCP =
|
|
|
|
|
queryParam.Compare === '0'
|
|
|
|
|
? res
|
|
|
|
|
: (res || []).map((ele) => ({
|
|
|
|
|
...ele,
|
|
|
|
|
TotalNumPercent: ele.CPTotalNum ? fixTo2Decimals(((ele.TotalNum - ele.CPTotalNum) / ele.CPTotalNum) * 100) : '-',
|
|
|
|
|
RecomendNumPercent: ele.CPRecomendNum ? fixTo2Decimals(((ele.RecomendNum - ele.CPRecomendNum) / ele.CPRecomendNum) * 100) : '-',
|
|
|
|
|
RecommendRateDelta: fixTo2Decimals((ele.RecommendRate - (ele.CPRecommendRate || 0)) * 100),
|
|
|
|
|
CPRecommendRate_100: fixTo2Decimals(ele.CPRecommendRate * 100) + '%',
|
|
|
|
|
}));
|
|
|
|
|
console.log(resCP);
|
|
|
|
|
runInAction(() => {
|
|
|
|
|
this.hotel.loading = false;
|
|
|
|
|
this.hotel.dataSource = [].concat(this.hotel.dataSource, res);
|
|
|
|
|
this.hotel.dataSource = resCP;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchValues = {
|
|
|
|
|
date: moment(),
|
|
|
|
|
DateType: { key: 'applyDate', label: '提交日期' },
|
|
|
|
|
DateType: { key: 'confirmDate', label: '确认日期' },
|
|
|
|
|
WebCode: { key: '', label: '所有来源' },
|
|
|
|
|
// IncludeTickets: { key: '1', label: '含门票'},
|
|
|
|
|
DepartmentList: [{ key: '', label: '所有小组' }],
|
|
|
|
|