修复BUG

This commit is contained in:
liaozetao
2024-04-01 10:39:40 +08:00
parent 6445a5c4de
commit 8a895ec221

View File

@@ -104,25 +104,27 @@
<label for="isReturnProfit" class="col-sm-4 control-label">是否返利:</label> <label for="isReturnProfit" class="col-sm-4 control-label">是否返利:</label>
<div class="col-sm-6"> <div class="col-sm-6">
<select name="isReturnProfit" id="isReturnProfit" data-btn-class="btn-warning" <select name="isReturnProfit" id="isReturnProfit" data-btn-class="btn-warning"
class="form-control"> class="form-control" onchange="swapProfit()">
<option value="1"></option> <option value="1"></option>
<option value="0"></option> <option value="0"></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div id="profitDiv">
<label class="col-sm-4 control-label">返利日期配置</label> <div class="form-group">
</div> <label class="col-sm-4 control-label">返利日期配置</label>
<div class="form-group">
<label class="col-sm-4 control-label"></label>
<div class="col-sm-8" id="returnProfits">
</div> </div>
</div> <div class="form-group">
<div class="form-group"> <label class="col-sm-4 control-label"></label>
<label class="col-sm-4 control-label"></label> <div class="col-sm-8" id="returnProfits">
<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"></label>
<div class="col-sm-3">
<button type="button" class="btn btn-primary form-control" id="returnProfitAdd">+ 添加</button>
</div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -328,7 +330,18 @@ const VIP_AUTH_TYPE = {
export default { export default {
name: "VipManageView", name: "VipManageView",
setup() { setup() {
return {}; function swapProfit() {
let isReturnProfit = $('#isReturnProfit').val();
if (isReturnProfit && isReturnProfit == 1) {
document.getElementById("profitDiv").style.display = "block";
} else {
document.getElementById("profitDiv").style.display = "none";
}
}
window.swapProfit = swapProfit;
return {
swapProfit,
};
}, },
created() { created() {
this.$nextTick(function () { this.$nextTick(function () {
@@ -595,7 +608,7 @@ export default {
$input.attr('value', returnProfitId); $input.attr('value', returnProfitId);
$span.append($input); $span.append($input);
let html = ''; let html = '';
if (!i || i == 0) { if (!profitDate || profitDate == 0) {
html += '立即返利<input type="hidden" data-index="' + i + '" id="profitDate' + i + '" value="0"/>'; html += '立即返利<input type="hidden" data-index="' + i + '" id="profitDate' + i + '" value="0"/>';
} else { } else {
html += '第 <input type="text" data-index="' + i + '" id="profitDate' + i + '" value="' + profitDate + '" style="width:41px;"/> 天,'; html += '第 <input type="text" data-index="' + i + '" id="profitDate' + i + '" value="' + profitDate + '" style="width:41px;"/> 天,';
@@ -639,12 +652,9 @@ export default {
if (json.success == 'true' || json.code == 200) { if (json.success == 'true' || json.code == 200) {
$("#tipMsg").text("删除成功"); $("#tipMsg").text("删除成功");
$("#tipModal").modal('show'); $("#tipModal").modal('show');
TableHelper.doRefresh("#table");
$("#editModal").modal('hide');
} else { } else {
$("#tipMsg").text("删除失败." + json.message); $("#tipMsg").text("删除失败." + json.message);
$("#tipModal").modal('show'); $("#tipModal").modal('show');
$("#editModal").modal('hide');
} }
} }
}); });
@@ -697,11 +707,21 @@ export default {
} }
let vipLevel = $("#addForm #vipLevel").val(); let vipLevel = $("#addForm #vipLevel").val();
let addSize = $('#addSize').val(); let addSize = $('#addSize').val();
if (addSize && addSize > 5) {
$("#tipMsg").text("返利数量超过5个");
$("#tipModal").modal('show');
return;
}
let returnProfitArray = []; let returnProfitArray = [];
for (let i = 0; i < addSize; i++) { for (let i = 0; i < addSize; i++) {
let returnProfitId = $('#returnProfitId' + i).val(); let returnProfitId = $('#returnProfitId' + i).val();
let profitDate = parseFloat($('#profitDate' + i).val()); let profitDate = parseFloat($('#profitDate' + i).val());
let profitAmount = $('#profitAmount' + i).val(); let profitAmount = $('#profitAmount' + i).val();
if (profitDate != 0 && profitDate > 29) {
$("#tipMsg").text("返利日期不能超过30天");
$("#tipModal").modal('show');
return;
}
let returnProfit = { let returnProfit = {
vipLevel: vipLevel, vipLevel: vipLevel,
profitDate: profitDate, profitDate: profitDate,