会员管理

This commit is contained in:
PQZ 2024-09-19 22:54:02 +08:00
parent 572ddb6269
commit 85d81ccc68
10 changed files with 1280 additions and 82 deletions

View File

@ -1,53 +1,62 @@
import request from '@/utils/request'
// 创建基础卡券
export function createCoupon(data) {
return request({
url: '/member/coupon/create',
method: 'post',
data: data
})
}
// 更新基础卡券
export function updateCoupon(data) {
return request({
url: '/member/coupon/update',
method: 'put',
data: data
})
}
// 删除基础卡券
export function deleteCoupon(id) {
return request({
url: '/member/coupon/delete?id=' + id,
method: 'delete'
})
}
// 获得基础卡券
export function getCoupon(id) {
return request({
url: '/member/coupon/get?id=' + id,
method: 'get'
})
}
// 获得基础卡券分页
export function getCouponPage(params) {
return request({
url: '/member/coupon/page',
method: 'get',
params
})
}
// 导出基础卡券 Excel
export function exportCouponExcel(params) {
return request({
url: '/member/coupon/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}
import request from '@/utils/request'
// 创建基础卡券
export function createCoupon(data) {
return request({
url: '/member/coupon/create',
method: 'post',
data: data
})
}
// 复制附属权益
export function copyCoupon(data) {
return request({
url: '/member/coupon/copy',
method: 'post',
data: data
})
}
// 更新基础卡券
export function updateCoupon(data) {
return request({
url: '/member/coupon/update',
method: 'put',
data: data
})
}
// 删除基础卡券
export function deleteCoupon(id) {
return request({
url: '/member/coupon/delete?id=' + id,
method: 'delete'
})
}
// 获得基础卡券
export function getCoupon(id) {
return request({
url: '/member/coupon/get?id=' + id,
method: 'get'
})
}
// 获得基础卡券分页
export function getCouponPage(params) {
return request({
url: '/member/coupon/page',
method: 'get',
params
})
}
// 导出基础卡券 Excel
export function exportCouponExcel(params) {
return request({
url: '/member/coupon/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -44,17 +44,41 @@
</el-switch>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="是否区分会员等级" prop="isMember">-->
<!-- <el-switch-->
<!-- v-model="formData.isMember"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- active-value="0"-->
<!-- inactive-value="1">-->
<!-- </el-switch>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="充值规则开关" prop="isRechRule">
<el-switch
v-model="formData.isRechRule"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="1"
inactive-value="0">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否关联卡券" prop="isCoupon">
<el-switch
v-model="formData.isCoupon"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="1"
inactive-value="0">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否打包赠送" prop="isPack">
<el-switch
v-model="formData.isPack"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="1"
inactive-value="0">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动描述" prop="remark">
<el-input type="textarea" v-model="formData.remark" placeholder="请输入活动描述"/>
@ -93,7 +117,9 @@ export default {
endTime: undefined,
status: '01',
remark: undefined,
isMember: '0',
isRechRule: '0',
isPack:'0',
isCoupon:'0',
},
//
formRules: {},
@ -151,7 +177,9 @@ export default {
endTime: undefined,
status: '01',
remark: undefined,
isMember: '0',
isRechRule: '0',
isPack:'0',
isCoupon:'0',
};
this.resetForm("formRef");
}

View File

@ -0,0 +1,208 @@
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-dialogDrag append-to-body>
<el-collapse v-model="activeNames">
<!-- 供应商基本信息 -->
<el-collapse-item name="1">
<template slot="title">
<div style="font-weight: bold">活动内容</div>
</template>
<el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item>
<template slot="label">
活动名称
</template>
{{ formData.name }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
活动类型
</template>
<dict-tag :type="DICT_TYPE.MEMBER_ACTIVE" :value="formData.type"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
开始时间
</template>
{{parseTime(formData.beginTime)}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
结束时间
</template>
{{parseTime(formData.endTime)}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
活动内容
</template>
{{formData.remark}}
</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
<el-collapse-item title="关联卡券" name="2">
<template slot="title">
<div style="font-weight: bold">关联卡券</div>
</template>
<el-button @click="openChooseCoupon" size="mini" type="primary" plain>选择卡券</el-button>
<el-table height="250" :data="formData.couponList" border size="small" style="width: 100%">
<el-table-column label="卡券名称" width="250" align="left" prop="name"/>
<el-table-column label="卡券类型" width="80" align="left" prop="type">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="开始有效期" align="center" prop="beginTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.beginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="结束有效期" align="center" prop="endTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="面额" width="100" align="right" prop="amount"/>
<el-table-column label="备注" show-overflow-tooltip align="left" prop="remark"/>
<el-table-column align="center" width="100" label="操作">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-delete"
@click="deleteItem(scope.$index, formData.couponList)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
<ChooseCouponDraw @success="chooseCoupon" ref="chooseCouponForm"/>
</div>
</template>
<script>
import * as ActiveMainApi from '@/api/member/active';
import ChooseCouponDraw from '@/views/member/active/ChooseCouponDraw.vue';
export default {
name: "ActiveRuleCouponForm",
components: {ChooseCouponDraw},
data() {
return {
//
dialogTitle: "",
//
dialogVisible: false,
// 12
formLoading: false,
//
activeNames: ['1', '2'],
//
formData: {
id: undefined,
name: undefined,
type: undefined,
beginTime: undefined,
endTime: undefined,
// status: '01',
remark: undefined,
// isRechRule: '0',
// isPack:'0',
// isCoupon:'0',
couponList:[]
},
//
formRules: {},
};
},
methods: {
/** 打开弹窗 */
async open(id) {
this.dialogVisible = true;
this.reset();
//
if (id) {
this.formLoading = true;
try {
const res = await ActiveMainApi.getActiveMain(id);
this.formData = res.data;
this.title = "修改营销活动";
} finally {
this.formLoading = false;
}
}
this.title = "新增营销活动";
},
/** 提交按钮 */
async submitForm() {
//
this.formLoading = true;
try {
const data = this.formData;
//
if (data.id) {
await ActiveMainApi.updateActiveMain(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
}
//
await ActiveMainApi.createActiveMain(data);
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.$emit('success');
} finally {
this.formLoading = false;
}
},
/**选择卡券*/
openChooseCoupon(){
this.$refs["chooseCouponForm"].open(this.formData.couponList);
},
/**
* 选中车辆
*/
chooseCoupon(chooseCoupon){
this.formData.couponList = chooseCoupon
},
/**
* 移除账户内容
*/
deleteItem(index, rows) {
rows.splice(index, 1);
},
/** 表单重置 */
reset() {
this.formData = {
id: undefined,
name: undefined,
type: undefined,
beginTime: undefined,
endTime: undefined,
// status: '01',
remark: undefined,
// isRechRule: '0',
// isPack:'0',
// isCoupon:'0',
couponList:[]
};
}
}
};
</script>

View File

@ -0,0 +1,218 @@
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
<el-collapse v-model="activeNames">
<!-- 供应商基本信息 -->
<el-collapse-item name="1">
<template slot="title">
<div style="font-weight: bold">活动内容</div>
</template>
<el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item>
<template slot="label">
活动名称
</template>
{{ formData.name }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
活动类型
</template>
<dict-tag :type="DICT_TYPE.MEMBER_ACTIVE" :value="formData.type"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
开始时间
</template>
{{parseTime(formData.beginTime)}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
结束时间
</template>
{{parseTime(formData.endTime)}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
活动内容
</template>
{{formData.remark}}
</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
<el-collapse-item title="充值规则" name="2">
<template slot="title">
<div style="font-weight: bold">充值规则</div>
</template>
<el-table :data="formData.ruleList" border size="small" style="width: 100%">
<el-table-column prop="name" align="left">
<template slot="header">
<i style="color: #409EFF;cursor:pointer" class="el-icon-circle-plus-outline" @click="addItem"/>
名称
</template>
<template v-slot="scope">
<el-input v-model="scope.row.name" ></el-input>
</template>
</el-table-column>
<el-table-column prop="rechAmount" align="center" label="充值金额">
<template v-slot="scope">
<el-input-number v-model="scope.row.rechAmount" :precision="2" :step="0.1" ></el-input-number>
</template>
</el-table-column>
<el-table-column prop="giveAmount" align="center" label="赠送金额">
<template v-slot="scope">
<el-input-number v-model="scope.row.giveAmount" :precision="2" :step="0.1" ></el-input-number>
</template>
</el-table-column>
<el-table-column align="center" width="100" label="操作">
<template v-slot="scope">
<el-button v-if="formData.ruleList.length > 1" size="mini" type="text" icon="el-icon-delete"
@click="deleteItem(scope.$index, formData.ruleList)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import * as ActiveMainApi from '@/api/member/active';
export default {
name: "ActiveRuleForm",
components: {},
data() {
return {
//
dialogTitle: "",
//
dialogVisible: false,
// 12
formLoading: false,
//
activeNames: ['1', '2'],
//
formData: {
id: undefined,
name: undefined,
type: undefined,
beginTime: undefined,
endTime: undefined,
// status: '01',
remark: undefined,
// isRechRule: '0',
// isPack:'0',
// isCoupon:'0',
ruleList: [{
name:'',
rechAmount: '',
giveAmount: '',
}],
},
//
formRules: {},
};
},
methods: {
/** 打开弹窗 */
async open(id) {
this.dialogVisible = true;
this.reset();
//
if (id) {
this.formLoading = true;
try {
const res = await ActiveMainApi.getActiveMain(id);
this.formData = res.data;
this.title = "修改营销活动";
} finally {
this.formLoading = false;
}
}
this.title = "新增营销活动";
},
/** 提交按钮 */
async submitForm() {
//
this.formLoading = true;
try {
const data = this.formData;
//
if (data.id) {
await ActiveMainApi.updateActiveMain(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
}
//
await ActiveMainApi.createActiveMain(data);
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.$emit('success');
} finally {
this.formLoading = false;
}
},
/**
* 新增规则
*/
addItem() {
const item = {
name:'',
rechAmount: '',
giveAmount: '',
}
this.formData.ruleList.push(item)
},
/**
* 移除账户内容
*/
deleteItem(index, rows) {
rows.splice(index, 1);
},
/** 表单重置 */
reset() {
this.formData = {
id: undefined,
name: undefined,
type: undefined,
beginTime: undefined,
endTime: undefined,
// status: '01',
remark: undefined,
// isRechRule: '0',
// isPack:'0',
// isCoupon:'0',
ruleList: [{
name:'',
rechAmount: '',
giveAmount: '',
}],
};
}
}
};
</script>

View File

@ -0,0 +1,258 @@
<template>
<!-- 对话框(添加 / 修改) -->
<el-drawer
title="选择卡券"
size="60%"
:visible.sync="drawVisible"
@close="cancelForm"
>
<div style="padding: 0 10px;margin-bottom: 70px">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<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="请选择卡券类型" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="核销规则" prop="outRule">
<el-select v-model="queryParams.type" placeholder="请选择核销规则" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_OUT_RULE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row>
<el-col :span="3">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
v-hasPermi="['member:coupon:create']">新增
</el-button>
</el-col>
</el-row>
<el-table
ref="multipleTable"
height="460"
v-loading="formLoading"
:data="list"
:stripe="true"
@select="selectRow"
@select-all="handleSelectAll"
:show-overflow-tooltip="true">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="卡券名称" width="250" align="left" prop="name"/>
<el-table-column label="卡券类型" width="80" align="left" prop="type">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="适用车型" width="130" align="center" prop="carModel">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_CAR" :value="scope.row.carModel"/>
</template>
</el-table-column>
<el-table-column label="开始有效期" align="center" prop="beginTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.beginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="结束有效期" align="center" prop="endTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="面额" width="100" align="right" prop="amount"/>
<el-table-column label="备注" show-overflow-tooltip align="left" prop="remark"/>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<div
style="position: absolute;bottom: 0;width: 100%;right: 0;padding: 5px 20px 0;z-index: 999;background: white;text-align: right">
<div class="demo-drawer__footer">
<el-button @click="cancelForm"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</div>
<!-- 对话框(添加 / 修改) -->
<CouponForm ref="formRef" @success="getList"/>
</el-drawer>
<!-- 对话框(添加 / 修改) -->
</template>
<script>
import * as CouponApi from '@/api/member/coupon';
import CouponForm from '@/views/member/coupon/CouponForm.vue';
export default {
name: "ChooseCouponDraw",
components: {CouponForm},
data() {
return {
//
//
drawVisible: false,
// 12
formLoading: false,
//
exportLoading: false,
//
showSearch: true,
//
formData: {},
//
total: 0,
//
list: [],
multipleSelection: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
name: null,
type: null,
carModel: null,
outRule: null,
},
};
},
methods: {
/** 打开弹窗 */
async open(multipleSelection) {
this.drawVisible = true;
this.formLoading = true;
this.reset();
try {
const res = await CouponApi.getCouponPage(this.queryParams);
this.list = res.data.records;
this.total = res.data.total;
this.multipleSelection = JSON.parse(JSON.stringify(multipleSelection))
this.defaultChecked(multipleSelection)
} finally {
this.formLoading = false;
}
},
/**选中*/
selectRow(val, row) {
//
let selectBool = val.length && val.indexOf(row) !== -1
if (!selectBool) {
//
this.multipleSelection.forEach((item, i) => {
if (item.id == row.id) {
this.multipleSelection.splice(i, 1)
}
})
} else {
//
this.multipleSelection.push(row)
}
},
/**全选*/
handleSelectAll(val) {
if (val.length == this.list.length) { //
this.multipleSelection = this.multipleSelection.concat(val)
//
let obj = {}
let result = []
this.multipleSelection.forEach(item => {
if (!obj[item.id]) {
result.push(item)
obj[item.id] = true
}
})
this.multipleSelection = result
} else { //
this.list.forEach(item => {
this.multipleSelection.forEach((multItem, i) => {
if (item.id == multItem.id) {
this.multipleSelection.splice(i, 1)
}
})
})
}
},
/**设置默认选中*/
defaultChecked(multipleSelection) {
const that = this;
this.$nextTick(() => {
that.list.forEach((v, i) => {
multipleSelection.map(item => {
if (item.id === v.id) {
that.$refs.multipleTable.toggleRowSelection(v, true);
}
})
});
});
},
cancelForm() {
this.drawVisible = false
},
/** 添加/修改操作 */
openForm(id) {
this.$refs["formRef"].open(id);
},
/** 查询列表 */
async getList() {
try {
this.formLoading = true
const res = await CouponApi.getCouponPage(this.queryParams);
this.list = res.data.records;
this.total = res.data.total;
this.defaultChecked(this.multipleSelection)
} finally {
this.formLoading = false
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/**重置参数*/
reset() {
this.queryParams = {
pageNo: 1,
pageSize: 10,
name: null,
type: null,
carModel: null,
outRule: null,
}
},
/** 提交按钮 */
submitForm() {
this.drawVisible = false
this.$emit('success', this.multipleSelection)
},
}
};
</script>

View File

@ -54,6 +54,12 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button v-if="scope.row.isCoupon == '1'" size="mini" type="text" icon="el-icon-bank-card" @click="openCouponForm(scope.row.id)"
v-hasPermi="['member:active-main:update']">关联卡券
</el-button>
<el-button v-if="scope.row.isRechRule == '1'" size="mini" type="text" icon="el-icon-wallet" @click="openRuleForm(scope.row.id)"
v-hasPermi="['member:active-main:update']">充值规则
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
v-hasPermi="['member:active-main:update']">修改
</el-button>
@ -68,17 +74,23 @@
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<ActiveMainForm ref="formRef" @success="getList"/>
<!-- 充值规则 -->
<ActiveRuleForm ref="ruleFormRef" @success="getList"/>
<!-- 关联卡券 -->
<ActiveRuleCouponForm ref="couponFormRef" @success="getList"/>
</div>
</template>
<script>
import * as ActiveMainApi from '@/api/member/active';
import ActiveMainForm from './ActiveMainForm.vue';
import ActiveRuleForm from './ActiveRuleForm.vue';
import ActiveRuleCouponForm from './ActiveRuleCouponForm.vue';
export default {
name: "ActiveMain",
components: {
ActiveMainForm,
ActiveMainForm,ActiveRuleForm,ActiveRuleCouponForm
},
data() {
return {
@ -142,6 +154,14 @@ export default {
openForm(id) {
this.$refs["formRef"].open(id);
},
/** 添加规则 */
openRuleForm(id) {
this.$refs["ruleFormRef"].open(id);
},
/** 添加规则 */
openCouponForm(id) {
this.$refs["couponFormRef"].open(id);
},
/** 删除按钮操作 */
async handleDelete(row) {
const id = row.id;

View File

@ -0,0 +1,170 @@
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<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="请选择卡券类型" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="核销规则" prop="outRule">
<el-select v-model="queryParams.type" placeholder="请选择核销规则" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_OUT_RULE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="openForm(undefined)"
v-hasPermi="['member:coupon:create']">新增
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="queryList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="卡券名称" width="200" align="left" prop="name"/>
<el-table-column label="卡券类型" width="100" align="left" prop="type">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="核销规则" width="100" align="center" prop="outRule">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_OUT_RULE" :value="scope.row.outRule"/>
</template>
</el-table-column>
<el-table-column label="开始有效期" align="center" prop="beginTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.beginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="结束有效期" align="center" prop="endTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="面额" width="100" align="right" prop="amount"/>
<el-table-column label="备注" show-overflow-tooltip align="left" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
v-hasPermi="['member:coupon:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['member:coupon:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="queryList"/>
<!-- 对话框(添加 / 修改) -->
<CouponForm ref="couponRefForm" @success="queryList"/>
</el-dialog>
</div>
</template>
<script>
import * as CouponApi from '@/api/member/coupon';
import CouponForm from './CouponForm.vue';
export default {
name: "ChildCouponForm",
components: {
CouponForm,
},
data() {
return {
//
dialogTitle: "",
//
dialogVisible: false,
// 12
loading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
isExpandAll: true,
//
refreshTable: true,
//
currentRow: {},
//
queryParams: {
pageNo: 1,
pageSize: 10,
parentId:null,
name: null,
type: null,
carModel: null,
outRule: null,
},
};
},
methods: {
/** 打开弹窗 */
async open(parentId) {
this.dialogVisible = true;
this.queryParams.parentId = parentId
this.queryList()
},
/** 查询列表 */
async queryList() {
try {
const res = await CouponApi.getCouponPage(this.queryParams);
this.list = res.data.records;
this.total = res.data.total;
} finally {
this.loading = false;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.queryList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 添加/修改操作 */
openForm(id) {
this.$refs["couponRefForm"].open(id,this.queryParams.parentId);
},
/** 删除按钮操作 */
async handleDelete(row) {
const id = row.id;
await this.$modal.confirm('是否确认删除基础卡券名称为"' + row.name + '"的数据项?')
try {
await CouponApi.deleteCoupon(id);
await this.queryList();
this.$modal.msgSuccess("删除成功");
} catch {
}
},
}
};
</script>

View File

@ -0,0 +1,267 @@
<template>
<!-- 对话框(添加 / 修改) -->
<el-drawer
title="选择卡券"
size="60%"
:visible.sync="drawVisible"
@close="cancelForm"
>
<div style="padding: 0 10px;margin-bottom: 70px">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>{{ formData.name }}</span>
</div>
<el-row :gutter="12">
<el-col v-for="item in formData.couponList" :span="6">
<el-card shadow="hover">
{{ item.name }}
</el-card>
</el-col>
</el-row>
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="color: red">点击确定后{{formData.name}}的附属权益复制到下列选中的目标卡券中</span>
</div>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<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="请选择卡券类型" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="核销规则" prop="outRule">
<el-select v-model="queryParams.type" placeholder="请选择核销规则" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_OUT_RULE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-table
ref="multipleTable"
height="460"
v-loading="formLoading"
:data="list"
:stripe="true"
@select="selectRow"
@select-all="handleSelectAll"
:show-overflow-tooltip="true">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="卡券名称" width="250" align="left" prop="name"/>
<el-table-column label="卡券类型" width="80" align="left" prop="type">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="适用车型" width="130" align="center" prop="carModel">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_CAR" :value="scope.row.carModel"/>
</template>
</el-table-column>
<el-table-column label="开始有效期" align="center" prop="beginTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.beginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="结束有效期" align="center" prop="endTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="面额" width="100" align="right" prop="amount"/>
<el-table-column label="备注" show-overflow-tooltip align="left" prop="remark"/>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</el-card>
</div>
<div
style="position: absolute;bottom: 0;width: 100%;right: 0;padding: 5px 20px 0;z-index: 999;background: white;text-align: right">
<div class="demo-drawer__footer">
<el-button @click="cancelForm"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</div>
<!-- 对话框(添加 / 修改) -->
</el-drawer>
<!-- 对话框(添加 / 修改) -->
</template>
<script>
import * as CouponApi from '@/api/member/coupon';
export default {
name: "CopyCouponDraw",
components: {},
data() {
return {
//
//
drawVisible: false,
// 12
formLoading: false,
//
exportLoading: false,
//
showSearch: true,
//
formData: {},
//
total: 0,
//
list: [],
multipleSelection: [],
id:null,
//
queryParams: {
pageNo: 1,
pageSize: 8,
name: null,
type: null,
carModel: null,
outRule: null,
},
};
},
methods: {
/** 打开弹窗 */
async open(id) {
this.drawVisible = true;
this.formLoading = true;
this.id = id;
this.reset();
if (id) {
try {
//
const res = await CouponApi.getCoupon(id);
this.formData = res.data;
//
const resp = await CouponApi.getCouponPage(this.queryParams);
this.list = resp.data.records;
this.total = resp.data.total;
} finally {
this.formLoading = false;
}
}
},
/**选中*/
selectRow(val, row) {
//
let selectBool = val.length && val.indexOf(row) !== -1
if (!selectBool) {
//
this.multipleSelection.forEach((item, i) => {
if (item.id == row.id) {
this.multipleSelection.splice(i, 1)
}
})
} else {
//
this.multipleSelection.push(row)
}
},
/**全选*/
handleSelectAll(val) {
if (val.length == this.list.length) { //
this.multipleSelection = this.multipleSelection.concat(val)
//
let obj = {}
let result = []
this.multipleSelection.forEach(item => {
if (!obj[item.id]) {
result.push(item)
obj[item.id] = true
}
})
this.multipleSelection = result
} else { //
this.list.forEach(item => {
this.multipleSelection.forEach((multItem, i) => {
if (item.id == multItem.id) {
this.multipleSelection.splice(i, 1)
}
})
})
}
},
cancelForm() {
this.drawVisible = false
},
/** 添加/修改操作 */
openForm(id) {
this.$refs["formRef"].open(id);
},
/** 查询列表 */
async getList() {
try {
this.formLoading = true
const res = await CouponApi.getCouponPage(this.queryParams);
this.list = res.data.records;
this.total = res.data.total;
} finally {
this.formLoading = false
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/**重置参数*/
reset() {
this.queryParams = {
pageNo: 1,
pageSize: 10,
name: null,
type: null,
carModel: null,
outRule: null,
}
this.multipleSelection = []
},
/** 提交按钮 */
async submitForm() {
this.drawVisible = false
const data = {
id:this.id,
couponList:this.multipleSelection
}
await CouponApi.copyCoupon(data);
this.$modal.msgSuccess("复制成功");
this.dialogVisible = false;
this.$emit('success');
},
}
};
</script>

View File

@ -118,6 +118,7 @@ export default {
remark: undefined,
outRule: undefined,
unitPrice: undefined,
parentId:null
},
//
formRules: {},
@ -125,9 +126,12 @@ export default {
},
methods: {
/** 打开弹窗 */
async open(id) {
async open(id,parentId) {
this.dialogVisible = true;
this.reset();
if (parentId){
this.formData.parentId = parentId
}
//
if (id) {
this.formLoading = true;
@ -180,6 +184,7 @@ export default {
remark: undefined,
outRule: undefined,
unitPrice: undefined,
parentId:null
};
this.resetForm("formRef");
}

View File

@ -31,23 +31,17 @@
v-hasPermi="['member:coupon:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['member:coupon:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="卡券名称" width="200" align="left" prop="name"/>
<el-table-column label="卡券类型" width="100" align="left" prop="type">
<el-table-column label="卡券名称" width="250" align="left" prop="name"/>
<el-table-column label="卡券类型" width="80" align="left" prop="type">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="适用车型" width="100" align="center" prop="carModel">
<el-table-column label="适用车型" width="130" align="center" prop="carModel">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MEMBER_CAR" :value="scope.row.carModel"/>
</template>
@ -57,20 +51,26 @@
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_OUT_RULE" :value="scope.row.outRule"/>
</template>
</el-table-column>
<el-table-column label="开始有效期" align="center" prop="beginTime" width="180">
<el-table-column label="开始有效期" align="center" prop="beginTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.beginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="结束有效期" align="center" prop="endTime" width="180">
<el-table-column label="结束有效期" align="center" prop="endTime" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="面额" width="100" align="right" prop="amount"/>
<el-table-column label="备注" show-overflow-tooltip align="left" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" width="250" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-goods" @click="openChildForm(scope.row.id)"
v-hasPermi="['member:coupon:update']">附属权益
</el-button>
<el-button size="mini" type="text" icon="el-icon-document-copy" @click="openCopyForm(scope.row.id)"
v-hasPermi="['member:coupon:update']">复制
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
v-hasPermi="['member:coupon:update']">修改
</el-button>
@ -85,17 +85,23 @@
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<CouponForm ref="formRef" @success="getList"/>
<!-- 附属权益 -->
<ChildCouponForm ref="childFormRef"/>
<!-- 复制附属权益 -->
<CopyCouponDraw ref="copyCouponRef" @success="getList"/>
</div>
</template>
<script>
import * as CouponApi from '@/api/member/coupon';
import CouponForm from './CouponForm.vue';
import ChildCouponForm from './ChildCouponForm.vue';
import CopyCouponDraw from './CopyCouponDraw.vue';
export default {
name: "Coupon",
components: {
CouponForm,
CouponForm,ChildCouponForm,CopyCouponDraw
},
data() {
return {
@ -153,8 +159,17 @@ export default {
},
/** 添加/修改操作 */
openForm(id) {
this.$refs["formRef"].open(id);
this.$refs["formRef"].open(id,undefined);
},
/** 附属权益 */
openChildForm(id) {
this.$refs["childFormRef"].open(id);
},
/** 复制附属权益 */
openCopyForm(id) {
this.$refs["copyCouponRef"].open(id);
},
/** 删除按钮操作 */
async handleDelete(row) {
const id = row.id;