Files
peko-admin-web/src/views/users/GiftManageView.vue

1811 lines
92 KiB
Vue
Raw Normal View History

2023-09-24 21:00:03 +08:00
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<section class="content">
<div id="table"></div>
<div id="toolbar">
<div class="col-sm-12">
<label for="selectGiftName" class="col-sm-1 control-label">名称:</label>
<div class="col-sm-2">
<input type="text" class="form-control" name="selectGiftName" id="selectGiftName"
placeholder="礼物名称" />
</div>
<label for="selectGiftGoldMin" class="col-sm-1 control-label">价格:</label>
<div class="col-sm-2">
<input type="number" class="form-control" name="selectGiftGoldMin" id="selectGiftGoldMin"
placeholder="下限" />
</div>
<label for="selectGiftGoldMax" class="col-sm-1 control-label">-</label>
<div class="col-sm-2">
<input type="number" class="form-control" name="selectGiftGoldMax" id="selectGiftGoldMax"
placeholder="上限" />
</div>
</div>
<div class="col-sm-12">
<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">
<option value="0" selected="selected">全部</option>
<option value="1">有效</option>
<option value="2">无效</option>
</select>
</div>
<label for="consume_type" class="col-sm-1 control-label">消费类型:</label>
<div class="col-sm-2">
<select name="consume_type" id="consume_type" class="form-control">
<option value="" selected="selected">全部</option>
2024-04-28 10:26:06 +08:00
<option value="1">钻石礼物</option>
2023-09-24 21:00:03 +08:00
<option value="2">萝卜礼物</option>
<option value="3">免费礼物</option>
</select>
</div>
<label for="gift_type" class="col-sm-1 control-label">礼物类型:</label>
<div class="col-sm-2">
<select name="gift_type" id="gift_type" class="form-control">
<option value="" selected="selected">全部</option>
<option value="2">普通面板礼物</option>
<option value="3">福袋礼物</option>
<option value="5">福袋奖池礼物</option>
2023-12-15 10:21:16 +08:00
<option value="1">轻聊或者竞拍房</option>
<option value="4">卡片</option>
2023-09-24 21:00:03 +08:00
<option value="7">贵族礼物</option>
<option value="8">周星榜礼物</option>
<option value="9">合成礼物</option>
<option value="10">涂鸦礼物</option>
2023-12-15 10:21:16 +08:00
<option value="11">个播人气礼物</option>
2023-09-24 21:00:03 +08:00
<option value="15">线性福袋礼物</option>
2024-03-21 14:27:24 +08:00
<option value="16">超级幸运礼物</option>
2024-08-06 11:26:57 +08:00
<option value="17">国家礼物</option>
2023-09-24 21:00:03 +08:00
</select>
</div>
2024-04-15 18:35:29 +08:00
<label for="partitionId" class="col-sm-1 control-label">地区:</label>
<div class="col-sm-2">
<select name="partitionId" id="partitionId" class="form-control"></select>
</div>
2023-09-24 21:00:03 +08:00
</div>
<div class="col-sm-12">
<button id="gift-add" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>增加
</button>
<button id="gift-multiDel" class="btn btn-default">
<i class="glyphicon glyphicon-wrench"></i>批量删除
</button>
<button id="gift-version-reset" class="btn btn-default">
<i class="glyphicon glyphicon-wrench"></i>设置礼物版本
</button>
<button id="gift-refresh" class="btn btn-default">
<i class="glyphicon glyphicon-wrench"></i>查询
</button>
</div>
</div>
</section><!-- .content -->
</div>
</div>
</section>
<div class="modal fade" id="giftVersionModal" tabindex="-1" role="dialog" aria-labelledby="gift-modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="gift-modalLabel">版本信息</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="giftVersionForm">
<div class="form-group">
<label class="col-sm-4 control-label">当前礼物版本</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="giftVersion" id="giftVersion"
readonly="false">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">新版本</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required]" name="configValue"
id="newGiftVersion">
</div>
</div>
<input type="hidden" name="configId" id="gift-configId" />
<input type="hidden" name="configName" id="gift-configName" />
<input type="hidden" name="nameSpace" id="gift-nameSpace" />
<input type="hidden" name="configStatus" id="gift-configStatus" />
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="gift-version-save">保存</button>
</div>
</form>
</div>
</div>
</div>
</div>
2024-01-09 12:11:42 +08:00
<div class="modal fade" id="giftModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel"
style="height: 100%; overflow: hidden; overflow: scroll;">
2023-09-24 21:00:03 +08:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="modalLabel">礼物信息</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="giftForm">
<input type="hidden" name="giftId" id="giftId" />
2024-04-09 19:05:17 +08:00
<div class="form-group">
<label for="partitionFlag" class="col-sm-2 control-label">选择分区</label>
<div class="col-sm-10">
<input type="checkbox" name="partitionFlag" value="1"/>英语区<br>
<input type="checkbox" name="partitionFlag" value="2"/>阿拉伯语区<br>
<input type="checkbox" name="partitionFlag" value="4"/>华语区<br>
</div>
</div>
2023-09-24 21:00:03 +08:00
<div class="form-group">
<label for="consumeType" class="col-sm-2 control-label">消费类型</label>
<div class="col-sm-10">
<select class="form-control" name="consumeType" id="consumeType"
data-btn-class="btn-warning" onchange="selectConsumeChange(this)">
2024-04-28 10:26:06 +08:00
<option value="1" selected="selected">钻石礼物</option>
2023-09-24 21:00:03 +08:00
<option value="2">萝卜礼物</option>
<option value="3">免费礼物</option>
</select>
</div>
</div>
<div class="form-group">
<label for="giftName" class="col-sm-2 control-label">礼物名称</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="giftName" id="giftName">
</div>
</div>
2024-04-09 19:05:17 +08:00
<div class="form-group">
<label for="giftArName" class="col-sm-2 control-label">阿语礼物名称</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="giftName" id="giftArName">
</div>
</div>
<div class="form-group">
<label for="giftEnName" class="col-sm-2 control-label">英语礼物名称</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="giftName" id="giftEnName">
</div>
</div>
2023-09-24 21:00:03 +08:00
<div class="form-group">
<label for="goldPrice" class="col-sm-2 control-label">礼物价格</label>
<div class="col-sm-10">
<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">
2023-12-13 17:23:31 +08:00
<select name="giftType" id="giftType" class="form-control" data-btn-class="btn-warning">
2023-12-13 17:44:38 +08:00
<option value="2" selected>普通面板礼物</option>
2023-09-24 21:00:03 +08:00
<option value="3">福袋礼物</option>
<option value="5">福袋奖池礼物</option>
<option value="1">轻聊或者竞拍房</option>
<option value="4">卡片</option>
<option value="7">贵族礼物</option>
<option value="8">周星榜礼物</option>
<option value="9">合成礼物</option>
<option value="10">涂鸦礼物</option>
2023-12-15 10:21:16 +08:00
<option value="11">个播人气礼物</option>
2023-09-24 21:00:03 +08:00
<option value="15">线性福袋礼物</option>
2024-03-21 14:27:24 +08:00
<option value="16">超级幸运礼物</option>
2024-08-06 11:26:57 +08:00
<option value="17">国家礼物</option>
2023-09-24 21:00:03 +08:00
</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">
<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">
<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">
<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">
<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>
<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>
<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>
<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>
<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>
<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>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="isTimeLimit" value="0"
checked></label>
<label class="radio-inline"><input type="radio" name="isTimeLimit" value="1"></label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">房间专属礼物</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="roomExclude" value="0"
onclick="setRoomId(this)" checked></label>
<label class="radio-inline"><input type="radio" name="roomExclude" value="1"
onclick="setRoomId(this)"></label>
</div>
<div class="col-sm-10">
<input type="text" style="display:none" placeholder="输入房间ID,逗号隔开" class="form-control"
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">
</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">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">礼物图片:</label>
<div class="col-sm-10">
<img src="" id="picImage" style="width:250px;height:90px;" alt="">
2024-01-09 15:47:01 +08:00
<input type="file" id="picUploadFile" name="file" @change="changeFile($event)">
2023-09-24 21:00:03 +08:00
<button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
<input type="hidden" id="picUrl" name="picUrl" class="form-control validate[required]" />
<span id="picImgInfo" style="color:red;"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">vgg图片:</label>
<div class="col-sm-10">
<img src="" id="vggImage" style="width:250px;height:90px;" alt="">
2024-01-09 15:56:22 +08:00
<input type="file" id="vggUploadFile" name="file" @change="changeFile($event)">
2023-09-24 21:00:03 +08:00
<button class="btn btn-success" type="button" id="vggUploadBtn">上传</button>
<input type="hidden" id="vggUrl" name="vggUrl" class="form-control validate[required]" />
<span id="vggImgInfo" style="color:red;"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">svga文件:</label>
<div class="col-sm-10">
2024-01-09 15:47:48 +08:00
<input type="file" id="svgaUploadFile" name="file" @change="changeFile($event)">
2023-09-24 21:00:03 +08:00
<button class="btn btn-success" type="button" id="svgaUploadBtn">上传</button>
<span>这里只适用于福袋svga动效上传</span>
<input type="hidden" id="luckyGiftSvgaUrl" name="luckyGiftSvgaUrl"
class="form-control validate[required]" />
<span id="svgaImgInfo" style="color:red;"></span>
</div>
</div>
<div class="form-group">
<label for="otherViewType" class="col-sm-2 control-label">其他视图文件类型:</label>
<div class="col-sm-10">
2024-04-29 15:13:02 +08:00
<select name="otherViewType" id="otherViewType" data-btn-class="btn-warning" class="form-control">
2023-09-24 21:00:03 +08:00
<option value="0">全部</option>
2024-04-29 15:13:02 +08:00
<option value="1" selected>MP4</option>
2023-09-24 21:00:03 +08:00
<option value="2">PAG</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">其他视图文件:</label>
<div class="col-sm-10">
2024-01-02 18:29:15 +08:00
<video src="" id="viewFile" style="width:50%;height:50%;" alt="" autoplay="true"></video>
2024-01-09 15:47:48 +08:00
<input type="file" id="viewUploadFile" name="file" @change="changeFile($event)">
2023-09-24 21:00:03 +08:00
<button class="btn btn-success" type="button" id="viewFileUploadBtn">上传</button>
<span>如果上面已经上传svga素材此处不要再上传</span>
<input type="hidden" id="viewUrl" name="viewUrl" class="form-control validate[required]" />
<span id="viewFileInfo" style="color:red;"></span>
</div>
</div>
<div class="form-group">
<label for="giftExplainUrl" class="col-sm-2 control-label">礼物说明</label>
<div class="col-sm-10">
<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">
<input type="text" class="form-control validate[required]" name="seqNo" id="seqNo">
</div>
</div>
<label class="col-sm-2 control-label">全服通知</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="isWholeServerLabel" value="0" checked
disabled></label>
<label class="radio-inline"><input type="radio" name="isWholeServerLabel" value="1"
disabled></label>
</div>
<input type="hidden" name="isWholeServer" id="isWholeServer" />
<input type="hidden" name="notifyStaySecond" id="notifyStaySecond" />
<input type="hidden" name="isSkipRoom" id="isSkipRoom" />
<input type="hidden" name="isSendMsg" id="isSendMsg" />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="save">保存</button>
</div>
</div>
</div>
</div>
<div class="modal first fade" id="tipModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">提示信息</h4>
</div>
<div class="modal-body" id="tipMsg"></div>
</div>
</div>
</div>
<!-- 为用户赠送礼物饰弹窗 -->
<div class="modal fade" id="sendGiftModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">x</span></button>
<h4 class="modal-title" id="modalSendLabel">赠送礼物</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="giftSendForm">
<input type="hidden" name="sendGiftId" id="sendGiftId" />
<div class="form-group">
<label for="sendErbanNo" class="col-sm-3 control-label">平台号</label>
<div class="col-sm-9">
<textarea name="sendErbanNo" id="sendErbanNo" class="form-control validate[required]"
placeholder="多个平台号使用英文逗号,分隔"></textarea>
</div>
</div>
<div class="form-group">
<label for="giftNum" class="col-sm-3 control-label">赠送数量</label>
<div class="col-sm-9">
<input type="text" name="giftNum" id="giftNum" class="form-control validate[required]"
value="1" />
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="send">提交</button>
</div>
</div>
</div>
</div>
<!--礼物专属房间列表-->
<div class="modal fade" id="roomGiftModel" tabindex="-1" role="dialog" aria-labelledby="gift-modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content room_class">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="roomGiftLabel">礼物专属房间列表</h4>
</div>
<div class="modal-body">
<div class="box box-primary">
<div class="box-body">
<section class="content">
<div id="roomGiftTable"></div>
<div id="roomGiftToolbar">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-2 control-label">用户平台号:</label>
<div class="col-sm-3">
<form class="form-horizontal" id="roomGiftForm">
<input type="hidden" class="form-control" name="giftId" id="query_gift_id">
<input type="text" class="form-control" name="erbanNo" id="erbanNo">
</form>
</div>
<button id="roomGiftSearch" class="btn btn-default">
<i class="glyphicon glyphicon-wrench"></i>查询
</button>
<button id="roomGiftAdd" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>增加
</button>
<button id="roomGiftImport" class="btn btn-default">
<i class="glyphicon glyphicon-import"></i>批量导入
</button>
<button id="roomGiftMultiDel" class="btn btn-default">
<i class="glyphicon glyphicon-remove"></i>批量删除
</button>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
</div>
</div>
<!--导入专属房间列表-->
<div class="modal fade" id="roomImportModel" tabindex="-1" role="dialog" aria-labelledby="gift-modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="roomImportLabel">礼物专属房间列表</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="roomImportForm">
<div class="form-group">
<input type="hidden" id="import_gift_id" name="giftId" />
<label for="uploadFile" class="col-sm-3 control-label">上传文件:</label>
<div class="col-sm-9">
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
application/vnd.ms-excel" class="form-control validate[required]" name="uploadFile"
id="uploadFile" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">注意:</label>
<div class="col-sm-9">
<span>
<font color="#dd4b39">1.上传文件仅支持.xls/.xlsx格式的文件<br>
2.表格的第一行为标题,房间号请从表格的第二行开始填写<br>
3.导入之前请确认是用户正在使用的平台号否则会导入失败<br>
4.导入之前请确认房间是否已存在如果已存在会导致导入报错</font>
</span>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="upload">确定</button>
</div>
</div>
</div>
</div>
<!--添加专属房间列表-->
<div class="modal fade" id="roomAddModel" tabindex="-1" role="dialog" aria-labelledby="gift-modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="roomAddLabel">礼物专属房间列表</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="roomAddForm">
<div class="form-group">
<input type="hidden" id="add_gift_id" name="giftId" />
<label for="addErbanNos" class="col-sm-3 control-label">房主平台号:</label>
<div class="col-sm-9">
<textarea type="text" class="form-control validate[required]" name="erbanNos"
id="addErbanNos" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">注意:</label>
<div class="col-sm-9">
<span>
<font color="#dd4b39">1.多个平台号用换行符分隔<br>
2.最多支持20个平台号输入<br>
3.超过20个平台号请使用文件导入方式增加<br>
4.增加之前请确认房间是否已存在如果已存在会导致添加报错</font>
</span>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="roomAdd">确定</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import ComboboxHelper from '@/assets/plugins/bootstrap-combobox/js/bootstrap-combobox-helper';
2024-01-09 15:47:01 +08:00
import { formatTime, showLoading, hideLoading, apiResult } from '@/utils/maintainer';
import { uploadGift } from '@/api/common/upload';
2024-04-15 18:35:29 +08:00
import { getPartitionInfoList } from '@/api/partition/partitionInfo';
import { buildSelectOption } from '@/utils/system-helper';
2023-09-24 21:00:03 +08:00
export default {
name: "GiftManageView",
2024-01-09 15:47:01 +08:00
data() {
return {
files: {},
};
},
2023-09-24 21:00:03 +08:00
setup() {
function selectConsumeChange(obj) {
var val = $('#consumeType').val();
if (val == 2) {
$('.noble').addClass("hidden");
} else {
$('.noble').removeClass("hidden");
}
if (val == 3) {
2023-12-13 17:23:31 +08:00
$('#giftType').val(2);
2023-09-24 21:00:03 +08:00
$("#giftType").attr('readonly', true);
$('#roomFreeGift').removeClass("hidden");
} else {
$("#giftType").attr('readonly', false);
$('#roomFreeGift').addClass("hidden");
}
}
// 添加房间专属礼物
function setRoomId(checkedRadio) {
checkedRadio.checked = true;
if (checkedRadio.value == '1') {
document.getElementById("roomExcludeId").style.display = '';
} else if (checkedRadio.value == '0') {
document.getElementById("roomExcludeId").style.display = 'none';
}
}
window.selectConsumeChange = selectConsumeChange;
window.setRoomId = setRoomId;
return {
selectConsumeChange,
setRoomId
};
},
created() {
this.$nextTick(function () {
2024-04-15 20:23:42 +08:00
this.initPartition();
2023-09-24 21:00:03 +08:00
this.initData();
});
},
methods: {
2024-01-09 15:47:01 +08:00
changeFile(event) {
console.log(event);
let target = event.target;
let id = target.id;
this.files[id] = target.files[0];
},
2023-09-24 21:00:03 +08:00
initData() {
2024-01-09 15:47:01 +08:00
let $this = this;
2023-09-24 21:00:03 +08:00
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'tmp', title: 'ID', align: 'center', checkbox: true },
{ field: 'giftId', title: '礼物ID', align: 'center', width: '5%' },
2024-04-09 19:05:17 +08:00
{field: 'giftName.zh', title: '礼物名称', align: 'center', width: '15%'},
{field: 'giftName.ar', title: '阿语礼物名称', align: 'center', width: '10%'},
{field: 'giftName.en', title: '英语礼物名称', align: 'center', width: '10%'},
{
field: 'partitionFlag',
title: '地区',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
let value = '';
2024-04-16 15:38:57 +08:00
if ((val & 1) != 0) {
2024-04-09 19:05:17 +08:00
value += '英语区<br>';
}
2024-04-16 15:38:57 +08:00
if ((val & 2) != 0) {
2024-04-09 19:05:17 +08:00
value += '阿拉伯语区<br>';
}
2024-04-16 15:38:57 +08:00
if ((val & 4) != 0) {
2024-04-09 19:05:17 +08:00
value += '华语区<br>';
}
return value;
}
},
2023-09-24 21:00:03 +08:00
{
field: 'giftStatus',
title: '礼物状态',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
if (val == 1) {
return '有效';
} else {
return '无效';
}
}
},
{ field: 'goldPrice', title: '礼物价格', align: 'center', width: '10%' },
{
field: 'consumeType',
title: '消费类型',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
if (val == 1) {
2024-04-28 10:26:06 +08:00
return '钻石礼物';
2023-09-24 21:00:03 +08:00
} else if (val == 2) {
return '萝卜礼物';
} else if (val == 3) {
return '免费礼物';
} else {
return '-';
}
}
},
{
field: 'hasEffect',
title: '特效',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (val == true) {
return '有';
} else {
return '无'
}
}
},
{
field: 'hasVggPic',
title: 'vgg特效',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (val == true) {
return '有';
} else {
return '无'
}
}
},
{
field: 'hasSvga',
title: 'svga动画',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (val == true) {
return '有';
} else {
return '无'
}
}
},
{
field: 'isLatest',
title: '最新礼物',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (val == true) {
return '是';
} else {
return '否'
}
}
},
{
field: 'isTimeLimit',
title: '限时礼物',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
if (val == true) {
return '是';
} else {
return '否'
}
}
},
{
field: 'roomExclude',
title: '房间专属',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
if (val == true) {
return '是';
} else {
return '否'
}
}
},
{ field: 'seqNo', title: '排序', align: 'center', width: '10%' },
{
field: 'startValidTime', title: '上线时间', align: 'center', width: '10%',
formatter: function (val) {
if (val) {
const date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '-';
}
}
},
{
field: 'endValidTime', title: '下线时间', align: 'center', width: '10%',
formatter: function (val) {
if (val) {
const date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '-';
}
}
},
{
field: 'giftId', title: '操作', align: 'center', width: '15%', formatter: function (val, row, index) {
var str = '<button class="btn btn-sm btn-success opt-edit" data-id=' + val + '>' +
'<i class="glyphicon glyphicon-edit"></i>编辑</button>' +
'<button class="btn btn-sm btn-danger opt-remove" data-id=' + val +
'><i class="glyphicon glyphicon-remove"></i>删除</button>' +
'<button class="btn btn-sm btn-warning opt-send" data-id=' + val +
'><i class="glyphicon glyphicon-send"></i> 赠送</button>';
if (row.roomExclude) {
str = str + '<button class="btn btn-sm btn-primary opt-query" data-id=' + val +
'><i class="glyphicon glyphicon-eye-open"></i> 查看房间列表</button>';
}
return str;
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [1, 10, 20, 30, 50],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
searchText: params.searchText,
type: $('#condition_type').val(),
consumeType: $('#consume_type').val(),
giftType: $('#gift_type').val(),
selectGiftName: $('#selectGiftName').val(),
selectGiftGoldMin: $('#selectGiftGoldMin').val(),
2024-04-16 15:21:25 +08:00
selectGiftGoldMax: $('#selectGiftGoldMax').val(),
partitionId: $('#partitionId').val(),
2023-09-24 21:00:03 +08:00
};
return param;
},
2024-04-09 19:05:17 +08:00
ajax:function(request){ //使用ajax请求
$.ajax({
type:"GET",
2024-04-22 10:49:46 +08:00
url:'/admin/gift/getList?type=' + ComboboxHelper.getSelected("#condition_type"),
2024-04-09 19:05:17 +08:00
contentType:'application/json;charset=utf-8',
dataType:'json',
data: request.data,
success:function (res) {
console.log(res);
request.success({
"rows": res.rows.map(i=>{
2024-04-12 18:10:32 +08:00
let value = i.giftName;
if (value.startsWith('{') && value.endsWith('}')) {
i.giftName = JSON.parse(value);
2024-04-12 18:18:45 +08:00
} else {
i.giftName = {
zh: value,
ar: value,
en: value,
};
2024-04-12 18:10:32 +08:00
}
2024-04-09 19:05:17 +08:00
return i;
}),
"total": res.total
});
},
error:function(error){
console.log(error);
}
})
},
2023-09-24 21:00:03 +08:00
toolbar: '#toolbar',
2024-04-22 10:44:52 +08:00
// url: '/admin/gift/getList',
2023-09-24 21:00:03 +08:00
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
$("#table").on("click", '.opt-remove', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除该记录吗?" +
"\r\n删除后再也不能找回请谨慎操作")) {
$.ajax({
type: 'post',
2024-04-22 10:44:52 +08:00
url: "/admin/gift/del",
2023-09-24 21:00:03 +08:00
data: { 'ids': JSON.stringify([id]) },
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败");
$("#tipModal").modal('show');
}
}
});
}
});
$("#gift-add").click(function () {
// 打开编辑弹窗
$("#giftModal").modal('show');
2024-01-09 15:47:01 +08:00
$this.files = {};
2023-09-24 21:00:03 +08:00
$("#giftForm")[0].reset();
$('#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('');
2024-04-23 16:57:18 +08:00
$('#viewUrl').val('');
2023-09-24 21:00:03 +08:00
$('#viewFile').attr("src", '');
$("#viewFileInfo").html('');
$("#startValidTime").val('');
$("#endValidTime").val('');
// $("#giftName").attr('readonly', false);
// $("#goldPrice").attr('readonly', false);
$("#nobleId").btComboBox('disable');
ComboboxHelper.setDef("#nobleId", '0');
2023-12-13 17:23:31 +08:00
$('#giftType').val(2);
2023-12-11 10:27:44 +08:00
$("input:radio[name='giftStatus']")[1].checked = true;
2024-04-26 18:25:07 +08:00
$("input:radio[name='hasEffect']")[0].checked = true;
2023-12-11 10:27:44 +08:00
$("input:radio[name='hasVggPic']")[1].checked = true;
2023-11-29 17:21:34 +08:00
$("input:radio[name='hasSvga']")[0].checked = true;
2024-04-26 18:25:07 +08:00
$("input:radio[name='isLatest']")[0].checked = true;
$("input:radio[name='isTimeLimit']")[0].checked = true;
2023-11-29 17:21:34 +08:00
$("input:radio[name='roomExclude']")[0].checked = true;
2023-09-24 21:00:03 +08:00
$("#notifyStaySecond").val('');
$("#isSkipRoom").val('');
$("#isSendMsg").val('');
$("#consumeType").removeAttr("disabled");
2024-01-20 17:47:30 +08:00
$('#roomExcludeId').val('');
2024-04-10 19:17:45 +08:00
$('input[name="partitionFlag"]').each(function() {
$(this).checked = false;
});
2024-01-20 18:59:49 +08:00
window.selectConsumeChange($("#consumeType"));
2024-01-20 17:47:30 +08:00
$('#roomExcludeId').val('');
2023-09-24 21:00:03 +08:00
});
$("#gift-version-save").click(function () {
if ($("#giftVersionForm").validationEngine('validate')) {
$.ajax({
type: "post",
2024-04-22 10:44:52 +08:00
url: "/admin/sysConf/save",
2023-09-24 21:00:03 +08:00
data: $('#giftVersionForm').serialize(),
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#giftVersionModal").modal('hide');
$("#tipMsg").text("设置成功");
$("#tipModal").modal('show');
} else {
$("#tipMsg").text("设置失败");
$("#tipModal").modal('show');
}
}
});
}
2024-01-09 12:11:42 +08:00
2023-09-24 21:00:03 +08:00
})
$("#nobleId").on('change', function () {
if (ComboboxHelper.getSelected("#nobleId") != 0) {
var nobleName = $("#nobleId").btComboBox('selectedOption')[1];
$("#nobleName").val(nobleName);
}
else {
$("#nobleName").val('');
}
})
$("#notNoble").on('change', function () {
ComboboxHelper.setDef("#nobleId", '0');
$("#nobleName").val('');
$("#nobleId").btComboBox('disable');
})
$("#isNoble").on('change', function () {
$("#nobleId").btComboBox('enable');
})
$("#gift-version-reset").click(function () {
$("#giftVersion").val('');
$("#gift-configName").val('');
$("#gift-configId").val('');
$("#gift-nameSpace").val('');
$("#gift-configStatus").val('');
$("#newGiftVersion").val('');
$.ajax({
type: "get",
2024-04-22 10:44:52 +08:00
url: "/admin/gift/getCurGiftVersion",
2023-09-24 21:00:03 +08:00
data: {},
dataType: "json",
success: function (json) {
if (json.entity) {
$("#giftVersion").val(json.entity.configValue);
$("#gift-configName").val(json.entity.configName);
$("#gift-configId").val(json.entity.configId);
$("#gift-nameSpace").val(json.entity.nameSpace);
$("#gift-configStatus").val(json.entity.configStatus);
$("#giftVersionModal").modal("show");
} else {
$("#tipMsg").text("获取当前礼物版本失败");
$("#tipModal").modal('show');
}
}
});
});
$("#gift-refresh").click(function () {
2024-04-22 10:44:52 +08:00
$("#table").bootstrapTable('refresh', { url: '/admin/gift/getList' });
2023-09-24 21:00:03 +08:00
})
$("#gift-multiDel").click(function () {
var rows = $("#table").bootstrapTable("getSelections");
if (rows.length == 0) {
alert("请先选择要删除的记录");
return;
}
console.log("rows: " + rows.length);
var idArr = [];
for (var i = 0; i < rows.length; i++) {
idArr.push(rows[i]['giftId']);
}
console.log(idArr);
if (confirm("你确认批量删除该记录吗?" +
"\r\n删除后再也不能找回请谨慎操作")) {
$.ajax({
type: 'post',
2024-04-22 10:44:52 +08:00
url: "/admin/gift/del",
2023-09-24 21:00:03 +08:00
data: { 'ids': JSON.stringify(idArr) },
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败");
$("#tipModal").modal('show');
}
}
});
}
});
$('#picUploadBtn').on('click', function () {
2024-01-02 18:10:57 +08:00
showLoading();
2024-01-09 15:47:01 +08:00
uploadGift($this.files['picUploadFile']).then(res => {
let path = res.path;
console.log(path);
$('#picUrl').val(path);
$('#picImage').attr("src", path);
if (path != '') {
$("#picImgInfo").html('已上传成功');
} else {
$("#picImgInfo").html('未上传成功');
2023-09-24 21:00:03 +08:00
}
2024-01-09 15:47:01 +08:00
hideLoading();
}).catch(e => {
console.error(e);
hideLoading();
2023-09-24 21:00:03 +08:00
});
2024-01-09 15:47:01 +08:00
});
2023-09-24 21:00:03 +08:00
$('#vggUploadBtn').on('click', function () {
2024-01-02 18:10:57 +08:00
showLoading();
2024-01-09 15:47:01 +08:00
uploadGift($this.files['vggUploadFile']).then(res => {
let path = res.path;
console.log(path);
$('#vggUrl').val(path);
$('#vggImage').attr("src", path);
if (path != '') {
$("#vggImgInfo").html('已上传成功');
} else {
$("#vggImgInfo").html('未上传成功');
2023-09-24 21:00:03 +08:00
}
2024-01-09 15:47:01 +08:00
hideLoading();
}).catch(e => {
console.error(e);
hideLoading();
});
});
2023-09-24 21:00:03 +08:00
$('#svgaUploadBtn').on('click', function () {
2024-01-02 18:10:57 +08:00
showLoading();
2024-01-09 15:47:01 +08:00
uploadGift($this.files['svgaUploadFile']).then(res => {
let path = res.path;
console.log(path);
$('#luckyGiftSvgaUrl').val(path);
if (path != '') {
$("#svgaImgInfo").html('已上传成功');
} else {
$("#svgaImgInfo").html('未上传成功');
2023-09-24 21:00:03 +08:00
}
2024-01-09 15:47:01 +08:00
hideLoading();
}).catch(e => {
console.error(e);
hideLoading();
});
});
2023-09-24 21:00:03 +08:00
$('#viewFileUploadBtn').on('click', function () {
2024-01-02 16:03:17 +08:00
showLoading();
2024-01-09 15:47:01 +08:00
uploadGift($this.files['viewUploadFile']).then(res => {
let path = res.path;
console.log(path);
$('#viewUrl').val(path);
2024-01-09 15:51:32 +08:00
$('#viewFile').attr("src", path);
2024-01-09 15:47:01 +08:00
if (path != '') {
$("#viewFileInfo").html('已上传成功');
} else {
$("#viewFileInfo").html('未上传成功');
2023-09-24 21:00:03 +08:00
}
2024-01-09 15:47:01 +08:00
hideLoading();
}).catch(e => {
console.error(e);
hideLoading();
2023-09-24 21:00:03 +08:00
});
2024-01-09 15:47:01 +08:00
});
2023-09-24 21:00:03 +08:00
$("#cancel").click(function () {
TableHelper.unCheckAll("#table");
});
function parseNum(val) {
if (val == undefined || val == 'false' || val == 0) {
return 0;
}
else {
return 1;
}
}
$('#resetTime').datetimepicker({
format: 'hh:ii:00',
autoclose: true,
});
$("#table").on("click", '.opt-edit', function () {
2024-01-20 18:59:49 +08:00
$('#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('');
2024-04-23 16:57:18 +08:00
$('#viewUrl').val('');
2024-01-20 18:59:49 +08:00
$('#viewFile').attr("src", '');
$("#viewFileInfo").html('');
$("#startValidTime").val('');
$("#endValidTime").val('');
$("#nobleId").btComboBox('disable');
ComboboxHelper.setDef("#nobleId", '0');
$('#giftType').val(2);
$("input:radio[name='giftStatus']")[1].checked = true;
$("input:radio[name='hasEffect']")[1].checked = true;
$("input:radio[name='hasVggPic']")[1].checked = true;
$("input:radio[name='hasSvga']")[0].checked = true;
$("input:radio[name='isLatest']")[1].checked = true;
$("input:radio[name='isTimeLimit']")[1].checked = true;
$("input:radio[name='roomExclude']")[0].checked = true;
$('#giftType').val('');
$("#notifyStaySecond").val('');
$("#isSkipRoom").val('');
$("#isSendMsg").val('');
$("#consumeType").removeAttr("disabled");
$('#roomExcludeId').val('');
2024-04-12 18:25:58 +08:00
$("input:checkbox[name='partitionFlag']")[0].checked = false;
$("input:checkbox[name='partitionFlag']")[1].checked = false;
$("input:checkbox[name='partitionFlag']")[2].checked = false;
2023-09-24 21:00:03 +08:00
console.log("btnEdit");
var id = $(this).attr("data-id");
2024-01-09 15:47:01 +08:00
$this.files = {};
2023-09-24 21:00:03 +08:00
$.ajax({
type: "get",
2024-04-22 10:44:52 +08:00
url: "/admin/gift/get",
2023-09-24 21:00:03 +08:00
data: { id: id },
dataType: "json",
success: function (json) {
if (json.roomFreeGiftConfig) {
$("#maxStage").val(json.roomFreeGiftConfig.maxStage);
$("#firstStageSecond").val(json.roomFreeGiftConfig.firstStageSecond);
$("#otherStageSecond").val(json.roomFreeGiftConfig.otherStageSecond);
$("#resetTime").val(json.roomFreeGiftConfig.resetTime);
$("#resetTimeCron").val(json.roomFreeGiftConfig.resetTimeCron);
}
if (json.entity) {
$("#giftId").val(json.entity.giftId);
2024-04-12 18:10:32 +08:00
let giftName = json.entity.giftName;
if (giftName.startsWith('{') && giftName.endsWith('}')) {
var jsonName = JSON.parse(giftName);
$("#giftName").val(jsonName.zh);
// 阿语名称
$("#giftArName").val(jsonName.ar);
// 英语名称
$("#giftEnName").val(jsonName.en);
} else {
$("#giftName").val(giftName);
// 阿语名称
$("#giftArName").val(giftName);
// 英语名称
$("#giftEnName").val(giftName);
}
2023-09-24 21:00:03 +08:00
$("#goldPrice").val(json.entity.goldPrice);
$("#seqNo").val(json.entity.seqNo);
$("#giftExplainUrl").val(json.entity.giftExplainUrl);
var consumeType = json.entity.consumeType;
$("#consumeType").val(consumeType);
$("#consumeType").attr("disabled", true);
$('#giftType').val(json.entity.giftType);
if (consumeType == 1) {
ComboboxHelper.setDef("#nobleId", '0');
$("#nobleId").btComboBox('disable');
$("#nobleName").val('');
}
if (consumeType == 2) {
$('.noble').addClass("hidden");
} else {
$('.noble').removeClass("hidden");
}
if (consumeType == 3) {
$("#giftType").attr('readonly', true);
$('#roomFreeGift').removeClass("hidden")
} else {
$("#giftType").attr('readonly', false);
$('#roomFreeGift').addClass("hidden")
}
$("#startValidTime").val(formatTime(json.entity.startValidTime));
$("#endValidTime").val(formatTime(json.entity.endValidTime));
var hasEffect = parseNum(json.entity.hasEffect);
var hasVggPic = parseNum(json.entity.hasVggPic);
var hasSvga = parseNum(json.entity.hasSvga);
var isLatest = parseNum(json.entity.isLatest);
var isTimeLimit = parseNum(json.entity.isTimeLimit);
var isWholeServer = parseNum(json.entity.isWholeServer);
var roomExclude = parseNum(json.entity.roomExclude);
2024-04-22 11:12:25 +08:00
var partitionFlag = json.entity.partitionFlag;
2023-09-24 21:00:03 +08:00
$("#isWholeServer").val(isWholeServer);
// 礼物状态的值跟其他不同, 1为有效 2为无效
if (json.entity.giftStatus == 1) {
$("input:radio[name='giftStatus']")[0].checked = true;
} else {
$("input:radio[name='giftStatus']")[1].checked = true;
}
// 设置radio
$("input:radio[name='hasEffect']")[hasEffect].checked = true;
$("input:radio[name='hasVggPic']")[hasVggPic].checked = true;
$("input:radio[name='hasSvga']")[hasSvga].checked = true;
$("input:radio[name='isLatest']")[isLatest].checked = true;
$("input:radio[name='isTimeLimit']")[isTimeLimit].checked = true;
$("input:radio[name='isWholeServerLabel']")[isWholeServer].checked = true;
$("input:radio[name='roomExclude']")[roomExclude].checked = true;
$("#notifyStaySecond").val(json.entity.notifyStaySecond);
$("#isSkipRoom").val(json.entity.isSkipRoom);
$("#isSendMsg").val(json.entity.isSendMsg);
// 设置礼物图片
$("#picUploadFile").val('');
$('#picUrl').val(json.entity.picUrl);
$('#picImage').attr("src", json.entity.picUrl);
if (json.entity.picUrl != '') {
$("#picImgInfo").html('已上传');
} else {
$("#picImgInfo").html('未上传');
}
// 设置vgg图片
$("#vggUploadFile").val('');
$('#vggUrl').val(json.entity.vggUrl);
$('#vggImage').attr("src", json.entity.vggUrl);
if (json.entity.vggUrl != '') {
$("#vggImgInfo").html('已上传');
} else {
$("#vggImgInfo").html('未上传');
}
// 设置svga图片
$("#svgaUploadFile").val('');
$('#luckyGiftSvgaUrl').val(json.entity.luckyGiftSvgaUrl);
if (json.entity.luckyGiftSvgaUrl != undefined) {
$("#svgaImgInfo").html('已上传');
} else {
$("#svgaImgInfo").html('未上传');
}
// 设置其他视图文件效果图片
2024-01-22 11:25:53 +08:00
$('#viewUploadFile').val('');
2023-09-24 21:00:03 +08:00
$('#otherViewType').val(json.entity.otherViewType);
$('#viewUrl').val(json.entity.viewUrl);
$('#viewFile').attr("src", json.entity.viewUrl);
if (json.entity.viewUrl != null && json.entity.viewUrl != 'undefined' && json.entity.viewUrl != '') {
$("#viewFileInfo").html('已上传');
} else {
$("#viewFileInfo").html('未上传');
}
2024-04-09 19:05:17 +08:00
//分区
2024-04-22 11:12:25 +08:00
console.log(partitionFlag & 2);
console.log(partitionFlag & 4);
2024-04-18 10:01:14 +08:00
if ((partitionFlag & 1) != 0) {
2024-04-12 18:25:58 +08:00
$("input:checkbox[name='partitionFlag']")[0].checked = true;
2024-04-09 19:05:17 +08:00
} else {
2024-04-12 18:25:58 +08:00
$("input:checkbox[name='partitionFlag']")[0].checked = false;
2024-04-09 19:05:17 +08:00
}
2024-04-18 10:01:14 +08:00
if ((partitionFlag & 2) != 0) {
2024-04-12 18:25:58 +08:00
$("input:checkbox[name='partitionFlag']")[1].checked = true;
2024-04-09 19:05:17 +08:00
} else {
2024-04-12 18:25:58 +08:00
$("input:checkbox[name='partitionFlag']")[1].checked = false;
2024-04-09 19:05:17 +08:00
}
2024-04-18 10:01:14 +08:00
if ((partitionFlag & 4) != 0) {
2024-04-12 18:25:58 +08:00
$("input:checkbox[name='partitionFlag']")[2].checked = true;
2024-04-09 19:05:17 +08:00
} else {
2024-04-12 18:25:58 +08:00
$("input:checkbox[name='partitionFlag']")[2].checked = false;
2024-04-09 19:05:17 +08:00
}
2023-09-24 21:00:03 +08:00
// 打开编辑弹窗
$("#giftModal").modal('show');
} else {
$("#tipMsg").text("获取菜单信息出错");
$("#tipModal").modal('show');
}
}
});
});
2024-04-15 20:16:41 +08:00
$("#save").click(function () {
2023-09-24 21:00:03 +08:00
if ($("#giftForm").validationEngine('validate')) {
$("#consumeType").removeAttr("disabled");
2024-04-15 20:16:41 +08:00
// 获取序列化字符串并转换为对象
let formData = $('#giftForm').serializeArray().reduce(function(obj, item) {
obj[item.name] = item.value;
return obj;
}, {});
var name = $("#giftName").val();
// 阿语名称
var ar_name = $("#giftArName").val();
// 英语名称
var en_name = $("#giftEnName").val();
// 国际化字段
var jsonName = {"zh":name,"ar":ar_name,"en":en_name}
const nameValue = JSON.stringify(jsonName);
// 修改属性值
formData.giftName = nameValue; // 将giftName修改为"newGiftName"
//分区
const partitionFlagArray = $("input:checkbox[name='partitionFlag']:checked").serializeArray();
let partitionFlag = 0;
for (let i = 0, len = partitionFlagArray.length; i < len; i++) {
console.log(partitionFlagArray[i]);
partitionFlag |= partitionFlagArray[i].value;
}
formData.partitionFlag = partitionFlag;
2024-04-16 11:03:00 +08:00
// 将修改后的对象转换回序列化字符串
let newSerializeStr = $.param(formData);
2023-09-24 21:00:03 +08:00
$.ajax({
type: "post",
2024-04-22 10:44:52 +08:00
url: "/admin/gift/save",
2024-04-09 19:05:17 +08:00
data: newSerializeStr,
2023-09-24 21:00:03 +08:00
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#giftModal").modal('hide');
$("#tipMsg").text("保存成功");
2024-04-23 14:43:42 +08:00
setTimeout(function() {
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
}, 1000);
2023-09-24 21:00:03 +08:00
} else {
$("#tipMsg").text("保存失败." + json.msg);
$("#tipModal").modal('show');
}
}
});
}
});
//打开赠送礼物弹窗
$("#table").on('click', '.opt-send', function () {
//清除数据
$('#sendGiftModal').find('input').val('');
$('#sendGiftModal').find('textarea').val('');
//设置数据
var giftId = $(this).attr("data-id");
$('#sendGiftId').val(giftId);
$('#giftNum').val('1');
$('#sendGiftModal').modal('show');
});
//赠送礼物
$("#send").click(function () {
var erbanNo = $('#sendErbanNo').val().trim();//去掉首尾的空格和换行符
if (!(erbanNo.length > 0)) {
$("#tipMsg").text("请输入平台号");
$("#tipModal").modal('show');
return;
}
var erbanList = erbanNo.split("\n");
if (erbanList.length > 100) {
$("#tipMsg").text("输入平台号超过100个");
$("#tipModal").modal('show');
return;
}
var giftId = $('#sendGiftId').val();
var giftNum = $('#giftNum').val();
if (!giftNum) {
$("#tipMsg").text("请输入赠送数量");
$("#tipModal").modal('show');
return;
}
var reg = giftNum.match(/^[0-9]*$/);
if (giftNum && reg == null) {
$("#tipMsg").text("请输入合理的赠送数量");
$("#tipModal").modal('show');
return;
}
$("#tipMsg").text("赠送中,请稍后...");
$("#tipModal").modal('show');
if ($("#giftSendForm").validationEngine('validate')) {
$.ajax({
type: "post",
2024-04-22 10:44:52 +08:00
url: "/admin/gift/send",
2023-09-24 21:00:03 +08:00
data: {
giftId: giftId,
erbanNo: erbanNo,
giftNum: giftNum
},
dataType: "json",
success: function (json) {
if (json.code == 100) {
$('#sendGiftModal').modal('hide');
$("#tipMsg").text("全部赠送成功");
TableHelper.doRefresh("#table");
} else if (json.code == 200) {
$("#tipMsg").text("部分用户赠送失败,赠送失败平台号:" + json.erban + ",赠送失败原因:" + json.message);
} else {
$("#tipMsg").text("全部赠送失败,赠送失败原因:" + json.message);
}
}
});
}
});
//打开查看房间列表弹窗
$("#table").on('click', '.opt-query', function () {
//清除数据
$("#erbanNo").val("");
//设置数据
var giftId = $(this).attr("data-id");
$("#query_gift_id").val(giftId);
roomGiftTableInit();
$('#roomGiftModel').modal('show');
});
//查询房间列表
$("#roomGiftSearch").on("click", function () {
roomGiftTableInit();
});
//打开导入房间列表弹窗
$("#roomGiftImport").on('click', function () {
var giftId = $("#query_gift_id").val();
$("#import_gift_id").val(giftId);
$('#roomImportModel').modal('show');
});
//打开增加房间列表弹窗
$("#roomGiftAdd").on("click", function () {
var giftId = $("#query_gift_id").val();
$("#add_gift_id").val(giftId);
$('#roomAddModel').modal('show');
});
//确认导入房间列表
$("#upload").on('click', function () {
var giftId = $("#import_gift_id").val();
if (giftId == null) {
$("#tipMsg").text("礼物ID不能为空.");
$("#tipModal").modal('show');
return;
}
var file = $("#uploadFile").val();
if (file == null || file == undefined || file == '') {
$("#tipMsg").text("上传文件不能为空.");
$("#tipModal").modal('show');
return;
}
showLoading();
var option = ({
type: "POST",
2024-04-22 10:44:52 +08:00
url: "/admin/gift/uploadRoomList",
2023-09-24 21:00:03 +08:00
cache: false,
contentType: false, //不可缺
processData: false, //不可缺
dataType: "json",
success: function (json) {
$("#roomImportModel").modal('hide');
hideLoading();
if (json.code == 200) {
TableHelper.doRefresh('#roomGiftTable');
$("#tipMsg").text("上传成功");
$("#tipModal").modal('show');
} else if (json.code == 300) {
$("#tipMsg").text(json.message + ",导入失败的行:" + json.data.row + ",导入失败原因:" + json.data.reason);
$("#tipModal").modal('show');
}
},
error: function () {
hideLoading();
$("#tipMsg").text("上传失败.");
$("#tipModal").modal('show');
}
});
$("#roomImportForm").ajaxSubmit(option);
});
//确认增加房间列表
$("#roomAdd").on('click', function () {
var giftId = $("#add_gift_id").val();
if (giftId == null) {
$("#tipMsg").text("礼物ID不能为空.");
$("#tipModal").modal('show');
return;
}
var erbanNos = $("#addErbanNos").val().trim();
if (erbanNos == null || erbanNos == '') {
$("#tipMsg").text("房主平台号不能为空.");
$("#tipModal").modal('show');
return;
}
debugger;
var erbanList = erbanNos.split("\n");
if (erbanList.length > 20) {
$("#tipMsg").text("输入平台号超过20个请使用批量导入方式上传");
$("#tipModal").modal('show');
return;
}
if ($("#roomAddForm").validationEngine('validate')) {
showLoading();
$.ajax({
type: "post",
2024-04-22 10:44:52 +08:00
url: "/admin/gift/addRoomList",
2023-09-24 21:00:03 +08:00
data: {
giftId: giftId,
erbanNos: erbanNos
},
dataType: "json",
success: function (json) {
$('#roomAddModel').modal('hide');
hideLoading();
if (json.code == 200) {
$('#sendGiftModal').modal('hide');
TableHelper.doRefresh("#roomGiftTable");
$("#tipMsg").text("添加成功");
$("#tipModal").modal('show');
} else if (json.code == 300) {
$("#tipMsg").text(json.message + ",添加失败的平台号:" + json.data.row + ",添加失败原因:" + json.data.reason);
$("#tipModal").modal('show');
}
},
error: function () {
hideLoading();
$("#tipMsg").text("添加失败.");
$("#tipModal").modal('show');
}
});
}
});
//单个删除
$("#roomGiftTable").on('click', '.opt-delete', function () {
var id = $(this).attr("data-id");
if (confirm("确认删除该条记录吗?删除后不能找回,请谨慎操作!")) {
$.ajax({
type: "post",
2024-04-22 10:44:52 +08:00
url: "/admin/gift/del",
2023-09-24 21:00:03 +08:00
data: {
id: id
},
dataType: "json",
success: function (json) {
if (json.code == 200) {
TableHelper.doRefresh("#roomGiftTable");
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
} else {
$("#tipMsg").text("删除失败");
$("#tipModal").modal('show');
}
},
error: function () {
$("#tipMsg").text("删除失败.");
$("#tipModal").modal('show');
}
});
}
})
//批量删除
$("#roomGiftMultiDel").on('click', function () {
var rows = $("#roomGiftTable").bootstrapTable("getSelections");
if (rows.length == 0) {
alert("请先选择要删除的记录");
return;
}
var idArr = [];
for (var i = 0; i < rows.length; i++) {
idArr.push(rows[i]['id']);
}
if (confirm("确认批量删除该记录吗?\r\n删除后再也不能找回请谨慎操作!")) {
$.ajax({
type: 'post',
2024-04-22 10:44:52 +08:00
url: "/admin/gift/batchDel",
2023-09-24 21:00:03 +08:00
data: { 'ids': JSON.stringify(idArr) },
dataType: "json",
success: function (json) {
if (json.code == 200) {
TableHelper.doRefresh("#roomGiftTable");
$("#tipMsg").text("批量删除成功");
$("#tipModal").modal('show');
} else {
$("#tipMsg").text("批量删除失败");
$("#tipModal").modal('show');
}
},
error: function () {
$("#tipMsg").text("批量删除失败.");
$("#tipModal").modal('show');
}
});
}
})
$("#startValidTime").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true,
startDate: new Date()
});
$('#endValidTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
startDate: new Date()
});
});
2024-04-15 18:35:29 +08:00
},
initPartition() {
getPartitionInfoList().then(res => {
let data = res.data;
buildSelectOption(
"#partitionId",
null,
[{
value: '',
text: '全部',
}].concat(data.map((v) => {
return {
value: v.id,
text: v.desc,
};
}))
);
});
},
2023-09-24 21:00:03 +08:00
},
2023-11-14 17:59:51 +08:00
2023-09-24 21:00:03 +08:00
};
//初始化房间列表
function roomGiftTableInit() {
$('#roomGiftTable').bootstrapTable('destroy');
$('#roomGiftTable').bootstrapTable({
columns: [
{ field: 'tmp', title: 'ID', align: 'center', checkbox: true },
{ field: 'erbanNo', title: '用户平台号', align: 'center', width: '10%' },
{ field: 'nick', title: '用户昵称', align: 'center', width: '30%' },
{ field: 'roomTitle', title: '房间标题', align: 'center', width: '30%' },
{ field: 'roomTag', title: '房间标签', align: 'center', width: '20%' },
{
field: 'permitRoom',
title: '房间类型',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
switch (val) {
case 1:
return '牌照房';
2024-01-09 12:11:42 +08:00
2023-09-24 21:00:03 +08:00
case 2:
return '非牌照房';
2024-01-09 12:11:42 +08:00
2023-09-24 21:00:03 +08:00
case 3:
return '新秀房';
2024-01-09 12:11:42 +08:00
2023-09-24 21:00:03 +08:00
}
}
},
{
field: 'id', title: '操作', align: 'center', width: '10%', formatter: function (val, row, index) {
var id = row.id;
var str = '<button class="btn btn-sm btn-danger opt-delete" data-id=' + id +
'><i class="glyphicon glyphicon-remove"></i>删除</button>&nbsp;&nbsp;';
return str;
}
}
],
cache: false,
striped: true,
showRefresh: true,
pageSize: 10,
pagination: true,
pageList: [1, 10, 20, 30, 50],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $('#erbanNo').val(),
giftId: $('#query_gift_id').val()
};
return param;
},
toolbar: '#roomGiftToolbar',
2024-04-22 10:44:52 +08:00
url: '/admin/gift/getRoomList',
2023-09-24 21:00:03 +08:00
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
</script>
<style scoped>
.room_class {
width: 150%;
}
.btn-sm {
width: 100%;
}
.first {
z-index: 2000;
}
</style>