/**
|
* 快车价格设置管理初始化
|
*/
|
var TMerchantAudit = {
|
id: "TMerchantTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TMerchantAudit.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '提交时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '商家店铺名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '头像', field: 'headImg', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (row.headImg == null || row.headImg === '') {
|
return '<a class = "view" href="javascript:void(0)"><img style="width: 50px;height:50px;" src="' + Feng.ctxPath + '/static/img/NoPIC.png" /></a>';
|
} else {
|
return '<a class = "view" href="javascript:void(0)"><img style="width: 50px;height:50px;" src="'+ row.headImg + '" /></a>';
|
}
|
},
|
events: 'operateEvents'
|
},
|
{title: '联系人名字', field: 'contactName', visible: true, align: 'center', valign: 'middle'},
|
{title: '联系人电话', field: 'contactPhone', visible: true, align: 'center', valign: 'middle'},
|
{title: '营业执照', field: 'businessLicense', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (row.businessLicense == null || row.businessLicense === '') {
|
return '<a class = "view" href="javascript:void(0)"><img style="width: 50px;height:50px;" src="' + Feng.ctxPath + '/static/img/NoPIC.png" /></a>';
|
} else {
|
return '<a class = "view" href="javascript:void(0)"><img style="width: 50px;height:50px;" src="'+ row.businessLicense + '" /></a>';
|
}
|
},
|
events: 'operateEventss'
|
},
|
{title: '经营地址', field: 'address', visible: true, align: 'center', valign: 'middle'},
|
{title: '状态', field: 'auditStatus', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
switch (value) {
|
case 1:
|
return "<span style='color: black'>待审核</span>";
|
case 2:
|
return "<span style='color: green'>审核通过</span>";
|
case 3:
|
return "<span style='color: red'>拒绝</span>";
|
}
|
}
|
}
|
];
|
};
|
|
|
/**
|
* 图片弹出预览框(可选)
|
*/
|
window.operateEvents = {
|
'click .view': function (e, value, row) {
|
// 设置图片路径
|
var imgUrl = row.headImg;
|
if(imgUrl != "") {
|
imgUrl = imgUrl;// 设置图片路径
|
} else {
|
imgUrl = '/static/img/NoPIC.png';// 默认无图
|
}
|
layer.open({
|
type: 1,
|
title: false,
|
closeBtn: 0,
|
area: 'auto',
|
skin: 'layui-layer-nobg', //没有背景色
|
shadeClose: true,
|
content: '<img src="' + imgUrl + '" height="100%" width="100%" />'
|
});
|
},
|
};
|
|
|
/**
|
* 图片弹出预览框(可选)
|
*/
|
window.operateEventss = {
|
'click .view': function (e, value, row) {
|
// 设置图片路径
|
var imgUrl = row.businessLicense;
|
if(imgUrl != "") {
|
imgUrl = imgUrl;// 设置图片路径
|
} else {
|
imgUrl = '/static/img/NoPIC.png';// 默认无图
|
}
|
layer.open({
|
type: 1,
|
title: false,
|
closeBtn: 0,
|
area: 'auto',
|
skin: 'layui-layer-nobg', //没有背景色
|
shadeClose: true,
|
content: '<img src="' + imgUrl + '" height="100%" width="100%" />'
|
});
|
},
|
};
|
|
|
/**
|
* 检查是否选中
|
*/
|
TMerchantAudit.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TMerchantAudit.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击审核
|
*/
|
TMerchantAudit.openAudit = function () {
|
if (this.check()){
|
var status = TMerchantAudit.seItem.auditStatus;
|
if (status == 2 || status == 3){
|
Feng.error("已经审核过该商家,不能再进行审核");
|
return false;
|
}
|
|
var index = layer.open({
|
type: 1,
|
title: '审核',
|
area: ['40%', '50%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: '<div class="row" style="width: 100%;margin-top: 30px"><label class="control-label col-sm-4"></label><div class="col-sm-2">' +
|
'<input type="radio" name="audit" value="2" onclick="TMerchantAudit.changeAudit(this)">通过</div><div class="col-sm-2"><input onclick="TMerchantAudit.changeAudit(this)" type="radio" name="audit" value="3">拒绝</div></div>' +
|
'<div class="row" id="auditChangeModel" hidden style="width: 100%;margin-top: 30px"><label class="control-label col-sm-2"></label><label class="control-label col-sm-2">备注</label>' +
|
'<div class="col-sm-4"><textarea class="form-control" onKeyUp="javascript:checkWord(this);" onMouseDown="javascript:checkWord(this);" id="auditNote" style="min-width: 360px;min-height: 100px;max-width: 360px;max-height: 100px"></textarea>\n' +
|
' <div>还可以输入<span style="font-family: Georgia; font-size: 26px;">200</span>个字符 </div></div></div>' +
|
'<div class="row" style="width: 100%;margin-top: 30px"><label class="control-label col-sm-5"></label><div class="col-sm-3">' +
|
'<button type="button" class="btn btn-primary" onclick="TMerchantAudit.AuditSubmit()">' +
|
' <i class="fa fa-check"></i> 提交\n' +
|
'</button></div></div>'
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 切换审核状态
|
*/
|
TMerchantAudit.changeAudit = function (t) {
|
if ($(t).val() == 2){
|
$("#auditChangeModel").hide();
|
}else if ($(t).val() == 3){
|
$("#auditChangeModel").show();
|
}
|
};
|
|
var maxstrlen=200;
|
|
function checkWord(c){
|
len=maxstrlen;
|
var str = c.value;
|
myLen=getStrleng(str);
|
var wck= $(c).next('div').find('span:first')[0];
|
if(myLen>len*2){
|
c.value=str.substring(0,i+1);
|
}
|
else{
|
wck.innerHTML = Math.floor((len*2-myLen)/2);
|
}
|
}
|
|
function getStrleng(str){
|
myLen =0;
|
i=0;
|
for(;(i<str.length)&&(myLen<=maxstrlen*2);i++){
|
if(str.charCodeAt(i)>0 && str.charCodeAt(i)<128)
|
myLen++;
|
else
|
myLen+=2;
|
}
|
return myLen;
|
}
|
|
|
/**
|
* 提交审核
|
*/
|
TMerchantAudit.AuditSubmit = function() {
|
if($('input[name="audit"]').is(":checked") === false){
|
Feng.error("请选择审核状态");
|
return;
|
}
|
|
if (this.check()){
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tMerchant/AuditSubmit", function(data){
|
Feng.success("审核成功!");
|
TMerchantAudit.table.refresh();
|
layer.close(window.TMerchantAudit.layerIndex);
|
},function(data){
|
Feng.error("审核失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",TMerchantAudit.seItem.id);
|
ajax.set("auditStatus",$('input[name="audit"]:checked').val());
|
ajax.set("auditNote",$('#auditNote').val());
|
ajax.start();
|
}
|
};
|
|
|
/**
|
* 点击删除
|
*/
|
TMerchantAudit.delete = function () {
|
if (this.check()){
|
var operation = function(){
|
var ajax = new $ax(Feng.ctxPath + "/tMerchant/delete", function (data) {
|
Feng.success("删除成功!");
|
TMerchantAudit.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",TMerchantAudit.seItem.id);
|
ajax.start();
|
};
|
Feng.confirm("是否确定刪除?", operation);
|
}
|
};
|
|
function compareDate(date1,date2){
|
var odate1 = new Date(date1);
|
var odate2 = new Date(date2);
|
return odate1.getTime() < odate2.getTime();
|
}
|
|
TMerchantAudit.search = function () {
|
|
if ($("#startTime").val() !== "" && $("#endTime").val() !== ""){
|
if (compareDate($("#startTime").val(), $("#endTime").val()) === false){
|
Feng.error("开始时间不能大于结束时间");
|
return false;
|
}
|
}
|
|
var queryData = {};
|
queryData['startTime'] = $("#startTime").val();
|
queryData['endTime'] = $("#endTime").val();
|
queryData['name'] = $("#name").val();
|
queryData['auditStatus'] = $("#auditStatus").val();
|
TMerchantAudit.table.refresh({query: queryData});
|
};
|
|
TMerchantAudit.resetSearch = function () {
|
$("#startTime").val("");
|
$("#endTime").val("");
|
$("#auditStatus").val("");
|
TMerchantAudit.search();
|
};
|
|
$(function () {
|
var defaultColunms = TMerchantAudit.initColumn();
|
var table = new BSTable(TMerchantAudit.id, "/tMerchant/tMerchantAuditList", defaultColunms);
|
table.setPaginationType("server");
|
TMerchantAudit.table = table.init();
|
});
|