新增礼物管理字段

This commit is contained in:
liaozetao
2024-01-26 09:57:16 +08:00
parent 41423be810
commit a0e267968d
3 changed files with 501 additions and 102 deletions

View File

@@ -0,0 +1,8 @@
import request from "@/utils/request";
export const getGiftLevelList = () => {
return request({
url: '/admin/gift/level/list',
method: 'get',
});
}

View File

@@ -0,0 +1,27 @@
import request from "@/utils/request";
export const getGiftUnlockList = () => {
return request({
url: '/admin/giftUnlock/list',
method: 'get',
});
}
export const getLockGiftList = (giftId) => {
return new Promise((resolve, reject) => {
$.ajax({
type: 'get',
url: "/admin/giftUnlock/lockGift?giftId=" + giftId,
dataType: "json",
async: false,
success: function (res) {
resolve(res);
},
error: function (res, status, e) {
console.error(res);
console.error(status);
reject(e);
}
});
});
}

View File

@@ -29,7 +29,7 @@
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-15">
<label for="condition_type" class="col-sm-1 control-label">状态:</label>
<div class="col-sm-2">
<select name="condition_type" id="condition_type" class="form-control">
@@ -63,6 +63,15 @@
<option value="11">个播人气礼物</option>
<option value="13">星座礼物</option>
<option value="15">线性福袋礼物</option>
<option value="16">条件解锁礼物</option>
<option value="17">附赠装扮礼物</option>
</select>
</div>
<label for="searchLevel" class="col-sm-1 control-label">礼物等级:</label>
<div class="col-sm-2">
<select name="searchLevel" id="searchLevel" class="form-control">
</select>
</div>
</div>
@@ -139,10 +148,11 @@
<div class="modal-body">
<form class="form-horizontal" id="giftForm">
<input type="hidden" name="giftId" id="giftId" />
<input type="hidden" name="sendDressIdBak" id="sendDressIdBak" />
<input type="hidden" name="receiveDressIdBak" id="receiveDressIdBak" />
<div class="form-group">
<label for="consumeType" class="col-sm-2 control-label">消费类型</label>
<div class="col-sm-10">
<label for="consumeType" class="col-sm-3 control-label">消费类型</label>
<div class="col-sm-8">
<select class="form-control" name="consumeType" id="consumeType"
data-btn-class="btn-warning" onchange="selectConsumeChange(this)">
<option value="1" selected="selected">金币礼物</option>
@@ -153,21 +163,21 @@
</div>
<div class="form-group">
<label for="giftName" class="col-sm-2 control-label">礼物名称</label>
<div class="col-sm-10">
<label for="giftName" class="col-sm-3 control-label">礼物名称</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required]" name="giftName" id="giftName">
</div>
</div>
<div class="form-group">
<label for="goldPrice" class="col-sm-2 control-label">礼物价格</label>
<div class="col-sm-10">
<label for="goldPrice" class="col-sm-3 control-label">礼物价格</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required]" name="goldPrice" id="goldPrice">
</div>
</div>
<div class="form-group">
<label for="giftType" class="col-sm-2 control-label">礼物类型</label>
<div class="col-sm-10">
<select name="giftType" id="giftType" data-btn-class="btn-warning">
<label for="giftType" class="col-sm-3 control-label">礼物类型</label>
<div class="col-sm-8">
<select name="giftType" id="giftType" data-btn-class="btn-warning" class="form-control" v-model="gift.giftType">
<option value="2">普通面板礼物</option>
<option value="3">福袋礼物</option>
<option value="5">福袋奖池礼物</option>
@@ -180,76 +190,181 @@
<option value="11">个播人气礼物</option>
<option value="13">星座礼物</option>
<option value="15">线性福袋礼物</option>
<option value="16">条件解锁礼物</option>
<option value="17">附赠装扮礼物</option>
</select>
</div>
</div>
<div v-if="gift.giftType == 16">
<div class="form-group">
<label for="subGiftType" class="col-sm-3 control-label">解锁礼物类型</label>
<div class="col-sm-8">
<select name="subGiftType" id="subGiftType" data-btn-class="btn-warning" class="form-control" v-model="gift.subGiftType">
<option value="0">基础解锁礼物</option>
<option value="1">被解锁礼物</option>
</select>
</div>
</div>
<div class="form-group" v-if="gift.subGiftType == 1">
<label for="baseGiftId" class="col-sm-3 control-label">需要的基础解锁礼物</label>
<div class="col-sm-8">
<select name="baseGiftId" id="baseGiftId" data-btn-class="btn-warning" class="form-control">
</select>
</div>
</div>
<div class="form-group" v-if="gift.subGiftType == 1">
<label for="unlockNum" class="col-sm-3 control-label">需要的该基础礼物个数</label>
<div class="col-sm-8">
<input type="number" class="form-control" name="unlockNum" id="unlockNum" min="1">
</div>
</div>
</div>
<div v-if="gift.giftType == 17">
<div class="form-group">
<label for="sendDressType" class="col-sm-3 control-label">送礼者获得装扮类型</label>
<div class="col-sm-8">
<select name="sendDressType" id="sendDressType" data-btn-class="btn-warning" class="form-control" @change="changeDressType('send')">
<option value="HEADWEAR">头像装饰</option>
<option value="CHATBUBBLE">气泡装饰</option>
<option value="CAR">座驾</option>
<option value="NAMEPLATE">铭牌</option>
</select>
</div>
</div>
<div class="form-group">
<label for="sendDressId" class="col-sm-3 control-label">送礼者获得装扮内容</label>
<div class="col-sm-8">
<select name="sendDressId" id="sendDressId" data-btn-class="btn-warning" class="form-control">
</select>
</div>
</div>
<div class="form-group">
<label for="sendDressTime" class="col-sm-3 control-label">送礼者获得装扮时长</label>
<div class="col-sm-8">
<input type="number" class="form-control" name="sendDressTime" id="sendDressTime" min="1">
</div>
</div>
<div class="form-group">
<label for="receiveDressType" class="col-sm-3 control-label">收礼者获得装扮类型</label>
<div class="col-sm-8">
<select name="receiveDressType" id="receiveDressType" data-btn-class="btn-warning" class="form-control" @change="changeDressType('receive')">
<option value="HEADWEAR">头像装饰</option>
<option value="CHATBUBBLE">气泡装饰</option>
<option value="CAR">座驾</option>
<option value="NAMEPLATE">铭牌</option>
</select>
</div>
</div>
<div class="form-group">
<label for="receiveDressId" class="col-sm-3 control-label">收礼者获得装扮内容</label>
<div class="col-sm-8">
<select name="receiveDressId" id="receiveDressId" data-btn-class="btn-warning" class="form-control">
</select>
</div>
</div>
<div class="form-group">
<label for="receiveDressTime" class="col-sm-3 control-label">收礼者获得装扮时长</label>
<div class="col-sm-8">
<input type="number" class="form-control" name="receiveDressTime" id="receiveDressTime" min="1">
</div>
</div>
<div class="form-group">
<label for="dressBanner" class="col-sm-3 control-label">礼物介绍banner</label>
<div class="col-sm-8">
<img src="" id="dressBannerImage" style="width:250px;height:90px;" alt="">
<input type="file" id="dressBannerFile" name="uploadFile"/>
<input type="hidden" id="dressBanner" name="dressBanner" class="form-control validate[required]" />
<span class="btn col-sm-4" id="dressBannerUploadInfo" style="color:red;"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<button class="btn btn-default col-sm-4" type="button" id="dressBannerUploadBtn" @click="uploadDressBanner">上传</button>
</div>
</div>
<div class="form-group">
<label for="bannerSkipUrl" class="col-sm-3 control-label">礼物介绍banner跳转</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required]" name="bannerSkipUrl" id="bannerSkipUrl">
</div>
</div>
</div>
<div class="form-group">
<label for="giftLevel" class="col-sm-3 control-label">礼物等级</label>
<div class="col-sm-8">
<select name="giftLevel" id="giftLevel" data-btn-class="btn-warning" class="form-control">
</select>
</div>
</div>
<div id="roomFreeGift">
<div class="form-group">
<label for="maxStage" class="col-sm-2 control-label">每日获得上限</label>
<div class="col-sm-10">
<label for="maxStage" class="col-sm-3 control-label">每日获得上限</label>
<div class="col-sm-8">
<input type="number" class="form-control" name="maxStage" id="maxStage" min="1"
placeholder="1">
</div>
</div>
<div class="form-group">
<label for="firstStageSecond" class="col-sm-2 control-label">首次倒计时秒数</label>
<div class="col-sm-10">
<label for="firstStageSecond" class="col-sm-3 control-label">首次倒计时秒数</label>
<div class="col-sm-8">
<input type="number" class="form-control" name="firstStageSecond" id="firstStageSecond"
min="1" placeholder="1">
</div>
</div>
<div class="form-group">
<label for="otherStageSecond" class="col-sm-2 control-label">其余倒计时秒数</label>
<div class="col-sm-10">
<label for="otherStageSecond" class="col-sm-3 control-label">其余倒计时秒数</label>
<div class="col-sm-8">
<input type="number" class="form-control" name="otherStageSecond" id="otherStageSecond"
min="1" placeholder="1">
</div>
</div>
<div class="form-group">
<label for="resetTime" class="col-sm-2 control-label">重置时间</label>
<div class="col-sm-10">
<label for="resetTime" class="col-sm-3 control-label">重置时间</label>
<div class="col-sm-8">
<input type="text" class="form-control datepicker" name="resetTime" id="resetTime">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">礼物状态</label>
<label class="col-sm-3 control-label">礼物状态</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="giftStatus" value="1"
checked>有效</label>
<label class="radio-inline"><input type="radio" name="giftStatus" value="2">无效</label>
</div>
<label class="col-sm-2 control-label">特效</label>
<label class="col-sm-3 control-label">特效</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="hasEffect" value="0" checked></label>
<label class="radio-inline"><input type="radio" name="hasEffect" value="1"></label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">vgg特效</label>
<label class="col-sm-3 control-label">vgg特效</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="hasVggPic" value="0" checked></label>
<label class="radio-inline"><input type="radio" name="hasVggPic" value="1"></label>
</div>
<label class="col-sm-2 control-label">svga动画</label>
<label class="col-sm-3 control-label">svga动画</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="hasSvga" value="0" checked></label>
<label class="radio-inline"><input type="radio" name="hasSvga" value="1"></label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">最新礼物</label>
<label class="col-sm-3 control-label">最新礼物</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="isLatest" value="0" checked></label>
<label class="radio-inline"><input type="radio" name="isLatest" value="1"></label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">限时礼物</label>
<label class="col-sm-3 control-label">限时礼物</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="isTimeLimit" value="0"
checked></label>
@@ -257,7 +372,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">房间专属礼物</label>
<label class="col-sm-3 control-label">房间专属礼物</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="roomExclude" value="0"
onclick="setRoomId(this)" checked></label>
@@ -269,24 +384,38 @@
name="roomExcludeId" id="roomExcludeId">
</div>
</div>
<div class="form-group">
<label for="startValidTime" class="col-sm-2 control-label">定时上线时间</label>
<div class="col-sm-10">
<input type="text" class="input-sm datetime" name="startValidTime" id="startValidTime">
<label for="giftTag" class="col-sm-3 control-label">礼物标签</label>
<div class="col-sm-8">
<img src="" id="giftTagImage" style="width:250px;height:90px;" alt="">
<input type="file" id="giftTagFile" name="uploadFile"/>
<input type="hidden" id="giftTag" name="giftTag" class="form-control validate[required]" />
<span class="btn col-sm-4" id="giftTagUploadInfo" style="color:red;"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<button class="btn btn-default col-sm-4" type="button" id="giftTagUploadBtn" @click="uploadGiftTag">上传</button>
</div>
</div>
<div class="form-group">
<label for="startValidTime" class="col-sm-3 control-label">定时上线时间</label>
<div class="col-sm-8">
<input type="text" class="input-sm datetime form-control" name="startValidTime" id="startValidTime">
</div>
</div>
<div class="form-group">
<label for="endValidTime" class="col-sm-2 control-label">定时下线时间</label>
<div class="col-sm-10">
<input type="text" class="input-sm datetime" name="endValidTime" id="endValidTime">
<label for="endValidTime" class="col-sm-3 control-label">定时下线时间</label>
<div class="col-sm-8">
<input type="text" class="input-sm datetime form-control" name="endValidTime" id="endValidTime">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">礼物图片:</label>
<div class="col-sm-10">
<label class="col-sm-3 control-label">礼物图片:</label>
<div class="col-sm-8">
<img src="" id="picImage" style="width:250px;height:90px;" alt="">
<input type="file" id="picUploadFile" name="file">
<button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
@@ -295,8 +424,8 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">vgg图片:</label>
<div class="col-sm-10">
<label class="col-sm-3 control-label">vgg图片:</label>
<div class="col-sm-8">
<img src="" id="vggImage" style="width:250px;height:90px;" alt="">
<input type="file" id="vggUploadFile" name="file">
<button class="btn btn-success" type="button" id="vggUploadBtn">上传</button>
@@ -305,8 +434,8 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">svga文件:</label>
<div class="col-sm-10">
<label class="col-sm-3 control-label">svga文件:</label>
<div class="col-sm-8">
<input type="file" id="svgaUploadFile" name="file">
<button class="btn btn-success" type="button" id="svgaUploadBtn">上传</button>
<span>这里只适用于福袋svga动效上传</span>
@@ -317,17 +446,17 @@
</div>
<div class="form-group">
<label for="otherViewType" class="col-sm-2 control-label">其他视图文件类型:</label>
<div class="col-sm-10">
<select name="otherViewType" id="otherViewType" data-btn-class="btn-warning">
<label for="otherViewType" class="col-sm-3 control-label">其他视图文件类型:</label>
<div class="col-sm-8">
<select name="otherViewType" id="otherViewType" data-btn-class="btn-warning" class="form-control">
<option value="0">全部</option>
<option value="1">MP4</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">其他视图文件:</label>
<div class="col-sm-10">
<label class="col-sm-3 control-label">其他视图文件:</label>
<div class="col-sm-8">
<video src="" id="viewFile" style="width:50%;height:50%;" alt="" autoplay="true"></video>
<input type="file" id="viewUploadFile" name="file">
<button class="btn btn-success" type="button" id="viewFileUploadBtn">上传</button>
@@ -337,22 +466,21 @@
</div>
</div>
<div class="form-group">
<label for="giftExplainUrl" class="col-sm-2 control-label">礼物说明</label>
<div class="col-sm-10">
<label for="giftExplainUrl" class="col-sm-3 control-label">礼物说明</label>
<div class="col-sm-8">
<input type="text" placeholder="礼物说明链接,非必填" class="form-control" name="giftExplainUrl"
id="giftExplainUrl">
</div>
</div>
<div class="form-group">
<label for="seqNo" class="col-sm-2 control-label">排序</label>
<div class="col-sm-10">
<label for="seqNo" class="col-sm-3 control-label">排序</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required]" name="seqNo" id="seqNo">
</div>
</div>
<label class="col-sm-2 control-label">全服通知</label>
<label class="col-sm-3 control-label">全服通知</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="isWholeServerLabel" value="0" checked
disabled></label>
@@ -549,10 +677,23 @@
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import ComboboxHelper from '@/assets/plugins/bootstrap-combobox/js/bootstrap-combobox-helper';
import { formatTime, showLoading, hideLoading } from '@/utils/maintainer';
import { formatTime, showLoading, hideLoading, buildSelectOption } from '@/utils/maintainer';
import { getGiftLevelList } from '@/api/gift/giftLevel';
import { getGiftUnlockList, getLockGiftList } from '@/api/gift/giftUnlock';
import { uploadFile } from '@/api/common/upload';
export default {
name: "GiftManageView",
data() {
return {
giftLevel: [],
gift: {
giftId: null,
giftType: 2,
subGiftType: 0,
},
};
},
setup() {
function selectConsumeChange(obj) {
var val = $('#consumeType').val();
@@ -562,7 +703,7 @@ export default {
$('.noble').removeClass("hidden");
}
if (val == 3) {
ComboboxHelper.setDef("#giftType", 2);
$("#giftType").val(2);
$("#giftType").attr('readonly', true);
$('#roomFreeGift').removeClass("hidden");
} else {
@@ -588,14 +729,168 @@ export default {
},
created() {
this.$nextTick(function () {
this.giftUnlockList();
this.levelList();
this.initData();
});
},
methods: {
changeDressType(type) {
let options = [];
let dressType = $('#' + type + 'DressType').val();
if (dressType == 'NAMEPLATE') {
$.ajax({
type: "get",
url: "/admin/nameplate/total/list",
dataType: "json",
async: false,
success: function (json) {
if (json.success == 'true' || json.code == 200) {
var data = json.data;
for (var i = 0, len = data.length; i < len; i++) {
var nameplate = data[i];
options[i] = {
value: nameplate.id,
text: nameplate.name
};
}
}
}
});
} else if (dressType == 'CAR') {
$.ajax({
type: "get",
url: "/admin/car/goods/total/list",
dataType: "json",
async: false,
success: function (json) {
if (json.success == 'true' || json.code == 200) {
var data = json.data;
for (var i = 0, len = data.length; i < len; i++) {
var car = data[i];
options[i] = {
value: car.id,
text: car.name
};
}
}
}
});
} else if (dressType == 'HEADWEAR') {
$.ajax({
type: "get",
url: "/admin/headwear/total/list",
dataType: "json",
async: false,
success: function (json) {
if (json.success == 'true' || json.code == 200) {
var data = json.data;
for (var i = 0, len = data.length; i < len; i++) {
var headWear = data[i];
options[i] = {
value: headWear.headwearId,
text: headWear.name
};
}
}
}
});
} else if (dressType == 'CHATBUBBLE') {
$.ajax({
type: "get",
url: "/admin/chatbubble/list",
dataType: "json",
async: false,
success: function (json) {
if (json.success == 'true' || json.code == 200) {
var data = json.data;
for (var i = 0, len = data.length; i < len; i++) {
var chatBubble = data[i];
options[i] = {
value: chatBubble.id,
text: chatBubble.name
};
}
}
}
});
}
let $dressId = $('#' + type + 'DressId');
let dressId = $('#' + type + 'DressIdBak').val();
$dressId.children().remove();
console.log(options);
if (options.length > 0) {
for (let j = 0; j < options.length; j++) {
var option = options[j];
var $option = $('<option/>');
$option.attr('value', option.value);
$option.attr('data-id', option.value);
$option.attr('data-name', option.text);
if (dressId && dressId == option.value) {
$option.attr('selected', true);
}
$option.html(option.text);
$dressId.append($option);
}
ComboboxHelper.build(options, '#' + type + 'DressId', dressId);
}
},
giftUnlockList() {
getGiftUnlockList().then(res => {
let data = res.data;
let lockGifts = data.map(e => {
return {
text: e.giftName,
value: e.giftId,
};
});
ComboboxHelper.setDef(lockGifts, '#baseGiftId', null);
});
},
levelList() {
getGiftLevelList().then(res => {
let data = res.data;
this.giftLevel = [{
text: '无',
value: ''
}].concat(data.map(e => {
return {
text: e.levelName,
value: e.levelValue
};
}));
buildSelectOption('#giftLevel', '', this.giftLevel);
buildSelectOption('#searchLevel', '', this.giftLevel);
});
},
uploadDressBanner() {
uploadFile('dressBannerFile').then(res => {
let path = res.path;
console.log(path);
$('#dressBanner').val(path);
$('#dressBannerImage').attr('src', path);
if (path != '') {
$("#dressBannerUploadInfo").html('已上传成功');
} else {
$("#dressBannerUploadInfo").html('未上传成功');
}
});
},
uploadGiftTag() {
uploadFile('giftTagFile').then(res => {
let path = res.path;
console.log(path);
$('#giftTag').val(path);
$('#giftTagImage').attr('src', path);
if (path != '') {
$("#giftTagUploadInfo").html('已上传成功');
} else {
$("#giftTagUploadInfo").html('未上传成功');
}
});
},
initData() {
//ComboboxHelper.build(null, '#giftType');
//ComboboxHelper.build(null, '#condition_type');
//ComboboxHelper.build(null, '#nobleId');
let $this = this;
$(function () {
$('#table').bootstrapTable('destroy');
// 清空分页组件的容器
@@ -714,6 +1009,20 @@ export default {
}
}
},
{
field: 'giftLevel',
title: '礼物等级',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
let value = '';
let data = $this.giftLevel.filter(v => v.levelValue == val);
if (data.length > 0) {
value = data[0].text;
}
return value;
}
},
{ field: 'seqNo', title: '排序', align: 'center', width: '10%' },
{
field: 'startValidTime', title: '上线时间', align: 'center', width: '10%',
@@ -765,6 +1074,10 @@ export default {
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
let giftLevel = $('#searchLevel').val();
if (!giftLevel || giftLevel == '') {
giftLevel = null;
}
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
@@ -774,7 +1087,8 @@ export default {
giftType: $('#gift_type').val(),
selectGiftName: $('#selectGiftName').val(),
selectGiftGoldMin: $('#selectGiftGoldMin').val(),
selectGiftGoldMax: $('#selectGiftGoldMax').val()
selectGiftGoldMax: $('#selectGiftGoldMax').val(),
giftLevel: giftLevel,
};
return param;
},
@@ -815,8 +1129,9 @@ export default {
}
});
$("#gift-add").click(function () {
// 打开编辑弹窗
$("#giftModal").modal('show');
$this.gift.giftId = null;
$this.gift.giftType = 2;
$this.gift.subGiftType = 0;
$("#giftForm")[0].reset();
$('#picUrl').val('');
$('#picImage').attr("src", '');
@@ -838,11 +1153,9 @@ export default {
$("#viewFileInfo").html('');
$("#startValidTime").val('');
$("#endValidTime").val('');
// $("#giftName").attr('readonly', false);
// $("#goldPrice").attr('readonly', false);
$("#nobleId").btComboBox('disable');
ComboboxHelper.setDef("#nobleId", '0');
ComboboxHelper.setDef("#giftType", '2');
$('#giftType').val('2');
$("input:radio[name='giftStatus']")[0].checked = true;
$("input:radio[name='hasEffect']")[0].checked = true;
$("input:radio[name='hasVggPic']")[0].checked = true;
@@ -856,6 +1169,25 @@ export default {
$("#consumeType").removeAttr("disabled");
window.selectConsumeChange($("#consumeType"));
$('#roomExcludeId').val('');
$('#giftLevel').val('');
$('#giftType').attr('disabled', '');
$('#subGiftType').attr('disabled', '');
$('#baseGiftId').attr('disabled', '');
$('#unlockNum').attr('disabled', '');
$('#sendDressType').val('');
$('#sendDressId').val('');
$('#sendDressTime').val('');
$('#receiveDressType').val('');
$('#receiveDressId').val('');
$('#receiveDressTime').val('');
$('#dressBanner').val('');
$('#dressBannerImage').attr("src", '');
$("#dressBannerUploadInfo").html('');
$("#dressBannerFile").val('');
$('#bannerSkipUrl').val('');
$('#sendDressIdBak').val('');
$('#receiveDressIdBak').val();
$("#giftModal").modal('show');
});
$("#gift-version-save").click(function () {
if ($("#giftVersionForm").validationEngine('validate')) {
@@ -1087,44 +1419,6 @@ export default {
autoclose: true,
});
$("#table").on("click", '.opt-edit', function () {
$('#picUrl').val('');
$('#picImage').attr("src", '');
$("#picImgInfo").html('');
$("#picUploadFile").val('');
$('#vggUrl').val('');
$("#vggUploadFile").val('');
$('#vggImage').attr("src", '');
$("#vggImgInfo").html('');
$("#svgaUploadFile").val('');
$('#luckyGiftSvgaUrl').val('');
$('#svgaImgInfo').html('');
$('#giftExplainUrl').val('');
$("#seqNo").val('');
$("#giftId").val('');
$('#viewUploadFile').val('');
$('#viewUrl').attr('');
$('#viewFile').attr("src", '');
$("#viewFileInfo").html('');
$("#startValidTime").val('');
$("#endValidTime").val('');
// $("#giftName").attr('readonly', false);
// $("#goldPrice").attr('readonly', false);
$("#nobleId").btComboBox('disable');
ComboboxHelper.setDef("#nobleId", '0');
ComboboxHelper.setDef("#giftType", '2');
$("input:radio[name='giftStatus']")[0].checked = true;
$("input:radio[name='hasEffect']")[0].checked = true;
$("input:radio[name='hasVggPic']")[0].checked = true;
$("input:radio[name='hasSvga']")[0].checked = true;
$("input:radio[name='isLatest']")[0].checked = true;
$("input:radio[name='isTimeLimit']")[0].checked = true;
$("input:radio[name='roomExclude']")[0].checked = true;
$("#notifyStaySecond").val('');
$("#isSkipRoom").val('');
$("#isSendMsg").val('');
$("#consumeType").removeAttr("disabled");
window.selectConsumeChange($("#consumeType"));
$('#roomExcludeId').val('');
console.log("btnEdit");
var id = $(this).attr("data-id");
$.ajax({
@@ -1133,6 +1427,7 @@ export default {
data: { id: id },
dataType: "json",
success: function (json) {
let entity = json.entity;
if (json.roomFreeGiftConfig) {
$("#maxStage").val(json.roomFreeGiftConfig.maxStage);
$("#firstStageSecond").val(json.roomFreeGiftConfig.firstStageSecond);
@@ -1142,8 +1437,6 @@ export default {
}
if (json.entity) {
$("#giftId").val(json.entity.giftId);
// $("#giftName").attr('readonly', true);
// $("#goldPrice").attr('readonly', true);
$("#giftName").val(json.entity.giftName);
$("#goldPrice").val(json.entity.goldPrice);
$("#seqNo").val(json.entity.seqNo);
@@ -1151,7 +1444,6 @@ export default {
var consumeType = json.entity.consumeType;
$("#consumeType").val(consumeType);
$("#consumeType").attr("disabled", true);
ComboboxHelper.setDef("#giftType", json.entity.giftType);
$('#giftType').val(json.entity.giftType);
if (consumeType == 1) {
ComboboxHelper.setDef("#nobleId", '0');
@@ -1233,6 +1525,37 @@ export default {
} else {
$("#viewFileInfo").html('未上传');
}
$('#giftLevel').val(json.entity.giftLevel);
$('#giftTag').val(json.entity.giftTag);
$('#subGiftType').val(entity.subGiftType);
$('#baseGiftId').val(entity.baseGiftId);
$('#unlockNum').val(entity.unlockNum);
$this.gift.giftId = entity.giftId;
$this.gift.giftType = entity.giftType;
$this.gift.subGiftType = entity.subGiftType;
if (entity.giftType == 16) {
$('#giftType').attr('disabled', 'disabled');
$('#subGiftType').attr('disabled', 'disabled');
$('#baseGiftId').attr('disabled', 'disabled');
$('#unlockNum').attr('disabled', 'disabled');
}
$('#sendDressType').val(entity.sendDressType);
$('#sendDressId').val(entity.sendDressId);
$('#sendDressTime').val(entity.sendDressTime);
$('#receiveDressType').val(entity.receiveDressType);
$('#receiveDressId').val(entity.receiveDressId);
$('#receiveDressTime').val(receiveDressTime);
$("#dressBannerFile").val('');
$('#dressBanner').val(entity.dressBanner);
$('#dressBannerImage').attr("src", entity.dressBanner);
if (entity.dressBanner != null && entity.dressBanner != 'undefined' && entity.dressBanner != '') {
$("#dressBannerUploadInfo").html('已上传');
} else {
$("#dressBannerUploadInfo").html('未上传');
}
$('#bannerSkipUrl').val(entity.bannerSkipUrl);
$('#sendDressIdBak').val(entity.sendDressId);
$('#receiveDressIdBak').val(entity.receiveDressId);
// 打开编辑弹窗
$("#giftModal").modal('show');
} else {
@@ -1243,6 +1566,47 @@ export default {
});
});
$("#save").click(function () {
let giftId = $('#giftId').val();
let giftName = $('#giftName').val();
let giftStatus = $('#giftStatus').val();
let giftType = $('#giftType').val();
if (giftType == 16) {
let subGiftType = $this.gift.subGiftType;
if (subGiftType == 0) {
if (!giftId && !confirm('基础解锁礼物保存后礼物类型无法更改,确认保存吗?')) {
return;
}
if (giftStatus == 2) {
getLockGiftList(giftId).then(res => {
let data = res.data;
if (data) {
let targetGiftName = data.map(e => {
return e.giftName;
}).join(',');
if (!confirm('该礼物为' + giftName + '' + giftName + '的基础解锁礼物,设置该礼物为无效会导致[' + targetGiftName + ']一并设置为无效,确认设置无效')) {
return;
}
}
});
}
} else if (subGiftType == 1) {
let baseGiftId = $this.gift.baseGiftId;
let unlockNum = $this.gift.unlockNum;
if (!baseGiftId || baseGiftId == 0) {
$("#tipMsg").text("基础解锁礼物不能为空");
$("#tipModal").modal('show');
return;
}
if (!unlockNum || unlockNum == 0) {
$("#tipMsg").text("解锁礼物个数不能为0");
$("#tipModal").modal('show');
return;
}
if (!giftId && !confirm('被解锁礼物保存后相关解锁需要的设置(礼物类型,解锁礼物,个数)无法更改,确认保存吗?')) {
return;
}
}
}
if ($("#giftForm").validationEngine('validate')) {
$("#consumeType").removeAttr("disabled");
$.ajax({