This commit is contained in:
faiz 2024-05-16 16:39:28 +08:00
parent e34a8dd8da
commit a08a4f4fa4
3 changed files with 37 additions and 2 deletions

View File

@ -37,6 +37,12 @@ export function storeCategoryStatusApi(id, status) {
export function exportReplytApi(data) {
return request.get(`store/reply/export`, data)
}
/**
* @description 导出订单列表
*/
export function exportProductApi(data) {
return request.get(`store/product/export`, data)
}
/**
* @description 属性规则 -- 列表
*/

View File

@ -128,7 +128,7 @@
<el-button size="small">导入批量发货</el-button>
</el-upload>
<el-button size="small" @click="getDeliveryList">批量发货记录</el-button>
<el-button size="small" @click="downloadLogistics">导出全部物流公司</el-button>
<!-- <el-button size="small" @click="downloadLogistics">导出全部物流公司</el-button> -->
<!-- <el-button size="small" @click="batchSend">批量发送货</el-button> -->
</div>
<el-table v-loading="listLoading" :data="tableData.data" size="small" class="table mt20" highlight-current-row :cell-class-name="addTdClass">

View File

@ -133,6 +133,7 @@
<router-link :to="{ path:`${roterPre}` + '/product/list/addProduct' }" class="mr10">
<el-button size="small" type="primary">添加商品</el-button>
</router-link>
<el-button size="small" type="primary" @click="exports">导出列表</el-button>
<!-- <el-button size="small" type="success" @click="onCopy">商品采集</el-button> -->
<el-button size="small" :disabled="checkedIds.length == 0 && !allCheck" type="default" @click="openBatch">批量设置</el-button>
<el-button size="small" :disabled="tableFrom.type != 1 || checkedIds.length == 0 && !allCheck" @click="batchOff">批量下架</el-button>
@ -568,9 +569,11 @@ import {
productBathSvipApi,
associatedFormList,
associatedFormInfo,
batchSetProduct
batchSetProduct,
exportProductApi
} from '@/api/product'
import { roterPre } from '@/settings'
import createWorkBook from '@/utils/newToExcel.js'
import taoBao from './taoBao'
import editAttr from './editAttr'
import proDetail from './proDetails.vue'
@ -685,6 +688,32 @@ export default {
this.productCon()
},
methods: {
//
async exports() {
const excelData = JSON.parse(JSON.stringify(this.tableFrom)); let data = []
excelData.page = 1
excelData.ids = this.checkedIds.toString()
let pageCount = 1
let lebData = {}
for (let i = 0; i < pageCount; i++) {
lebData = await this.downOrderData(excelData)
pageCount = Math.ceil(lebData.count / excelData.limit)
if (lebData.export.length) {
data = data.concat(lebData.export)
excelData.page++
}
}
createWorkBook(lebData.header, lebData.title, data, lebData.foot, lebData.filename)
return
},
/** 订单 */
downOrderData(excelData) {
return new Promise((resolve, reject) => {
exportProductApi(excelData).then((res) => {
return resolve(res.data)
})
})
},
//
onchangeTime(e) {
this.timeVal = e