first commit
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" size="small">
|
||||
<el-form-item label="宝箱记录ID" prop="id">
|
||||
<el-input v-model="queryParams.id" placeholder="请输入宝箱记录ID" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="持有者ID" prop="holderUserId">
|
||||
<el-input v-model="queryParams.holderUserId" placeholder="请输入持有者ID" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="饰品ID" prop="ornamentsId">
|
||||
<el-input v-model="queryParams.ornamentsId" placeholder="请输入饰品ID" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="饰品名称" prop="itemName">
|
||||
<el-input v-model="queryParams.itemName" placeholder="请输入饰品名称" clearable></el-input>
|
||||
</el-form-item>
|
||||
<!-- 经典开箱记录(source=1)只提供「背包」和「经典开箱分解」两个状态 -->
|
||||
<el-form-item label="宝箱状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="item in statusOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</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-table :data="tableData" style="width: 100%" v-loading="loading">
|
||||
<el-table-column align="center" prop="boxRecordId" label="宝箱记录ID"></el-table-column>
|
||||
<el-table-column align="center" prop="userId" label="开启者ID "></el-table-column>
|
||||
<el-table-column align="center" prop="holderUserId" label="持有者ID"></el-table-column>
|
||||
<el-table-column align="center" prop="boxId" label="宝箱ID"></el-table-column>
|
||||
<el-table-column align="center" prop="boxName" label="宝箱名称"></el-table-column>
|
||||
<el-table-column align="center" prop="boxPrice" label="宝箱价格"></el-table-column>
|
||||
<el-table-column align="center" prop="ornamentsId" label="饰品ID"></el-table-column>
|
||||
<el-table-column align="center" prop="ornamentName" label="饰品名称"></el-table-column>
|
||||
<el-table-column align="center" prop="ornamentImgUrl" label="饰品封面">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.ornamentImgUrl" :width="50" :height="50" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="ornamentsPrice" label="饰品价格"></el-table-column>
|
||||
<el-table-column align="center" prop="status" label="状态">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.status == '0'" class="df">
|
||||
<span style=" background-color: #3c8dbc;" class="ds"></span>
|
||||
背包
|
||||
</div>
|
||||
<div v-else-if="scope.row.status == '5'" class="df">
|
||||
<span class="ds" style="background-color: #f39c12;"></span>
|
||||
{{ (source === '1' || source == 1) ? '经典开箱分解' : '对战自动分解' }}
|
||||
</div>
|
||||
<div v-else-if="scope.row.status == '1'" class="df">
|
||||
<span class="ds" style="background-color: #DD4B39;"></span>
|
||||
在背包不显示
|
||||
</div>
|
||||
<div v-else class="df">
|
||||
<span class="ds" style="background-color: gray;"></span>
|
||||
{{ scope.row.status ? String(scope.row.status) : '(未知状态)' }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="createTime" label="创建时间"></el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getBoxRecords } from "@/api/skins/ttBox/api";
|
||||
export default {
|
||||
name: 'BoxRecords',
|
||||
dicts: ["box_record_type"],
|
||||
|
||||
data() {
|
||||
const source = this.$route.query.source || null;
|
||||
return {
|
||||
tableData: [],
|
||||
showSearch: true,
|
||||
total: 1,
|
||||
loading: false,
|
||||
source: source,
|
||||
queryParams: {
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
holderUserId: null,
|
||||
itemName: null,
|
||||
ornamentsId: null,
|
||||
status: null,
|
||||
userId: null,
|
||||
source: source
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
computed: {
|
||||
// 经典开箱记录(source=1)只提供「背包」和「经典开箱分解」两个状态筛选
|
||||
statusOptions() {
|
||||
const isClassic = this.source === '1' || this.source == 1;
|
||||
if (isClassic) {
|
||||
return [
|
||||
{ value: '0', label: '背包' },
|
||||
{ value: '5', label: '经典开箱分解' }
|
||||
];
|
||||
}
|
||||
return this.dict.type.box_record_type || [];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
holderUserId: null,
|
||||
itemName: null,
|
||||
ornamentsId: null,
|
||||
status: null,
|
||||
userId: null,
|
||||
source: this.$route.query.source || null
|
||||
};
|
||||
this.getList();
|
||||
},
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getBoxRecords(this.queryParams).then(res => {
|
||||
this.tableData = res.rows;
|
||||
this.loading = false;
|
||||
this.total = res.total;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.home {
|
||||
padding: 20px;
|
||||
}
|
||||
.df {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 1;
|
||||
}
|
||||
.ds {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 10px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<el-form :inline="true" :model="queryParams" size="small">
|
||||
<el-form-item label="宝箱分类ID" prop="id">
|
||||
<el-input v-model="queryParams.id" placeholder="请输入宝箱记录ID" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="宝箱名称" prop="userId">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入用户ID" clearable></el-input>
|
||||
</el-form-item>
|
||||
<!-- 仅无过滤的“宝箱分类”菜单展示;对战/经典宝箱分类菜单已由路由锁定类型 -->
|
||||
<el-form-item v-if="$route.query.type == null" label="是否对战" prop="isFightType">
|
||||
<el-select v-model="queryParams.isFightType" placeholder="请选择" clearable>
|
||||
<el-option label="是" value="0" />
|
||||
<el-option label="否" value="1" />
|
||||
</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-form>
|
||||
<el-button @click="handleCreat" type="success" icon="el-icon-plus" size="mini">新增</el-button>
|
||||
</el-form>
|
||||
<el-table :data="tableData" style="width: 100%" v-loading="loading">
|
||||
<el-table-column align="center" prop="id" label="Id"></el-table-column>
|
||||
<el-table-column align="center" prop="icon" label="宝箱分类图标" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.icon" :width="60" :height="60" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="name" label="宝箱分类名称"></el-table-column>
|
||||
<!-- 仅在通用“宝箱分类”菜单展示是否对战类型;对战/经典分类已由路由锁定类型 -->
|
||||
<el-table-column v-if="$route.query.type == null" align="center" prop="isFightType" label="是否对战类型">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.isFightType"
|
||||
:active-value="'0'"
|
||||
:inactive-value="'1'"
|
||||
inactive-color="#D9534F"
|
||||
active-color="#5CB85C"
|
||||
inactive-text="是"
|
||||
active-text="否"
|
||||
@change="updateUserStatus(scope.row)"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="isShow" label="是否显示">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.isShow"
|
||||
:active-value="'0'"
|
||||
:inactive-value="'1'"
|
||||
active-color="#5CB85C"
|
||||
inactive-color="#D9534F"
|
||||
active-text="显示"
|
||||
inactive-text="隐藏"
|
||||
@change="updateUserStatus(scope.row)"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="sort" label="宝箱分类排序"></el-table-column>
|
||||
<el-table-column align="center" prop="sort" label="宝箱分类排序">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleChange(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-dialog title="新增宝箱分类" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="宝箱分类图标" :label-width="formLabelWidth">
|
||||
<image-upload v-model="form.icon" />
|
||||
</el-form-item>
|
||||
<el-form-item label="宝箱分类名称" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="宝箱分类排序" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.sort" autocomplete="off"></el-input>
|
||||
</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 {
|
||||
boxType,
|
||||
boxTypelist,
|
||||
boxTypeChange,
|
||||
boxTypeId,
|
||||
delBoxType
|
||||
} from "@/api/skins/ttBox/api";
|
||||
export default {
|
||||
name: 'BoxType',
|
||||
data() {
|
||||
return {
|
||||
type: 1,
|
||||
loading: false,
|
||||
formLabelWidth: "80",
|
||||
dialogFormVisible: false,
|
||||
form: { icon: null, name: null, sort: null },
|
||||
tableData: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
isFightType: this.$route.query.type,
|
||||
name: null,
|
||||
id: null
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 同一 boxType 组件被“宝箱分类/对战宝箱分类/经典宝箱分类”多个菜单以不同 query 复用,
|
||||
// keep-alive 可能复用同一实例导致过滤串味;监听路由变化按 type 重新过滤加载。
|
||||
"$route"() {
|
||||
this.queryParams.isFightType = this.$route.query.type || null;
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getlist();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getlist();
|
||||
},
|
||||
methods: {
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
isFightType: this.$route.query.type || null,
|
||||
name: null,
|
||||
id: null
|
||||
};
|
||||
this.getlist();
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getlist();
|
||||
},
|
||||
updateUserStatus(res) {
|
||||
let data = { ...res };
|
||||
boxTypeChange(data)
|
||||
.then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getlist();
|
||||
})
|
||||
.catch(err => {
|
||||
this.getlist();
|
||||
});
|
||||
},
|
||||
handleDelete(res) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除编号为"' + res.id + '"的数据项?')
|
||||
.then(() => {
|
||||
this.loading = true;
|
||||
delBoxType(res.id).then(res => {
|
||||
this.getlist();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
handleChange(res) {
|
||||
this.type = 2;
|
||||
this.dialogFormVisible = true;
|
||||
boxTypeId(res.id).then(response => {
|
||||
this.form = response.data;
|
||||
});
|
||||
},
|
||||
handleSubmit() {
|
||||
if (this.type == 1) {
|
||||
boxType(this.form).then(res => {
|
||||
this.$modal.msgSuccess("添加成功");
|
||||
(this.form = { icon: null, name: null, sort: null }), this.getlist();
|
||||
this.dialogFormVisible = false;
|
||||
});
|
||||
} else if (this.type == 2) {
|
||||
boxTypeChange(this.form).then(res => {
|
||||
this.$modal.msgSuccess("添加成功");
|
||||
(this.form = { icon: null, name: null, sort: null }), this.getlist();
|
||||
this.dialogFormVisible = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
handleCreat() {
|
||||
this.type = 1;
|
||||
// 在“对战/经典宝箱分类”菜单下新增时自动归入当前类型,否则新增后不属于本页分类而不显示
|
||||
this.form = {
|
||||
icon: null,
|
||||
name: null,
|
||||
sort: null,
|
||||
isFightType: this.$route.query.type || null
|
||||
};
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
getlist() {
|
||||
this.loading = true;
|
||||
boxTypelist(this.queryParams).then(res => {
|
||||
this.tableData = res.rows;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.home {
|
||||
padding: 20px;
|
||||
}
|
||||
::v-deep .el-switch {
|
||||
border-radius: 0px !important;
|
||||
height: 24px !important;
|
||||
}
|
||||
::v-deep .el-switch__core {
|
||||
width: 70px !important;
|
||||
height: 24px;
|
||||
border-radius: 3px;
|
||||
border: none;
|
||||
}
|
||||
::v-deep .el-switch__core::after {
|
||||
width: 50%;
|
||||
height: 24px;
|
||||
border-radius: 0px;
|
||||
top: 0px !important;
|
||||
right: 0px !important;
|
||||
left: 0px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
}
|
||||
::v-deep .el-switch.is-checked .el-switch__core::after {
|
||||
margin-left: -35px;
|
||||
box-sizing: border-box;
|
||||
top: 0px !important;
|
||||
right: 0px !important;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
}
|
||||
/*关闭时文字位置设置*/
|
||||
::v-deep .el-switch__label--right {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: 40%;
|
||||
z-index: 1;
|
||||
right: 6px;
|
||||
margin-left: 0px;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
span {
|
||||
font-size: 13px;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
/* 激活时另一个文字消失 */
|
||||
::v-deep .el-switch__label.is-active {
|
||||
text-align: center;
|
||||
display: none;
|
||||
}
|
||||
/*开启时文字位置设置*/
|
||||
::v-deep .el-switch__label--left {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: 40%;
|
||||
z-index: 1;
|
||||
left: 5px;
|
||||
margin-right: 0px;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
span {
|
||||
font-size: 13px;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user