秒杀配置时间筛选,导出列表

This commit is contained in:
faiz 2024-11-26 15:34:18 +08:00
parent 4211dde102
commit 1d9a004673
1 changed files with 41 additions and 4 deletions

View File

@ -110,7 +110,7 @@
class="selWidth"
/>
</el-form-item>
<!-- <el-form-item label="时间选择:" prop="create_time">
<el-form-item label="时间选择:" prop="create_time">
<el-date-picker
v-model="timeVal"
value-format="yyyy/MM/dd HH:mm:ss"
@ -126,7 +126,7 @@
@change="onchangeTime"
clearable
/>
</el-form-item> -->
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="getList(1)"
>搜索</el-button
@ -165,6 +165,9 @@
@click="batchOff"
>批量强制下架</el-button
>
<el-button type="primary" size="small" @click="exports"
>导出列表</el-button
>
</div>
<el-table
class="mt20"
@ -700,6 +703,7 @@ import {
seckillProductOffApi,
getProductLabelApi,
updatetSeckillLabel,
exportSeckillApi,
} from "@/api/product";
import { seckillDetailApi } from "@/api/marketing";
import { roterPre } from "@/settings";
@ -707,6 +711,7 @@ import infoFrom from "./info";
import previewBox from "@/components/previewBox/index";
import ueditorFrom from "@/components/ueditorFrom";
import timeOptions from "@/utils/timeOptions";
import createWorkBook from "@/utils/newToExcel.js";
import editAttr from "./editAttr";
const defaultObj = {
product_id: "",
@ -865,10 +870,42 @@ export default {
/**重置 */
searchReset() {
this.timeVal = [];
this.tableFrom.date = "";
this.tableFrom.seckill_time = "";
this.$refs.searchForm.resetFields();
this.getList(1);
},
async exports() {
let excelData = JSON.parse(JSON.stringify(this.tableFrom)),
data = [];
excelData.page = 1;
excelData.limit = 200;
let pageCount = 1;
let lebData = {};
for (let i = 0; i < pageCount; i++) {
lebData = await this.downData(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;
},
/**订单列表 */
downData(excelData) {
return new Promise((resolve, reject) => {
exportSeckillApi(excelData).then((res) => {
return resolve(res.data);
});
});
},
//
onAuditFree(row) {
console.log(row);
@ -878,7 +915,7 @@ export default {
//
onchangeTime(e) {
this.timeVal = e;
this.tableFrom.date = e ? this.timeVal.join("-") : "";
this.tableFrom.seckill_time = e ? this.timeVal.join("-") : "";
this.getList(1);
},
subSuccess() {