/**
|
* 系统管理--用户管理的单例对象
|
*/
|
var ExamineCoursePackage = {
|
id: "managerTable",//表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
|
|
|
/**
|
* 初始化表格的列
|
*/
|
ExamineCoursePackage.initColumn = function () {
|
let columns = [
|
{field: 'selectItem', radio: true},
|
{title: '序号', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '所在省市', field: 'city', align: 'center', valign: 'middle'},
|
{title: '所属门店', field: 'store', align: 'center', valign: 'middle'},
|
{title: '课包种类', field: 'type', align: 'center', valign: 'middle'},
|
{title: '课包类型', field: 'coursePackageType', align: 'center', valign: 'middle'},
|
{title: '课包名称', field: 'name', align: 'center', valign: 'middle'},
|
{title: '支付方式', field: 'payType', align: 'center', valign: 'middle'},
|
{title: '审核状态', field: 'auditStatus', align: 'center', valign: 'middle',
|
formatter: function (v) {
|
switch (v) {
|
case 1:
|
return '待审核';
|
case 3:
|
return '未通过';
|
}
|
}
|
}
|
];
|
return columns;
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
ExamineCoursePackage.check = function () {
|
let selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
} else {
|
ExamineCoursePackage.seItem = selected[0];
|
return true;
|
}
|
};
|
|
|
/**
|
* 点击修改按钮时
|
* @param userId 管理员id
|
*/
|
ExamineCoursePackage.examineCoursePackage = function () {
|
if (this.check()) {
|
if(ExamineCoursePackage.seItem.auditStatus != 1){
|
Feng.error("不能重复审核");
|
return
|
}
|
let htmlStr =
|
'<div class="form-horizontal">' +
|
' <div class="col-sm-11" style="padding: 10px;">' +
|
' <div class="form-group">\n' +
|
' <label class="col-sm-3 control-label">*审核状态:</label>\n' +
|
' <div class="col-sm-8">\n' +
|
' <input name="auditStatus" type="radio" value="2"/> 通过 ' +
|
' <input name="auditStatus" type="radio" value="3"/> 拒绝 ' +
|
' </div>' +
|
' </div>' +
|
' <div class="form-group">\n' +
|
' <label class="col-sm-3 control-label">*拒绝理由:</label>\n' +
|
' <div class="col-sm-8">\n' +
|
' <textarea id="authRemark" style="width: 100%;height: 200px;" placeholder="请输入拒绝理由"></textarea>' +
|
' </div>' +
|
' </div>' +
|
' </div>' +
|
'</div>';
|
layer.open({
|
type: 1
|
, title: '课包审核'
|
, area: ['800px', '400px']
|
, offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
|
, id: 'layerDemo' //防止重复弹出cge
|
, content: htmlStr
|
, btn: ['保存', '关闭']
|
, btnAlign: 'c' //按钮居中
|
, shade: 0.5 //不显示遮罩
|
, yes: function () {
|
let auditStatus = $('input[name="auditStatus"]:checked').val();
|
if(typeof auditStatus == "undefined"){
|
Feng.error("请选择审核结果");
|
return
|
}
|
|
let authRemark = $('#authRemark').val();
|
console.log("========="+authRemark)
|
|
|
if(3 == auditStatus && '' == authRemark){
|
Feng.error("请输入拒绝理由");
|
return
|
}
|
let ajax = new $ax(Feng.ctxPath + "/coursePackage/setCoursePackageAuditStatus", function (res) {
|
if(res.code == 200){
|
Feng.success("审核成功!");
|
layer.closeAll();
|
ExamineCoursePackage.table.refresh();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
Feng.error("审核失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id", ExamineCoursePackage.seItem.id);
|
ajax.set("auditStatus", auditStatus);
|
ajax.set("authRemark", authRemark);
|
ajax.start();
|
},
|
});
|
}
|
};
|
|
|
ExamineCoursePackage.detailsExamineCoursePackage = function () {
|
if (this.check()) {
|
let index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/coursePackage/showExamineCoursePackageDetails?id=' + this.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
|
|
ExamineCoursePackage.resetSearch = function () {
|
$("#provinceCode").val("");
|
$("#cityCode").val("");
|
$("#coursePackageTypeId").val("");
|
$("#name").val("");
|
$("#auditStatus").val("");
|
ExamineCoursePackage.search();
|
}
|
|
ExamineCoursePackage.search = function () {
|
let queryData = {};
|
queryData['provinceCode'] = $("#provinceCode").val();
|
queryData['cityCode'] = $("#cityCode").val();
|
queryData['coursePackageTypeId'] = $("#coursePackageTypeId").val();
|
queryData['name'] = $("#name").val();
|
queryData['auditStatus'] = $("#auditStatus").val();
|
ExamineCoursePackage.table.refresh({query: queryData});
|
}
|
|
|
$(function () {
|
let defaultColunms = ExamineCoursePackage.initColumn();
|
let table = new BSTable(ExamineCoursePackage.id, "/coursePackage/queryExamineCoursePackageLists", defaultColunms);
|
// 设置物理分页server(逻辑分页client)
|
table.setPaginationType("server");
|
ExamineCoursePackage.table = table.init();
|
|
|
$('#provinceCode').change(function () {
|
let ajax = new $ax(Feng.ctxPath + "/coursePackage/queryCity", function (data) {
|
let htmlStr = '';
|
for (let i = 0; i < data.length; i++) {
|
htmlStr += '<option value="' + data[i].code + '">' + data[i].name + '</option>'
|
}
|
$('#cityCode').html(htmlStr);
|
}, function (data) {
|
Feng.error("获取失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("code", $(this).val());
|
ajax.start();
|
})
|
});
|