修复BUG

This commit is contained in:
liaozetao
2024-04-01 10:39:40 +08:00
parent 7485375e17
commit 8673cdac26

View File

@@ -104,25 +104,27 @@
<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">
class="form-control" onchange="swapProfit()">
<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 id="profitDiv">
<div class="form-group">
<label class="col-sm-4 control-label">返利日期配置</label>
</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 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>
<div class="form-group">
@@ -328,7 +330,18 @@ const VIP_AUTH_TYPE = {
export default {
name: "VipManageView",
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() {
this.$nextTick(function () {
@@ -595,7 +608,7 @@ export default {
$input.attr('value', returnProfitId);
$span.append($input);
let html = '';
if (!i || i == 0) {
if (!profitDate || profitDate == 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;"/> 天,';
@@ -639,12 +652,9 @@ export default {
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');
}
}
});
@@ -697,11 +707,21 @@ export default {
}
let vipLevel = $("#addForm #vipLevel").val();
let addSize = $('#addSize').val();
if (addSize && addSize > 5) {
$("#tipMsg").text("返利数量超过5个");
$("#tipModal").modal('show');
return;
}
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();
if (profitDate != 0 && profitDate > 29) {
$("#tipMsg").text("返利日期不能超过30天");
$("#tipModal").modal('show');
return;
}
let returnProfit = {
vipLevel: vipLevel,
profitDate: profitDate,