first commit

This commit is contained in:
2026-09-21 19:21:35 +08:00
commit 6c944c4ffd
2733 changed files with 296956 additions and 0 deletions
@@ -0,0 +1,245 @@
<template>
<div class="home">
<el-table :data="pagedTableData" style="width: 100%" v-loading="loading">
<el-table-column align="center" prop="itemName" label="装备名称"></el-table-column>
<el-table-column align="center" prop="itemName" label="装备图片">
<template slot-scope="scope">
<image-preview :src="scope.row.imageUrl" :width="40" :height="40" />
</template>
</el-table-column>
<el-table-column align="center" prop="usePrice" label="价格"></el-table-column>
<el-table-column align="center" prop="userId" label="获奖用户ID">
<template slot-scope="scope">{{scope.row.userId || '无'}}</template>
</el-table-column>
<el-table-column align="center" prop="nickName" label="获奖用户昵称">
<template slot-scope="scope">{{scope.row.nickName || '无'}}</template>
</el-table-column>
<el-table-column align="center" prop="designatedBy" label="指定人">
<template slot-scope="scope">{{scope.row.designatedBy || "无" }}</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button type="text" @click="handleAppoint(scope.row)">指定获奖者</el-button>
<el-button type="text" @click="cancelNamedWinnerMethod(scope.row)">取消奖品</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:limit.sync="pageQuery.pageSize"
:page.sync="pageQuery.pageNum"
:total="total"
/>
<el-dialog title="指定获奖者" :visible.sync="dialogFormVisible">
<el-form :model="formAdd" label-width="120px">
<el-form-item label="用户">
<el-popover placement="bottom-start" width="460" trigger="hover" ref="morePop">
<el-input slot="reference" v-model="form.nickName" placeholder="用户 " readonly></el-input>
<el-form>
<el-row>
<el-col :span="18">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
@input="filterUsers"
></el-input>
</el-col>
<el-col :span="6">
<el-button @click="filterUsers" style="margin-left: 35px;">搜索</el-button>
</el-col>
</el-row>
<el-row>
<el-form v-loading="loadings" v-if="userList !== null">
<div class="magicbox" @scroll="scrollEventFn" v-if="userList.length > 0">
<div
class="magic"
v-for="(item,index) in userList"
:key="index"
@click="addOr(item)"
>
<div>{{ item.userId }}</div>
<div>{{ item.nickName }}</div>
<div>{{item.userName}}</div>
</div>
</div>
<div v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">无此用户</div>
</div>
</el-form>
<el-form v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">请输入用户ID</div>
</el-form>
</el-row>
</el-form>
</el-popover>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSubmit">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listUser } from "@/api/skins/ttuser/api";
import {
getRollPrizeList,
namedWinner,
cancelNamedWinner,
getzhidinguser,
roll,
delRoll,
rollChange
} from "@/api/skins/ttRoll/api";
export default {
name: 'AwardDetail',
data() {
return {
loading: false,
formAdd: {},
orOnselects: {},
orform: {},
userList: {},
allUserList: [],
id: Number(this.$route.query.id),
tableData: [],
total: 0,
pageQuery: {
pageNum: 1,
pageSize: 10
},
dialogFormVisible: false,
loadings: false,
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: null,
phoneNumber: null,
status: null,
certifyId: null,
userId: null,
userName: null,
userType: null
},
form: {},
forms: {
nickName: null
}
};
},
watch: {
dialogFormVisible: {
handler(aa, bb) {
if (aa == false) {
this.form = {};
this.getList();
}
}
}
},
mounted() {
this.getList();
this.serchornaments();
},
computed: {
// 奖品列表(前端分页)
pagedTableData() {
const start = (this.pageQuery.pageNum - 1) * this.pageQuery.pageSize;
return this.tableData.slice(start, start + this.pageQuery.pageSize);
}
},
methods: {
addOr(res) {
this.form.nickName = res.nickName;
this.form.userId = res.userId;
this.$refs.morePop.doClose();
},
handleSubmit() {
this.form.rollUserId = this.form.userId
namedWinner(this.form).then(res => {
this.dialogFormVisible = false;
this.getList();
this.$message({
message: "编辑成功",
type: "success"
});
});
},
cancelNamedWinnerMethod(row) {
console.log(row);
if (row.rollUserPrizeId) {
cancelNamedWinner([row.rollUserPrizeId]).then(res => {
this.getList();
this.$message({
message: "取消成功",
type: "success"
});
});
}
},
serchornaments() {
this.loadings = true;
getzhidinguser(this.id).then(response => {
this.allUserList = response.data || [];
this.filterUsers();
this.loadings = false;
});
},
// 按用户ID过滤roll房成员
filterUsers() {
const keyword = (this.queryParams.userId || "").toString().trim();
if (!keyword) {
this.userList = this.allUserList;
return;
}
this.userList = this.allUserList.filter(
item => item.userId != null && String(item.userId).indexOf(keyword) !== -1
);
},
handleAppoint(res) {
//校验是否已有中奖者
console.log("中奖者校验...")
this.dialogFormVisible = true;
this.form = res;
},
scrollEventFn(e) {
// 成员列表一次性加载完成,无需滚动追加(原逻辑会重复追加同一批数据)
},
getList() {
this.loading = true;
getRollPrizeList(this.id).then(res => {
this.tableData = res.data || [];
this.total = this.tableData.length;
this.loading = false;
});
}
}
};
</script>
<style lang="scss" scoped>
.magicbox {
margin: 0 auto;
margin-top: 5px;
height: 300px;
overflow-y: scroll;
.magic {
height: 32px;
padding: 2px 5px;
line-height: 32px;
display: flex;
align-items: center;
justify-content: space-between;
&:hover {
background-color: #409eff;
transition: all ease 0.3s;
}
}
}
.home {
padding: 20px;
}
</style>
+655
View File
@@ -0,0 +1,655 @@
<template>
<div class="home">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="ID" prop="userName">
<el-input
v-model="queryParams.id"
placeholder="请输入Roll房ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="Roll房名称 " prop="nickName">
<el-input
v-model="queryParams.rollName"
placeholder="请输入Roll房名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="Roll房状态 " prop="rollStatus">
<el-select v-model="queryParams.rollStatus" placeholder="请选择Roll房类型" clearable>
<el-option label="已结束" value="1"></el-option>
<el-option label="进行中" value="0"></el-option>
</el-select>
</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="success"
plain
icon="el-icon-plus"
size="mini"
@click="handleCreat"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-edit"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50" align="center" />
<el-table-column align="center" prop="id" label="Id" width="50"></el-table-column>
<el-table-column align="center" prop="rollName" label="房间名" width="150"></el-table-column>
<el-table-column align="center" prop="rollType" label="房间类型" width="103">
<template slot-scope="scope">
<el-tag v-if="scope.row.rollType == 0">官方</el-tag>
<el-tag v-else>主播</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="rollPassword" label="密码" width="80"></el-table-column>
<el-table-column align="center" prop="peopleNum" label="可参与人数" width="123"></el-table-column>
<el-table-column align="center" prop="endTime" label="开奖时间" width="188"></el-table-column>
<el-table-column align="center" prop="rechargeStartTime" label="计算充值起始日期" width="188"></el-table-column>
<el-table-column align="center" prop="minRecharge" label="充值X币" width="103"></el-table-column>
<el-table-column align="center" prop="vipLevel" label="VIP门槛" width="103">
<template slot-scope="scope">
VIP{{ scope.row.vipLevel || 0 }}
</template>
</el-table-column>
<el-table-column align="center" prop="rollStatus" label="状态" width="103">
<template slot-scope="scope">
<div
v-if="scope.row.rollStatus == '0'"
style="display:flex; align-items:center;justify-content:center;line-height: 1;"
>
<span
style="width: 8px; height:8px; margin-right:10px; border-radius: 50%; background-color: green; display:inline-block;"
></span>
进行中
</div>
<div
v-if="scope.row.rollStatus == '1'"
style="display:flex; align-items:center;justify-content:center;"
>
<span
style="width: 8px; height:8px; margin-right:10px; border-radius: 50%; background-color: #DD4B39; display:inline-block;"
></span>
已结束
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="sortBy" label="置顶"></el-table-column>
<el-table-column align="center" prop="createBy" label="创建用户" width="103"></el-table-column>
<el-table-column align="center" prop="createTime" label="创建时间" width="188"></el-table-column>
<el-table-column align="center" prop="address" label="操作" width="180">
<template slot-scope="scope">
<el-button
type="text"
size="mini"
icon="el-icon-delete"
@click="handleDelete(scope.row.id)"
>删除</el-button>
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleChange(scope.row)">修改</el-button>
<el-button type="text" size="mini" icon="el-icon-view" @click="handleSelect(scope.row)">详情</el-button>
<el-button type="text" size="mini" icon="el-icon-view" @click="handleRouter(scope.row)">装备列表</el-button>
<el-button type="text" size="mini" icon="el-icon-view" @click="rollUser(scope.row)">房间用户</el-button>
<el-button type="text" size="mini" icon="el-icon-trophy" @click="handleWinning(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="dialogFormVisible" width="30%">
<el-form :model="form" :rules="rules" label-width="100px" ref="ruleForm">
<el-form-item label="房间类型" prop="rollType">
<el-select v-model="form.rollType" placeholder="请选择房间类型">
<el-option
v-for="dict in dict.type.roll_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="主播" prop="userId" v-if="form.rollType == 1">
<el-select v-model="form.userId" filterable placeholder="请选择主播" clearable>
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.nickName + ' | ' + item.userName"
:value="item.userId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="房间名" prop="rollName">
<el-input v-model="form.rollName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="描述" prop="desc">
<el-input type="textarea" v-model="form.description"></el-input>
</el-form-item>
<el-form-item label="奖池" prop="jackpotId">
<el-select v-model="form.jackpotId" filterable placeholder="请选择" clearable>
<el-option
v-for="item in JackpotList"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
<div v-if="form.rollType == 1 && form.userId && form.jackpotId" style="font-size: 13px; line-height: 1.6; margin-top: 4px;">
当前金币余额:<span :style="{ color: balanceInsufficient ? '#F56C6C' : '#67C23A' }">{{ anchorBalance }}</span> 金币
&nbsp;|&nbsp; 奖池总价值:<span style="color:#E6A23C;">{{ selectedJackpotTotal }}</span> 金币
<span v-if="balanceInsufficient" style="color:#F56C6C; font-weight:bold;">(余额不足)</span>
<span v-if="selectedJackpotTotal > 0 && selectedJackpotTotal < 200" style="color:#F56C6C; font-weight:bold;">(主播房奖池总价值不能低于200金币)</span>
</div>
</el-form-item>
<el-form-item label="开奖时间" prop="endTime">
<el-date-picker
value-format="yyyy-MM-dd HH:mm:ss"
v-model="form.endTime"
type="datetime"
placeholder="选择日期时间"
default-time="8:00:00"
></el-date-picker>
</el-form-item>
<el-form-item label="参与人数" prop="peopleNum">
<el-input-number v-model="form.peopleNum" :min="1" :max="10000" label="参与人数"></el-input-number>
</el-form-item>
<el-form-item label="房间密码" prop="rollPassword">
<el-input v-model="form.rollPassword" autocomplete="off" placeholder="请输入房间密码"></el-input>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为空表示无密码
</span>
</el-form-item>
<el-form-item label="计算充值起始日期" prop="rechargeStartTime">
<el-date-picker
v-model="form.rechargeStartTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
></el-date-picker>
</el-form-item>
<el-form-item label="充值门槛" prop="minRecharge">
<el-input v-model="form.minRecharge" autocomplete="off"></el-input>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为0时表示不做限制
</span>
</el-form-item>
<el-form-item label="VIP等级" prop="vipLevel">
<el-input-number v-model="form.vipLevel" :min="0" :max="13" label="VIP等级"></el-input-number>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为0时表示不做限制
</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button v-if="title == '新建Roll房'" type="primary" @click="submitForm('ruleForm')">新 增</el-button>
<el-button v-if="title == '修改Roll房'" type="primary" @click="handleSub('ruleForm')">修 改</el-button>
</div>
</el-dialog>
<!-- 中奖详情 -->
<el-dialog title="中奖详情" :visible.sync="winningVisible" width="700px">
<div style="margin-bottom: 10px; color: #909399; font-size: 13px;">
共 <b>{{ winningList.length }}</b> 件奖品,总价值 <b>{{ winningTotalPrice }}</b> 金币
</div>
<el-table v-loading="winningLoading" :data="winningPagedList" border stripe max-height="400">
<el-table-column align="center" prop="userId" label="用户ID" width="80"></el-table-column>
<el-table-column align="center" label="昵称" min-width="100">
<template slot-scope="scope">{{ scope.row.nickName || '-' }}</template>
</el-table-column>
<el-table-column align="center" prop="ornamentName" label="饰品名称" min-width="150"></el-table-column>
<el-table-column align="center" label="图片" width="60">
<template slot-scope="scope">
<image-preview :src="scope.row.imageUrl" :width="40" :height="40" />
</template>
</el-table-column>
<el-table-column align="center" prop="ornamentsPrice" label="单价" width="80"></el-table-column>
<el-table-column align="center" prop="createTime" label="中奖时间" width="160"></el-table-column>
</el-table>
<pagination
v-show="winningList.length > 0"
:limit.sync="winningQuery.pageSize"
:page.sync="winningQuery.pageNum"
:total="winningList.length"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="winningVisible = false">关 闭</el-button>
</div>
</el-dialog>
<!-- 详情 -->
<el-dialog title="详情" :visible.sync="openView" width="35%">
<el-form ref="form" :model="form" label-width="150px" size="mini">
<el-row>
<el-col :span="12">
<el-form-item label="Roll房ID:">{{ form.id }}</el-form-item>
<el-form-item label="房间名:">{{ form.rollName }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="密码:">{{ form.rollPassword || '无密码'}}</el-form-item>
<el-form-item label="可参与人数:">{{ form.peopleNum }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="roll房状态:">
<div v-if="form.rollStatus == '0'">进行中</div>
<div v-if="form.rollStatus == '1'">已结束</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开奖时间:">{{ form.endTime }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="roll房类型:" prop="userType">
<span v-if="form.rollType === '0'">官方房间</span>
<span v-if="form.rollType === '1'">主播房间</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主播ID:" v-if="form.rollType == '1'">{{form.userId}}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="计算充值起始日期:">{{ form.rechargeStartTime || '不计' }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="充值门槛:">{{ form.minRecharge }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="VIP等级门槛:">VIP{{ form.vipLevel || 0 }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="创建者:">{{ form.createBy }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="roll房创建时间:">{{ form.createTime }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="更新者:">{{ form.updateBy }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="更新时间:">{{ form.updateTime }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="创建时间:">{{ form.createTime }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开奖时间:">{{ form.endTime }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="房间描述:">{{ form.description }}</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="openView = false">关 闭</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
list,
rollJackpotList,
roll,
delRoll,
rollChange,
getRollWinningRecords
} from "@/api/skins/ttRoll/api";
import { listUser } from "@/api/skins/ttuser/api";
export default {
name: 'Roll',
dicts: ["roll_type", "user_status"],
data() {
return {
total: 1,
openView: false,
menuType: "A",
title: "",
form: {
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
vipLevel: 0,
peopleNum: 1,
rechargeStartTime: null,
rollName: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
},
rules: {
rollType: [
{ required: true, message: "请选择房间类型", trigger: "blur" }
],
jackpotId: [{ required: true, message: "请选择奖池", trigger: "blur" }],
userId: [{ required: true, message: "请选择主播", trigger: "blur" }],
rollName: [
{ required: true, message: "请输入roll房名称", trigger: "blur" }
],
endTime: [
{ required: true, message: "请选择开奖时间", trigger: "blur" }
],
minRecharge: [
{ required: true, message: "请输入充值金额", trigger: "blur" }
],
peopleNum: [
{ required: true, message: "请选择参与人数", trigger: "blur" }
]
},
dialogFormVisible: false,
ids: [],
types: {
userType: "01",
pageSize: 99
},
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
loading: false,
showSearch: true,
JackpotList: [],
queryParams: {
id: null,
pageNum: 1,
pageSize: 10,
rollName: null,
rollStatus: null
},
tableData: [],
userList: [],
winningVisible: false,
winningLoading: false,
winningList: [],
winningQuery: {
pageNum: 1,
pageSize: 10
}
};
},
mounted() {
this.getList();
},
computed: {
// 选中主播的金币余额
anchorBalance() {
const u = this.userList.find(item => item.userId == this.form.userId);
return u && u.accountAmount != null ? Number(u.accountAmount) : 0;
},
// 选中奖池的总价值
selectedJackpotTotal() {
const j = this.JackpotList.find(item => item.jackpotId == this.form.jackpotId);
return j && j.totalPrice != null ? Number(j.totalPrice) : 0;
},
// 主播房余额是否不足
balanceInsufficient() {
return this.form.rollType == 1 && this.selectedJackpotTotal > this.anchorBalance;
},
// 中奖详情总价值
winningTotalPrice() {
const total = this.winningList.reduce((sum, i) => sum + (Number(i.ornamentsPrice) || 0), 0);
return total.toFixed(2);
},
// 中奖详情当前页数据(前端分页)
winningPagedList() {
const start = (this.winningQuery.pageNum - 1) * this.winningQuery.pageSize;
return this.winningList.slice(start, start + this.winningQuery.pageSize);
}
},
methods: {
/** 中奖详情 */
handleWinning(row) {
this.winningVisible = true;
this.winningLoading = true;
this.winningList = [];
this.winningQuery.pageNum = 1;
getRollWinningRecords(row.id).then(res => {
if (res && res.code === 200) {
this.winningList = res.data || [];
}
this.winningLoading = false;
}).catch(() => {
this.winningLoading = false;
});
},
handleRouter(res) {
this.$router.push({
path: "/roll/awarddetali",
query: {
id: res.id
}
});
},
/** ROLL房用户 */
rollUser(row) {
if (row && row.id) {
this.$router.push({ path: `/roll/rollUser/${row.id}` });
}
},
handleSelect(res) {
this.form = {};
this.openView = true;
this.form = res;
},
handleChange(res) {
this.form = {};
this.form = res;
this.selected();
this.title = "修改Roll房";
this.dialogFormVisible = true;
},
handleSub(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
if (this.form.rollType == 1 && this.selectedJackpotTotal < 200) {
this.$message.error(
`主播房奖池总价值不能低于200金币,当前为 ${this.selectedJackpotTotal} 金币`
);
return;
}
rollChange(this.form).then(res => {
this.$message({
type: "success",
message: "添加成功!"
});
this.dialogFormVisible = false;
this.form = {
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
peopleNum: 1,
rechargeStartTime: null,
rollName: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
};
this.getList();
});
} else {
return false;
}
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
if (this.form.rollType == 1 && this.selectedJackpotTotal < 200) {
this.$message.error(
`主播房奖池总价值不能低于200金币,当前为 ${this.selectedJackpotTotal} 金币`
);
return;
}
if (this.form.rollType == 1 && this.balanceInsufficient) {
this.$message.error(
`余额不足:奖池总价值 ${this.selectedJackpotTotal} 金币,超过主播当前金币余额 ${this.anchorBalance} 金币`
);
return;
}
roll(this.form).then(res => {
this.$message({
type: "success",
message: "添加成功!"
});
this.dialogFormVisible = false;
this.form = {
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
vipLevel: 0,
peopleNum: 1,
rechargeStartTime: null,
rollName: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
};
this.getList();
});
} else {
return false;
}
});
},
selected() {
listUser(this.types).then(res => {
this.userList = res.rows;
});
rollJackpotList({ pageNum: 1, pageSize: 9999 }).then(res => {
this.JackpotList = res.rows;
});
},
handleCreat() {
this.selected();
this.dialogFormVisible = true;
this.title = "新建Roll房";
this.form = {
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
vipLevel: 0,
peopleNum: 1,
rechargeStartTime: null,
rollName: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
};
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
handleDelete(row) {
this.$modal
.confirm('是否确认删除ID为"' + row + '"的Roll房?')
.then(() => {
delRoll(row).then(res => {
this.getList();
this.$modal.msgSuccess("删除成功");
});
})
.catch(() => {});
},
handleExport() {
this.download(
"admin/roll/export",
{
...this.queryParams
},
`Roll_${new Date().getTime()}.xlsx`
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
id: null,
pageNum: 1,
pageSize: 10,
rollName: null,
rollStatus: null
};
this.handleQuery();
},
getList() {
this.loading = true;
list(this.queryParams).then(res => {
this.tableData = res.rows;
this.loading = false;
this.total = res.total;
});
}
}
};
</script>
<style scoped lang="scss">
.home {
padding: 20px;
}
</style>
@@ -0,0 +1,307 @@
<template>
<div class="home">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="配置名称" prop="configName">
<el-input
v-model="queryParams.configName"
placeholder="请输入配置名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="周期类型" prop="periodType">
<el-select v-model="queryParams.periodType" placeholder="请选择周期类型" clearable>
<el-option label="每日" value="DAILY"></el-option>
<el-option label="每周" value="WEEKLY"></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option label="启用" value="0"></el-option>
<el-option label="停用" value="1"></el-option>
</el-select>
</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="success"
plain
icon="el-icon-plus"
size="mini"
@click="handleCreat"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="tableData" style="width: 100%" v-loading="loading">
<el-table-column align="center" prop="id" label="ID" width="60"></el-table-column>
<el-table-column align="center" prop="configName" label="配置名称"></el-table-column>
<el-table-column align="center" prop="periodType" label="周期" width="80">
<template slot-scope="scope">
<el-tag v-if="scope.row.periodType === 'DAILY'" type="success">每日</el-tag>
<el-tag v-else-if="scope.row.periodType === 'WEEKLY'" type="warning">每周</el-tag>
<span v-else>{{ scope.row.periodType }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="jackpotId" label="奖池" width="140">
<template slot-scope="scope">
{{ jackpotName(scope.row.jackpotId) }}
</template>
</el-table-column>
<el-table-column align="center" prop="roomName" label="房间名"></el-table-column>
<el-table-column align="center" prop="minRecharge" label="充值门槛" width="90"></el-table-column>
<el-table-column align="center" prop="vipLevel" label="VIP门槛" width="90">
<template slot-scope="scope">VIP{{ scope.row.vipLevel || 0 }}</template>
</el-table-column>
<el-table-column align="center" prop="peopleNum" label="人数上限" width="90"></el-table-column>
<el-table-column align="center" prop="rollPassword" label="密码" width="80"></el-table-column>
<el-table-column align="center" prop="sortBy" label="排序" width="70"></el-table-column>
<el-table-column align="center" prop="status" label="状态" width="90">
<template slot-scope="scope">
<el-switch
:value="scope.row.status === '0'"
active-color="#13ce66"
inactive-color="#ff4949"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column align="center" prop="lastGenerateTime" label="上次生成时间" width="160"></el-table-column>
<el-table-column align="center" label="操作" width="140">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleChange(scope.row)">编辑</el-button>
<el-button type="text" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row.id)">删除</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="dialogFormVisible" width="35%">
<el-form :model="form" :rules="rules" label-width="120px" ref="ruleForm">
<el-form-item label="配置名称" prop="configName">
<el-input v-model="form.configName" autocomplete="off" placeholder="请输入配置名称(内部标识)"></el-input>
</el-form-item>
<el-form-item label="周期类型" prop="periodType">
<el-select v-model="form.periodType" placeholder="请选择周期类型">
<el-option label="每日(日Roll)" value="DAILY"></el-option>
<el-option label="每周(周Roll)" value="WEEKLY"></el-option>
</el-select>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 日Roll统计今日充值,周Roll统计本周充值
</span>
</el-form-item>
<el-form-item label="奖池" prop="jackpotId">
<el-select v-model="form.jackpotId" filterable placeholder="请选择奖池" clearable>
<el-option
v-for="item in JackpotList"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="房间名" prop="roomName">
<el-input v-model="form.roomName" autocomplete="off" placeholder="请输入生成房间的名称"></el-input>
</el-form-item>
<el-form-item label="房间描述" prop="description">
<el-input type="textarea" v-model="form.description" placeholder="请输入房间描述"></el-input>
</el-form-item>
<el-form-item label="充值门槛" prop="minRecharge">
<el-input v-model="form.minRecharge" autocomplete="off"></el-input>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为0时表示无门槛
</span>
</el-form-item>
<el-form-item label="VIP等级" prop="vipLevel">
<el-input-number v-model="form.vipLevel" :min="0" :max="13" label="VIP等级"></el-input-number>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为0时表示不限
</span>
</el-form-item>
<el-form-item label="人数上限" prop="peopleNum">
<el-input-number v-model="form.peopleNum" :min="1" :max="100000" label="人数上限"></el-input-number>
</el-form-item>
<el-form-item label="房间密码" prop="rollPassword">
<el-input v-model="form.rollPassword" autocomplete="off" placeholder="请输入房间密码"></el-input>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为空表示无密码
</span>
</el-form-item>
<el-form-item label="排序" prop="sortBy">
<el-input-number v-model="form.sortBy" :min="0" label="排序"></el-input-number>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">停用</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
officialRollConfigList,
officialRollConfigAdd,
officialRollConfigChange,
officialRollConfigDel,
officialRollConfigChangeStatus,
rollJackpotList
} from "@/api/skins/ttRoll/api";
export default {
name: "OfficialRollConfig",
data() {
return {
total: 0,
loading: false,
showSearch: true,
dialogFormVisible: false,
title: "",
isEdit: false,
tableData: [],
JackpotList: [],
queryParams: {
configName: null,
periodType: null,
status: null,
pageNum: 1,
pageSize: 10
},
form: this.emptyForm(),
rules: {
configName: [{ required: true, message: "请输入配置名称", trigger: "blur" }],
periodType: [{ required: true, message: "请选择周期类型", trigger: "change" }],
jackpotId: [{ required: true, message: "请选择奖池", trigger: "change" }],
roomName: [{ required: true, message: "请输入房间名", trigger: "blur" }],
peopleNum: [{ required: true, message: "请输入人数上限", trigger: "blur" }]
}
};
},
mounted() {
this.getList();
this.loadJackpot();
},
methods: {
emptyForm() {
return {
id: null,
configName: null,
periodType: "DAILY",
jackpotId: null,
roomName: null,
description: null,
minRecharge: 0,
vipLevel: 0,
peopleNum: 100,
rollPassword: null,
sortBy: 0,
status: "0"
};
},
jackpotName(jackpotId) {
const j = this.JackpotList.find(item => item.jackpotId == jackpotId);
return j ? j.jackpotName : jackpotId;
},
loadJackpot() {
rollJackpotList({ pageNum: 1, pageSize: 9999 }).then(res => {
this.JackpotList = res.rows || [];
});
},
getList() {
this.loading = true;
officialRollConfigList(this.queryParams).then(res => {
this.tableData = res.rows || [];
this.total = res.total || 0;
this.loading = false;
}).catch(() => {
this.loading = false;
});
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
resetQuery() {
this.queryParams = {
configName: null,
periodType: null,
status: null,
pageNum: 1,
pageSize: 10
};
this.handleQuery();
},
handleCreat() {
this.form = this.emptyForm();
this.isEdit = false;
this.title = "新增官方周期Roll配置";
this.dialogFormVisible = true;
},
handleChange(row) {
this.form = Object.assign(this.emptyForm(), row);
this.isEdit = true;
this.title = "编辑官方周期Roll配置";
this.dialogFormVisible = true;
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (!valid) return false;
const api = this.isEdit ? officialRollConfigChange : officialRollConfigAdd;
api(this.form).then(() => {
this.$modal.msgSuccess(this.isEdit ? "编辑成功" : "新增成功");
this.dialogFormVisible = false;
this.getList();
});
});
},
handleStatusChange(row) {
const newStatus = row.status === "0" ? "1" : "0";
const text = newStatus === "0" ? "启用" : "停用";
this.$modal
.confirm(`确认要${text}配置"${row.configName}"吗?`)
.then(() => {
return officialRollConfigChangeStatus({ id: row.id, status: newStatus });
})
.then(() => {
row.status = newStatus;
this.$modal.msgSuccess(text + "成功");
})
.catch(() => {});
},
handleDelete(id) {
this.$modal
.confirm('是否确认删除ID为"' + id + '"的配置?')
.then(() => {
return officialRollConfigDel(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}
}
};
</script>
<style scoped lang="scss">
.home {
padding: 20px;
}
</style>
+646
View File
@@ -0,0 +1,646 @@
<template>
<div class="home">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="奖池名称" prop="userName">
<el-input
v-model="queryParams.jackpotName"
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="success"
plain
icon="el-icon-plus"
size="mini"
@click="handleCreat"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="tableData" style="width: 100%" v-loading="loading">
<el-table-column align="center" prop="jackpotId" label="ID"></el-table-column>
<el-table-column align="center" prop="jackpotName" label="奖池名称"></el-table-column>
<el-table-column align="center" prop="totalPrice" label="奖池总价值">
<template slot-scope="scope">
<span>¥{{ scope.row.totalPrice != null ? scope.row.totalPrice : '0.00' }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="createBy" label="创建者"></el-table-column>
<el-table-column align="center" prop="updateBy" label="更新者"></el-table-column>
<el-table-column align="center" prop="description" label="奖池描述"></el-table-column>
<el-table-column align="center" prop="createTime" label="创建时间"></el-table-column>
<el-table-column align="center" prop="updateTime" label="更新时间"></el-table-column>
<el-table-column align="center" prop="address" label="操作">
<template slot-scope="scope">
<el-button
type="text"
size="mini"
icon="el-icon-delete"
@click="handleDelete(scope.row.jackpotId)"
>删除</el-button>
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleChange(scope.row)">编辑</el-button>
<el-dropdown size="mini">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-caret-right" @click.native="handleAdd(scope.row)">批量填货</el-dropdown-item>
<el-dropdown-item icon="el-icon-view" @click.native="handleWatch(scope.row)">查看奖项</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!-- TODO 此处需要加分页 -->
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" :visible.sync="dialogFormVisible">
<el-form :model="form" v-if="type === 1 " label-width="120px">
<el-form-item label="奖池名称">
<el-input v-model="form.jackpotName" autocomplete="off" placeholder="请输入奖池名称"></el-input>
</el-form-item>
<el-form-item label="奖池说明">
<el-input
type="textarea"
v-model="form.description"
autocomplete="off"
placeholder="请输入奖池说明"
></el-input>
</el-form-item>
</el-form>
<el-form :model="form" v-if="type === 2 " label-width="120px">
<el-form-item label="奖池名称">
<el-input v-model="form.jackpotName" autocomplete="off" placeholder="请输入奖池名称"></el-input>
</el-form-item>
<el-form-item label="奖池说明">
<el-input
type="textarea"
v-model="form.description"
autocomplete="off"
placeholder="请输入奖池说明"
></el-input>
</el-form-item>
</el-form>
<el-form :model="formAdd" v-if="type === 3" label-width="120px">
<el-form-item label="所属奖池">
<el-select v-model="formAdd.jackpotId" filterable placeholder="请选择">
<el-option
v-for="item in tableData"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="奖池">
<el-popover placement="bottom-start" width="460" trigger="hover" ref="morePop">
<el-input slot="reference" v-model="orOnselects.itemName" placeholder="点击选择饰品" readonly></el-input>
<el-form>
<el-row>
<el-col :span="18">
<el-input v-model="orform.itemName" placeholder="请输入饰品名称" @input="serchornaments"></el-input>
</el-col>
<el-col :span="6">
<el-button @click="serchornaments" style="margin-left: 35px;">搜索</el-button>
</el-col>
</el-row>
<el-row>
<el-form v-loading="loadings" v-if="orList !== null">
<div class="magicbox" @scroll="scrollEventFn" v-if="orList.length > 0">
<div
class="magic"
v-for="(item,index) in orList"
:key="index"
@click="addOr(item)"
>{{ item.itemName }} - ¥ {{ item.usePrice }}</div>
</div>
<div v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">无此名称饰品名称</div>
</div>
</el-form>
<el-form v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">请输入饰品名称</div>
</el-form>
</el-row>
</el-form>
</el-popover>
</el-form-item>
<el-form-item label="数量" prop="ornamentsNum">
<el-input-number v-model="formAdd.ornamentsNum" :min="1" :max="1000"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSubmit">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="批量填货" :visible.sync="FormVisible" width="85%">
<el-form :model="formPrize">
<el-form-item label="所属奖池">
<el-select v-model="formPrize.jackpotId" filterable placeholder="请选择">
<el-option
v-for="item in tableData"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
</el-form-item>
<el-tabs v-model="activeName" type="card" @tab-click="tabclick">
<el-tab-pane label="选择饰品" name="first">
<el-form ref="queryForm" :inline="true" :model="orform" label-width="68px" size="small">
<el-row>
<el-col :span="4">
<el-form-item label="饰品ID" class="orform">
<el-input v-model="orform.id" placeholder="请输入饰品ID" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="饰品名称" class="orform">
<el-input v-model="orform.name" placeholder="请输入饰品名称" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="外观" class="orform">
<el-select v-model="orform.exterior" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.ornaments_exterior_name"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="类型" class="orform">
<el-select v-model="orform.type" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.ornaments_type_name"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="价格区间" class="orform max">
<div style="display:flex;">
<el-input v-model="orform.minPrice" placeholder="最小值" clearable></el-input>
<div style="width: 50px; "></div>
<el-input v-model="orform.maxPrice" placeholder="最大值" clearable></el-input>
</div>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item>
<el-button
icon="el-icon-search"
size="mini"
type="primary"
@click="orhandleClick"
>搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="orresetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:data="orList"
style="width: 100%"
@selection-change="selectPrize"
v-loading="loadings"
>
<el-table-column align="center" type="selection" width="55" fixed></el-table-column>
<el-table-column align="center" prop="name" label="名称" width="350"></el-table-column>
<el-table-column align="center" prop="usePrice" label="价格"></el-table-column>
<el-table-column align="center" prop="quantity" label="在售数量"></el-table-column>
<el-table-column align="center" label="外观名称" prop="exteriorName">
<template slot-scope="scope">{{ scope.row.exteriorName || '无涂装' }}</template>
</el-table-column>
<el-table-column align="center" label="稀有度">
<template slot-scope="scope">
<el-tag
:color="getRarityColor(scope.row.rarityName)"
style="color: #fff;"
>{{ scope.row.rarityName }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="封面">
<template slot-scope="scope">
<image-preview :src="scope.row.imageUrl" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column align="center" label="类型">
<template slot-scope="scope">
<el-tag>{{ scope.row.typeName }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="更新时间" prop="updateTime" />
</el-table>
<pagination
v-show="ortotal>0"
:limit.sync="orform.pageSize"
:page.sync="orform.pageNum"
:total="ortotal"
@pagination="serchornaments"
/>
</el-tab-pane>
<el-tab-pane label="选择道具" name="second" v-if="false">
<el-table
:data="orList"
style="width: 100%"
@selection-change="selectPrize"
v-loading="loadings"
>
<el-table-column align="center" type="selection" width="55" fixed></el-table-column>
<el-table-column align="center" label="道具名称" prop="itemName" />
<el-table-column align="center" label="道具图片" prop="levelImg">
<template slot-scope="scope">
<image-preview :src="scope.row.imageUrl" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column align="center" label="道具价格" prop="usePrice" />
<el-table-column align="center" label="创建时间" prop="createTime" />
</el-table>
<pagination
v-show="ortotal>0"
:limit.sync="orform.pageSize"
:page.sync="orform.pageNum"
:total="ortotal"
@pagination="serchornaments"
/>
</el-tab-pane>
</el-tabs>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="FormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSubmitone">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
rollJackpotList,
delRollJackpot,
rollJackpotCreat,
rollJackpotChange,
rollJackpotAdd,
rollJackpotOrnamentsList,
batchAdd
} from "@/api/skins/ttRoll/api";
import { listOrnaments, getWebsiteProperty } from "@/api/skins/ttOrnaments/api";
export default {
name: 'RollPrize',
dicts: [
"shopping_isputaway_status",
"ornaments_exterior_name",
"ornaments_type_name"
],
data() {
return {
activeName: "first",
FormVisible: false,
// 总条数
total: 0,
totalPrize: 1,
ortotal: 1,
formLabelWidth: "120px",
boxList: [],
prizeIds: [],
type: 1,
loading: false,
loadings: false,
dialogFormVisible: false,
title: "",
showSearch: true,
formWatch: null,
tableData: [],
orOnselect: {},
orOnselects: {
itemName: null
},
orList: null,
formAdd: {
jackpotId: null,
ornamentsId: null,
ornamentsLevelId: null,
ornamentsNum: 1
},
form: {
description: null,
jackpotName: null
},
queryParams: {
jackpotName: null,
pageNum: 1,
pageSize: 10
},
formPrize: {
boxId: null,
anchorOdds: 0,
isLuck: 0,
ornamentsLevelId: null,
luckOdds: 0,
odds: 0,
ornamentsId: null,
realOdds: 0
},
orform: {
itemName: null,
pageNum: 1,
pageSize: 10
}
};
},
mounted() {
this.getList();
},
methods: {
// 数据库 rarity_color 字段为空,前端根据 rarity_name 映射 CS2 标准稀有度颜色(颜色按稀有度由低到高递进)
getRarityColor(rarityName) {
const map = {
"消费级": "#b0c3d9",
"工业级": "#5e98d9",
"军规级": "#4b69ff",
"受限": "#8847ff",
"受限级": "#8847ff",
"保密": "#d32ce6",
"保密级": "#d32ce6",
"隐秘": "#eb4b4b",
"隐秘级": "#eb4b4b",
"违禁": "#e4ae39",
"高级": "#4b69ff",
"卓越": "#8847ff",
"奇异": "#d32ce6",
"非凡": "#eb4b4b",
"大师": "#eb4b4b",
"普通": "#b0c3d9",
"普通级": "#b0c3d9"
};
return map[rarityName] || "#909399";
},
serchprop() {
this.loadings = true;
getWebsiteProperty(this.orform).then(res => {
this.orList = res.rows;
this.loadings = false;
this.ortotal = res.total;
});
},
orhandleClick() {
if (this.activeName == "first") {
this.serchornaments();
} else if (this.activeName == "second") {
this.serchprop();
} else {
return;
}
},
orresetQuery() {
this.orform = {};
if (this.activeName == "first") {
this.serchornaments();
} else if (this.activeName == "second") {
this.serchprop();
} else {
}
},
selectPrize(selection) {
this.prizeIds = selection.map(item => item.id);
},
tabclick() {
// alert("66");
if (this.activeName == "first") {
this.serchornaments();
} else if (this.activeName == "second") {
this.serchprop();
} else {
return;
}
},
handleSubmitone() {
batchAdd(this.formPrize.jackpotId, this.prizeIds).then(res => {
this.FormVisible = false;
this.$modal.msgSuccess("添加成功");
});
},
handleWatch(res) {
this.$router.push({
path: "/roll/prizedetail",
query: {
id: res.jackpotId
}
});
},
addOr(res) {
this.formAdd.ornamentsId = res.id;
this.orOnselect = res;
this.orOnselects.itemName = res.itemName + " - ¥" + res.usePrice;
this.$refs.morePop.doClose();
this.orform.itemName = null;
this.orList = null;
},
scrollEventFn(e) {
if (
e.srcElement.scrollTop + e.srcElement.clientHeight >=
e.srcElement.scrollHeight
) {
this.orform.pageNum += 1;
listOrnaments(this.orform).then(res => {
this.orList.push.apply(this.orList, res.rows);
});
}
},
serchornaments() {
this.loadings = true;
listOrnaments(this.orform).then(res => {
this.ortotal = res.data.total;
this.orList = res.data.records;
this.loadings = false;
});
},
handleAdd(res) {
this.formPrize.jackpotName = res.jackpotName;
this.formPrize.jackpotId = res.jackpotId;
this.serchornaments();
this.title = "批量填货";
this.FormVisible = true;
},
handleChange(res) {
this.form = {};
this.title = "编辑奖池";
this.type = 2;
this.form = res;
this.dialogFormVisible = true;
},
resetQuery() {
this.getList();
this.queryForm = {
jackpotName: null,
pageNum: 1,
pageSize: 20
};
},
handleSubmit() {
if (this.type == 1 || this.type == 2) {
let msgs = [];
if (!this.form.jackpotName || !this.form.jackpotName.trim()) {
msgs.push("奖池名称");
}
if (!this.form.description || !this.form.description.trim()) {
msgs.push("奖池说明");
}
if (msgs.length > 0) {
this.$message({ message: "请输入" + msgs.join("、"), type: "warning" });
return;
}
}
if (this.type == 1) {
rollJackpotCreat(this.form).then(res => {
this.getList();
this.dialogFormVisible = false;
this.$message({
message: "新增成功",
type: "success"
});
});
} else if (this.type == 2) {
rollJackpotChange(this.form).then(res => {
this.getList();
this.dialogFormVisible = false;
this.$message({
message: "编辑成功",
type: "success"
});
});
} else if (this.type == 3) {
rollJackpotAdd(this.formAdd).then(res => {
this.getList();
this.orOnselects.itemName = "";
this.dialogFormVisible = false;
this.$message({
message: "添加成功",
type: "success"
});
});
}
},
handleCreat() {
(this.form = {
description: null,
jackpotName: null
}),
(this.title = "新增奖池");
this.dialogFormVisible = true;
this.type = 1;
},
handleDelete(row) {
this.$modal
.confirm('是否确认删除ID为"' + row + '"的Roll房?')
.then(() => {
delRollJackpot(row).then(res => {
this.getList();
this.$modal.msgSuccess("删除成功");
});
})
.catch(() => {});
},
handleExport() {
this.download(
"admin/prize/export",
{
...this.queryParams
},
`Roll_${new Date().getTime()}.xlsx`
);
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
getList() {
this.loading = true;
rollJackpotList(this.queryParams).then(res => {
this.tableData = res.rows;
this.total = res.total;
document.body.click();
this.loading = false;
});
}
}
};
</script>
<style lang="scss" scoped>
.magicbox {
margin: 0 auto;
margin-top: 5px;
height: 300px;
overflow-y: scroll;
.magic {
height: 32px;
padding: 2px 5px;
line-height: 32px;
&:hover {
background-color: #409eff;
transition: all ease 0.3s;
}
}
}
.orform ::v-deep {
.el-form-item__content {
width: 65%;
}
}
.max ::v-deep {
.el-form-item__content {
.el-input {
.el-input__inner {
padding-right: 10px;
}
}
}
}
.home {
padding: 20px;
}
</style>
@@ -0,0 +1,445 @@
<template>
<div class="home">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="ID" prop="userName">
<el-input
v-model="queryParams.id"
placeholder="请输入ID"
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="success"
plain
icon="el-icon-plus"
size="mini"
@click="handleCreat"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-edit"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['admin:prize:edit']"
>删除</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="formWatchss" style="width: 100%" v-loading="loading">
<el-table-column align="center" prop="id" label="id" width="180"></el-table-column>
<el-table-column align="center" prop="jackpotName" label="所属奖池" width="180"></el-table-column>
<el-table-column align="center" prop label="饰品图">
<template slot-scope="scope">
<image-preview :src="scope.row.imageUrl" :width="40" :height="40" />
</template>
</el-table-column>
<el-table-column align="center" prop="name" label="饰品名称"></el-table-column>
<el-table-column align="center" prop="usePrice" label="金额"></el-table-column>
<!-- <el-table-column align="center" prop="usePrice" label="颜色"></el-table-column> -->
<el-table-column align="center" prop="ornamentsNum" label="数量" width="50">
<template slot-scope="scope">
<el-popover placement="top" width="290" popper-class="layout">
<el-row>
<el-col :span="18">
<el-input v-model="scope.row.ornamentsNum" clearable></el-input>
</el-col>
<el-col :span="6">
<div style="text-align: right; margin: 0;line-height:36px">
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
<el-button type="text" size="mini" @click="handleChangeOrnum(scope.row)">确定</el-button>
</div>
</el-col>
</el-row>
<el-button slot="reference" type="text">{{scope.row.ornamentsNum}}</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column align="center" prop="createTime" label="创建时间"></el-table-column>
<el-table-column align="center" prop="updateTime" label="最后更新"></el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleChange(scope.row)">编辑</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-delete"
@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="dialogFormVisible">
<div v-if="type == 1">
<el-form :model="formAdd" label-width="120px">
<el-form-item label="所属奖池">
<el-select v-model="formAdd.jackpotId" filterable placeholder="请选择">
<el-option
v-for="item in tableData"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="奖池">
<el-popover placement="bottom-start" width="460" trigger="hover" ref="morePop">
<el-input
slot="reference"
v-model="orOnselects.itemName"
placeholder="点击选择饰品"
readonly
></el-input>
<el-form>
<el-row>
<el-col :span="18">
<el-input
v-model="orform.name"
placeholder="请输入饰品名称"
@input="serchornaments"
></el-input>
</el-col>
<el-col :span="6">
<el-button @click="serchornaments" style="margin-left: 35px;">搜索</el-button>
</el-col>
</el-row>
<el-row>
<el-form v-loading="loadings" v-if="orList !== null">
<div class="magicbox" @scroll="scrollEventFn" v-if="orList.length > 0">
<div
class="magic"
v-for="(item,index) in orList"
:key="index"
@click="addOr(item)"
>{{ item.name }} - ¥ {{ item.usePrice }}</div>
</div>
<div v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">无此名称饰品名称</div>
</div>
</el-form>
<el-form v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">请输入饰品名称</div>
</el-form>
</el-row>
</el-form>
</el-popover>
</el-form-item>
<el-form-item label="数量">
<el-input-number v-model="formAdd.ornamentsNum" :min="1" :max="1000"></el-input-number>
</el-form-item>
</el-form>
</div>
<div v-if="type == 2">
<el-form :model="formAdd" label-width="120px">
<el-form-item label="所属奖池">
<el-select v-model="formAdd.jackpotId" placeholder="请选择">
<el-option
v-for="item in tableData"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="奖池">
<el-popover placement="bottom-start" width="460" trigger="hover" ref="morePop">
<el-input
slot="reference"
v-model="orOnselects.itemName"
placeholder="点击选择饰品"
readonly
></el-input>
<el-form>
<el-row>
<el-col :span="18">
<el-input
v-model="orform.name"
placeholder="请输入饰品名称"
@input="serchornaments"
></el-input>
</el-col>
<el-col :span="6">
<el-button @click="serchornaments" style="margin-left: 35px;">搜索</el-button>
</el-col>
</el-row>
<el-row>
<el-form v-loading="loadings" v-if="orList !== null">
<div class="magicbox" @scroll="scrollEventFn" v-if="orList.length > 0">
<div
class="magic"
v-for="(item,index) in orList"
:key="index"
@click="addOr(item)"
>{{ item.name }} - ¥ {{ item.usePrice }}</div>
</div>
<div v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">无此名称饰品名称</div>
</div>
</el-form>
<el-form v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">请输入饰品名称</div>
</el-form>
</el-row>
</el-form>
</el-popover>
</el-form-item>
<el-form-item label="数量">
<el-input-number v-model="formAdd.ornamentsNum" :min="1" :max="1000"></el-input-number>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSubmit">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
rollJackpotList,
delRollJackpot,
rollJackpotCreat,
rollJackpotChange,
rollJackpotAdd,
rollJackpotdetial,
rollJackpotOrnamentsList,
rollJackpotOrnamentsChange,
rollJackpotOrnamentDel
} from "@/api/skins/ttRoll/api";
import { listOrnaments } from "@/api/skins/ttOrnaments/api";
export default {
name: 'RollPrizeDetail',
data() {
return {
total: 0,
type: 1,
loading: false,
loadings: false,
title: "添加饰品",
showSearch: true,
dialogFormVisible: false,
formWatch: [],
formWatchs: [],
formWatchss: [],
tableData: [],
orform: {
itemName: null,
pageNum: 1,
pageSize: 20
},
changeOr: {
jackpotId: Number(this.$route.query.id),
ornamentsId: null,
ornamentsLevelId: 0,
ornamentsNum: 1
},
orOnselect: {},
orOnselects: {
itemName: null
},
orList: null,
formAdd: {
jackpotId: null,
ornamentsId: null,
ornamentsLevelId: null,
ornamentsNum: 1,
price: null
},
queryParams: {
jackpotId: Number(this.$route.query.id),
pageNum: 1,
pageSize: 10
}
};
},
mounted() {
this.getList();
},
methods: {
handleDelete(res) {
rollJackpotOrnamentDel(Number(this.$route.query.id), res.id).then(res => {
this.getList();
this.$message({
message: "删除成功",
type: "success"
});
});
},
handleChange(res) {
this.type = 2;
this.dialogFormVisible = true;
this.formAdd = res;
this.formAdd.jackpotId = Number(this.$route.query.id);
},
// 点击数量修改数量
handleChangeOrnum(res) {
res.jackpotId = Number(this.changeOr.jackpotId);
rollJackpotOrnamentsChange(res)
.then(res => {
this.getList();
this.visible = false;
document.body.click();
this.$message({
message: "修改成功",
type: "success"
});
})
.catch(err => {
this.getList();
document.body.click();
});
},
handleSubmit() {
if (this.type == 1) {
rollJackpotAdd(this.formAdd).then(res => {
this.getList();
this.dialogFormVisible = false;
this.orOnselects.itemName = "";
this.$message({
message: "添加成功",
type: "success"
});
});
} else if (this.type == 2) {
this.formAdd.jackpotId = this.changeOr.jackpotId;
rollJackpotOrnamentsChange(this.formAdd).then(res => {
this.getList();
this.dialogFormVisible = false;
this.formAdd = {};
this.$message({
message: "编辑成功",
type: "success"
});
});
}
},
addOr(res) {
this.formAdd.ornamentsId = res.id;
this.formAdd.price = res.usePrice;
this.orOnselect = res;
this.orOnselects.itemName = res.name + " - ¥" + res.usePrice;
this.$refs.morePop.doClose();
this.orform.itemName = null;
this.orList = null;
},
scrollEventFn(e) {
if (
e.srcElement.scrollTop + e.srcElement.clientHeight >=
e.srcElement.scrollHeight
) {
this.orform.pageNum += 1;
listOrnaments(this.orform).then(res => {
this.orList.push.apply(this.orList, res.data.records);
});
}
},
serchornaments() {
this.loadings = true;
listOrnaments(this.orform).then(res => {
this.orList = res.data.records;
this.loadings = false;
});
},
resetQuery() {
this.getList();
this.queryForm = {
jackpotId: Number(this.$route.query.id),
pageNum: 1,
pageSize: 10
};
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
handleCreat() {
this.type = 1;
this.dialogFormVisible = true;
this.title = "添加饰品";
this.formAdd.jackpotId = Number(this.$route.query.id);
},
getList() {
rollJackpotList(this.queryForm).then(res => {
this.tableData = res.rows;
});
this.loading = true;
rollJackpotOrnamentsList(this.queryParams).then(res => {
this.total = res.total;
this.formWatch = res.rows;
this.loading = false;
rollJackpotdetial(Number(this.$route.query.id)).then(res => {
this.formWatchs = res.data;
for (let i = 0; i < this.formWatch.length; i++) {
this.formWatch[i].jackpotName = res.data.jackpotName;
}
this.formWatchss = this.formWatch;
});
});
},
handleExport() {
this.download(
"admin/prize/export",
{
...this.queryParams
},
`Roll_${new Date().getTime()}.xlsx`
);
}
}
};
</script>
<style scoped lang="scss">
.layout {
padding: 5px;
}
.magicbox {
margin: 0 auto;
margin-top: 5px;
height: 300px;
overflow-y: scroll;
.magic {
height: 32px;
padding: 2px 5px;
line-height: 32px;
&:hover {
background-color: #409eff;
transition: all ease 0.3s;
}
}
}
.home {
padding: 20px;
}
</style>
@@ -0,0 +1,206 @@
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="addRobot"
>加入机器人</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
size="mini"
@click="openAddUser"
>加入用户</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getUserList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="pagedUserList">
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="昵称" align="center" prop="nickName" />
<el-table-column label="用户类型" align="center" prop="userType">
<template slot-scope="scope">
<dict-tag :options="dict.type.user_type" :value="scope.row.userType" />
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="phoneNumber" />
</el-table>
<pagination
v-show="total > 0"
:limit.sync="pageQuery.pageSize"
:page.sync="pageQuery.pageNum"
:total="total"
/>
<!-- 加入机器人对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="机器人数量" prop="robotNum">
<el-input-number v-model="form.robotNum" :min="0" />
</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>
<!-- 加入普通用户对话框 -->
<el-dialog title="加入用户" :visible.sync="addUserOpen" width="500px" append-to-body>
<el-form label-width="60px">
<el-form-item label="用户">
<el-input v-model="userKeyword" placeholder="请输入用户ID" style="width: 300px" @keyup.enter.native="searchUser" />
<el-button type="primary" style="margin-left:8px" @click="searchUser">搜索</el-button>
</el-form-item>
</el-form>
<el-table
:data="searchUserList"
highlight-current-row
@current-change="handleSelectUser" style="width: 100%; margin-top: 8px"
>
<el-table-column label="用户ID" prop="userId" width="100" />
<el-table-column label="昵称" prop="nickName" />
<el-table-column label="手机号" prop="phoneNumber" />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitAddUser">确 定</el-button>
<el-button @click="addUserOpen = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getRollUser, addRobot, searchUserById, addUser } from "@/api/skins/ttRoll/api";
export default {
name: "RollUser",
dicts: ["user_type"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 显示搜索条件
showSearch: true,
// 注册用户表格数据
userList: [],
// 总条数
total: 0,
// 分页参数
pageQuery: {
pageNum: 1,
pageSize: 10
},
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 表单参数
form: {},
// 表单校验
rules: {
robotNum: [
{ required: true, message: "机器人数量不能为空", trigger: "blur" }
],
},
addUserOpen: false,
userKeyword: '',
searchUserList: [],
selectedUser: null,
};
},
created() {
this.getUserList();
},
computed: {
// 房间用户列表(前端分页)
pagedUserList() {
const start = (this.pageQuery.pageNum - 1) * this.pageQuery.pageSize;
return this.userList.slice(start, start + this.pageQuery.pageSize);
}
},
methods: {
/** 查询注册用户列表 */
getUserList() {
this.loading = true;
getRollUser(this.$route.params.rollId).then(response => {
this.userList = response.data || [];
this.total = this.userList.length;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
},
/** 新增按钮操作 */
addRobot() {
// this.reset();
// listOrnament(this.queryParams).then(response => {
// this.ornamentList = response.rows;
// this.total = response.total;
// this.loading = false;
// });
this.open = true;
this.title = "添加饰品";
},
/** 更新提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.rollId = this.$route.params.rollId;
addRobot(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getUserList();
});
}
});
},
// methods 新增
openAddUser() {
this.addUserOpen = true;
this.userKeyword = '';
this.searchUserList = [];
this.selectedUser = null;
},
searchUser() {
const keyword = (this.userKeyword || "").toString().trim();
if (!keyword) {
this.$modal.msgWarning("请输入用户ID");
return;
}
if (!/^\d+$/.test(keyword)) {
this.$modal.msgWarning("用户ID只能为数字");
return;
}
searchUserById(keyword).then(res => {
this.searchUserList = res.rows || [];
});
},
handleSelectUser(row) {
this.selectedUser = row;
},
submitAddUser() {
if (!this.selectedUser) {
this.$modal.msgWarning("请先搜索并选择一个用户");
return;
}
addUser({
rollId: this.$route.params.rollId,
userId: this.selectedUser.userId
}).then(() => {
this.$modal.msgSuccess("加入成功");
this.addUserOpen = false;
this.getUserList();
});
},
}
};
</script>
@@ -0,0 +1,481 @@
<template>
<div class="home">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="ID" prop="userName">
<el-input
v-model="queryParams.id"
placeholder="请输入Roll房ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="Roll房名称" prop="nickName">
<el-input
v-model="queryParams.name"
placeholder="请输入Roll房名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="Roll房状态 " prop="rollStatus">
<el-select v-model="queryParams.rollStatus" placeholder="请选择Roll房类型" clearable>
<el-option label="已结束" value="1"></el-option>
<el-option label="进行中" value="0"></el-option>
</el-select>
</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="success"
plain
icon="el-icon-plus"
size="mini"
@click="handleCreat"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-edit"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" align="center" />
<el-table-column align="center" prop="id" label="Id"></el-table-column>
<el-table-column align="center" prop="name" label="房间名"></el-table-column>
<el-table-column align="center" prop="rechargeCondition" label="循环条件"></el-table-column>
<el-table-column align="center" prop="minRecharge" label="充值门槛"></el-table-column>
<el-table-column align="center" prop="rollStatus" label="状态">
<template slot-scope="scope">
<div
v-if="scope.row.status == '0'"
style="display:flex; align-items:center;justify-content:center;line-height: 1;"
>
<span
style="width: 8px; height:8px; margin-right:10px; border-radius: 50%; background-color: green; display:inline-block;"
></span>
开启
</div>
<div
v-if="scope.row.status == '1'"
style="display:flex; align-items:center;justify-content:center;"
>
<span
style="width: 8px; height:8px; margin-right:10px; border-radius: 50%; background-color: #DD4B39; display:inline-block;"
></span>
关闭
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="sortBy" label="置顶"></el-table-column>
<el-table-column align="center" prop="createBy" label="创建用户"></el-table-column>
<el-table-column align="center" prop="createTime" label="创建时间"></el-table-column>
<el-table-column align="center" prop="address" label="操作">
<template slot-scope="scope">
<el-button
type="text"
size="mini"
icon="el-icon-delete"
@click="handleDelete(scope.row.id)"
>删除</el-button>
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleChange(scope.row)">修改</el-button>
<el-button type="text" size="mini" icon="el-icon-view" @click="handleSelect(scope.row)">详情</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-view"
@click="handleRouter(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="dialogFormVisible" width="30%">
<el-form :model="form" :rules="rules" label-width="100px" ref="ruleForm">
<el-form-item label="房间名" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="奖池" prop="jackpotId">
<el-select v-model="form.jackpotId" filterable placeholder="请选择" clearable>
<el-option
v-for="item in JackpotList"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="循环条件" prop="rechargeCondition" v-if="title== '新建Roll房'">
<el-select v-model="form.rechargeCondition" filterable placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.time_roll_condition"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="充值门槛" prop="minRecharge">
<el-input v-model="form.minRecharge" autocomplete="off"></el-input>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为0时表示不做限制
</span>
</el-form-item>
<el-form-item label="排序" prop="sortBy" v-if="title == '修改Roll房'">
<el-input-number type="textarea" v-model="form.sortBy"></el-input-number>
</el-form-item>
<el-form-item label="描述" prop="desc">
<el-input type="textarea" v-model="form.description"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button v-if="title == '新建Roll房'" type="primary" @click="submitForm('ruleForm')">新 增</el-button>
<el-button v-if="title == '修改Roll房'" type="primary" @click="handleSub('ruleForm')">修 改</el-button>
</div>
</el-dialog>
<!-- 详情 -->
<el-dialog title="详情" :visible.sync="openView" width="35%">
<el-form ref="form" :model="form" label-width="150px" size="mini">
<el-row>
<el-col :span="12">
<el-form-item label="Roll房ID:">{{ form.id }}</el-form-item>
<el-form-item label="房间名:">{{ form.name }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="密码:">{{ form.rollPassword || '无密码'}}</el-form-item>
<el-form-item label="可参与人数:">{{ form.peopleNum }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="roll房状态:">
<div v-if="form.rollStatus == '0'">进行中</div>
<div v-if="form.rollStatus == '1'">已结束</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开奖时间:">{{ form.endTime }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="roll房类型:" prop="userType">
<span v-if="form.rollType === '0'">官方房间</span>
<span v-if="form.rollType === '1'">主播房间</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主播ID:" v-if="form.rollType == '1'">{{form.userId}}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="计算充值起始日期:">{{ form.rechargeStartTime || '不计' }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="充值门槛:">{{ form.minRecharge }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="创建者:">{{ form.createBy }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="roll房创建时间:">{{ form.createTime }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="更新者:">{{ form.updateBy }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="更新时间:">{{ form.updateTime }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12"></el-col>
<el-col :span="12"></el-col>
</el-row>
<el-row>
<el-form-item label="房间描述:">{{ form.description }}</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="openView = false">关 闭</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getTimeRoll,
rollJackpotList,
addtimeRoll,
delTimeroll,
changetimeRoll
} from "@/api/skins/ttRoll/api";
import { listUser } from "@/api/skins/ttuser/api";
export default {
name: 'TimeRoll',
dicts: ["roll_type", "user_status", "time_roll_condition"],
data() {
return {
total: 1,
openView: false,
menuType: "A",
title: "",
form: {
rechargeCondition: 0,
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
peopleNum: 1,
rechargeStartTime: null,
name: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
},
rules: {
jackpotId: [{ required: true, message: "请选择奖池", trigger: "blur" }],
userId: [{ required: true, message: "请选择主播", trigger: "blur" }],
name: [{ required: true, message: "请输roll房名称", trigger: "blur" }],
endTime: [
{ required: true, message: "请选择开奖时间", trigger: "blur" }
],
minRecharge: [
{ required: true, message: "请输入充值金额", trigger: "select" }
],
rechargeCondition: [
{ required: true, message: "请选择循环条件", trigger: "select" }
]
},
dialogFormVisible: false,
ids: [],
types: {
userType: "01",
pageSize: 99
},
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
loading: false,
showSearch: true,
JackpotList: [],
queryParams: {
id: null,
pageNum: 1,
pageSize: 10,
name: null,
rollStatus: null
},
tableData: [],
userList: []
};
},
mounted() {
this.getList();
},
methods: {
handleRouter(res) {
this.$router.push({
path: "/roll/awarddetali",
query: {
id: res.id
}
});
},
handleSelect(res) {
this.form = {};
this.openView = true;
this.form = res;
},
handleChange(res) {
this.form = {};
this.form = res;
this.selected();
this.title = "修改Roll房";
this.dialogFormVisible = true;
},
handleSub(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
changetimeRoll(this.form).then(res => {
this.$message({
type: "success",
message: "添加成功!"
});
this.dialogFormVisible = false;
this.form = {
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
peopleNum: 1,
rechargeStartTime: null,
name: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
};
this.getList();
});
} else {
return false;
}
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
addtimeRoll(this.form).then(res => {
this.$message({
type: "success",
message: "添加成功!"
});
this.dialogFormVisible = false;
this.form = {
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
peopleNum: 1,
rechargeStartTime: null,
name: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
};
this.getList();
});
} else {
return false;
}
});
},
selected() {
listUser(this.types).then(res => {
this.userList = res.rows;
});
rollJackpotList({ pageNum: 1, pageSize: 9999 }).then(res => {
this.JackpotList = res.rows;
});
},
handleCreat() {
this.selected();
this.dialogFormVisible = true;
this.title = "新建Roll房";
this.form = {
description: null,
endTime: null,
jackpotId: null,
minRecharge: 0,
peopleNum: 1,
rechargeStartTime: null,
name: null,
rollPassword: null,
rollType: null,
sortBy: null,
userId: null
};
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
handleDelete(row) {
this.$modal
.confirm('是否确认删除ID为"' + row + '"的Roll房?')
.then(() => {
delTimeroll(row).then(res => {
this.getList();
this.$modal.msgSuccess("删除成功");
});
})
.catch(() => {});
},
handleExport() {
this.download(
"admin/roll/export",
{
...this.queryParams
},
`Roll_${new Date().getTime()}.xlsx`
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
id: null,
pageNum: 1,
pageSize: 10,
name: null,
rollStatus: null
};
this.handleQuery();
},
getList() {
this.loading = true;
getTimeRoll(this.queryParams).then(res => {
this.tableData = res.rows;
this.loading = false;
this.total = res.total;
});
}
}
};
</script>
<style scoped lang="scss">
.home {
padding: 20px;
}
</style>