修改活动分组用户
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listGroupsOrder(params) {
|
||||
const res = await request.get('/sylive/groupsOrder/', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function exportGroupsOrder(params) {
|
||||
const res = await request.get('/sylive/groupsOrder/export', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -1,19 +1,5 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 分页查询订单
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageOrder(params) {
|
||||
const res = await request.get('/sylive/order/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
* @param params 查询条件
|
||||
@@ -28,18 +14,6 @@ export async function listOrder(params) {
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询订单
|
||||
* @param id 订单id
|
||||
*/
|
||||
export async function getOrder(id) {
|
||||
const res = await request.get('/sylive/order/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单
|
||||
* @param params 查询条件
|
||||
|
||||
@@ -139,11 +139,11 @@ export async function importUsers(file) {
|
||||
* 检查用户是否存在
|
||||
* @param field 检查的字段
|
||||
* @param value 字段的值
|
||||
* @param id 修改时的id
|
||||
* @param organizationId 机构id
|
||||
*/
|
||||
export async function checkExistence(field, value, id) {
|
||||
export async function checkExistence(field, value, organizationId) {
|
||||
const res = await request.get('/sylive/user/existence', {
|
||||
params: { field, value, id }
|
||||
params: { field, value, organizationId }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
|
||||
@@ -43,7 +43,19 @@
|
||||
</template>
|
||||
<!-- 操作列 -->
|
||||
<template v-slot:action="{ row }">
|
||||
<el-dropdown @command="(command) => dropStatistics(command, row)">
|
||||
<el-link
|
||||
v-if="row.groups == 1"
|
||||
type="primary"
|
||||
:underline="false"
|
||||
icon="el-icon-data-analysis"
|
||||
@click="dropStatistics('gro', row)"
|
||||
>
|
||||
数据统计
|
||||
</el-link>
|
||||
<el-dropdown
|
||||
v-else
|
||||
@command="(command) => dropStatistics(command, row)"
|
||||
>
|
||||
<el-link
|
||||
type="primary"
|
||||
:underline="false"
|
||||
@@ -53,10 +65,7 @@
|
||||
<i class="el-icon-arrow-down"></i>
|
||||
</el-link>
|
||||
<template v-slot:dropdown>
|
||||
<el-dropdown-menu v-if="row.groups == 1">
|
||||
<el-dropdown-item command="gro">分组数据统计</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
<el-dropdown-menu v-else>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="org">机构数据统计</el-dropdown-item>
|
||||
<el-dropdown-item command="team">团队数据统计</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
@@ -66,7 +75,7 @@
|
||||
type="primary"
|
||||
:underline="false"
|
||||
icon="el-icon-shopping-cart-full"
|
||||
@click="openOrder(row.activityId)"
|
||||
@click="openOrder(row.activityId, row.groups)"
|
||||
>
|
||||
订单
|
||||
</el-link>
|
||||
@@ -302,8 +311,14 @@
|
||||
this.showCode = true;
|
||||
},
|
||||
/* 打开活动订单页 */
|
||||
openOrder(activityId) {
|
||||
this.$router.replace('/sylive/order?id=' + activityId);
|
||||
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) {
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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="姓名:">
|
||||
<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: 4, md: 8 } : { span: 4 }">
|
||||
<el-form-item label="订单类型:">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="where.type"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option label="权益" :value="0" />
|
||||
<el-option label="商品" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
|
||||
<el-form-item label="来源:">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="where.cfrom"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option label="门店" :value="0" />
|
||||
<el-option label="团队" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
|
||||
<el-form-item label="状态:">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="where.status"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option label="未支付" :value="0" />
|
||||
<el-option label="已支付" :value="1" />
|
||||
</el-select>
|
||||
</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 }"
|
||||
v-show="where.cfrom == '1' ? false : true"
|
||||
>
|
||||
<el-form-item label="门店:">
|
||||
<ele-tree-select
|
||||
:data="organizationList"
|
||||
label-key="organizationName"
|
||||
value-key="organizationId"
|
||||
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 }"
|
||||
v-show="where.cfrom == '0' ? false : true"
|
||||
>
|
||||
<el-form-item label="团队:">
|
||||
<ele-tree-select
|
||||
:data="teamList"
|
||||
label-key="teamName"
|
||||
value-key="teamId"
|
||||
v-model="where.teamId"
|
||||
: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: 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 { listOrganizations } from '@/api/sylive/organization';
|
||||
import { listTeams } from '@/api/sylive/team';
|
||||
import { listGoods } from '@/api/sylive/goods';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
status: 1,
|
||||
uname: '',
|
||||
mobile: '',
|
||||
type: '',
|
||||
cfrom: '',
|
||||
bizId: '',
|
||||
teamId: ''
|
||||
};
|
||||
return {
|
||||
// 门店数据
|
||||
organizationList: [],
|
||||
// 团队数据
|
||||
teamList: [],
|
||||
// 商品数据
|
||||
goodsList: [],
|
||||
// 表单数据
|
||||
where: { ...defaultWhere }
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.organizationQuery();
|
||||
this.teamQuery();
|
||||
this.goodsQuery();
|
||||
},
|
||||
methods: {
|
||||
/* 搜索 */
|
||||
search() {
|
||||
this.$emit('search', this.where);
|
||||
},
|
||||
/* 重置 */
|
||||
reset() {
|
||||
this.where = { ...this.defaultWhere };
|
||||
this.search();
|
||||
},
|
||||
/* 查询机构 */
|
||||
organizationQuery() {
|
||||
listOrganizations({ unOrganizationType: 4 })
|
||||
.then((list) => {
|
||||
this.organizationList = this.$util.toTreeData({
|
||||
data: list,
|
||||
idField: 'organizationId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 查询团队 */
|
||||
teamQuery() {
|
||||
listTeams({ unTeamType: 3 })
|
||||
.then((list) => {
|
||||
this.teamList = this.$util.toTreeData({
|
||||
data: list,
|
||||
idField: 'teamId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 查询商品 */
|
||||
goodsQuery() {
|
||||
const activityId = this.$route.query.id;
|
||||
listGoods({ activityId: activityId })
|
||||
.then((list) => {
|
||||
this.goodsList = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,252 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<el-card shadow="never">
|
||||
<!-- 搜索表单 -->
|
||||
<gro-order-search @search="reload" />
|
||||
<!-- 数据表格 -->
|
||||
<ele-pro-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { setPageTabTitle } from '@/utils/page-tab-util';
|
||||
import GroOrderSearch from './components/gro-order-search.vue';
|
||||
import { getActivity } from '@/api/sylive/activity';
|
||||
import {
|
||||
listGroupsOrder,
|
||||
exportGroupsOrder
|
||||
} from '@/api/sylive/groups-order';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
const ROUTE_PATH = '/sylive/groups-order';
|
||||
|
||||
export default {
|
||||
name: 'syliveGroupsOrder',
|
||||
components: { GroOrderSearch },
|
||||
data() {
|
||||
return {
|
||||
// 加载状态
|
||||
title: '权益订单',
|
||||
loading: true,
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
columnKey: 'index',
|
||||
type: 'index',
|
||||
width: 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: '订单价格',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 70
|
||||
},
|
||||
{
|
||||
prop: 'payTime',
|
||||
label: '付款时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 100,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 100,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'area',
|
||||
label: '区域',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'stores',
|
||||
label: '门店',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'consultant',
|
||||
label: '顾问',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
},
|
||||
{
|
||||
prop: 'typeName',
|
||||
label: '订单类型',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 70
|
||||
},
|
||||
{
|
||||
prop: 'cfromName',
|
||||
label: '来源',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 50
|
||||
},
|
||||
{
|
||||
prop: 'statusName',
|
||||
label: '状态',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
const activityId = this.$route.query.id;
|
||||
return listGroupsOrder({ ...where, ...order, page, limit, activityId });
|
||||
},
|
||||
query() {
|
||||
const activityId = this.$route.query.id;
|
||||
if (!activityId) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
getActivity(Number(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.$route.query.id;
|
||||
exportGroupsOrder({ ...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.createTime),
|
||||
d.area,
|
||||
d.stores,
|
||||
d.consultant,
|
||||
d.typeName,
|
||||
d.cfromName,
|
||||
d.statusName,
|
||||
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;
|
||||
}
|
||||
this.query();
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.reload({ page: 1 });
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -31,7 +31,7 @@
|
||||
import { setPageTabTitle } from '@/utils/page-tab-util';
|
||||
import OrderSearch from './components/order-search.vue';
|
||||
import { getActivity } from '@/api/sylive/activity';
|
||||
import { pageOrder, exportOrder } from '@/api/sylive/order';
|
||||
import { listOrder, exportOrder } from '@/api/sylive/order';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
const ROUTE_PATH = '/sylive/order';
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
const activityId = this.$route.query.id;
|
||||
return pageOrder({ ...where, ...order, page, limit, activityId });
|
||||
return listOrder({ ...where, ...order, page, limit, activityId });
|
||||
},
|
||||
query() {
|
||||
const activityId = this.$route.query.id;
|
||||
@@ -154,7 +154,7 @@
|
||||
this.loading = false;
|
||||
// 修改页签标题
|
||||
if (this.$route.path === ROUTE_PATH) {
|
||||
this.title = data.title + '-订单';
|
||||
this.title = data.title + '的订单';
|
||||
setPageTabTitle(this.title);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
validator: (_rule, value, callback) => {
|
||||
if (this.data) {
|
||||
return callback();
|
||||
}
|
||||
if (!value) {
|
||||
return callback(new Error('请输入手机号'));
|
||||
}
|
||||
@@ -91,7 +94,7 @@
|
||||
if (!st.test(value)) {
|
||||
return callback(new Error('手机号格式不正确'));
|
||||
}
|
||||
checkExistence('mobile', value, this.data?.mobile)
|
||||
checkExistence('mobile', value, this.form.organizationId)
|
||||
.then(() => {
|
||||
callback(new Error('手机号已经存在'));
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user