Files
peko-admin-web/src/views/luckyTycoon/luckyTycoonCollectSet.vue

1109 lines
31 KiB
Vue
Raw Normal View History

2024-07-04 20:32:23 +08:00
<template>
<div class="box">
<!-- 查询按钮 -->
<el-button class="primary" type="primary" @click="addFun()">新增</el-button>
</div>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="partitionDesc" align="center" label="地区" />
<el-table-column prop="x" align="center" label="活动模式">
<template v-slot="scope">
{{ scope.row.collectType == 0 ? "点亮礼物" : "累计礼物" }}
</template>
</el-table-column>
<el-table-column prop="collectGiftNames" align="center" label="礼物名称" />
<el-table-column prop="createTime" align="center" label="添加时间" />
<el-table-column align="center" label="点亮礼物数量">
<template v-slot="scope">
<div
v-for="(res, index) in JsonFunc(scope.row.rewardJson)"
:key="index"
>
{{ scope.row.collectType == 0 ? res.conditionValue : "/" }}
</div>
</template>
</el-table-column>
<el-table-column align="center" label="需要累计幸运值">
<template v-slot="scope">
<div
v-for="(res, index) in JsonFunc(scope.row.rewardJson)"
:key="index"
>
{{ scope.row.collectType == 1 ? res.conditionValue : "/" }}
</div>
</template>
</el-table-column>
<el-table-column align="center" label="奖励类型">
<template v-slot="scope">
<div
v-for="(res, index) in JsonFunc(scope.row.rewardJson)"
:key="index"
>
{{ typeFunc(res.rewardType) }}
</div>
</template>
</el-table-column>
<el-table-column align="center" label="奖励礼物昵称">
<template v-slot="scope">
<div
v-for="(res, index) in JsonFunc(scope.row.rewardJson)"
:key="index"
>
{{ res.rewardName }}
</div>
</template>
</el-table-column>
<el-table-column
align="center"
prop="giftInfo"
label="礼物图片"
width="120"
>
<template v-slot="scope">
<el-image
style="width: 100px; height: 100px"
:src="imgFun(JsonFunc(scope.row.rewardJson))[0]"
:zoom-rate="1.1"
:preview-src-list="imgFun(JsonFunc(scope.row.rewardJson))"
2024-11-08 17:26:57 +08:00
fit="scale-down"
2024-07-04 20:32:23 +08:00
preview-teleported="true"
hide-on-click-modal="true"
/>
</template>
</el-table-column>
<el-table-column prop="x" align="center" label="奖励礼物天数">
<template v-slot="scope">
<div
v-for="(res, index) in JsonFunc(scope.row.rewardJson)"
:key="index"
>
{{ res.rewardNum }}
</div>
</template>
</el-table-column>
<el-table-column prop="x" align="center" label="奖励礼物上限天数">
<template v-slot="scope">
<div
v-for="(res, index) in JsonFunc(scope.row.rewardJson)"
:key="index"
>
{{ res.rewardLimit }}
</div>
</template>
</el-table-column>
<el-table-column align="center" label="活动周期">
<template v-slot="scope">{{
scope.row.activityType == 0
? "每日"
: scope.row.activityType == 1
? "每周"
: "每月"
}}</template>
</el-table-column>
<el-table-column prop="startTime" align="center" label="起始时间">
<template v-slot="scope">
{{ scope.row.startTime }}-{{ scope.row.endTime }}
</template></el-table-column
>
<el-table-column prop="isEnabled" align="center" label="是否可见">
<template v-slot="scope">{{
scope.row.isEnabled == 1 ? "是" : "否"
}}</template>
</el-table-column>
<el-table-column prop="seqNo" align="center" label="排序" />
<el-table-column align="center" label="操作" width="240">
<template v-slot="scope">
<el-button
@click="eidFun(scope)"
class="primary"
type="primary"
size="default"
>编辑</el-button
>
<el-button
@click="
delDialog = true;
delDialogObj = scope.row;
"
:class="scope.row.isEnabled == 1 ? 'danger' : 'primary'"
:type="scope.row.isEnabled == 1 ? 'danger' : 'primary'"
size="default"
>
{{ scope.row.isEnabled == 1 ? "下线" : "上线" }}
</el-button>
<el-button
@click="
deriveObjNew = scope.row;
deriveDialog = true;
"
class="primary"
type="primary"
size="default"
>导出</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
style="margin-top: 10px"
class="paginationClass"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 999999999]"
layout="sizes, prev, pager, next"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<!-- 新增&编辑弹窗 -->
<el-dialog
2024-07-05 15:47:55 +08:00
destroy-on-close
2024-07-04 20:32:23 +08:00
class="pub"
v-model="controlsDialog"
:title="controlsTitle"
width="32%"
center
>
<!-- 地区选择 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>地区选择</span
>
<el-select filterable v-model="controlsObj.value" placeholder="请选择">
<el-option
v-for="item in controlsObj.options"
:key="item.id"
:label="item.desc"
:value="item.id"
>
</el-option>
</el-select>
</div>
<!-- 选择活动模式 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>选择活动模式</span
>
<el-select filterable v-model="controlsObj.value2" placeholder="请选择">
<el-option
v-for="item in controlsObj.options2"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<!-- 礼物 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>礼物</span
>
<el-select
multiple
filterable
v-model="controlsObj.value3"
placeholder="请选择"
>
<el-option
v-for="item in controlsObj.options3"
:key="item.giftId"
:label="JsonFunc(item.giftName).zh"
:value="item.giftId"
>
</el-option>
</el-select>
</div>
<!-- 活动周期 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>活动周期</span
>
<el-select filterable v-model="controlsObj.value4" placeholder="请选择">
<el-option
v-for="item in controlsObj.options4"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<!-- 选择时间 -->
<div style="margin-bottom: 25px; margin-top: 10px">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>选择时间</span
>
<div class="inquire">
<el-date-picker
v-model="controlsObj.time"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 60%"
>
</el-date-picker>
</div>
</div>
<!-- 是否可见 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>是否可见</span
>
<el-select filterable v-model="controlsObj.value5" placeholder="请选择">
<el-option
v-for="item in controlsObj.options5"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<!-- 排序 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>排序</span
>
<el-input
v-model="controlsObj.sort"
placeholder=""
class="input"
style="display: inline-block; width: 36%"
></el-input>
</div>
<!-- 渲染动态元素 -->
<div v-for="(item, index) in items" :key="index">
<!-- 需要点亮礼物数量&需要累计数量 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>{{ conTrolsContent }}</span
>
<el-input
v-model="items[index].num"
placeholder=""
class="input"
style="display: inline-block; width: 36%"
></el-input>
</div>
<!-- 奖励类型 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>奖励类型</span
>
<el-select filterable v-model="items[index].value" placeholder="请选择">
<el-option
v-for="item in items[index].options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<!-- 奖励 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>奖励</span
>
<el-select
filterable
v-model="items[index].value2"
placeholder="请先选择奖励类型"
>
<el-option
v-for="(item, i) in items[index].options2"
:key="i"
:label="
items[index].value == 2
? JsonFunc(item.giftName).zh
: items[index].value == 16 || items[index].value == 17
? JsonFunc(item.name).zh
: items[index].value == 3 ||
items[index].value == 4 ||
items[index].value == 14
? item.name
: []
"
:value="
items[index].value == 2
? item.giftId
: items[index].value == 3 ||
items[index].value == 14 ||
items[index].value == 16 ||
items[index].value == 17
? item.id
: items[index].value == 4
? item.headwearId
: []
"
>
</el-option>
</el-select>
</div>
<!-- 奖励天数 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>奖励天数</span
>
<el-input
v-model="items[index].day"
placeholder=""
class="input"
style="display: inline-block; width: 36%"
></el-input>
</div>
<!-- 奖励上限数量 -->
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>奖励上限数量</span
>
<el-input
v-model="items[index].maxNum"
placeholder=""
class="input"
style="display: inline-block; width: 36%"
></el-input>
</div>
</div>
<!-- -->
<el-button
type="primary"
class="primary"
style="margin-left: 110px; margin-right: 20px"
@click="addItem"
>+</el-button
>
<!-- -->
<el-button type="danger" class="danger" @click="removeItem()">-</el-button>
<!-- 弹窗按钮 -->
<template #footer>
<span class="dialog-footer">
<el-button @click="controlsDialog = false">取消</el-button>
<el-button type="primary" @click="controlsDialogOut()">
确认
</el-button>
</span>
</template>
</el-dialog>
<!-- 二次确认弹窗 -->
2024-07-05 15:47:55 +08:00
<el-dialog
destroy-on-close
v-model="delDialog"
title="提示"
width="30%"
center
>
2024-07-04 20:32:23 +08:00
<span> 确定要进行该操作吗?</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="delDialog = false">取消</el-button>
<el-button type="primary" @click="delClick()"> 确认 </el-button>
</span>
</template>
</el-dialog>
<!-- 导出弹窗 -->
2024-07-05 15:47:55 +08:00
<el-dialog
destroy-on-close
v-model="deriveDialog"
title="导出"
width="28%"
center
>
2024-07-04 20:32:23 +08:00
<!-- 榜单数据 -->
<div style="margin-bottom: 25px; margin-top: 10px">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>地区选择</span
>
<el-select filterable v-model="deriveObj.value" placeholder="请选择">
<el-option
v-for="item in deriveObj.options"
:key="item.id"
:label="item.desc"
:value="item.id"
>
</el-option>
</el-select>
</div>
<!-- 选择时间 -->
<div style="margin-bottom: 25px; margin-top: 10px">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>选择时间</span
>
<div class="inquire">
<el-date-picker
v-model="deriveObj.time"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 60%"
>
</el-date-picker>
</div>
</div>
<!-- 弹窗按钮 -->
<template #footer>
<span class="dialog-footer">
<el-button @click="deriveDialog = false">取消</el-button>
<el-button type="primary" @click="deriveOut()"> 确认导出 </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import {
luckyBagCollectPage,
updateEnabled,
luckyBagCollectExport,
listPartitionInfo,
getAll,
carAll,
headwearAll,
nameplateAll,
chatbubbleAll,
infocard,
luckyBagCollectSave,
} from "@/api/luckyTycoon/luckyTycoon";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
import { ref, watch } from "vue";
export default {
name: "luckyTycoonCollectSet",
created() {
this.getData();
listPartitionInfo().then((res) => {
this.deriveObj.options = res.data;
this.controlsObj.options = res.data;
});
this.loading = true;
getAll().then((res) => {
this.controlsObj.options3 = res.data;
this.giftArr = res.data;
carAll().then((res) => {
this.carArr = res.data;
headwearAll().then((res) => {
this.headArr = res.data;
nameplateAll().then((res) => {
this.nameplateArr = res.data;
chatbubbleAll().then((res) => {
this.bubbleArr = res.data;
infocard().then((res) => {
this.cardArr = res.data;
this.loading = false;
});
});
});
});
});
});
},
data() {
return {
time: null,
items: [],
giftArr: [],
carArr: [],
headArr: [],
nameplateArr: [],
bubbleArr: [],
cardArr: [],
// =====================
deriveDialog: false,
deriveObjNew: {},
deriveObj: {
value: "",
time: "",
options: [],
},
delDialog: false,
delDialogObj: {},
loading: false,
// 表格数据
tableData: [],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
controlsDialog: false,
controlsTitle: "编辑&新增",
conTrolsContent: "点亮礼物数量:",
conTrolsType: 1, //1新增 2编辑
controlsObj: {
value: "",
options: [],
value2: "",
options2: [
{
value: 0,
label: "点亮礼物",
},
{
value: 1,
label: "累计礼物",
},
],
cost: "",
value3: [],
options3: [],
cost2: "",
value4: "",
options4: [
{
value: 0,
label: "每日",
},
{
value: 1,
label: "每周",
},
{
value: 2,
label: "每月",
},
],
cost3: "",
inventory: "",
inventoryAll: "",
sort: "",
value5: 1,
options5: [
{
value: 1,
label: "是",
},
{
value: 0,
label: "否",
},
],
time: [],
},
endObj: {},
};
},
watch: {
"controlsObj.value2": function (newValue, oldValue) {
newValue == 0
? (this.conTrolsContent = "点亮礼物数量:")
: (this.conTrolsContent = "需累计幸运值:");
},
items: {
handler: function (newItems, oldItems) {
let than = this;
clearTimeout(this.time);
this.time = setTimeout(function () {
newItems.forEach((res, i) => {
if (res.value) {
if (res.value == 2) {
//礼物
than.items[i].options2 = than.giftArr;
} else if (res.value == 3) {
//座驾
than.items[i].options2 = than.carArr;
} else if (res.value == 4) {
//头饰
than.items[i].options2 = than.headArr;
} else if (res.value == 14) {
//铭牌
than.items[i].options2 = than.nameplateArr;
} else if (res.value == 16) {
//气泡
than.items[i].options2 = than.bubbleArr;
} else if (res.value == 17) {
//资料卡
than.items[i].options2 = than.cardArr;
}
}
});
}, 1000);
},
deep: true,
},
},
methods: {
getData() {
this.loading = true;
luckyBagCollectPage({
page: this.currentPage,
pageSize: this.pageSize,
}).then((res) => {
if (res.code == 200) {
this.tableData = res.data.records;
} else {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
});
},
addItem() {
this.items.push({
num: "",
value: "",
options: [
{
value: 2,
label: "礼物",
},
{
value: 3,
label: "座驾",
},
{
value: 4,
label: "头饰",
},
{
value: 14,
label: "铭牌",
},
{
value: 16,
label: "气泡",
},
{
value: 17,
label: "资料卡",
},
],
value2: "",
options2: [],
day: "",
maxNum: "",
});
},
removeItem(index) {
this.items.splice(this.items.length - 1, 1);
},
// 新增按钮
addFun() {
this.controlsDialog = true;
this.conTrolsType = 1;
this.controlsTitle = "新增";
this.controlsObj.value = "";
this.controlsObj.value2 = "";
this.controlsObj.value3 = [];
this.controlsObj.value4 = "";
this.controlsObj.time[0] = "";
this.controlsObj.time[1] = "";
this.controlsObj.value5 = "";
this.controlsObj.sort = "";
this.items = [];
},
// 编辑按钮
eidFun(scope) {
this.conTrolsType = 2;
this.controlsTitle = "编辑";
this.endObj = scope.row;
this.controlsObj.value = this.endObj.partitionId;
this.controlsObj.value2 = this.endObj.collectType;
this.controlsObj.value3 = this.endObj.collectGiftIds
.split(",")
.map(Number);
this.controlsObj.value4 = this.endObj.activityType;
this.controlsObj.time[0] = this.endObj.startTime;
this.controlsObj.time[1] = this.endObj.endTime;
this.controlsObj.value5 = this.endObj.isEnabled;
this.controlsObj.sort = this.endObj.seqNo;
this.controlsDialog = true;
var rewardJson = JSON.parse(this.endObj.rewardJson);
rewardJson.forEach((res, i) => {
console.log(res);
this.items[i] = {
num: res.conditionValue,
value: res.rewardType,
options: [
{
value: 2,
label: "礼物",
},
{
value: 3,
label: "座驾",
},
{
value: 4,
label: "头饰",
},
{
value: 14,
label: "铭牌",
},
{
value: 16,
label: "气泡",
},
{
value: 17,
label: "资料卡",
},
],
value2: res.rewardId,
day: res.rewardNum,
maxNum: res.rewardLimit,
};
});
},
// 确认新增&编辑
controlsDialogOut() {
var indexArr = 0;
2024-07-04 20:32:23 +08:00
if (this.conTrolsType == 1) {
let startTime = "";
let endTime = "";
if (this.controlsObj.time && this.controlsObj.time.length > 0) {
startTime = dateFormat(
this.controlsObj.time[0],
"yyyy-MM-dd hh:mm:ss"
);
endTime = dateFormat(this.controlsObj.time[1], "yyyy-MM-dd hh:mm:ss");
}
var arr = [];
this.items.forEach((res, i) => {
res.options2.forEach((val, is) => {
if (res.value == 2) {
if (res.value2 == val.giftId) {
indexArr = is;
}
} else if (
res.value == 3 ||
res.value == 14 ||
res.value == 16 ||
res.value == 17
) {
if (res.value2 == val.id) {
indexArr = is;
}
} else if (res.value == 4) {
if (res.value2 == val.headwearId) {
indexArr = is;
}
}
});
2024-07-04 20:32:23 +08:00
var rewardName =
res.value == 2
? this.JsonFunc(res.options2[indexArr].giftName).zh
: res.value == 16 || res.value == 17
? this.JsonFunc(res.options2[indexArr].name).zh
: res.value == 3 || res.value == 4 || res.value == 14
? res.options2[indexArr].name
: [];
arr[i] = {
conditionValue: this.items[i].num,
rewardType: this.items[i].value,
rewardId: this.items[i].value2,
rewardNum: this.items[i].day,
rewardLimit: this.items[i].maxNum,
rewardName,
rewardPic: this.items[i].options2[indexArr].picUrl
? this.items[i].options2[indexArr].picUrl
2024-07-05 17:31:36 +08:00
: this.items[i].options2[indexArr].pic
? this.items[i].options2[indexArr].pic
: this.items[i].options2[indexArr].androidUrl
? this.items[i].options2[indexArr].androidUrl
: this.items[i].options2[indexArr].iconPic,
2024-07-04 20:32:23 +08:00
};
});
var obj = {
startTime,
endTime,
partitionId: this.controlsObj.value,
collectType: this.controlsObj.value2,
collectGiftIds: this.controlsObj.value3.join(","),
activityType: this.controlsObj.value4,
isEnabled: this.controlsObj.value5,
seqNo: this.controlsObj.sort,
rewardJson: JSON.stringify(arr),
};
console.log(obj);
luckyBagCollectSave(obj).then((res) => {
if (res.code == 200) {
this.controlsDialog = false;
this.getData();
this.items = [];
this.loading = false;
} else {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
});
} else if (this.conTrolsType == 2) {
let startTime = "";
let endTime = "";
if (this.controlsObj.time && this.controlsObj.time.length > 0) {
startTime = dateFormat(
this.controlsObj.time[0],
"yyyy-MM-dd hh:mm:ss"
);
endTime = dateFormat(this.controlsObj.time[1], "yyyy-MM-dd hh:mm:ss");
}
var arr2 = [];
this.items.forEach((res, i) => {
res.options2.forEach((val, is) => {
if (res.value == 2) {
if (res.value2 == val.giftId) {
indexArr = is;
}
} else if (
res.value == 3 ||
res.value == 14 ||
res.value == 16 ||
res.value == 17
) {
if (res.value2 == val.id) {
indexArr = is;
}
} else if (res.value == 4) {
if (res.value2 == val.headwearId) {
indexArr = is;
}
}
});
2024-07-04 20:32:23 +08:00
var rewardName =
res.value == 2
? this.JsonFunc(res.options2[indexArr].giftName).zh
: res.value == 16 || res.value == 17
? this.JsonFunc(res.options2[indexArr].name).zh
: res.value == 3 || res.value == 4 || res.value == 14
? res.options2[indexArr].name
: [];
arr2[i] = {
conditionValue: this.items[i].num,
rewardType: this.items[i].value,
rewardId: this.items[i].value2,
rewardNum: this.items[i].day,
rewardLimit: this.items[i].maxNum,
rewardName,
rewardPic: this.items[i].options2[indexArr].picUrl
? this.items[i].options2[indexArr].picUrl
: this.items[i].options2[indexArr].pic
? this.items[i].options2[indexArr].pic
: this.items[i].options2[indexArr].androidUrl
? this.items[i].options2[indexArr].androidUrl
: this.items[i].options2[indexArr].iconPic,
2024-07-04 20:32:23 +08:00
};
});
var obj2 = {
startTime,
endTime,
partitionId: this.controlsObj.value,
collectType: this.controlsObj.value2,
collectGiftIds: this.controlsObj.value3.join(","),
activityType: this.controlsObj.value4,
isEnabled: this.controlsObj.value5,
seqNo: this.controlsObj.sort,
rewardJson: JSON.stringify(arr2),
id: this.endObj.id,
};
luckyBagCollectSave(obj2).then((res) => {
if (res.code == 200) {
this.controlsDialog = false;
this.getData();
this.items = [];
this.loading = false;
} else {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
});
}
},
// 确认导出
deriveOut() {
let startTime = "";
let endTime = "";
if (this.controlsObj.time && this.controlsObj.time.length > 0) {
startTime = dateFormat(this.controlsObj.time[0], "yyyy-MM-dd hh:mm:ss");
endTime = dateFormat(this.controlsObj.time[1], "yyyy-MM-dd hh:mm:ss");
}
luckyBagCollectExport({
collectId: this.deriveObjNew.id,
partitionId: this.deriveObj.value,
startTime,
endTime,
}).then((res) => {
this.deriveDialog = false;
});
},
// 上下线
delClick() {
updateEnabled({
collectId: this.delDialogObj.id,
isEnabled: this.delDialogObj.isEnabled == 1 ? 0 : 1,
}).then((res) => {
if (res.code == 200) {
this.getData();
this.delDialog = false;
} else {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
});
},
JsonFunc(val) {
var res = this.isJson(val) ? JSON.parse(val) : val;
return res;
},
isJson(str) {
if (typeof str !== "string") {
// 如果不是字符串则不可能是JSON
return false;
}
try {
JSON.parse(str);
return true;
} catch (e) {
// 如果解析错误则不是JSON
return false;
}
},
typeFunc(val) {
var res = "";
if (val == 1) {
res = "金币";
} else if (val == 2) {
res = "礼物";
} else if (val == 3) {
res = "座驾";
} else if (val == 4) {
res = "头饰";
} else if (val == 5) {
res = "背景";
} else if (val == 6) {
res = "实物";
} else if (val == 7) {
res = "靓号";
} else if (val == 8) {
res = "全麦礼物";
} else if (val == 9) {
res = "随机靓号";
} else if (val == 10) {
res = "锤子";
} else if (val == 13) {
res = "祝福语";
} else if (val == 14) {
res = "铭牌";
} else if (val == 15) {
res = "虚拟货币";
} else if (val == 16) {
res = "聊天气泡";
} else if (val == 17) {
res = "资料卡";
}
return res;
},
imgFun(val) {
var arr = [];
val.forEach((res) => {
arr.push(res.rewardPic);
});
return arr;
},
// 分页导航
handleSizeChange() {
this.getData();
},
handleCurrentChange() {
this.getData();
},
},
};
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
.dialogTableVisibleBut {
display: block;
margin: 30px 0 0 830px;
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
// .pub {
// .input {
// width: 36%;
// display: inline-block;
// .el-input__wrapper {
// width: 100% !important;
// }
// }
// .el-input__wrapper {
// width: 100% !important;
// display: inline-block;
// }
// }
.el-input__wrapper {
width: 100% !important;
display: inline-block;
}
</style>