加普通商品
This commit is contained in:
@@ -14,34 +14,6 @@ export async function pageActivity(params) {
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询活动订单
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageOrder(params) {
|
||||
const res = await request.get('/sylive/activity/order', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
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
|
||||
|
||||
@@ -65,13 +65,13 @@ export async function updateGoods(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改活动状态
|
||||
* @param userId 活动id
|
||||
* 修改商品状态
|
||||
* @param itemId 商品id
|
||||
* @param status 状态
|
||||
*/
|
||||
export async function updateGoodsStatus(id, status) {
|
||||
export async function updateGoodsStatus(itemId, status) {
|
||||
const res = await request.put('/sylive/goods/status', {
|
||||
id,
|
||||
itemId,
|
||||
status
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
|
||||
@@ -41,13 +41,15 @@ export async function getOrder(id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
* @param data 订单信息
|
||||
* 导出订单
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function updateOrder(data) {
|
||||
const res = await request.put('/sylive/order', data);
|
||||
export async function exportOrder(params) {
|
||||
const res = await request.get('/sylive/order/export', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="true"
|
||||
custom-class="ele-dialog-form"
|
||||
title="编辑商品"
|
||||
title="编辑权益商品"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
|
||||
|
||||
@@ -83,12 +83,11 @@
|
||||
<template v-slot:dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="activity">修改活动</el-dropdown-item>
|
||||
<el-dropdown-item command="item">修改商品</el-dropdown-item>
|
||||
<el-dropdown-item command="item">修改权益商品</el-dropdown-item>
|
||||
<!--
|
||||
<el-dropdown-item command="coupon">修改券</el-dropdown-item>
|
||||
<el-dropdown-item command="goods">
|
||||
修改周边好物
|
||||
</el-dropdown-item>-->
|
||||
-->
|
||||
<el-dropdown-item command="goods">修改商品</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -261,7 +260,7 @@
|
||||
this.current = row.coupon;
|
||||
this.showEditCoupon = true;
|
||||
} else if (command === 'goods') {
|
||||
this.$router.replace('/sylive/activity/goods?id=' + row.activityId);
|
||||
this.$router.replace('/sylive/goods?id=' + row.activityId);
|
||||
}
|
||||
},
|
||||
/* 打开数据统计页 */
|
||||
@@ -328,7 +327,7 @@
|
||||
},
|
||||
/* 打开活动订单页 */
|
||||
openOrder(activityId) {
|
||||
this.$router.replace('/sylive/activity/order?id=' + activityId);
|
||||
this.$router.replace('/sylive/order?id=' + activityId);
|
||||
},
|
||||
/* 删除 */
|
||||
remove(row) {
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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.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: 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>
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
status: 1,
|
||||
uname: '',
|
||||
mobile: '',
|
||||
cfrom: ''
|
||||
};
|
||||
return {
|
||||
// 表单数据
|
||||
where: { ...defaultWhere }
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 搜索 */
|
||||
search() {
|
||||
this.$emit('search', this.where);
|
||||
},
|
||||
/* 重置 */
|
||||
reset() {
|
||||
this.where = { ...this.defaultWhere };
|
||||
this.search();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,238 +0,0 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<el-card shadow="never">
|
||||
<!-- 搜索表单 -->
|
||||
<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 OrderSearch from './components/order-search.vue';
|
||||
import { getActivity, pageOrder, orderExport } from '@/api/sylive/activity';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
const ROUTE_PATH = '/sylive/activity/order';
|
||||
|
||||
export default {
|
||||
name: 'syliveActivityOrder',
|
||||
components: { OrderSearch },
|
||||
data() {
|
||||
return {
|
||||
// 加载状态
|
||||
title: '权益订单',
|
||||
loading: true,
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
columnKey: 'index',
|
||||
type: 'index',
|
||||
width: 45,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'uname',
|
||||
label: '姓名',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'mobile',
|
||||
label: '手机号',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'itemTitle',
|
||||
label: '商品标题',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
prop: 'totalPrice',
|
||||
label: '订单价格',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 70
|
||||
},
|
||||
{
|
||||
prop: 'payTime',
|
||||
label: '付款时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
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: 'cfromName',
|
||||
label: '来源',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
},
|
||||
{
|
||||
prop: 'statusName',
|
||||
label: '状态',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
const activityId = this.$route.query.id;
|
||||
return pageOrder({ ...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;
|
||||
orderExport({ ...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.cfromName,
|
||||
d.statusName
|
||||
]);
|
||||
});
|
||||
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>
|
||||
+3
-2
@@ -100,7 +100,7 @@
|
||||
},
|
||||
data() {
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
itemId: null,
|
||||
activityId: null,
|
||||
title: '',
|
||||
price: '',
|
||||
@@ -241,12 +241,13 @@
|
||||
this.editversion = false;
|
||||
if (visible) {
|
||||
this.editversion = true;
|
||||
if (this.data.id) {
|
||||
if (this.data.itemId) {
|
||||
this.$util.assignObject(this.form, {
|
||||
...this.data
|
||||
});
|
||||
this.isUpdate = true;
|
||||
} else {
|
||||
this.form.banner = [];
|
||||
this.form.activityId = this.data.activityId;
|
||||
this.isUpdate = false;
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { lg: 8, md: 16 } : { span: 8 }">
|
||||
<el-form-item label="商品标题:">
|
||||
<el-input clearable v-model="where.uname" placeholder="请输入" />
|
||||
<el-input clearable v-model="where.title" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
|
||||
@@ -8,6 +8,7 @@
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:selection.sync="selection"
|
||||
cache-key="syliveActivityGoodsTable"
|
||||
>
|
||||
<!-- 表头工具栏 -->
|
||||
@@ -31,6 +32,37 @@
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 状态列 -->
|
||||
<template v-slot:status="{ row }">
|
||||
<el-switch
|
||||
:active-value="0"
|
||||
:inactive-value="1"
|
||||
v-model="row.status"
|
||||
@change="editStatus(row)"
|
||||
/>
|
||||
</template>
|
||||
<!-- 操作列 -->
|
||||
<template v-slot:action="{ row }">
|
||||
<el-link
|
||||
type="primary"
|
||||
:underline="false"
|
||||
icon="el-icon-edit"
|
||||
@click="openEdit(row)"
|
||||
>
|
||||
修改
|
||||
</el-link>
|
||||
<el-popconfirm
|
||||
class="ele-action"
|
||||
title="确定要删除此用户吗?"
|
||||
@confirm="remove(row)"
|
||||
>
|
||||
<template v-slot:reference>
|
||||
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
||||
删除
|
||||
</el-link>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</el-card>
|
||||
<!-- 编辑弹窗 -->
|
||||
@@ -49,16 +81,18 @@
|
||||
removeGoodss,
|
||||
updateGoodsStatus
|
||||
} from '@/api/sylive/goods';
|
||||
const ROUTE_PATH = '/sylive/activity/goods';
|
||||
const ROUTE_PATH = '/sylive/goods';
|
||||
|
||||
export default {
|
||||
name: 'syliveActivityGoods',
|
||||
name: 'syliveGoods',
|
||||
components: { GoodsSearch, GoodsEdit },
|
||||
data() {
|
||||
return {
|
||||
// 加载状态
|
||||
title: '周边好物',
|
||||
loading: true,
|
||||
// 表格选中数据
|
||||
selection: [],
|
||||
// 当前编辑数据
|
||||
current: null,
|
||||
// 是否显示编辑弹窗
|
||||
@@ -66,6 +100,13 @@
|
||||
activityId: null,
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
columnKey: 'selection',
|
||||
type: 'selection',
|
||||
width: 45,
|
||||
align: 'center',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
columnKey: 'index',
|
||||
type: 'index',
|
||||
@@ -75,75 +116,67 @@
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'uname',
|
||||
label: '姓名',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'mobile',
|
||||
label: '手机号',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'item_title',
|
||||
label: '商品标题',
|
||||
prop: 'title',
|
||||
label: '标题',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
prop: 'total_price',
|
||||
label: '订单价格',
|
||||
prop: 'stock',
|
||||
label: '库存',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 70
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'pay_time',
|
||||
label: '付款时间',
|
||||
prop: 'price',
|
||||
label: '价格',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'sort',
|
||||
label: '排序',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'timeStart',
|
||||
label: '抢购开始时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
minWidth: 120,
|
||||
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: 'statusName',
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
align: 'center',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 60
|
||||
width: 90,
|
||||
resizable: false,
|
||||
slot: 'status',
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
columnKey: 'action',
|
||||
label: '操作',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
resizable: false,
|
||||
slot: 'action'
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -165,7 +198,7 @@
|
||||
this.loading = false;
|
||||
// 修改页签标题
|
||||
if (this.$route.path === ROUTE_PATH) {
|
||||
this.title = data.title + '-周边好物';
|
||||
this.title = data.title + '-商品';
|
||||
setPageTabTitle(this.title);
|
||||
}
|
||||
})
|
||||
@@ -181,9 +214,10 @@
|
||||
/* 显示编辑 */
|
||||
openEdit(item) {
|
||||
if (!item) {
|
||||
item.activityId = this.activityId;
|
||||
this.current = { activityId: this.activityId };
|
||||
} else {
|
||||
this.current = item;
|
||||
}
|
||||
this.current = item;
|
||||
this.showEdit = true;
|
||||
},
|
||||
/* 删除 */
|
||||
@@ -206,7 +240,7 @@
|
||||
this.$message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
this.$confirm('确定要删除选中的活动吗?', '提示', {
|
||||
this.$confirm('确定要删除选中的商品吗?', '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
@@ -227,7 +261,7 @@
|
||||
/* 更改状态 */
|
||||
editStatus(row) {
|
||||
const loading = this.$loading({ lock: true });
|
||||
updateGoodsStatus(row.activityId, row.status)
|
||||
updateGoodsStatus(row.itemId, row.status)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
@@ -7,27 +7,43 @@
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-form-item label="订单号:">
|
||||
<el-input clearable v-model="where.sid" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
|
||||
<el-form-item label="姓名:">
|
||||
<el-input clearable v-model="where.name" placeholder="请输入" />
|
||||
<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: 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: 6, md: 12 } : { span: 6 }">
|
||||
<el-form-item label="商品标题:">
|
||||
<el-input clearable v-model="where.item_title" placeholder="请输入" />
|
||||
<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: 6, md: 12 } : { span: 6 }">
|
||||
<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
|
||||
@@ -40,7 +56,43 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<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"
|
||||
@@ -58,17 +110,26 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrganizations } from '@/api/sylive/organization';
|
||||
import { listTeams } from '@/api/sylive/team';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
status: 1,
|
||||
name: '',
|
||||
uname: '',
|
||||
mobile: '',
|
||||
sid: '',
|
||||
item_title: ''
|
||||
type: '',
|
||||
cfrom: '',
|
||||
bizId: '',
|
||||
teamId: ''
|
||||
};
|
||||
return {
|
||||
// 门店数据
|
||||
organizationList: [],
|
||||
// 团队数据
|
||||
teamList: [],
|
||||
// 表单数据
|
||||
where: { ...defaultWhere }
|
||||
};
|
||||
@@ -79,6 +140,10 @@
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.organizationQuery();
|
||||
this.teamQuery();
|
||||
},
|
||||
methods: {
|
||||
/* 搜索 */
|
||||
search() {
|
||||
@@ -88,6 +153,34 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,14 +11,29 @@
|
||||
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 OrderSearch from './components/order-search.vue';
|
||||
import { pageOrder } from '@/api/sylive/order';
|
||||
import { getActivity } from '@/api/sylive/activity';
|
||||
import { pageOrder, exportOrder } from '@/api/sylive/order';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
const ROUTE_PATH = '/sylive/order';
|
||||
|
||||
export default {
|
||||
name: 'syliveOrder',
|
||||
@@ -26,6 +41,7 @@
|
||||
data() {
|
||||
return {
|
||||
// 加载状态
|
||||
title: '权益订单',
|
||||
loading: true,
|
||||
// 表格列配置
|
||||
columns: [
|
||||
@@ -38,16 +54,10 @@
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'sid',
|
||||
label: '订单号',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 140
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
prop: 'uname',
|
||||
label: '姓名',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
minWidth: 60
|
||||
},
|
||||
{
|
||||
prop: 'mobile',
|
||||
@@ -56,25 +66,24 @@
|
||||
minWidth: 80
|
||||
},
|
||||
{
|
||||
prop: 'item_title',
|
||||
prop: 'itemTitle',
|
||||
label: '商品标题',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 150
|
||||
minWidth: 130
|
||||
},
|
||||
{
|
||||
prop: 'total_price',
|
||||
prop: 'totalPrice',
|
||||
label: '订单价格',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80
|
||||
minWidth: 70
|
||||
},
|
||||
{
|
||||
prop: 'pay_time',
|
||||
prop: 'payTime',
|
||||
label: '付款时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 120,
|
||||
minWidth: 100,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
@@ -84,17 +93,46 @@
|
||||
label: '创建时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 120,
|
||||
minWidth: 100,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'statusName',
|
||||
label: '状态',
|
||||
sortable: 'custom',
|
||||
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
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -102,11 +140,105 @@
|
||||
methods: {
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
return pageOrder({ ...where, ...order, page, limit });
|
||||
const activityId = this.$route.query.id;
|
||||
return pageOrder({ ...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;
|
||||
exportOrder({ ...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
|
||||
]);
|
||||
});
|
||||
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
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user