Browse Source

订单和发票信息的导出功能

master
453530270@qq.com 3 years ago
parent
commit
cf198627e4
  1. 16
      src/api/index.js
  2. 4
      src/components/page/afterService/invoice.vue
  3. 6
      src/components/page/order/index.vue

16
src/api/index.js

@ -131,7 +131,21 @@ export const rankingSort = query => {
// 导出订单xls
export const xlsdc =query => {
return request({
url: '/admin/order.Order/export',
url: '/admin/order.Otrder/export',
method: 'post',
data: query,
//
responseType:'blob',
//请求头
headers:{
"Content-Type":"application/json;charset=UTF-8;"
}
});
};
// 导出发票信息xls
export const fpxlsdc =query => {
return request({
url: '/admin/order.InvoiceManagement2/export',
method: 'post',
data: query,
//

4
src/components/page/afterService/invoice.vue

@ -113,7 +113,7 @@
</template>
<script>
import Operation from '../../Operation.vue'
import {InvoiceManagementList,downloadInvoice} from '../../../api/index'
import {InvoiceManagementList,downloadInvoice,fpxlsdc} from '../../../api/index'
export default {
data() {
return{
@ -237,7 +237,7 @@ export default {
},
// xls
xlsdc(){
xlsdc(this.query).then(res=>{
fpxlsdc(this.query).then(res=>{
const fname = new Date().getTime()+".xlsx"
let bloburl = window.URL.createObjectURL(new Blob([res]))
const a = document.createElement('a')

6
src/components/page/order/index.vue

@ -263,17 +263,17 @@ export default {
// xls
xlsdc(){
xlsdc(this.query).then(res=>{
console.log(res)
const fname = new Date().getTime()+".xlsx"
// let bloburl = window.URL.createObjectURL(res)
let bloburl = window.URL.createObjectURL(new Blob([res]))
// let bloburl = 'data:text/csv;charset=utf-8,' + encodeURIComponent(res)
const a = document.createElement('a')
a.download = fname
a.href = bloburl
// add click
a.click()
window.URL.revokeObjectURL(bloburl)
console.log(a)
// console.log(a)
})
.catch(err=>{
console.error(err)

Loading…
Cancel
Save