新增信誉值

This commit is contained in:
dragon
2025-01-07 18:15:21 +08:00
parent 3659f582d5
commit 1b47d48d0a

View File

@@ -54,12 +54,23 @@
</div> </div>
</section> </section>
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel"> <div
class="modal fade"
id="editModal"
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-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span <button
aria-hidden="true">&times;</span> type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title" id="modalLabel">代充信息</h4> <h4 class="modal-title" id="modalLabel">代充信息</h4>
</div> </div>
@@ -67,9 +78,26 @@
<form class="form-horizontal"> <form class="form-horizontal">
<input type="hidden" name="id" id="id" /> <input type="hidden" name="id" id="id" />
<div class="form-group"> <div class="form-group">
<label for="erbanNo" class="col-sm-3 control-label">Peko ID</label> <label for="erbanNo" class="col-sm-3 control-label"
>Peko ID</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" id="erbanNo"> <input type="text" class="form-control" id="erbanNo" />
</div>
</div>
<div class="form-group">
<label for="starLevel" class="col-sm-3 control-label"
>信誉值:</label
>
<div class="col-sm-9">
<select name="starLevel" id="starLevel">
<option value="">-- 请选择 --</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -78,14 +106,22 @@
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button> <button type="button" class="btn btn-default" data-dismiss="modal">
取消
</button>
<button type="button" class="btn btn-primary" id="save">确认</button> <button type="button" class="btn btn-primary" id="save">确认</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="tipModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel"> <div
class="modal fade"
id="tipModal"
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-content">
<div class="modal-header"> <div class="modal-header">
@@ -98,7 +134,7 @@
</template> </template>
<script> <script>
import TableHelper from '@/utils/bootstrap-table-helper'; import TableHelper from "@/utils/bootstrap-table-helper";
var partitionArray; var partitionArray;
var regionArray; var regionArray;
@@ -326,16 +362,17 @@ export default {
} }
//新增 //新增
$('#btnAdd').on('click', function () { $("#btnAdd").on("click", function () {
$("#id").val(''); $("#id").val("");
$("#erbanNo").val(''); $("#erbanNo").val("");
$("#starLevel").val("");
showRegion(); showRegion();
$("#editModal").modal('show'); $("#editModal").modal("show");
}); });
// 查询刷新 // 查询刷新
$('#btnSearch').on('click', function () { $("#btnSearch").on("click", function () {
TableHelper.doRefresh('#table'); TableHelper.doRefresh("#table");
}); });
//展示地区 //展示地区
@@ -343,22 +380,31 @@ export default {
if (!regionArray) { if (!regionArray) {
return; return;
} }
var $form = $('#editModal .modal-body .form-horizontal'); var $form = $("#editModal .modal-body .form-horizontal");
for (let i = 0, len = regionArray.length; i < len; i++) { for (let i = 0, len = regionArray.length; i < len; i++) {
$('#region' + i).remove(); $("#region" + i).remove();
var region = regionArray[i]; var region = regionArray[i];
var name = region.name; var name = region.name;
var type = region.type; var type = region.type;
var $formGroup = $('<div/>'); var $formGroup = $("<div/>");
$formGroup.attr('id', 'region' + i); $formGroup.attr("id", "region" + i);
$formGroup.attr('class', 'form-group'); $formGroup.attr("class", "form-group");
var $label = $('<label/>'); var $label = $("<label/>");
$label.attr('class', 'col-sm-3 control-label'); $label.attr("class", "col-sm-3 control-label");
$label.html('<input type="checkbox" name="type" value="' + type + '" onclick=\"editSeqText(this);\"/>&nbsp;' + name); $label.html(
'<input type="checkbox" name="type" value="' +
type +
'" onclick="editSeqText(this);"/>&nbsp;' +
name
);
$formGroup.append($label); $formGroup.append($label);
var $div = $('<div/>'); var $div = $("<div/>");
$div.attr('class', 'col-sm-9'); $div.attr("class", "col-sm-9");
$div.html('<input type="text" readonly class="form-control" id="seq' + type + '" value="0"/>'); $div.html(
'<input type="text" readonly class="form-control" id="seq' +
type +
'" value="0"/>'
);
$formGroup.append($div); $formGroup.append($div);
$form.append($formGroup); $form.append($formGroup);
} }
@@ -366,13 +412,15 @@ export default {
//保存 //保存
$("#save").click(function () { $("#save").click(function () {
const msg = '确定要保存吗?'; const msg = "确定要保存吗?";
if (confirm(msg)) { if (confirm(msg)) {
var id = $('#id').val(); var id = $("#id").val();
const typeArray = $("input:checkbox[name='type']:checked").serializeArray(); const typeArray = $(
"input:checkbox[name='type']:checked"
).serializeArray();
if (!typeArray) { if (!typeArray) {
$("#tipMsg").text("代充地区不能为空"); $("#tipMsg").text("代充地区不能为空");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
var userRegionArray = []; var userRegionArray = [];
@@ -384,7 +432,7 @@ export default {
for (let j = 0; j < typeArray.length; j++) { for (let j = 0; j < typeArray.length; j++) {
console.log(typeArray[j]); console.log(typeArray[j]);
if (typeArray[j] && region.type == typeArray[j].value) { if (typeArray[j] && region.type == typeArray[j].value) {
seq = $('#seq' + region.type).val(); seq = $("#seq" + region.type).val();
isCheck = true; isCheck = true;
break; break;
} }
@@ -393,13 +441,14 @@ export default {
type: region.type, type: region.type,
name: region.name, name: region.name,
isCheck: isCheck, isCheck: isCheck,
seq: seq seq: seq,
}; };
userRegionArray.push(userRegion); userRegionArray.push(userRegion);
} }
var data = { var data = {
erbanNo: $('#erbanNo').val(), erbanNo: $("#erbanNo").val(),
userRegions: JSON.stringify(userRegionArray) starLevel: $("#starLevel").val(),
userRegions: JSON.stringify(userRegionArray),
}; };
if (id) { if (id) {
data.id = id; data.id = id;
@@ -410,29 +459,32 @@ export default {
data: data, data: data,
dataType: "json", dataType: "json",
success: function (json) { success: function (json) {
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"); TableHelper.doRefresh("#table");
$("#editModal").modal('hide'); $("#editModal").modal("hide");
} else { } else {
$("#tipMsg").text("保存失败." + json.message); $("#tipMsg").text("保存失败." + json.message);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
$("#editModal").modal('hide'); $("#editModal").modal("hide");
}
} }
},
}); });
} }
}); });
//编辑 //编辑
$('#table').on('click', '.opt-edit', function () { $("#table").on("click", ".opt-edit", function () {
const currentData = $('#table').bootstrapTable('getData')[$(this).data('index')]; const currentData =
$("#table").bootstrapTable("getData")[$(this).data("index")];
showRegion(); showRegion();
var id = currentData.id; var id = currentData.id;
var erbanNo = currentData.erbanNo; var erbanNo = currentData.erbanNo;
var starLevel = currentData.starLevel;
var userRegions = currentData.userRegions; var userRegions = currentData.userRegions;
$("#erbanNo").val(erbanNo); $("#erbanNo").val(erbanNo);
$("#starLevel").val(starLevel);
$("#id").val(id); $("#id").val(id);
if (regionArray) { if (regionArray) {
for (let i = 0; i < regionArray.length; i++) { for (let i = 0; i < regionArray.length; i++) {
@@ -448,48 +500,54 @@ export default {
} }
} }
if (isCheck) { if (isCheck) {
$('input:checkbox[value="' + region.type + '"]').prop('checked', true); $('input:checkbox[value="' + region.type + '"]').prop(
$('#seq' + region.type).removeAttr('readonly'); "checked",
$('#seq' + region.type).val(seq); true
);
$("#seq" + region.type).removeAttr("readonly");
$("#seq" + region.type).val(seq);
} else { } else {
$("input:checkbox[value='" + region.type + "']").prop('checked', false); $("input:checkbox[value='" + region.type + "']").prop(
$('#seq' + region.type).attr('readonly', 'true'); "checked",
$('#seq' + region.type).val(0); false
);
$("#seq" + region.type).attr("readonly", "true");
$("#seq" + region.type).val(0);
} }
} }
} }
$("#editModal").modal('show'); $("#editModal").modal("show");
}); });
//删除 //删除
$('#table').on('click', '.opt-del', function () { $("#table").on("click", ".opt-del", function () {
const currentData = $('#table').bootstrapTable('getData')[$(this).data('index')]; const currentData =
$("#table").bootstrapTable("getData")[$(this).data("index")];
var id = currentData.id; var id = currentData.id;
const msg = '确定要删除吗?'; const msg = "确定要删除吗?";
if (confirm(msg)) { if (confirm(msg)) {
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/admin/recharge/user/del?id=" + id, url: "/admin/recharge/user/del?id=" + id,
dataType: "json", dataType: "json",
success: function (json) { success: function (json) {
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"); TableHelper.doRefresh("#table");
$("#editModal").modal('hide'); $("#editModal").modal("hide");
} else { } else {
$("#tipMsg").text("删除失败." + json.message); $("#tipMsg").text("删除失败." + json.message);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
$("#editModal").modal('hide'); $("#editModal").modal("hide");
}
}
});
}
});
});
} }
}, },
});
}
});
});
},
},
}; };
</script> </script>