market_api_1010
This commit is contained in:
@@ -28,6 +28,20 @@ export async function pageOrder(params) {
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询活动订单
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function orderExport(params) {
|
||||
const res = await request.get('/sylive/activity/order_export', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询活动
|
||||
* @param id 活动id
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-col v-bind="styleResponsive ? { lg: 8, md: 16 } : { span: 8 }">
|
||||
<el-form-item label="姓名:">
|
||||
<el-input clearable v-model="where.uname" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-col v-bind="styleResponsive ? { lg: 8, md: 16 } : { span: 8 }">
|
||||
<el-form-item label="手机号:">
|
||||
<el-input clearable v-model="where.mobile" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-col v-bind="styleResponsive ? { lg: 8, md: 16 } : { span: 8 }">
|
||||
<el-form-item label="商品标题:">
|
||||
<el-input clearable v-model="where.item_title" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
@@ -35,7 +35,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
|
||||
<div class="ele-form-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
|
||||
@@ -11,6 +11,17 @@
|
||||
cache-key="syliveOrderTable"
|
||||
>
|
||||
<!-- 表头工具栏 -->
|
||||
<template v-slot:toolbar>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
icon="el-icon-download"
|
||||
@click="exportData"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</el-card>
|
||||
</div>
|
||||
@@ -19,7 +30,8 @@
|
||||
<script>
|
||||
import { setPageTabTitle } from '@/utils/page-tab-util';
|
||||
import OrderSearch from './components/order-search.vue';
|
||||
import { getActivity, pageOrder } from '@/api/sylive/activity';
|
||||
import { getActivity, pageOrder, orderExport } from '@/api/sylive/activity';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
const ROUTE_PATH = '/sylive/activity/order';
|
||||
|
||||
export default {
|
||||
@@ -129,6 +141,53 @@
|
||||
/* 刷新表格 */
|
||||
reload(where) {
|
||||
this.$refs.table.reload({ page: 1, where: where });
|
||||
},
|
||||
/* 导出数据 */
|
||||
exportData() {
|
||||
const array = [
|
||||
[
|
||||
'姓名',
|
||||
'手机号',
|
||||
'商品标题',
|
||||
'订单价格',
|
||||
'付款时间',
|
||||
'创建时间',
|
||||
'顾问',
|
||||
'状态'
|
||||
]
|
||||
];
|
||||
const loading = this.$loading({ lock: true });
|
||||
this.$refs.table.doRequest(({ where, order }) => {
|
||||
orderExport({ ...where, ...order })
|
||||
.then((data) => {
|
||||
loading.close();
|
||||
data.forEach((d) => {
|
||||
array.push([
|
||||
d.uname,
|
||||
d.mobile,
|
||||
d.item_title,
|
||||
d.total_price,
|
||||
this.$util.toDateString(d.pay_time),
|
||||
this.$util.toDateString(d.createTime),
|
||||
d.consultant,
|
||||
d.statusName
|
||||
]);
|
||||
});
|
||||
writeFile(
|
||||
{
|
||||
SheetNames: ['Sheet1'],
|
||||
Sheets: {
|
||||
Sheet1: utils.aoa_to_sheet(array)
|
||||
}
|
||||
},
|
||||
'活动订单.xlsx'
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
Reference in New Issue
Block a user