修改vip贵族信息
This commit is contained in:
@@ -23,8 +23,9 @@
|
||||
<h4 class="modal-title" id="modalLabel">贵族编辑</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" id="addForm">
|
||||
<div class="form-horizontal" id="addForm">
|
||||
<input type="hidden" name="vipLevel" id="vipLevel" />
|
||||
<input type="hidden" name="addSize" id="addSize" />
|
||||
<div class="form-group">
|
||||
<label for="vipName" class="col-sm-4 control-label">名称:</label>
|
||||
<div class="col-sm-6">
|
||||
@@ -92,6 +93,38 @@
|
||||
</div>
|
||||
<!--权限-->
|
||||
<div id="authDiv">
|
||||
<div class="form-group">
|
||||
<label for="buyAmount" class="col-sm-4 control-label">购买价格:</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" name="buyAmount"
|
||||
id="buyAmount">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="isReturnProfit" class="col-sm-4 control-label">是否返利:</label>
|
||||
<div class="col-sm-6">
|
||||
<select name="isReturnProfit" id="isReturnProfit" data-btn-class="btn-warning"
|
||||
class="form-control">
|
||||
<option value="1">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">返利日期配置</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"></label>
|
||||
<div class="col-sm-8" id="returnProfits">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"></label>
|
||||
<div class="col-sm-3">
|
||||
<button type="button" class="btn btn-primary form-control" id="returnProfitAdd">+ 添加</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">
|
||||
<input type="checkbox" class="authCheckBox" name="namePlateIds" value="1" />贵族铭牌
|
||||
@@ -211,7 +244,7 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
@@ -322,7 +355,7 @@ export default {
|
||||
},
|
||||
{ field: 'levelKeepScore', title: '保级值', align: 'center', width: '5%' },
|
||||
{ field: 'levelUpScore', title: '所需升级值', align: 'center', width: '5%' },
|
||||
{ field: 'comingSoon', title: '是否敬请祈祷', visible: false, align: 'center', width: '5%' },
|
||||
{ field: 'comingSoon', title: '是否敬请期待', visible: false, align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'authItems', title: '贵族特权', align: 'center', width: '5%',
|
||||
formatter: function (val, row) {
|
||||
@@ -334,6 +367,47 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'isReturnProfit',
|
||||
title: '是否返利',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row) {
|
||||
let value = '否';
|
||||
if (val == 1) {
|
||||
value = '是';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'returnProfits',
|
||||
title: '返利日期+返利钻石数量',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row) {
|
||||
let value = '';
|
||||
if (val && val.length > 0) {
|
||||
for (let i = 0, len = val.length; i < len; i++) {
|
||||
let item = val[i];
|
||||
let profitDate = item.profitDate;
|
||||
let profitAmount = item.profitAmount;
|
||||
if (profitDate == 0) {
|
||||
value += '立即返利:' + profitAmount;
|
||||
} else {
|
||||
value += '第' + profitDate + '天:' + profitAmount;
|
||||
}
|
||||
if (i != len - 1) {
|
||||
value += '<br/>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value = '/';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{ field: 'buyAmount', title: '购买价格', align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'opt',
|
||||
title: '操作',
|
||||
@@ -409,7 +483,7 @@ export default {
|
||||
console.log(vip)
|
||||
initEditModal(vip);
|
||||
initVipAuth(vip);
|
||||
|
||||
initReturnProfit(vip);
|
||||
$("#editModal").modal('show');
|
||||
});
|
||||
|
||||
@@ -494,6 +568,88 @@ export default {
|
||||
}
|
||||
)
|
||||
|
||||
function initReturnProfit(val) {
|
||||
if (!val) {
|
||||
return;
|
||||
}
|
||||
let returnProfits = val.returnProfits;
|
||||
if (!returnProfits || returnProfits.length <= 0) {
|
||||
return;
|
||||
}
|
||||
$('#addSize').val(returnProfits.length);
|
||||
let $div = $('#returnProfits');
|
||||
for (let i = 0, len = returnProfits.length; i < len; i++) {
|
||||
let returnProfit = returnProfits[i];
|
||||
let returnProfitId = returnProfit.id;
|
||||
let profitDate = returnProfit.profitDate;
|
||||
let profitAmount = returnProfit.profitAmount;
|
||||
let $span = $('<span/>');
|
||||
$span.attr('id', 'returnProfit' + i);
|
||||
let $input = $('<input/>');
|
||||
$input.attr('type', 'hidden');
|
||||
$input.attr('name', 'returnProfitId' + i);
|
||||
$input.attr('id', 'returnProfitId' + i);
|
||||
$input.attr('value', returnProfitId);
|
||||
$span.append($input);
|
||||
let html = '';
|
||||
if (!i || i == 0) {
|
||||
html += '立即返利<input type="hidden" data-index="' + i + '" id="profitDate' + i + '" value="0"/>,';
|
||||
} else {
|
||||
html += '第 <input type="text" data-index="' + i + '" id="profitDate' + i + '" value="' + profitDate + '" style="width:41px;"/> 天,';
|
||||
}
|
||||
html += '返利 <input type="text" data-index="' + i + '" id="profitAmount' + i + '" value="' + profitAmount + '" style="width:41px;"/> 钻石 <button class="btn btn-sm btn-default opt-del" data-index="' + i + '">删除</button><br/>';
|
||||
$span.html(html);
|
||||
$div.append($span);
|
||||
}
|
||||
}
|
||||
|
||||
//添加返利
|
||||
$("#returnProfitAdd").click(function () {
|
||||
let i = parseInt($('#addSize').val());
|
||||
let $div = $('#returnProfits');
|
||||
let $span = $('<span/>');
|
||||
$span.attr('id', 'returnProfit' + i);
|
||||
let html = '';
|
||||
if (!i || i == 0) {
|
||||
html += '立即返利<input type="hidden" data-index="' + i + '" id="profitDate' + i + '" value="0"/>,';
|
||||
} else {
|
||||
html += '第 <input type="text" data-index="' + i + '" id="profitDate' + i + '" style="width:41px;"/> 天,';
|
||||
}
|
||||
html += '返利 <input type="text" data-index="' + i + '" id="profitAmount' + i + '" style="width:41px;"/> 钻石 <button class="btn btn-sm btn-default opt-del" data-index="' + i + '">删除</button><br/>';
|
||||
$span.html(html);
|
||||
$div.append($span);
|
||||
$('#addSize').val(++i);
|
||||
});
|
||||
|
||||
//删除
|
||||
$('#editModal .modal-body .form-horizontal').on('click', '.opt-del', function () {
|
||||
var index = $(this).data('index');
|
||||
var returnProfitId = $('#returnProfitId' + index).val();
|
||||
if (returnProfitId) {
|
||||
const msg = '确定要删除吗?';
|
||||
if (confirm(msg)) {
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/admin/vip/return/profit/del?returnProfitId=" + returnProfitId,
|
||||
dataType: "json",
|
||||
success: function (json) {
|
||||
if (json.success == 'true' || json.code == 200) {
|
||||
$("#tipMsg").text("删除成功");
|
||||
$("#tipModal").modal('show');
|
||||
TableHelper.doRefresh("#table");
|
||||
$("#editModal").modal('hide');
|
||||
} else {
|
||||
$("#tipMsg").text("删除失败." + json.message);
|
||||
$("#tipModal").modal('show');
|
||||
$("#editModal").modal('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#returnProfit' + index).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 保存
|
||||
$('#button-save').on('click', function () {
|
||||
let params = buildSaveParams();
|
||||
@@ -534,12 +690,33 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
let vipLevel = $("#addForm #vipLevel").val();
|
||||
let addSize = $('#addSize').val();
|
||||
let returnProfitArray = [];
|
||||
for (let i = 0; i < addSize; i++) {
|
||||
let returnProfitId = $('#returnProfitId' + i).val();
|
||||
let profitDate = parseFloat($('#profitDate' + i).val());
|
||||
let profitAmount = $('#profitAmount' + i).val();
|
||||
let returnProfit = {
|
||||
vipLevel: vipLevel,
|
||||
profitDate: profitDate,
|
||||
profitAmount: parseInt(profitAmount),
|
||||
seqNo: vipLevel
|
||||
};
|
||||
if (returnProfitId) {
|
||||
returnProfit.id = returnProfitId;
|
||||
}
|
||||
returnProfitArray.push(returnProfit);
|
||||
}
|
||||
const param = {
|
||||
vipLevel: $("#addForm #vipLevel").val(),
|
||||
vipLogo: $("#addForm #vipLogo").val(),
|
||||
vipIcon: $("#addForm #vipIcon").val(),
|
||||
floatPic: $("#addForm #floatPic").val(),
|
||||
authMap: authMap
|
||||
isReturnProfit: $('#isReturnProfit').val(),
|
||||
buyAmount: $('#buyAmount').val(),
|
||||
authMap: authMap,
|
||||
returnProfitJson: JSON.stringify(returnProfitArray)
|
||||
};
|
||||
return param;
|
||||
}
|
||||
|
Reference in New Issue
Block a user