vue element 订单导出
this.exportOrderSubmit({
busId: this.bcId,//当前登录人所属的商家ID
efinishDate: efinishDate,//完成结束时间
eorderDate: eorderDate,//下单结束时间
sfinishDate: sfinishDate,//完成开始时间
sorderDate: sorderDate,//下单开始时间
goodsName: this.searchOrdersForm.goodsName,//商品名称
orderNo: this.searchOrdersForm.orderNo,//订单号
orderStatus: this.searchOrdersForm.orderStatus,//订单状态
receiveName: this.searchOrdersForm.receiveName,//收货人姓名
phone: this.searchOrdersForm.phone,//收货人电话
}).then(res => {
const blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
})
const url = window.URL.createObjectURL(blob)
const aLink = document.createElement('a')
aLink.style.display = 'none'
aLink.href = url
aLink.setAttribute('download','订单数据统计' + '.xlsx')
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink)
window.URL.revokeObjectURL(url)
})
请求的头部
exportOrderList({}, orderInfors) {
return new Promise((resolve, reject) => {
axios({
url: UrlUtil.getURL("exportOrderList"),
method: 'GET',
responseType: 'blob',
params: {
...orderInfors
}
}).then(res => {
resolve(res);
}).catch(err => {
reject(err)
})
});
},