优惠券

This commit is contained in:
齐天大圣 2023-11-08 09:33:11 +08:00
parent 630f95dfb0
commit 94adf07fa8
4 changed files with 1009 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询优惠券列表
export function listFavorable(query) {
return request({
url: '/business/marketingActivity/favorable/list',
method: 'get',
params: query
})
}
// 查询优惠券详细
export function getFavorable(id) {
return request({
url: '/business/marketingActivity/favorable/' + id,
method: 'get'
})
}
// 新增优惠券
export function addFavorable(data) {
return request({
url: '/business/marketingActivity/favorable',
method: 'post',
data: data
})
}
// 修改优惠券
export function updateFavorable(data) {
return request({
url: '/business/marketingActivity/favorable',
method: 'put',
data: data
})
}
// 删除优惠券
export function delFavorable(id) {
return request({
url: '/business/marketingActivity/favorable/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询优惠券记录列表
export function listRecord(query) {
return request({
url: '/business/marketingActivity/record/list',
method: 'get',
params: query
})
}
// 查询优惠券记录详细
export function getRecord(id) {
return request({
url: '/business/marketingActivity/record/' + id,
method: 'get'
})
}
// 新增优惠券记录
export function addRecord(data) {
return request({
url: '/business/marketingActivity/record',
method: 'post',
data: data
})
}
// 修改优惠券记录
export function updateRecord(data) {
return request({
url: '/business/marketingActivity/record',
method: 'put',
data: data
})
}
// 删除优惠券记录
export function delRecord(id) {
return request({
url: '/business/marketingActivity/record/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,525 @@
<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="所属连锁店id" prop="chainStorId">
<el-input
v-model="queryParams.chainStorId"
placeholder="请输入所属连锁店id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属店铺id" prop="storeId">
<el-input
v-model="queryParams.storeId"
placeholder="请输入所属店铺id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否在线 0在线 1 下线" prop="isonline">
<el-input
v-model="queryParams.isonline"
placeholder="请输入是否在线 0在线 1 下线"
clearable
@keyup.enter.native="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="fullDeduction">
<el-input
v-model="queryParams.fullDeduction"
placeholder="请输入满减金额"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优惠金额" prop="discountAmount">
<el-input
v-model="queryParams.discountAmount"
placeholder="请输入优惠金额"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="满足金额" prop="satisfiedAmount">
<el-input
v-model="queryParams.satisfiedAmount"
placeholder="请输入满足金额"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优惠折扣" prop="specialDiscount">
<el-input
v-model="queryParams.specialDiscount"
placeholder="请输入优惠折扣"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="折扣抵消" prop="discountOffset">
<el-input
v-model="queryParams.discountOffset"
placeholder="请输入折扣抵消"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="有效期" prop="validity">
<el-input
v-model="queryParams.validity"
placeholder="请输入有效期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="生效日期" prop="effectiveDate">
<el-input
v-model="queryParams.effectiveDate"
placeholder="请输入生效日期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="生效时间" prop="effectiveTime">
<el-input
v-model="queryParams.effectiveTime"
placeholder="请输入生效时间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="可用时段" prop="availablePeriod">
<el-input
v-model="queryParams.availablePeriod"
placeholder="请输入可用时段"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="可用日期" prop="checkTime">
<el-input
v-model="queryParams.checkTime"
placeholder="请输入可用日期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="排除日期" prop="checkOutTime">
<el-date-picker clearable
v-model="queryParams.checkOutTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择排除日期">
</el-date-picker>
</el-form-item>
<el-form-item label="互斥功能 0满减活动 1储值卡付款" prop="exclusiveFunction">
<el-input
v-model="queryParams.exclusiveFunction"
placeholder="请输入互斥功能 0满减活动 1储值卡付款"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="领取规则 0每人限领一张 1每人每日限领一张" prop="claimRule">
<el-input
v-model="queryParams.claimRule"
placeholder="请输入领取规则 0每人限领一张 1每人每日限领一张"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="发放数量" prop="count">
<el-input
v-model="queryParams.count"
placeholder="请输入发放数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="二维码链接" prop="qrCodeLink">
<el-input
v-model="queryParams.qrCodeLink"
placeholder="请输入二维码链接"
clearable
@keyup.enter.native="handleQuery"
/>
</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-hasPermi="['business/marketingActivity:favorable:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business/marketingActivity:favorable:edit']"
>修改</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-hasPermi="['business/marketingActivity:favorable:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['business/marketingActivity:favorable:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="favorableList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" />
<el-table-column label="所属连锁店id" align="center" prop="chainStorId" />
<el-table-column label="所属店铺id" align="center" prop="storeId" />
<el-table-column label="是否在线 0在线 1 下线" align="center" prop="isonline" />
<el-table-column label="优惠券名称" align="center" prop="name" />
<el-table-column label="卡券类型 0油品券 1商品券 2通用券" align="center" prop="type" />
<el-table-column label="优惠类型 0满减券 1折扣券" align="center" prop="discountType" />
<el-table-column label="可用油品 092# 1: 95# 298# 30# 4-10# 5 LNG 6CNG 7京92# 8京95# 9京0#" align="center" prop="oilType" />
<el-table-column label="满减金额" align="center" prop="fullDeduction" />
<el-table-column label="优惠金额" align="center" prop="discountAmount" />
<el-table-column label="满足金额" align="center" prop="satisfiedAmount" />
<el-table-column label="优惠折扣" align="center" prop="specialDiscount" />
<el-table-column label="折扣抵消" align="center" prop="discountOffset" />
<el-table-column label="有效期" align="center" prop="validity" />
<el-table-column label="生效日期" align="center" prop="effectiveDate" />
<el-table-column label="生效时间" align="center" prop="effectiveTime" />
<el-table-column label="可用时段" align="center" prop="availablePeriod" />
<el-table-column label="可用周期类型 day每天可用 week周可用 month月可用" align="center" prop="checkDateType" />
<el-table-column label="可用日期" align="center" prop="checkTime" />
<el-table-column label="排除日期" align="center" prop="checkOutTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.checkOutTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="互斥功能 0满减活动 1储值卡付款" align="center" prop="exclusiveFunction" />
<el-table-column label="领取规则 0每人限领一张 1每人每日限领一张" align="center" prop="claimRule" />
<el-table-column label="发放数量" align="center" prop="count" />
<el-table-column label="二维码链接" align="center" prop="qrCodeLink" />
<el-table-column label="优惠券状态 0启用 1 禁用" align="center" prop="status" />
<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-hasPermi="['business/marketingActivity:favorable:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business/marketingActivity:favorable: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"
/>
<!-- 添加或修改优惠券对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="所属连锁店id" prop="chainStorId">
<el-input v-model="form.chainStorId" placeholder="请输入所属连锁店id" />
</el-form-item>
<el-form-item label="所属店铺id" prop="storeId">
<el-input v-model="form.storeId" placeholder="请输入所属店铺id" />
</el-form-item>
<el-form-item label="是否在线 0在线 1 下线" prop="isonline">
<el-input v-model="form.isonline" placeholder="请输入是否在线 0在线 1 下线" />
</el-form-item>
<el-form-item label="优惠券名称" prop="name">
<el-input v-model="form.name" placeholder="请输入优惠券名称" />
</el-form-item>
<el-form-item label="满减金额" prop="fullDeduction">
<el-input v-model="form.fullDeduction" placeholder="请输入满减金额" />
</el-form-item>
<el-form-item label="优惠金额" prop="discountAmount">
<el-input v-model="form.discountAmount" placeholder="请输入优惠金额" />
</el-form-item>
<el-form-item label="满足金额" prop="satisfiedAmount">
<el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" />
</el-form-item>
<el-form-item label="优惠折扣" prop="specialDiscount">
<el-input v-model="form.specialDiscount" placeholder="请输入优惠折扣" />
</el-form-item>
<el-form-item label="折扣抵消" prop="discountOffset">
<el-input v-model="form.discountOffset" placeholder="请输入折扣抵消" />
</el-form-item>
<el-form-item label="有效期" prop="validity">
<el-input v-model="form.validity" placeholder="请输入有效期" />
</el-form-item>
<el-form-item label="生效日期" prop="effectiveDate">
<el-input v-model="form.effectiveDate" placeholder="请输入生效日期" />
</el-form-item>
<el-form-item label="生效时间" prop="effectiveTime">
<el-input v-model="form.effectiveTime" placeholder="请输入生效时间" />
</el-form-item>
<el-form-item label="可用时段" prop="availablePeriod">
<el-input v-model="form.availablePeriod" placeholder="请输入可用时段" />
</el-form-item>
<el-form-item label="可用日期" prop="checkTime">
<el-input v-model="form.checkTime" placeholder="请输入可用日期" />
</el-form-item>
<el-form-item label="排除日期" prop="checkOutTime">
<el-date-picker clearable
v-model="form.checkOutTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择排除日期">
</el-date-picker>
</el-form-item>
<el-form-item label="互斥功能 0满减活动 1储值卡付款" prop="exclusiveFunction">
<el-input v-model="form.exclusiveFunction" placeholder="请输入互斥功能 0满减活动 1储值卡付款" />
</el-form-item>
<el-form-item label="领取规则 0每人限领一张 1每人每日限领一张" prop="claimRule">
<el-input v-model="form.claimRule" placeholder="请输入领取规则 0每人限领一张 1每人每日限领一张" />
</el-form-item>
<el-form-item label="发放数量" prop="count">
<el-input v-model="form.count" placeholder="请输入发放数量" />
</el-form-item>
<el-form-item label="二维码链接" prop="qrCodeLink">
<el-input v-model="form.qrCodeLink" placeholder="请输入二维码链接" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listFavorable, getFavorable, delFavorable, addFavorable, updateFavorable } from "@/api/business/marketingActivity/favorable";
export default {
name: "Favorable",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
favorableList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
chainStorId: null,
storeId: null,
isonline: null,
name: null,
type: null,
discountType: null,
oilType: null,
fullDeduction: null,
discountAmount: null,
satisfiedAmount: null,
specialDiscount: null,
discountOffset: null,
validity: null,
effectiveDate: null,
effectiveTime: null,
availablePeriod: null,
checkDateType: null,
checkTime: null,
checkOutTime: null,
exclusiveFunction: null,
claimRule: null,
count: null,
qrCodeLink: null,
status: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询优惠券列表 */
getList() {
this.loading = true;
listFavorable(this.queryParams).then(response => {
this.favorableList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
chainStorId: null,
storeId: null,
isonline: null,
name: null,
type: null,
discountType: null,
oilType: null,
fullDeduction: null,
discountAmount: null,
satisfiedAmount: null,
specialDiscount: null,
discountOffset: null,
validity: null,
effectiveDate: null,
effectiveTime: null,
availablePeriod: null,
checkDateType: null,
checkTime: null,
checkOutTime: null,
exclusiveFunction: null,
claimRule: null,
count: null,
qrCodeLink: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
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.reset();
this.open = true;
this.title = "添加优惠券";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getFavorable(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改优惠券";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateFavorable(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFavorable(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除优惠券编号为"' + ids + '"的数据项?').then(function() {
return delFavorable(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('business/marketingActivity/favorable/export', {
...this.queryParams
}, `favorable_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,396 @@
<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="优惠券id" prop="cardFavorableId">
<el-input
v-model="queryParams.cardFavorableId"
placeholder="请输入优惠券id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属连锁店id" prop="chainStorId">
<el-input
v-model="queryParams.chainStorId"
placeholder="请输入所属连锁店id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属店铺id" prop="storeId">
<el-input
v-model="queryParams.storeId"
placeholder="请输入所属店铺id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="会员id" prop="mtUserId">
<el-input
v-model="queryParams.mtUserId"
placeholder="请输入会员id"
clearable
@keyup.enter.native="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="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入会员手机号码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="卡号" prop="ticketCode">
<el-input
v-model="queryParams.ticketCode"
placeholder="请输入卡号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="有效期开始时间" prop="startTime">
<el-date-picker clearable
v-model="queryParams.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择有效期开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="有效期结束时间" prop="endTime">
<el-date-picker clearable
v-model="queryParams.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择有效期结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="描述信息" prop="exchangeFrom">
<el-input
v-model="queryParams.exchangeFrom"
placeholder="请输入描述信息"
clearable
@keyup.enter.native="handleQuery"
/>
</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-hasPermi="['business/marketingActivity:record:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business/marketingActivity:record:edit']"
>修改</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-hasPermi="['business/marketingActivity:record:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['business/marketingActivity:record:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" />
<el-table-column label="优惠券id" align="center" prop="cardFavorableId" />
<el-table-column label="所属连锁店id" align="center" prop="chainStorId" />
<el-table-column label="所属店铺id" align="center" prop="storeId" />
<el-table-column label="会员id" align="center" prop="mtUserId" />
<el-table-column label="会员名字" align="center" prop="name" />
<el-table-column label="会员手机号码" align="center" prop="mobile" />
<el-table-column label="卡号" align="center" prop="ticketCode" />
<el-table-column label="卡券状态 0未使用 1已使用 2已过期" align="center" prop="status" />
<el-table-column label="有效期开始时间" align="center" prop="startTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="有效期结束时间" align="center" prop="endTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="描述信息" align="center" prop="exchangeFrom" />
<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-hasPermi="['business/marketingActivity:record:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business/marketingActivity:record: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"
/>
<!-- 添加或修改优惠券记录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="优惠券id" prop="cardFavorableId">
<el-input v-model="form.cardFavorableId" placeholder="请输入优惠券id" />
</el-form-item>
<el-form-item label="所属连锁店id" prop="chainStorId">
<el-input v-model="form.chainStorId" placeholder="请输入所属连锁店id" />
</el-form-item>
<el-form-item label="所属店铺id" prop="storeId">
<el-input v-model="form.storeId" placeholder="请输入所属店铺id" />
</el-form-item>
<el-form-item label="会员id" prop="mtUserId">
<el-input v-model="form.mtUserId" placeholder="请输入会员id" />
</el-form-item>
<el-form-item label="会员名字" prop="name">
<el-input v-model="form.name" placeholder="请输入会员名字" />
</el-form-item>
<el-form-item label="会员手机号码" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入会员手机号码" />
</el-form-item>
<el-form-item label="卡号" prop="ticketCode">
<el-input v-model="form.ticketCode" placeholder="请输入卡号" />
</el-form-item>
<el-form-item label="有效期开始时间" prop="startTime">
<el-date-picker clearable
v-model="form.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择有效期开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="有效期结束时间" prop="endTime">
<el-date-picker clearable
v-model="form.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择有效期结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="描述信息" prop="exchangeFrom">
<el-input v-model="form.exchangeFrom" placeholder="请输入描述信息" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/business/marketingActivity/record";
export default {
name: "Record",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
recordList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
cardFavorableId: null,
chainStorId: null,
storeId: null,
mtUserId: null,
name: null,
mobile: null,
ticketCode: null,
status: null,
startTime: null,
endTime: null,
exchangeFrom: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询优惠券记录列表 */
getList() {
this.loading = true;
listRecord(this.queryParams).then(response => {
this.recordList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
cardFavorableId: null,
chainStorId: null,
storeId: null,
mtUserId: null,
name: null,
mobile: null,
ticketCode: null,
status: null,
startTime: null,
endTime: null,
exchangeFrom: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
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.reset();
this.open = true;
this.title = "添加优惠券记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getRecord(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改优惠券记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateRecord(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRecord(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除优惠券记录编号为"' + ids + '"的数据项?').then(function() {
return delRecord(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('business/marketingActivity/record/export', {
...this.queryParams
}, `record_${new Date().getTime()}.xlsx`)
}
}
};
</script>