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.
199 lines
7.3 KiB
JavaScript
199 lines
7.3 KiB
JavaScript
import {makeAutoObservable, runInAction} from "mobx";
|
|
import * as config from "../config";
|
|
|
|
|
|
class DashboardStore {
|
|
|
|
constructor(rootStore) {
|
|
this.rootStore = rootStore;
|
|
makeAutoObservable(this);
|
|
}
|
|
|
|
loading = false;
|
|
site_select_mode = 'multiple';//是否多选站点
|
|
webcode = ['CHT', 'AH', 'GH'];
|
|
|
|
//订单统计 begin
|
|
orders_data = {
|
|
loading: false,
|
|
data: [],
|
|
getOrderCount_all: this.getOrderCount_all.bind(this),
|
|
}
|
|
|
|
getOrderCount_all() { //统计所有站点订单数量
|
|
this.orders_data.loading = true;
|
|
const date_picker_store = this.rootStore.date_picker_store;
|
|
let url = '/service-web/QueryData/GetOrderCount'
|
|
url += '?WebCode=all&COLI_ApplyDate1=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&COLI_ApplyDate2=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59';
|
|
|
|
fetch(config.HT_HOST + url)
|
|
.then((response) => response.json())
|
|
.then((json) => {
|
|
runInAction(() => {
|
|
this.orders_data.data = json.ordercount1;
|
|
this.orders_data.loading = false;
|
|
})
|
|
})
|
|
.catch((error) => {
|
|
this.orders_data.loading = false;
|
|
console.log('fetch data failed', error);
|
|
});
|
|
}
|
|
|
|
//订单统计 end
|
|
|
|
// 临时订单 begin
|
|
|
|
ordersTemp_data = {
|
|
data: [],
|
|
data_detail: [],
|
|
loading: false,
|
|
loading_detail: false,
|
|
show_table: false,
|
|
site_select_mode: 'multiple',
|
|
webcode: ['CHT', 'AH', 'GH'],
|
|
handleChange_webcode: this.handleChange_site_select.bind(this),
|
|
asyncFetch: this.get_CountOrdersData.bind(this),
|
|
asyncFetch_detail: this.get_CountOrdersData_detail.bind(this),
|
|
}
|
|
|
|
handleChange_site_select(value) {
|
|
this.ordersTemp_data.webcode = value;
|
|
}
|
|
|
|
get_CountOrdersData() {
|
|
this.ordersTemp_data.loading = true;
|
|
this.ordersTemp_data.show_table = false;
|
|
const date_picker_store = this.rootStore.date_picker_store;
|
|
let url = '/service-baseinfo/QueryWebData?type=orders_temp&db=1';
|
|
const website_code = "'" + this.ordersTemp_data.webcode.join("','") + "'";
|
|
url += '&WebSite=' + website_code + '&ApplyDateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&ApplyDateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59';
|
|
fetch(config.HT_HOST + url)
|
|
.then((response) => response.json())
|
|
.then((json) => {
|
|
runInAction(() => {
|
|
this.ordersTemp_data.data = json.data;
|
|
this.ordersTemp_data.loading = false;
|
|
})
|
|
})
|
|
.catch((error) => {
|
|
this.ordersTemp_data.loading = false;
|
|
console.log('fetch data failed', error);
|
|
});
|
|
}
|
|
|
|
get_CountOrdersData_detail() {
|
|
this.ordersTemp_data.loading_detail = true;
|
|
this.ordersTemp_data.show_table = true;
|
|
const date_picker_store = this.rootStore.date_picker_store;
|
|
let url = '/service-baseinfo/QueryWebData?type=orders_temp_detail&db=1';
|
|
const website_code = "'" + this.ordersTemp_data.webcode.join("','") + "'";
|
|
url += '&WebSite=' + website_code + '&ApplyDateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&ApplyDateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59';
|
|
fetch(config.HT_HOST + url)
|
|
.then((response) => response.json())
|
|
.then((json) => {
|
|
runInAction(() => {
|
|
this.ordersTemp_data.data_detail = json.data;
|
|
this.ordersTemp_data.loading_detail = false;
|
|
})
|
|
})
|
|
.catch((error) => {
|
|
this.ordersTemp_data.loading_detail = false;
|
|
console.log('fetch data failed', error);
|
|
});
|
|
}
|
|
|
|
// 临时订单 end
|
|
|
|
|
|
// 移动成交 beign
|
|
handleChange_webcode = (value) => {
|
|
this.webcode = value;
|
|
};
|
|
|
|
handleChange_group_select(value) {
|
|
this.mobile_data.groups = value;
|
|
};
|
|
|
|
onChange_datetype(e) {
|
|
this.mobile_data.date_type = e.target.value;
|
|
};
|
|
|
|
get_CountYDOrder() {
|
|
const date_picker_store = this.rootStore.date_picker_store;
|
|
this.mobile_data.loading = true;
|
|
let url = '/service-tourdesign/CountYDOrder?DEI_SNList=' + this.mobile_data.groups.toString();
|
|
if (this.mobile_data.date_type == 'applyDate') {
|
|
url += '&ApplydateCheck=1&OrderStartdateCheck=0';
|
|
} else {
|
|
url += '&ApplydateCheck=0&OrderStartdateCheck=1';
|
|
}
|
|
url += '&ApplydateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&ApplydateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59';
|
|
url += '&OrderStartdateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&OrderStartdateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59';
|
|
fetch(config.HT_HOST + url)
|
|
.then((response) => response.json())
|
|
.then((json) => {
|
|
let table_data = []
|
|
json && json.map((item, index) => {
|
|
table_data.push({
|
|
key: index,
|
|
department_name: item.DEI_DepartmentName,
|
|
mobile_order: item.YDOrderNum + '/' + item.OrderNum + ' (' + (item.OrderNumRate * 100).toFixed(1) + '%)',
|
|
mobile_deal: item.YDOrderNumSUC + ' / ' + item.OrderNumSUC + ' (' + (item.OrderNumSUCRate * 100).toFixed(1) + '%)',
|
|
mobile_gross: item.YDML + ' / ' + item.ML + ' (' + (item.MLRate * 100).toFixed(1) + '%)',
|
|
})
|
|
})
|
|
runInAction(() => {
|
|
this.mobile_data.data = table_data;
|
|
this.mobile_data.loading = false;
|
|
})
|
|
})
|
|
.catch((error) => {
|
|
this.mobile_data.loading = false;
|
|
console.log('fetch data failed', error);
|
|
});
|
|
};
|
|
|
|
mobile_data = {
|
|
loading: false,
|
|
data: [],
|
|
group_select_mode: 'multiple',//是否多选分组
|
|
groups: ['1', '2', '28', '7', '8', '9', '11', '12', '20', '21','18'],
|
|
columns: [
|
|
{
|
|
title: '市场',
|
|
dataIndex: 'department_name',
|
|
key: 'department_name',
|
|
},
|
|
{
|
|
title: '移动订单/总订单',
|
|
dataIndex: 'mobile_order',
|
|
key: 'mobile_order',
|
|
},
|
|
{
|
|
title: '移动成交/总成交',
|
|
dataIndex: 'mobile_deal',
|
|
key: 'mobile_deal',
|
|
},
|
|
{
|
|
title: '移动毛利/总毛利',
|
|
dataIndex: 'mobile_gross',
|
|
key: 'mobile_gross',
|
|
},
|
|
],
|
|
date_type: 'applyDate',
|
|
group_handleChange: this.handleChange_group_select.bind(this),
|
|
onChange_datetype: this.onChange_datetype.bind(this),
|
|
asyncFetch: this.get_CountYDOrder.bind(this),
|
|
}
|
|
// 移动成交 end
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
export default DashboardStore;
|
|
|