Commit 6b526d63 by 吕明尚

修改后台管理系统,增加抽奖,奖品,集点,配置页面

parent 1133aa5f
import request from '@/utils/request'
// 查询抽奖记录日志列表
export function listLotteryRecordsLog(query) {
return request({
url: '/system/lotteryRecordsLog/list',
method: 'get',
params: query
})
}
// 查询抽奖记录日志详细
export function getLotteryRecordsLog(id) {
return request({
url: '/system/lotteryRecordsLog/' + id,
method: 'get'
})
}
// 新增抽奖记录日志
export function addLotteryRecordsLog(data) {
return request({
url: '/system/lotteryRecordsLog',
method: 'post',
data: data
})
}
// 修改抽奖记录日志
export function updateLotteryRecordsLog(data) {
return request({
url: '/system/lotteryRecordsLog',
method: 'put',
data: data
})
}
// 删除抽奖记录日志
export function delLotteryRecordsLog(id) {
return request({
url: '/system/lotteryRecordsLog/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
// 查询用户集点活动列表
export function listPointActivities(query) {
return request({
url: '/system/pointActivities/list',
method: 'get',
params: query
})
}
// 查询用户集点活动详细
export function getPointActivities(id) {
return request({
url: '/system/pointActivities/' + id,
method: 'get'
})
}
// 新增用户集点活动
export function addPointActivities(data) {
return request({
url: '/system/pointActivities',
method: 'post',
data: data
})
}
// 修改用户集点活动
export function updatePointActivities(data) {
return request({
url: '/system/pointActivities',
method: 'put',
data: data
})
}
// 删除用户集点活动
export function delPointActivities(id) {
return request({
url: '/system/pointActivities/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
// 查询用户集点活动配置列表
export function listPointActivitiesConf(query) {
return request({
url: '/system/pointActivitiesConf/list',
method: 'get',
params: query
})
}
// 查询用户集点活动配置详细
export function getPointActivitiesConf(id) {
return request({
url: '/system/pointActivitiesConf/' + id,
method: 'get'
})
}
// 新增用户集点活动配置
export function addPointActivitiesConf(data) {
return request({
url: '/system/pointActivitiesConf',
method: 'post',
data: data
})
}
// 修改用户集点活动配置
export function updatePointActivitiesConf(data) {
return request({
url: '/system/pointActivitiesConf',
method: 'put',
data: data
})
}
// 删除用户集点活动配置
export function delPointActivitiesConf(id) {
return request({
url: '/system/pointActivitiesConf/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
// 查询奖品列表
export function listPrize(query) {
return request({
url: '/system/prize/list',
method: 'get',
params: query
})
}
// 查询奖品详细
export function getPrize(id) {
return request({
url: '/system/prize/' + id,
method: 'get'
})
}
// 新增奖品
export function addPrize(data) {
return request({
url: '/system/prize',
method: 'post',
data: data
})
}
// 修改奖品
export function updatePrize(data) {
return request({
url: '/system/prize',
method: 'put',
data: data
})
}
// 删除奖品
export function delPrize(id) {
return request({
url: '/system/prize/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
// 查询转盘游戏列表
export function listWheelGame(query) {
return request({
url: '/system/wheelGame/list',
method: 'get',
params: query
})
}
export function query(query) {
return request({
url: '/system/wheelGame/query',
method: 'get',
params: query
})
}
// 查询转盘游戏详细
export function getWheelGame(id) {
return request({
url: '/system/wheelGame/' + id,
method: 'get'
})
}
// 新增转盘游戏
export function addWheelGame(data) {
return request({
url: '/system/wheelGame',
method: 'post',
data: data
})
}
// 修改转盘游戏
export function updateWheelGame(data) {
return request({
url: '/system/wheelGame',
method: 'put',
data: data
})
}
// 删除转盘游戏
export function delWheelGame(id) {
return request({
url: '/system/wheelGame/' + id,
method: 'delete'
})
}
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item label="游戏id" prop="gameId">
<el-input
v-model="queryParams.gameId"
clearable
placeholder="请输入游戏id"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="用户id" prop="userId">-->
<!-- <el-input-->
<!-- v-model="queryParams.userId"-->
<!-- placeholder="请输入用户id"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="用户名" prop="userName">
<el-input
v-model="queryParams.userName"
clearable
placeholder="请输入用户名"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model="queryParams.phone"
clearable
placeholder="请输入手机号"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="抽奖时间" prop="drawTime">
<el-date-picker v-model="queryParams.drawTime"
clearable
placeholder="请选择抽奖时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="是否中奖" prop="isHit">
<el-select v-model="queryParams.isHit" clearable placeholder="请选择是否中奖">
<el-option
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="中奖奖品" prop="hitPrize">-->
<!-- <el-input-->
<!-- v-model="queryParams.hitPrize"-->
<!-- placeholder="请输入中奖奖品"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label=" 是否发放 1未发放,2 已发放 3 发放失败" prop="isSend">
<el-input
v-model="queryParams.isSend"
clearable
placeholder="请输入 是否发放 1未发放,2 已发放 3 发放失败"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @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="['system:lotteryRecordsLog: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="['system:lotteryRecordsLog: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="['system:lotteryRecordsLog:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
v-hasPermi="['system:lotteryRecordsLog:export']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="lotteryRecordsLogList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<!-- <el-table-column label="主键" align="center" prop="id" />-->
<el-table-column align="center" label="游戏id" prop="gameId"/>
<el-table-column align="center" label="用户id" prop="userId"/>
<el-table-column align="center" label="用户名" prop="userName"/>
<el-table-column align="center" label="手机号" prop="phone"/>
<el-table-column align="center" label="抽奖时间" prop="drawTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.drawTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="是否中奖 0:未中奖 1:中奖" prop="isHit"/>
<el-table-column align="center" label="中奖奖品" prop="hitPrize"/>
<el-table-column align="center" label=" 是否发放 1未发放,2 已发放 3 发放失败" prop="isSend"/>
<el-table-column align="center" label="发放结果" prop="sendMsg"/>
<el-table-column align="center" label="备注" prop="remark"/>
<!-- <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="['system:lotteryRecordsLog:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['system:lotteryRecordsLog:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 添加或修改抽奖记录日志对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="游戏id" prop="gameId">
<el-input v-model="form.gameId" placeholder="请输入游戏id"/>
</el-form-item>
<el-form-item label="用户id" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户id"/>
</el-form-item>
<el-form-item label="用户名" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名"/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号"/>
</el-form-item>
<el-form-item label="抽奖时间" prop="drawTime">
<el-date-picker v-model="form.drawTime"
clearable
placeholder="请选择抽奖时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="是否中奖 0:未中奖 1:中奖" prop="isHit">
<el-input v-model="form.isHit" placeholder="请输入是否中奖 0:未中奖 1:中奖"/>
</el-form-item>
<el-form-item label="中奖奖品" prop="hitPrize">
<el-input v-model="form.hitPrize" placeholder="请输入中奖奖品"/>
</el-form-item>
<el-form-item label=" 是否发放 1未发放,2 已发放 3 发放失败" prop="isSend">
<el-input v-model="form.isSend" placeholder="请输入 是否发放 1未发放,2 已发放 3 发放失败"/>
</el-form-item>
<el-form-item label="发放结果" prop="sendMsg">
<el-input v-model="form.sendMsg" placeholder="请输入内容" type="textarea"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>
</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 {
listLotteryRecordsLog,
getLotteryRecordsLog,
delLotteryRecordsLog,
addLotteryRecordsLog,
updateLotteryRecordsLog
} from "@/api/system/lotteryRecordsLog";
export default {
name: "LotteryRecordsLog",
dicts: ['store_is_use_coupon',],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 抽奖记录日志表格数据
lotteryRecordsLogList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
gameId: null,
userId: null,
userName: null,
phone: null,
drawTime: null,
isHit: null,
hitPrize: null,
isSend: null,
sendMsg: null,
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询抽奖记录日志列表 */
getList() {
this.loading = true;
listLotteryRecordsLog(this.queryParams).then(response => {
this.lotteryRecordsLogList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
gameId: null,
userId: null,
userName: null,
phone: null,
drawTime: null,
isHit: null,
hitPrize: null,
isSend: null,
sendMsg: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: 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
getLotteryRecordsLog(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) {
updateLotteryRecordsLog(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLotteryRecordsLog(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 delLotteryRecordsLog(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/lotteryRecordsLog/export', {
...this.queryParams
}, `lotteryRecordsLog_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item label="用户ID" prop="consumerId">
<el-input
v-model="queryParams.consumerId"
clearable
placeholder="请输入用户ID"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="配置ID" prop="confId">
<el-input
v-model="queryParams.confId"
clearable
placeholder="请输入配置ID"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="已累计点数" prop="points">
<el-input
v-model="queryParams.points"
clearable
placeholder="请输入已累计点数"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="上次消费时间" prop="lastConsumptionTime">
<el-date-picker v-model="queryParams.lastConsumptionTime"
clearable
placeholder="请选择上次消费时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="是否可领取" prop="isReceive">
<el-select v-model="queryParams.isReceive" clearable placeholder="请选择是否可领取">
<el-option
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否已领取优惠券" prop="couponReceived">
<el-select v-model="queryParams.couponReceived" clearable placeholder="请选择是否已领取优惠券">
<el-option
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="优惠券领取日期" prop="receivedDate">
<el-date-picker v-model="queryParams.receivedDate"
clearable
placeholder="请选择优惠券领取日期"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="优惠券过期日期" prop="couponExpirationDate">
<el-date-picker v-model="queryParams.couponExpirationDate"
clearable
placeholder="请选择优惠券过期日期"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="是否删除(0:否,1:是)" prop="isDelete">
<el-input
v-model="queryParams.isDelete"
clearable
placeholder="请输入是否删除(0:否,1:是)"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @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
v-hasPermi="['system:pointActivities:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:pointActivities:edit']"
:disabled="single"
icon="el-icon-edit"
plain
size="mini"
type="success"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:pointActivities:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:pointActivities:export']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="pointActivitiesList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="center" label="主键" prop="id"/>
<el-table-column align="center" label="用户ID" prop="consumerId"/>
<el-table-column align="center" label="配置ID" prop="confId"/>
<el-table-column align="center" label="已累计点数" prop="points"/>
<el-table-column align="center" label="上次消费时间" prop="lastConsumptionTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.lastConsumptionTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="是否可领取" prop="isReceive">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_is_use_coupon" :value="scope.row.isReceive"/>
</template>
</el-table-column>
<el-table-column align="center" label="是否已领取优惠券" prop="couponReceived">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_is_use_coupon" :value="scope.row.couponReceived"/>
</template>
</el-table-column>
<el-table-column align="center" label="优惠券领取日期" prop="receivedDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.receivedDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="优惠券过期日期" prop="couponExpirationDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.couponExpirationDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="是否删除(0:否,1:是)" prop="isDelete"/>
<el-table-column align="center" label="备注" prop="remark"/>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:pointActivities:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
v-hasPermi="['system:pointActivities:remove']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 添加或修改用户集点活动对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户ID" prop="consumerId">
<el-input v-model="form.consumerId" placeholder="请输入用户ID"/>
</el-form-item>
<el-form-item label="配置ID" prop="confId">
<el-input v-model="form.confId" placeholder="请输入配置ID"/>
</el-form-item>
<el-form-item label="已累计点数" prop="points">
<el-input v-model="form.points" placeholder="请输入已累计点数"/>
</el-form-item>
<el-form-item label="上次消费时间" prop="lastConsumptionTime">
<el-date-picker v-model="form.lastConsumptionTime"
clearable
placeholder="请选择上次消费时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="是否可领取" prop="isReceive">
<el-radio-group v-model="form.isReceive">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否已领取优惠券" prop="couponReceived">
<el-radio-group v-model="form.couponReceived">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="优惠券领取日期" prop="receivedDate">
<el-date-picker v-model="form.receivedDate"
clearable
placeholder="请选择优惠券领取日期"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="优惠券过期日期" prop="couponExpirationDate">
<el-date-picker v-model="form.couponExpirationDate"
clearable
placeholder="请选择优惠券过期日期"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="是否删除(0:否,1:是)" prop="isDelete">
<el-input v-model="form.isDelete" placeholder="请输入是否删除(0:否,1:是)"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" 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 {
listPointActivities,
getPointActivities,
delPointActivities,
addPointActivities,
updatePointActivities
} from "@/api/system/pointActivities";
export default {
name: "PointActivities",
dicts: ['store_is_use_coupon'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 用户集点活动表格数据
pointActivitiesList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
consumerId: null,
confId: null,
points: null,
lastConsumptionTime: null,
isReceive: null,
couponReceived: null,
receivedDate: null,
couponExpirationDate: null,
isDelete: null,
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询用户集点活动列表 */
getList() {
this.loading = true;
listPointActivities(this.queryParams).then(response => {
this.pointActivitiesList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
consumerId: null,
confId: null,
points: null,
lastConsumptionTime: null,
isReceive: null,
couponReceived: null,
receivedDate: null,
couponExpirationDate: null,
isDelete: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: 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
getPointActivities(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) {
updatePointActivities(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPointActivities(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 delPointActivities(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/pointActivities/export', {
...this.queryParams
}, `pointActivities_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item label="配置名称" prop="name">
<el-input
v-model="queryParams.name"
clearable
placeholder="请输入配置名称"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="集点所需的消费次数" prop="pointsRequired">
<el-input
v-model="queryParams.pointsRequired"
clearable
placeholder="请输入集点所需的消费次数"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="每次消费的时间间隔(小时)" prop="timeInterval">
<el-input
v-model="queryParams.timeInterval"
clearable
placeholder="请输入每次消费的时间间隔(小时)"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优惠券Id" prop="couponId">
<el-input
v-model="queryParams.couponId"
clearable
placeholder="请输入优惠券Id"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优惠券的领取期限 (天)" prop="collectionDeadline">
<el-input
v-model="queryParams.collectionDeadline"
clearable
placeholder="请输入优惠券的领取期限 (天)"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优惠券的使用期限 (天)" prop="couponDuration">
<el-input
v-model="queryParams.couponDuration"
clearable
placeholder="请输入优惠券的使用期限 (天)"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="集点活动的重置周期 (月)" prop="collectionResetPeriod">
<el-input
v-model="queryParams.collectionResetPeriod"
clearable
placeholder="请输入集点活动的重置周期 (月)"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否开启" prop="isOpen">
<el-select v-model="queryParams.isOpen" clearable placeholder="请选择是否开启">
<el-option
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否删除(0:否,1:是)" prop="isDelete">
<el-input
v-model="queryParams.isDelete"
clearable
placeholder="请输入是否删除(0:否,1:是)"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @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
v-hasPermi="['system:pointActivitiesConf:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:pointActivitiesConf:edit']"
:disabled="single"
icon="el-icon-edit"
plain
size="mini"
type="success"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:pointActivitiesConf:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:pointActivitiesConf:export']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="pointActivitiesConfList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="center" label="主键" prop="id"/>
<el-table-column align="center" label="配置名称" prop="name"/>
<el-table-column align="center" label="集点所需的消费次数" prop="pointsRequired"/>
<el-table-column align="center" label="每次消费的时间间隔(小时)" prop="timeInterval"/>
<el-table-column align="center" label="优惠券Id" prop="couponId"/>
<el-table-column align="center" label="优惠券的领取期限 (天)" prop="collectionDeadline"/>
<el-table-column align="center" label="优惠券的使用期限 (天)" prop="couponDuration"/>
<el-table-column align="center" label="集点活动的重置周期 (月)" prop="collectionResetPeriod"/>
<el-table-column align="center" label="是否开启" prop="isOpen">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_is_use_coupon" :value="scope.row.isOpen"/>
</template>
</el-table-column>
<el-table-column align="center" label="是否删除(0:否,1:是)" prop="isDelete"/>
<el-table-column align="center" label="备注" prop="remark"/>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:pointActivitiesConf:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
v-hasPermi="['system:pointActivitiesConf:remove']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 添加或修改用户集点活动配置对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="配置名称" prop="name">
<el-input v-model="form.name" placeholder="请输入配置名称"/>
</el-form-item>
<el-form-item label="集点所需的消费次数" prop="pointsRequired">
<el-input v-model="form.pointsRequired" placeholder="请输入集点所需的消费次数"/>
</el-form-item>
<el-form-item label="每次消费的时间间隔(小时)" prop="timeInterval">
<el-input v-model="form.timeInterval" placeholder="请输入每次消费的时间间隔(小时)"/>
</el-form-item>
<el-form-item label="优惠券Id" prop="couponId">
<el-input v-model="form.couponId" placeholder="请输入优惠券Id"/>
</el-form-item>
<el-form-item label="优惠券的领取期限 (天)" prop="collectionDeadline">
<el-input v-model="form.collectionDeadline" placeholder="请输入优惠券的领取期限 (天)"/>
</el-form-item>
<el-form-item label="优惠券的使用期限 (天)" prop="couponDuration">
<el-input v-model="form.couponDuration" placeholder="请输入优惠券的使用期限 (天)"/>
</el-form-item>
<el-form-item label="集点活动的重置周期 (月)" prop="collectionResetPeriod">
<el-input v-model="form.collectionResetPeriod" placeholder="请输入集点活动的重置周期 (月)"/>
</el-form-item>
<el-form-item label="是否开启" prop="isOpen">
<el-radio-group v-model="form.isOpen">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否删除(0:否,1:是)" prop="isDelete">
<el-input v-model="form.isDelete" placeholder="请输入是否删除(0:否,1:是)"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" 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 {
listPointActivitiesConf,
getPointActivitiesConf,
delPointActivitiesConf,
addPointActivitiesConf,
updatePointActivitiesConf
} from "@/api/system/pointActivitiesConf";
export default {
name: "PointActivitiesConf",
dicts: ['store_is_use_coupon'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 用户集点活动配置表格数据
pointActivitiesConfList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
pointsRequired: null,
timeInterval: null,
couponId: null,
collectionDeadline: null,
couponDuration: null,
collectionResetPeriod: null,
isOpen: null,
isDelete: null,
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询用户集点活动配置列表 */
getList() {
this.loading = true;
listPointActivitiesConf(this.queryParams).then(response => {
this.pointActivitiesConfList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
pointsRequired: null,
timeInterval: null,
couponId: null,
collectionDeadline: null,
couponDuration: null,
collectionResetPeriod: null,
isOpen: null,
isDelete: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: 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
getPointActivitiesConf(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) {
updatePointActivitiesConf(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPointActivitiesConf(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 delPointActivitiesConf(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/pointActivitiesConf/export', {
...this.queryParams
}, `pointActivitiesConf_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<!-- <el-form-item label="游戏id" prop="gameId">-->
<!-- <el-input-->
<!-- v-model="queryParams.gameId"-->
<!-- placeholder="请输入游戏id"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="奖品名字" prop="prizeName">
<el-input
v-model="queryParams.prizeName"
clearable
placeholder="请输入奖品名字"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="奖品类型" prop="prizeType">
<el-select v-model="queryParams.prizeType" clearable placeholder="请选择奖品类型">
<el-option
v-for="dict in dict.type.prize_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="奖品值" prop="prizeValue">-->
<!-- <el-input-->
<!-- v-model="queryParams.prizeValue"-->
<!-- placeholder="请输入奖品值"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="当前命中" prop="currentNum">-->
<!-- <el-input-->
<!-- v-model="queryParams.currentNum"-->
<!-- placeholder="请输入当前命中"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="最大中奖数 0:代表不限制" prop="maxNum">-->
<!-- <el-input-->
<!-- v-model="queryParams.maxNum"-->
<!-- placeholder="请输入最大中奖数 0:代表不限制"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="中奖几率" prop="ratio">-->
<!-- <el-input-->
<!-- v-model="queryParams.ratio"-->
<!-- placeholder="请输入中奖几率"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @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
v-hasPermi="['system:prize:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:prize:edit']"
:disabled="single"
icon="el-icon-edit"
plain
size="mini"
type="success"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:prize:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:prize:export']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="prizeList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<!-- <el-table-column label="主键" align="center" prop="id" />-->
<!-- <el-table-column label="游戏id" align="center" prop="gameId" />-->
<el-table-column align="center" label="游戏名称" prop="gameName"/>
<el-table-column align="center" label="优惠券名称" prop="couponName"/>
<el-table-column align="center" label="奖品类型" prop="prizeType">
<template slot-scope="scope">
<dict-tag :options="dict.type.prize_type" :value="scope.row.prizeType"/>
</template>
</el-table-column>
<el-table-column align="center" label="奖品名字" prop="prizeName"/>
<el-table-column align="center" label="奖品值" prop="prizeValue"/>
<el-table-column align="center" label="当前命中" prop="currentNum"/>
<el-table-column align="center" label="最大中奖数" prop="maxNum"/>
<el-table-column align="center" label="中奖几率" prop="ratio"/>
<el-table-column align="center" label="备注" prop="remark"/>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:prize:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
v-hasPermi="['system:prize:remove']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 添加或修改奖品对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- <el-form-item label="游戏id" prop="gameId">-->
<!-- <el-input v-model="form.gameId" placeholder="请输入游戏id" />-->
<!-- </el-form-item>-->
<el-form-item label="游戏" prop="gameId">
<el-select v-model="form.gameId" clearable placeholder="请选择游戏">
<el-option
v-for="item in wheelGameList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="奖品类型" prop="prizeType">
<el-select v-model="form.prizeType" placeholder="请选择奖品类型">
<el-option
v-for="dict in dict.type.prize_type"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="form.prizeType == 1 " label="优惠券" prop="couponId">
<el-select v-model="form.couponId" clearable placeholder="请选择优惠券">
<el-option
v-for="item in couponList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="奖品名字" prop="prizeName">
<el-input v-model="form.prizeName" placeholder="请输入奖品名字"/>
</el-form-item>
<el-form-item label="奖品值" prop="prizeValue">
<el-input-number v-model="form.prizeValue" :max="999" :min="1"/>
</el-form-item>
<el-form-item label="当前命中" prop="currentNum">
<el-input-number v-model="form.currentNum" :max="999" :min="0" disabled/>
</el-form-item>
<el-form-item label="最大中奖数" prop="maxNum">
<el-input-number v-model="form.maxNum" :max="999" :min="0" disabled/>
</el-form-item>
<el-form-item label="中奖几率" prop="ratio">
<el-input-number v-model="form.ratio" :max="999" :min="1" :step="1"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>
</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 {listPrize, getPrize, delPrize, addPrize, updatePrize} from "@/api/system/prize";
import {query} from "@/api/system/wheelGame";
import {durationCoupon} from "../../../api/system/coupon";
import moment from "moment/moment";
export default {
name: "Prize",
dicts: ['prize_type',],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 奖品表格数据
prizeList: [],
couponList: [],
wheelGameList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
gameId: null,
prizeType: null,
prizeName: null,
prizeValue: null,
currentNum: null,
maxNum: null,
ratio: null,
},
couponQueryParams: {
endDate: null
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
created() {
this.getList();
this.getCouponList();
this.getGameList();
},
methods: {
/** 查询奖品列表 */
getList() {
this.loading = true;
listPrize(this.queryParams).then(response => {
this.prizeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
gameId: null,
prizeType: null,
prizeName: null,
prizeValue: null,
currentNum: null,
maxNum: null,
ratio: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: 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
getPrize(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) {
updatePrize(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPrize(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 delPrize(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/prize/export', {
...this.queryParams
}, `prize_${new Date().getTime()}.xlsx`)
},
getCouponList() {
this.couponQueryParams.endDate = moment().format('YYYY-MM-DD')
durationCoupon(this.couponQueryParams).then(response => {
this.couponList = response.data;
});
},
getGameList() {
query().then(response => {
this.wheelGameList = response.data;
});
}
}
};
</script>
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item label="活动名称" prop="name">
<el-input
v-model="queryParams.name"
clearable
placeholder="请输入活动名称"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker v-model="queryParams.startTime"
clearable
placeholder="请选择开始时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker v-model="queryParams.endTime"
clearable
placeholder="请选择结束时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input
v-model="queryParams.description"
clearable
placeholder="请输入描述"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="单人当天限制次数 0:代表不限制" prop="dayLimit">-->
<!-- <el-input-->
<!-- v-model="queryParams.dayLimit"-->
<!-- placeholder="请输入单人当天限制次数 0:代表不限制"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="单人总次数限制 0:代表不限制" prop="singleLimit">-->
<!-- <el-input-->
<!-- v-model="queryParams.singleLimit"-->
<!-- placeholder="请输入单人总次数限制 0:代表不限制"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="是否开启" prop="isOpen">
<el-select v-model="queryParams.isOpen" clearable placeholder="请选择是否开启">
<el-option
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @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
v-hasPermi="['system:wheelGame:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:wheelGame:edit']"
:disabled="single"
icon="el-icon-edit"
plain
size="mini"
type="success"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:wheelGame:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:wheelGame:export']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="wheelGameList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<!-- <el-table-column label="主键" align="center" prop="id" />-->
<el-table-column align="center" label="活动名称" prop="name"/>
<el-table-column align="center" label="开始时间" prop="startTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="结束时间" prop="endTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="描述" prop="description"/>
<el-table-column align="center" label="单人当天限制次数" prop="dayLimit"/>
<el-table-column align="center" label="单人总次数限制" prop="singleLimit"/>
<el-table-column align="center" label="是否开启" prop="isOpen">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_is_use_coupon" :value="scope.row.isOpen"/>
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark"/>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:wheelGame:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
v-hasPermi="['system:wheelGame:remove']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 添加或修改转盘游戏对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="活动名称" prop="name">
<el-input v-model="form.name" placeholder="请输入活动名称"/>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker v-model="form.startTime"
clearable
placeholder="请选择开始时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker v-model="form.endTime"
clearable
placeholder="请选择结束时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" placeholder="请输入描述"/>
</el-form-item>
<el-form-item label="单人当天限制次数" prop="dayLimit">
<el-input-number v-model="form.dayLimit" :max="999" :min="0" disabled/>
</el-form-item>
<el-form-item label="单人总次数限制" prop="singleLimit">
<el-input-number v-model="form.singleLimit" :max="999" :min="0" disabled/>
</el-form-item>
<el-form-item label="是否开启" prop="isOpen">
<el-radio-group v-model="form.isOpen">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>
</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 {listWheelGame, getWheelGame, delWheelGame, addWheelGame, updateWheelGame} from "@/api/system/wheelGame";
export default {
name: "WheelGame",
dicts: ['store_is_use_coupon',],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 转盘游戏表格数据
wheelGameList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
startTime: null,
endTime: null,
description: null,
dayLimit: null,
singleLimit: null,
isOpen: null,
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询转盘游戏列表 */
getList() {
this.loading = true;
listWheelGame(this.queryParams).then(response => {
this.wheelGameList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
startTime: null,
endTime: null,
description: null,
dayLimit: null,
singleLimit: null,
isOpen: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: 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
getWheelGame(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) {
updateWheelGame(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWheelGame(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 delWheelGame(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/wheelGame/export', {
...this.queryParams
}, `wheelGame_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment