|
|
|
import {makeAutoObservable} from "mobx"
|
|
|
|
import * as config from "../config";
|
|
|
|
import moment from "moment";
|
|
|
|
|
|
|
|
|
|
|
|
class OrdersStore {
|
|
|
|
|
|
|
|
constructor(rootStore) {
|
|
|
|
this.rootStore = rootStore;
|
|
|
|
makeAutoObservable(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
webcode = 'CHT';
|
|
|
|
orderCountData = [];//订单统计数据源
|
|
|
|
orderCountData_Form=[];//表单类型统计数据源
|
|
|
|
loading = false;
|
|
|
|
|
|
|
|
handleChange_webcode = (value) => {
|
|
|
|
this.webcode = value;
|
|
|
|
};
|
|
|
|
|
|
|
|
//网站订单数量
|
|
|
|
getOrderCount() {
|
|
|
|
this.loading = true;
|
|
|
|
const date_picker_store = this.rootStore.date_picker_store;
|
|
|
|
|
|
|
|
let url = '/service-web/QueryData/GetOrderCount'//?WebCode=cht&COLI_ApplyDate1=2022-08-01&COLI_ApplyDate2=2022-08-31&COLI_ApplyDateold1=2021-08-01&COLI_ApplyDateold2=2021-08-31';
|
|
|
|
url += '?WebCode=' + this.webcode + '&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';
|
|
|
|
if (date_picker_store.start_date_cp && date_picker_store.end_date_cp) {
|
|
|
|
url += '&COLI_ApplyDateold1=' + date_picker_store.start_date_cp.format(config.DATE_FORMAT) + '&COLI_ApplyDateold2=' + date_picker_store.end_date_cp.format(config.DATE_FORMAT) + '%2023:59:59';
|
|
|
|
}
|
|
|
|
fetch(config.HT_HOST + url)
|
|
|
|
.then((response) => response.json())
|
|
|
|
.then((json) => {
|
|
|
|
this.orderCountData = json.ordercount;
|
|
|
|
this.loading = false;
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
this.loading = false;
|
|
|
|
console.log('fetch data failed', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//网站订单类型
|
|
|
|
getOrderCountByType(order_type) {
|
|
|
|
this.loading = true;
|
|
|
|
const date_picker_store = this.rootStore.date_picker_store;
|
|
|
|
|
|
|
|
let url = '/service-web/QueryData/GetOrderCountByType'
|
|
|
|
url += '?WebCode=' + this.webcode + '&OrderType=' + order_type;
|
|
|
|
url += '&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';
|
|
|
|
if (date_picker_store.start_date_cp && date_picker_store.end_date_cp) {
|
|
|
|
url += '&COLI_ApplyDateold1=' + date_picker_store.start_date_cp.format(config.DATE_FORMAT) + '&COLI_ApplyDateold2=' + date_picker_store.end_date_cp.format(config.DATE_FORMAT) + '%2023:59:59';
|
|
|
|
}
|
|
|
|
fetch(config.HT_HOST + url)
|
|
|
|
.then((response) => response.json())
|
|
|
|
.then((json) => {
|
|
|
|
this.orderCountData_Form = json.ordercount;
|
|
|
|
this.loading = false;
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
this.loading = false;
|
|
|
|
console.log('fetch data failed', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default OrdersStore;
|