修复字段报错

This commit is contained in:
liaozetao
2024-01-11 17:14:45 +08:00
parent b7cc65001f
commit 270ef2e0e1

View File

@@ -12,13 +12,9 @@
<div id="toolbar">
<div class="col-sm-12">
<form action=""
id="searchForm"
method="POST">
<form action="" id="searchForm" method="POST">
转盘分类<select name="jackpotType"
id="jackpotType"
data-btn-class="btn btn-warning">
转盘分类<select name="jackpotType" id="jackpotType" data-btn-class="btn btn-warning">
<option value="1">幸运新人奖池</option>
<option value="2">幸运普通奖池</option>
<option value="3">幸运白名单奖池</option>
@@ -33,23 +29,17 @@
</select>
<label class="deviateRange">
偏差范围
<select name="deviateRange"
id="deviateRange"
data-btn-class="btn btn-warning">
<select name="deviateRange" id="deviateRange" data-btn-class="btn btn-warning">
</select>
</label>
<label class="diamondDeviateRange">
偏差范围
<select name="diamondDeviateRange"
id="diamondDeviateRange"
data-btn-class="btn btn-warning">
<select name="diamondDeviateRange" id="diamondDeviateRange" data-btn-class="btn btn-warning">
</select>
</label>
</form>
<button class="btn btn-primary"
id="searchBtn">搜索</button>
<button class="btn btn-primary"
id="add">添加奖品</button>
<button class="btn btn-primary" id="searchBtn">搜索</button>
<button class="btn btn-primary" id="add">添加奖品</button>
</div>
<div class="col-sm-12 jackpot">
@@ -61,14 +51,10 @@
</p>
<p class="col-sm-12">
<span class="col-sm-3"
id="jackpotName"></span>
<span class="col-sm-3"
id="jackpotNum"></span>
<span class="col-sm-3"
id="prizeNum"></span>
<span class="col-sm-3"
id="expectNum"></span>
<span class="col-sm-3" id="jackpotName"></span>
<span class="col-sm-3" id="jackpotNum"></span>
<span class="col-sm-3" id="prizeNum"></span>
<span class="col-sm-3" id="expectNum"></span>
</p>
</div>
@@ -79,47 +65,31 @@
</section>
<!-- 添加弹窗 -->
<div class="modal fade"
id="addModal"
tabindex="-1"
role="dialog"
aria-labelledby="modalLabel">
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog"
role="document">
<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">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<h4 class="modal-title"
id="addModalLabel">添加奖品</h4>
<h4 class="modal-title" id="addModalLabel">添加奖品</h4>
</div>
<div class="modal-body">
<form action=""
class="form-horizontal"
id="addForm">
<form action="" class="form-horizontal" id="addForm">
<!-- 选择奖品 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">选择奖品</label>
<label for="" class="col-sm-3 control-label">选择奖品</label>
<div class="col-sm-8">
<select name="awardType"
id="awardType"
data-btn-class="btn btn-warning">
<select name="awardType" id="awardType" data-btn-class="btn btn-warning">
<!-- <option value=""></option> -->
</select>
<select name="awardChoose"
id="awardChoose"
data-btn-class="btn btn-warning">
<select name="awardChoose" id="awardChoose" data-btn-class="btn btn-warning">
<!-- <option value=""></option> -->
</select>
</div>
@@ -127,29 +97,19 @@
<!-- 奖品个数 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">奖品个数</label>
<label for="" class="col-sm-3 control-label">奖品个数</label>
<div class="col-sm-8">
<input type="text"
id="jackpotNumber"
name="jackpotNumber"
class=" validate[required]"
placeholder="单行输入">
<input type="text" id="jackpotNumber" name="jackpotNumber" class=" validate[required]" placeholder="单行输入">
</div>
</div>
<!-- 中奖率 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">实际中奖率</label>
<label for="" class="col-sm-3 control-label">实际中奖率</label>
<div class="col-sm-8">
<input type="text"
id="winningRate"
name="winningRate"
class=" validate[required]"
placeholder="单行输入">%
<input type="text" id="winningRate" name="winningRate" class=" validate[required]" placeholder="单行输入">%
<br />
<div class="tips">
<i class="glyphicon glyphicon-info-sign"></i>中奖率综合为100当前概率不得超过100
@@ -159,15 +119,10 @@
<!-- 展示中奖率 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">展示中奖率</label>
<label for="" class="col-sm-3 control-label">展示中奖率</label>
<div class="col-sm-8">
<input type="text"
id="showRate"
name="showRate"
class=" validate[required]"
placeholder="单行输入">%
<input type="text" id="showRate" name="showRate" class=" validate[required]" placeholder="单行输入">%
<br />
<div class="tips">
<i class="glyphicon glyphicon-info-sign"></i>中奖率综合为100当前概率不得超过100
@@ -176,12 +131,9 @@
</div>
<div class="form-group">
<label for=""
class="col-sm-3 control-label">是否默认奖品</label>
<label for="" class="col-sm-3 control-label">是否默认奖品</label>
<div class="col-sm-8">
<select name="itemType"
id="itemType"
data-btn-class="btn btn-warning">
<select name="itemType" id="itemType" data-btn-class="btn btn-warning">
<option value="1"> 默认奖品 </option>
<option value="2"> 普通奖品 </option>
</select>
@@ -190,15 +142,10 @@
<!-- 创建者 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">创建者</label>
<label for="" class="col-sm-3 control-label">创建者</label>
<div class="col-sm-8">
<input type="text"
id="creator"
name="creator"
class="validate[required]"
placeholder="必填项">
<input type="text" id="creator" name="creator" class="validate[required]" placeholder="必填项">
</div>
</div>
@@ -206,12 +153,8 @@
</div>
<div class="modal-footer">
<button class="btn btn-default"
type="button"
id="addReset">重置</button>
<button class="btn btn-primary"
type="button"
id="addSave">保存</button>
<button class="btn btn-default" type="button" id="addReset">重置</button>
<button class="btn btn-primary" type="button" id="addSave">保存</button>
</div>
</div>
</div>
@@ -219,56 +162,35 @@
</div>
<!-- 编辑弹窗 -->
<div class="modal fade"
id="editModal"
tabindex="-1"
role="dialog"
aria-labelledby="modalLabel">
<div class="modal-dialog"
role="document">
<div class="modal fade" id="editModal" 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">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<h4 class="modal-title"
id="editModalLabel">编辑奖品</h4>
<h4 class="modal-title" id="editModalLabel">编辑奖品</h4>
</div>
<div class="modal-body">
<form action=""
class="form-horizontal"
id="editForm">
<input type="hidden"
id="editId">
<form action="" class="form-horizontal" id="editForm">
<input type="hidden" id="editId">
<!-- 奖品个数 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">奖品个数</label>
<label for="" class="col-sm-3 control-label">奖品个数</label>
<div class="col-sm-8">
<input type="text"
id="jackpotNumber2"
name="jackpotNumber2"
class=" validate[required]"
placeholder="单行输入">
<input type="text" id="jackpotNumber2" name="jackpotNumber2" class=" validate[required]"
placeholder="单行输入">
</div>
</div>
<!-- 中奖率 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">实际中奖率</label>
<label for="" class="col-sm-3 control-label">实际中奖率</label>
<div class="col-sm-8">
<input type="text"
id="winningRate2"
name="winningRate2"
class=" validate[required]"
placeholder="单行输入">%
<input type="text" id="winningRate2" name="winningRate2" class=" validate[required]" placeholder="单行输入">%
<br />
<div class="tips">
<i class="glyphicon glyphicon-info-sign"></i>中奖率综合为100当前概率不得超过100
@@ -278,15 +200,10 @@
<!-- 展示给用户看的中奖率 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">展示中奖率</label>
<label for="" class="col-sm-3 control-label">展示中奖率</label>
<div class="col-sm-8">
<input type="text"
id="showRate2"
name="showRate2"
class=" validate[required]"
placeholder="单行输入">%
<input type="text" id="showRate2" name="showRate2" class=" validate[required]" placeholder="单行输入">%
<br />
<div class="tips">
<i class="glyphicon glyphicon-info-sign"></i>中奖率综合为100当前概率不得超过100
@@ -294,12 +211,9 @@
</div>
</div>
<div class="form-group">
<label for=""
class="col-sm-3 control-label">是否默认奖品</label>
<label for="" class="col-sm-3 control-label">是否默认奖品</label>
<div class="col-sm-8">
<select name="itemType"
id="itemType2"
data-btn-class="btn btn-warning">
<select name="itemType" id="itemType2" data-btn-class="btn btn-warning">
<option value="1"> 默认奖品 </option>
<option value="2"> 普通奖品 </option>
</select>
@@ -308,26 +222,18 @@
<!-- 创建者 -->
<div class="form-group">
<label for=""
class="col-sm-3 control-label">创建者</label>
<label for="" class="col-sm-3 control-label">创建者</label>
<div class="col-sm-8">
<input type="text"
id="creator2"
name="creator2"
class="validate[required]">
<input type="text" id="creator2" name="creator2" class="validate[required]">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-default"
type="button"
id="editReset">重置</button>
<button class="btn btn-primary"
type="button"
id="editSave">保存</button>
<button class="btn btn-default" type="button" id="editReset">重置</button>
<button class="btn btn-primary" type="button" id="editSave">保存</button>
</div>
</div>
</div>
@@ -345,16 +251,16 @@ var ACCURACY = 1000; // 小数点精度
var RATIO_PART = 100000; // 概率换算单位
export default {
name: "PrizeManageAdminView",
setup () {
setup() {
return {};
},
created () {
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData () {
initData() {
$(function () {
var main = {
init: function () {
@@ -693,13 +599,19 @@ export default {
field: 'prizeName', title: '奖品名称', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var key = row.prizeId;
console.log(key);
return idObj[key].prizeName;
if (idObj[key]) {
return idObj[key].prizeName;
}
return '';
}
},
{
field: '', title: '奖品分类', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var $prizeId = row.prizeId;
var $type = idObj[$prizeId].prizeType;
var $type;
if (idObj[$prizeId]) {
$type = idObj[$prizeId].prizeType;
}
switch ($type) {
case 8:
return '谢谢参与';
@@ -737,13 +649,19 @@ export default {
{
field: '', title: '平台价值', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var key = row.prizeId;
return idObj[key].platformValue;
if (idObj[key]) {
return idObj[key].platformValue;
}
return '';
}
},
{
field: '', title: '实际价值', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var key = row.prizeId;
return idObj[key].actualValue;
if (idObj[key]) {
return idObj[key].actualValue;
}
return '';
}
},
{
@@ -759,7 +677,10 @@ export default {
{
field: '', title: '期望值', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var key = row.prizeId;
return row.occupationRatio * idObj[key].actualValue / RATIO_PART;
if (idObj[key]) {
return row.occupationRatio * idObj[key].actualValue / RATIO_PART;
}
return '';
}
},
{ field: 'usePrizeNum', title: '被抽中数量', align: 'center', valign: 'middle', width: '10%' },
@@ -778,7 +699,7 @@ export default {
pageList: [10, 20, 30, 50],
sidePagination: 'server',
queryParamsType: 'undefined',
queryParams: function queryParams (params) {
queryParams: function queryParams(params) {
var param = {
pageSize: params.pageSize,
@@ -838,7 +759,7 @@ export default {
};
function clearModal () {
function clearModal() {
$('#addForm').find('input[type=text],select,input[type=hidden]').each(function () {
$(this).val('');
});
@@ -847,7 +768,7 @@ function clearModal () {
});
}
function getDeviateRangeId () {
function getDeviateRangeId() {
if ($('#deviateRange').val()) {
var jackpotType = $('#jackpotType').val();
if (jackpotType == '4') {
@@ -878,7 +799,7 @@ function getDeviateRangeId () {
align-items: center;
}
#toolbar > div:first-child {
#toolbar>div:first-child {
margin-right: 10px;
}
</style>