卡券初始化
This commit is contained in:
parent
06ba2f1733
commit
faf02f7943
44
src/api/bst/vip.js
Normal file
44
src/api/bst/vip.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询卡券列表
|
||||
export function listVip(query) {
|
||||
return request({
|
||||
url: '/bst/vip/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询卡券详细
|
||||
export function getVip(id) {
|
||||
return request({
|
||||
url: '/bst/vip/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增卡券
|
||||
export function addVip(data) {
|
||||
return request({
|
||||
url: '/bst/vip',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改卡券
|
||||
export function updateVip(data) {
|
||||
return request({
|
||||
url: '/bst/vip',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除卡券
|
||||
export function delVip(id) {
|
||||
return request({
|
||||
url: '/bst/vip/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -44,6 +44,8 @@ import DictData from '@/components/DictData';
|
|||
import filter from '@/utils/filter';
|
||||
// 行内表单组件
|
||||
import FormCol from '@/components/FormCol';
|
||||
// 字典标签组件
|
||||
import { dictLabel } from '@/utils';
|
||||
|
||||
filter(Vue);
|
||||
|
||||
|
@ -61,6 +63,7 @@ Vue.prototype.checkPermi = checkPermi
|
|||
Vue.prototype.checkRole = checkRole
|
||||
Vue.prototype.isSysAdmin = isSysAdmin
|
||||
Vue.prototype.isAgent = isAgent
|
||||
Vue.prototype.dictLabel = dictLabel
|
||||
|
||||
// 全局组件挂载
|
||||
Vue.component('DictTag', DictTag)
|
||||
|
|
|
@ -403,3 +403,42 @@ export const OrderRefundType = {
|
|||
RIDE: "2", // 骑行费
|
||||
}
|
||||
|
||||
// 卡券类型
|
||||
export const VipType = {
|
||||
BALANCE: "1", // 储值卡
|
||||
DEDUCT: "2", // 抵扣卡
|
||||
DISCOUNT: "3", // 折扣卡
|
||||
|
||||
// 获取单位
|
||||
getUnit(type) {
|
||||
if (type === this.BALANCE) {
|
||||
return '元';
|
||||
} else if (type === this.DEDUCT) {
|
||||
return '元';
|
||||
} else if (type === this.DISCOUNT) {
|
||||
return '折';
|
||||
}
|
||||
},
|
||||
// 获取标签
|
||||
getLabel(type) {
|
||||
if (type === this.BALANCE) {
|
||||
return '储值金额';
|
||||
} else if (type === this.DEDUCT) {
|
||||
return '抵扣金额';
|
||||
} else if (type === this.DISCOUNT) {
|
||||
return '折扣';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 卡券状态
|
||||
export const VipStatus = {
|
||||
ON_SALE: "1", // 上架
|
||||
OFF_SALE: "2", // 下架
|
||||
}
|
||||
|
||||
// 卡券限制频率单位
|
||||
export const VipLimitUnit = {
|
||||
DAY: "1", // 天
|
||||
}
|
||||
|
||||
|
|
260
src/views/bst/vip/components/VipEditDialog.vue
Normal file
260
src/views/bst/vip/components/VipEditDialog.vue
Normal file
|
@ -0,0 +1,260 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="dialogVisible"
|
||||
width="800px"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
@open="handleOpen"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" v-loading="loading">
|
||||
<el-row>
|
||||
<form-col :span="span" label="卡券名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入会员卡名称" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="运营区" prop="areaId">
|
||||
<area-remote-select v-model="form.areaId" placeholder="请选择运营区" style="width: 100%;" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="排序" prop="sort">
|
||||
<el-input-number v-model="form.sort" placeholder="请输入排序" type="number" style="width: 100%;" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.vip_status"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</form-col>
|
||||
<!-- <form-col :span="span" label="卡券类型" prop="type">
|
||||
<el-radio-group v-model="form.type" placeholder="请选择卡券类型">
|
||||
<el-radio-button
|
||||
v-for="dict in dict.type.vip_type"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</form-col> -->
|
||||
<form-col :span="span" label="售价" prop="price">
|
||||
<el-input v-model="form.price" type="number" placeholder="请输入售价">
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</form-col>
|
||||
<form-col :span="span" :label="VipType.getLabel(form.type)" prop="discountValue">
|
||||
<el-input v-model="form.discountValue" placeholder="请输入优惠" type="number">
|
||||
<template #append>{{ VipType.getUnit(form.type) }}</template>
|
||||
</el-input>
|
||||
</form-col>
|
||||
<form-col :span="span" label="有效期" prop="validDays">
|
||||
<el-input v-model="form.validDays" placeholder="请输入有效期" type="number">
|
||||
<template #append>天</template>
|
||||
</el-input>
|
||||
</form-col>
|
||||
<form-col :span="span" label="可用次数" prop="limitTotal">
|
||||
<el-input v-model="form.limitTotal" placeholder="请输入可用次数" type="number">
|
||||
<template #append>次</template>
|
||||
</el-input>
|
||||
</form-col>
|
||||
<form-col :span="span" label="使用门槛" prop="minAmount">
|
||||
<el-input v-model="form.minAmount" placeholder="请输入使用门槛" type="number">
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</form-col>
|
||||
<form-col :span="24" label="使用说明" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" :rows="3" show-word-limit maxlength="500" />
|
||||
</form-col>
|
||||
<form-col :span="24" label="频率限制" prop="enableLimit" tip="开启后,将会限制用户的使用频率,从购买之日开始计算">
|
||||
<el-switch v-model="form.enableLimit" active-text="开启" inactive-text="关闭" />
|
||||
</form-col>
|
||||
<template v-if="form.enableLimit">
|
||||
<form-col :span="24" label="限制频率" prop="limitCount">
|
||||
<el-row>
|
||||
<el-col :span="14">
|
||||
<el-input v-model="form.limitRound" placeholder="请输入周期" type="number">
|
||||
<template #prepend>每</template>
|
||||
<template #append>
|
||||
<el-select v-model="form.limitUnit" placeholder="请选择单位" style="width: 5em">
|
||||
<el-option
|
||||
v-for="dict in dict.type.vip_limit_unit"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-input v-model="form.limitCount" placeholder="请输入次数" type="number">
|
||||
<template #append>次</template>
|
||||
</el-input>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</form-col>
|
||||
</template>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :loading="submitLoading">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addVip, getVip, updateVip } from "@/api/bst/vip";
|
||||
import AreaRemoteSelect from '@/components/Business/Area/AreaRemoteSelect.vue';
|
||||
import FormCol from "@/components/FormCol/index.vue";
|
||||
import { VipLimitUnit, VipStatus, VipType } from '@/utils/enums';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'VipEditDialog',
|
||||
components: {
|
||||
FormCol,
|
||||
AreaRemoteSelect
|
||||
},
|
||||
dicts: ['vip_status', 'vip_type', 'vip_limit_unit'],
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
id: {
|
||||
type: [String, Number],
|
||||
default: null
|
||||
},
|
||||
initData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
VipType,
|
||||
VipStatus,
|
||||
VipLimitUnit,
|
||||
loading: false,
|
||||
submitLoading: false,
|
||||
span: 12,
|
||||
title: '',
|
||||
form: {},
|
||||
rules: {
|
||||
areaId: [
|
||||
{ required: true, message: "运营区不能为空", trigger: "change" }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: "会员卡名称不能为空", trigger: "blur" }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: "卡类型不能为空", trigger: "change" }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: "售价不能为空", trigger: "blur" }
|
||||
],
|
||||
discountValue: [
|
||||
{ required: true, message: "优惠不能为空", trigger: "blur" }
|
||||
],
|
||||
validDays: [
|
||||
{ required: true, message: "有效期不能为空", trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "状态不能为空", trigger: "change" }
|
||||
],
|
||||
enableLimit: [
|
||||
{ required: true, message: "使用限制不能为空", trigger: "change" }
|
||||
],
|
||||
limitTotal: [
|
||||
{ required: true, message: "总次数不能为空", trigger: "blur" }
|
||||
],
|
||||
limitCount: [
|
||||
{ required: true, message: "限制次数不能为空", trigger: "blur" }
|
||||
],
|
||||
minAmount: [
|
||||
{ required: true, message: "使用门槛不能为空", trigger: "blur" }
|
||||
],
|
||||
sort: [
|
||||
{ required: true, message: "排序不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialogVisible: {
|
||||
get() {
|
||||
return this.visible;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:visible', val);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleOpen() {
|
||||
if (this.id == null) {
|
||||
this.reset();
|
||||
this.title = "添加卡券";
|
||||
} else {
|
||||
this.getDetail();
|
||||
this.title = "修改卡券";
|
||||
}
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
areaId: null,
|
||||
name: null,
|
||||
type: VipType.DISCOUNT,
|
||||
price: null,
|
||||
discountValue: null,
|
||||
validDays: null,
|
||||
status: VipStatus.ON_SALE,
|
||||
description: null,
|
||||
enableLimit: false,
|
||||
limitTotal: null,
|
||||
limitRound: 30,
|
||||
limitUnit: VipLimitUnit.DAY,
|
||||
limitCount: 10,
|
||||
sort: 0,
|
||||
minAmount: 0,
|
||||
...this.initData
|
||||
};
|
||||
this.$nextTick(() => {
|
||||
this.$refs.form && this.$refs.form.clearValidate();
|
||||
});
|
||||
},
|
||||
getDetail() {
|
||||
this.loading = true;
|
||||
getVip(this.id).then(response => {
|
||||
this.form = response.data;
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
this.submitLoading = true;
|
||||
const promise = this.form.id != null ? updateVip(this.form) : addVip(this.form);
|
||||
promise.then(response => {
|
||||
this.$modal.msgSuccess(this.form.id != null ? "修改成功" : "新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
}).finally(() => {
|
||||
this.submitLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
this.dialogVisible = false;
|
||||
this.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
325
src/views/bst/vip/index.vue
Normal file
325
src/views/bst/vip/index.vue
Normal file
|
@ -0,0 +1,325 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="运营区" prop="areaId">
|
||||
<area-remote-select v-model="queryParams.areaId" placeholder="请选择运营区" clearable @change="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="卡券名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入卡券名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="卡类型" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择卡类型" clearable @change="handleQuery">
|
||||
<el-option
|
||||
v-for="dict in dict.type.vip_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable @change="handleQuery">
|
||||
<el-option
|
||||
v-for="dict in dict.type.vip_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用限制" prop="enableLimit">
|
||||
<el-radio-group v-model="queryParams.enableLimit" placeholder="请选择使用限制" clearable @change="handleQuery">
|
||||
<el-radio :label="null">全部</el-radio>
|
||||
<el-radio :label="true">有限制</el-radio>
|
||||
<el-radio :label="false">无限制</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-has-permi="['bst:vip:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-has-permi="['bst:vip:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-has-permi="['bst:vip:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="vipList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<template v-for="column of showColumns">
|
||||
<el-table-column
|
||||
:key="column.key"
|
||||
:label="column.label"
|
||||
:prop="column.key"
|
||||
:align="column.align"
|
||||
:min-width="column.minWidth"
|
||||
:sort-orders="orderSorts"
|
||||
:sortable="column.sortable"
|
||||
:show-overflow-tooltip="column.overflow"
|
||||
:width="column.width"
|
||||
>
|
||||
<template slot-scope="d">
|
||||
<template v-if="column.key === 'id'">
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'enableLimit'">
|
||||
总计可用 {{ d.row.limitTotal }} 次
|
||||
<template v-if="d.row.minAmount">
|
||||
,使用门槛 {{ d.row.minAmount | fix2 | dv}} 元
|
||||
</template>
|
||||
<template v-if="d.row.enableLimit">
|
||||
,每 {{ d.row.limitRound }} {{ dictLabel(dict.type.vip_limit_unit, d.row.limitUnit) }} {{ d.row.limitCount }} 次
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'validDays'">
|
||||
{{ d.row.validDays }} 天
|
||||
</template>
|
||||
<template v-else-if="column.key === 'price'">
|
||||
{{ d.row.price | fix2 | dv}} 元
|
||||
</template>
|
||||
<template v-else-if="column.key === 'discountValue'">
|
||||
{{ d.row.discountValue | dv}} {{ VipType.getUnit(d.row.type) }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'areaName'">
|
||||
<area-link :id="d.row.areaId" :text="d.row.areaName" />
|
||||
</template>
|
||||
<template v-else-if="column.key === 'name'">
|
||||
{{ d.row.name }}
|
||||
<dict-tag :options="dict.type.vip_type" :value="d.row.type" size="mini" style="margin-left: 4px;"/>
|
||||
<dict-tag :options="dict.type.vip_status" :value="d.row.status" size="mini" style="margin-left: 4px;"/>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-has-permi="['bst:vip:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-has-permi="['bst:vip:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改卡券对话框 -->
|
||||
<vip-edit-dialog
|
||||
:visible.sync="open"
|
||||
:id="row.id"
|
||||
@success="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { delVip, listVip } from "@/api/bst/vip";
|
||||
import BooleanTag from '@/components/BooleanTag/index.vue';
|
||||
import AreaLink from '@/components/Business/Area/AreaLink.vue';
|
||||
import AreaRemoteSelect from '@/components/Business/Area/AreaRemoteSelect.vue';
|
||||
import FormCol from "@/components/FormCol/index.vue";
|
||||
import { VipType } from '@/utils/enums';
|
||||
import { $showColumns } from '@/utils/mixins';
|
||||
import VipEditDialog from './components/VipEditDialog.vue';
|
||||
import { formatDiscounValue } from "./util";
|
||||
// 默认排序字段
|
||||
const defaultSort = {
|
||||
prop: "sort",
|
||||
order: "ascending"
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "Vip",
|
||||
mixins: [$showColumns],
|
||||
dicts: ['vip_status', 'vip_type', 'vip_limit_unit'],
|
||||
components: {
|
||||
FormCol,
|
||||
AreaRemoteSelect,
|
||||
AreaLink,
|
||||
BooleanTag,
|
||||
VipEditDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
VipType,
|
||||
span: 24,
|
||||
// 字段列表
|
||||
columns: [
|
||||
{key: 'id', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'name', visible: true, label: '卡券名称', minWidth: null, sortable: true, overflow: false, align: 'left', width: "300"},
|
||||
{key: 'areaName', visible: true, label: '运营区', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'price', visible: true, label: '售价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'discountValue', visible: true, label: '优惠', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'validDays', visible: true, label: '有效期', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'enableLimit', visible: true, label: '使用限制', minWidth: null, sortable: true, overflow: false, align: 'center', width: "250"},
|
||||
{key: 'description', visible: true, label: '使用说明', minWidth: null, sortable: true, overflow: true, align: 'center', width: null},
|
||||
{key: 'sort', visible: true, label: '排序', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
],
|
||||
// 排序方式
|
||||
orderSorts: ['ascending', 'descending', null],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 卡券表格数据
|
||||
vipList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
defaultSort,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
orderByColumn: defaultSort.prop,
|
||||
isAsc: defaultSort.order,
|
||||
id: null,
|
||||
areaId: null,
|
||||
name: null,
|
||||
type: null,
|
||||
validDays: null,
|
||||
status: null,
|
||||
description: null,
|
||||
deleted: null,
|
||||
enableLimit: null,
|
||||
limitUnit: null
|
||||
},
|
||||
// 表单参数
|
||||
row: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
formatDiscounValue,
|
||||
/** 当排序按钮被点击时触发 **/
|
||||
onSortChange(column) {
|
||||
if (column.order == null) {
|
||||
this.queryParams.orderByColumn = defaultSort.prop;
|
||||
this.queryParams.isAsc = defaultSort.order;
|
||||
} else {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
/** 查询卡券列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listVip(this.queryParams).then(response => {
|
||||
this.vipList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.row = {}
|
||||
this.open = true;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.row = row;
|
||||
this.open = true;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除卡券编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delVip(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('bst/vip/export', {
|
||||
...this.queryParams
|
||||
}, `vip_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
2
src/views/bst/vip/util.js
Normal file
2
src/views/bst/vip/util.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
|
Loading…
Reference in New Issue
Block a user