/**
* 查看uu订单
*/
Vue.component('manager-dada-order', {
template: `
查询
导出
{{ sumData.order_count }}
{{ sumData.default_total }}
`,
props: {
'userType': {
type: Number,
default: 1,
},//1商户 2门店
},
data() {
return {
operate: {},
orderList: [],
count: 0,
searchForm: {
order_type: '',
order_id: '',
store_id: '',
status: '',
time: [],
page: 1,
limit: 10,
},
sumData: {
order_count: 0,
complete: 0,
cost_total: 0,
default_total: 0,
},
requestUrl: {
sumData: {
1: '/index.php/Retail/Delivery/getMerDeliveryTotal',
2: '/index.php/Retail/Delivery/getStoreDeliveryTotal',
},
dataList: {
1: '/index.php/Retail/Delivery/getMerDeliveryList',
2: '/index.php/Retail/Delivery/getStoreDeliveryList',
},
export: {
1: '/index.php/Retail/Delivery/merExport',
2: '/index.php/Retail/Delivery/storeExport',
}
}
};
},
methods: {
//获取统计数据
getSumData() {
this.sendRequest(this.requestUrl.sumData[this.userType], {
data: this.searchForm,
success: (res) => {
if (res.status == 1) {
this.sumData = {
order_count: res.data.order_count,
complete: res.data.complete,
cost_total: res.data.cost_total,
default_total: res.data.default_total,
};
} else {
this.$message.warning(res.message);
}
}
})
},
searchData() {
this.getSumData();
this.currentChange(1);
},
getOrderData() {
this.sendRequest(this.requestUrl.dataList[this.userType], {
data: this.searchForm,
success: (res) => {
if (res.status == 1) {
this.orderList = res.data.list;
this.count = res.data.count;
}
}
});
},
/**
* 分页
* @param int val 当前选择的页数
*/
currentChange(val) {
this.searchForm.page = val;
this.getOrderData();
},
/**
* 每页显示数量
* @param int val 数量
*/
sizeChange(val) {
this.searchForm.limit = val;
this.searchForm.page = 1;
this.getOrderData();
},
//导出
exportExcel() {
let order_id = this.searchForm.order_id;
let store_id = this.searchForm.store_id;
let status = this.searchForm.status;
let order_type = this.searchForm.order_type;
let time = this.searchForm.time;
if(!this.searchForm.time.length){
this.$confirm('不选择时间则默认导出当日记录', '确定导出数据吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
window.location.href = this.requestUrl.export[this.userType] + "?order_id=" + order_id + "&store_id=" + store_id + "&status=" + status + "&order_type=" + order_type + "&time=" + time;
}).catch(() => {
})
}else{
window.location.href = this.requestUrl.export[this.userType] + "?order_id=" + order_id + "&store_id=" + store_id + "&status=" + status + "&order_type=" + order_type + "&time=" + time;
}
},
},
created() {
this.getSumData();
this.getOrderData();
this.checkOperateAuth({
export: this.requestUrl.export[this.userType]
}, (data) => {
this.operate = data;
})
}
});