加中奖名单
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listGroupsWin(params) {
|
||||
const res = await request.get('/sylive/groupsWin/', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function exportGroupsWin(params) {
|
||||
const res = await request.get('/sylive/groupsWin/export', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 中奖类型
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function getGroupsWinType(params) {
|
||||
const res = await request.get('/sylive/groupsWin/win_type', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -63,22 +63,21 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-link
|
||||
type="primary"
|
||||
:underline="false"
|
||||
icon="el-icon-shopping-cart-full"
|
||||
@click="openOrder(row.activityId, row.groups)"
|
||||
>
|
||||
订单
|
||||
</el-link>
|
||||
<el-link
|
||||
type="primary"
|
||||
:underline="false"
|
||||
icon="el-icon-_share"
|
||||
@click="openCode(row)"
|
||||
>
|
||||
链接
|
||||
</el-link>
|
||||
<el-dropdown @command="(command) => dropMore(command, row)">
|
||||
<el-link type="primary" :underline="false" icon="el-icon-_share">
|
||||
更多
|
||||
<i class="el-icon-arrow-down"></i>
|
||||
</el-link>
|
||||
<template v-slot:dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="order">订单列表</el-dropdown-item>
|
||||
<el-dropdown-item command="win" v-if="row.groups == 1">
|
||||
中奖名单
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="code">活动链接</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-dropdown @command="(command) => dropClick(command, row)">
|
||||
<el-link type="primary" :underline="false" icon="el-icon-edit">
|
||||
修改
|
||||
@@ -292,6 +291,24 @@
|
||||
}
|
||||
this.$router.replace(url);
|
||||
},
|
||||
/* 打开更多页 */
|
||||
dropMore(command, row) {
|
||||
let url = '';
|
||||
if (command === 'order') {
|
||||
if (row.groups == 1) {
|
||||
url = '/sylive/groups-order?id=' + row.activityId;
|
||||
} else {
|
||||
url = '/sylive/order?id=' + row.activityId;
|
||||
}
|
||||
this.$router.replace(url);
|
||||
} else if (command === 'win') {
|
||||
url = '/sylive/groups-win?id=' + row.activityId;
|
||||
this.$router.replace(url);
|
||||
} else if (command === 'code') {
|
||||
this.current = row;
|
||||
this.showCode = true;
|
||||
}
|
||||
},
|
||||
/* 查询机构 */
|
||||
organizationQuery() {
|
||||
listOrganizationParent({ parentId: 0 })
|
||||
@@ -313,21 +330,6 @@
|
||||
reload(where) {
|
||||
this.$refs.table.reload({ page: 1, where: where });
|
||||
},
|
||||
/* 打开二维码弹窗 */
|
||||
openCode(row) {
|
||||
this.current = row;
|
||||
this.showCode = true;
|
||||
},
|
||||
/* 打开活动订单页 */
|
||||
openOrder(activityId, groups) {
|
||||
let to = '';
|
||||
if (groups == 1) {
|
||||
to = '/sylive/groups-order?id=' + activityId;
|
||||
} else {
|
||||
to = '/sylive/order?id=' + activityId;
|
||||
}
|
||||
this.$router.replace(to);
|
||||
},
|
||||
/* 删除 */
|
||||
remove(row) {
|
||||
const loading = this.$loading({ lock: true });
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<el-form
|
||||
label-width="77px"
|
||||
class="ele-form-search"
|
||||
@keyup.enter.native="search"
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
|
||||
<el-form-item label="门店:">
|
||||
<ele-tree-select
|
||||
:data="groupsList"
|
||||
label-key="groupsName"
|
||||
value-key="groupsId"
|
||||
v-model="where.bizId"
|
||||
:clearable="true"
|
||||
placeholder="请选择"
|
||||
:disabled="false"
|
||||
:default-expand-all="false"
|
||||
:expand-on-click-node="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
|
||||
<el-form-item label="商品:">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="where.itemId"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in goodsList"
|
||||
:key="item.itemId"
|
||||
:value="item.itemId"
|
||||
:label="item.title"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
|
||||
<el-form-item label="姓名:">
|
||||
<el-input clearable v-model="where.uname" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
|
||||
<el-form-item label="手机号:">
|
||||
<el-input clearable v-model="where.mobile" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
|
||||
<el-form-item label="中奖类型:">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="where.winType"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in winTypeList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
:label="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
|
||||
<div class="ele-form-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
class="ele-btn-icon"
|
||||
@click="search"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button @click="reset">重置</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listGroups } from '@/api/sylive/groups';
|
||||
import { listGoods } from '@/api/sylive/goods';
|
||||
import { getGroupsWinType } from '@/api/sylive/groups-win';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
uname: '',
|
||||
mobile: '',
|
||||
winType: '',
|
||||
bizId: ''
|
||||
};
|
||||
return {
|
||||
activityId: null,
|
||||
// 门店数据
|
||||
groupsList: [],
|
||||
// 商品数据
|
||||
goodsList: [],
|
||||
winTypeList: [],
|
||||
// 表单数据
|
||||
where: { ...defaultWhere }
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.groupsWinTypeQuery();
|
||||
},
|
||||
methods: {
|
||||
/* 搜索 */
|
||||
search() {
|
||||
this.$emit('search', this.where);
|
||||
},
|
||||
/* 重置 */
|
||||
reset() {
|
||||
this.where = { ...this.defaultWhere };
|
||||
this.search();
|
||||
},
|
||||
/* 查询中奖类型 */
|
||||
groupsWinTypeQuery() {
|
||||
getGroupsWinType({ activityId: this.activityId })
|
||||
.then((list) => {
|
||||
this.winTypeList = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 查询分组 */
|
||||
groupsQuery() {
|
||||
listGroups({ activityId: this.activityId })
|
||||
.then((list) => {
|
||||
this.groupsList = this.$util.toTreeData({
|
||||
data: list,
|
||||
idField: 'groupsId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 查询商品 */
|
||||
goodsQuery() {
|
||||
listGoods({ activityId: this.activityId })
|
||||
.then((list) => {
|
||||
this.goodsList = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler(route) {
|
||||
const { path } = route;
|
||||
if (path !== '/sylive/groups-win') {
|
||||
return;
|
||||
}
|
||||
const activityId = this.$route.query.id;
|
||||
if (!activityId || activityId == this.activityId) {
|
||||
return;
|
||||
}
|
||||
this.activityId = activityId;
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.reload({ page: 1 });
|
||||
}
|
||||
this.groupsQuery();
|
||||
this.goodsQuery();
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<el-card shadow="never">
|
||||
<!-- 搜索表单 -->
|
||||
<gro-win-search @search="reload" />
|
||||
<!-- 数据表格 -->
|
||||
<ele-pro-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
cache-key="syliveWinTable"
|
||||
>
|
||||
<!-- 表头工具栏 -->
|
||||
<template v-slot:toolbar>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
icon="el-icon-dwinload"
|
||||
@click="exportData"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { setPageTabTitle } from '@/utils/page-tab-util';
|
||||
import GroWinSearch from './components/gro-win-search.vue';
|
||||
import { getActivity } from '@/api/sylive/activity';
|
||||
import { listGroupsWin, exportGroupsWin } from '@/api/sylive/groups-win';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
const ROUTE_PATH = '/sylive/groups-win';
|
||||
|
||||
export default {
|
||||
name: 'syliveGroupsWin',
|
||||
components: { GroWinSearch },
|
||||
data() {
|
||||
return {
|
||||
activityId: null,
|
||||
// 加载状态
|
||||
title: '中奖名单',
|
||||
loading: true,
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
prop: 'id',
|
||||
label: 'ID',
|
||||
minWidth: 45,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'uname',
|
||||
label: '姓名',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
},
|
||||
{
|
||||
prop: 'mobile',
|
||||
label: '手机号',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'itemTitle',
|
||||
label: '商品标题',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 130
|
||||
},
|
||||
{
|
||||
prop: 'totalPrice',
|
||||
label: '订单价格',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
},
|
||||
{
|
||||
prop: 'payTime',
|
||||
label: '付款时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 100,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'winTime',
|
||||
label: '中奖时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 100,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'winName',
|
||||
label: '中奖类型',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 90
|
||||
},
|
||||
{
|
||||
prop: 'consultant',
|
||||
label: '顾问',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
},
|
||||
{
|
||||
prop: 'levelName1',
|
||||
label: '战区',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'levelName2',
|
||||
label: '战队',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'stores',
|
||||
label: '门店',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
const activityId = this.activityId;
|
||||
return listGroupsWin({ ...where, ...order, page, limit, activityId });
|
||||
},
|
||||
query() {
|
||||
this.loading = true;
|
||||
getActivity(Number(this.activityId))
|
||||
.then((data) => {
|
||||
this.loading = false;
|
||||
// 修改页签标题
|
||||
if (this.$route.path === ROUTE_PATH) {
|
||||
this.title = data.title + '的中奖名单';
|
||||
setPageTabTitle(this.title);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 刷新表格 */
|
||||
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 }) => {
|
||||
const activityId = this.activityId;
|
||||
exportGroupsWin({ ...where, ...order, activityId })
|
||||
.then((data) => {
|
||||
loading.close();
|
||||
data.forEach((d) => {
|
||||
array.push([
|
||||
d.sid,
|
||||
d.uname,
|
||||
d.mobile,
|
||||
d.itemTitle,
|
||||
d.totalPrice,
|
||||
this.$util.toDateString(d.payTime),
|
||||
this.$util.toDateString(d.winTime),
|
||||
d.winName,
|
||||
d.consultant,
|
||||
d.levelName1,
|
||||
d.levelName2,
|
||||
d.stores,
|
||||
d.biz,
|
||||
d.address
|
||||
]);
|
||||
});
|
||||
writeFile(
|
||||
{
|
||||
SheetNames: ['Sheet1'],
|
||||
Sheets: {
|
||||
Sheet1: utils.aoa_to_sheet(array)
|
||||
}
|
||||
},
|
||||
this.title + '.xlsx'
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler(route) {
|
||||
const { path } = route;
|
||||
if (path !== ROUTE_PATH) {
|
||||
return;
|
||||
}
|
||||
const activityId = this.$route.query.id;
|
||||
if (!activityId || activityId == this.activityId) {
|
||||
return;
|
||||
}
|
||||
this.activityId = activityId;
|
||||
this.query();
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.reload({ page: 1 });
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user