/**
|
* 门店信息管理初始化
|
*/
|
var MemMerchant = {
|
id: "MemMerchantTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
MemMerchant.initColumn = function () {
|
return [
|
{field: 'selectItem', checkbox: true},
|
{title: 'ID', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '门店名称', field: 'merchantName', visible: true, align: 'center', valign: 'middle'},
|
{title: '联系人', field: 'linkman', visible: true, align: 'center', valign: 'middle'},
|
{title: '联系电话', field: 'linkPhone', visible: true, align: 'center', valign: 'middle'},
|
{title: '申请用户ID', field: 'userId', visible: true, align: 'center', valign: 'middle'},
|
{title: '营业执照', field: 'businessLicense', visible: true, align: 'center', valign: 'middle'},
|
{title: '其他资料', field: 'otherDetails', visible: true, align: 'center', valign: 'middle'},
|
{title: '头部图片', field: 'headPicture', visible: true, align: 'center', valign: 'middle'},
|
{title: '申请说明', field: 'applyDes', visible: true, align: 'center', valign: 'middle'},
|
{title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
return Feng.getStateFormat(value);
|
}
|
},
|
{title: '审核状态', field: 'auditState', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
return Feng.getStateFormat(value);
|
}
|
},
|
{title: '审核时间', field: 'auditTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '处理备注', field: 'auditMark', visible: true, align: 'center', valign: 'middle'},
|
{title: '是否删除', field: 'isDelete', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
return Feng.getIsObjFormat(value);
|
}
|
},
|
{title: '等级ID', field: 'gradeId', visible: true, align: 'center', valign: 'middle'},
|
{title: '店铺logo', field: 'logo', visible: true, align: 'center', valign: 'middle'},
|
{title: 'IM账号', field: 'imAccount', visible: true, align: 'center', valign: 'middle'},
|
{title: 'IM密码', field: 'imPassword', visible: true, align: 'center', valign: 'middle'},
|
{title: '操作', field: 'opts', visible: true, align: 'left', valign: 'middle',
|
formatter: function (value, row) {
|
var opts = Feng.Opts();
|
if ($("#updateAuth").val() == 'true') {
|
opts.add("MemMerchant.openMemMerchantUpdate('"+row.id+"');", "编辑");
|
}
|
if ($("#deleteAuth").val() == 'true') {
|
opts.addDanger("MemMerchant.delete('"+row.id+"');", "删除");
|
}
|
if ($("#updateStateAuth").val() == 'true') {
|
opts.add("MemMerchant.updateState('"+row.id+"','1');", "编辑状态");
|
}
|
return opts.getOpts();
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
MemMerchant.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
MemMerchant.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击 打开页面
|
*/
|
MemMerchant.upgradeMerchant = function ( id, name) {
|
Feng.confirm( "成为".concat(name).concat( "期间我们需要冻结您").concat( $("#" + id).data( "vip")).concat( "米粒"), function () {
|
Feng.base_ajax( "/memMerchant/upgradeMerchant", { gradeId: id}, function ( data) {
|
Feng.success( "升级成功");
|
MemMerchant.local_search();
|
});
|
});
|
};
|
|
MemMerchant.local_search = function () {
|
window.location.href = location.href;
|
}
|
/**
|
* 修改 退货地址
|
*/
|
MemMerchant.get = function( key, val) {
|
return (typeof val == "undefined") ? $("#" + key).val() : val;
|
}
|
MemMerchant.updateAddress = function () {
|
if ( !Feng.check_form( "address_form")) { return; }
|
var edit_item = {
|
id: this.get( "address_id"),
|
address: this.get( "address"),
|
takeName: this.get( "takeName"),
|
phone: this.get( "phone")
|
}
|
Feng.base_ajax( "/memMerchant/updateReturnAddress", edit_item, function ( data) {
|
Feng.success( "修改成功");
|
MemMerchant.local_search();
|
});
|
};
|
|
/**
|
* 点击添加门店信息
|
*/
|
MemMerchant.openMemMerchantAdd = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加门店信息',
|
area: ['80%', '80%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/memMerchant/memMerchant_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 点击编辑门店信息
|
*/
|
MemMerchant.openMemMerchantUpdate = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '编辑门店信息',
|
area: ['80%', '80%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/memMerchant/memMerchant_update/' + id
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看门店信息详情
|
*/
|
MemMerchant.openMemMerchantDetail = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '门店信息详情',
|
area: ['80%', '80%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/memMerchant/detail/' + id
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 删除/批量删除门店信息
|
*/
|
MemMerchant.delete = function(id){
|
var ids = id;
|
if(id == 0) {
|
// 如果id为0,则为批量删除
|
ids = Feng.checkBoxIds(MemMerchant.id);
|
}
|
if (ids.length != 0) {
|
var operation = function() {
|
// 加载动画层,0代表加载的风格,支持0-2
|
var index = parent.layer.load(0, {shade: false});
|
var ajax = new $ax(Feng.ctxPath + "/memMerchant/delete", function (data) {
|
// 关闭加载动画层
|
parent.layer.close(index);
|
Feng.success("删除成功!");
|
MemMerchant.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("ids", ids);
|
ajax.start();
|
};
|
Feng.confirm("是否删除所选中的数据?", operation);
|
}
|
};
|
|
/**
|
* 编辑门店信息状态
|
*/
|
MemMerchant.updateState = function (id, state) {
|
var ajax = new $ax(Feng.ctxPath + "/memMerchant/updateState", function (data) {
|
if(data.code == 200){
|
Feng.success("操作成功!");
|
MemMerchant.table.refresh();
|
} else {
|
Feng.error("操作失败!" + data.message);
|
}
|
}, function () {
|
Feng.error("操作失败!");
|
});
|
ajax.set("memMerchantId", id);
|
ajax.set("state", state);
|
ajax.start();
|
};
|
|
/**
|
* 查询门店信息列表
|
*/
|
MemMerchant.search = function () {
|
var queryData = {};
|
queryData['beginTime'] = $("#beginTime").val();
|
queryData['endTime'] = $("#endTime").val();
|
queryData['condition'] = $("#condition").val();
|
MemMerchant.table.refresh({query: queryData});
|
};
|
/**
|
* 重置查询条件
|
*/
|
MemMerchant.resetSearch = function () {
|
$("#beginTime").val("");
|
$("#endTime").val("");
|
$("#condition").val("");
|
MemMerchant.search();
|
};
|
$(function () {
|
var defaultColunms = MemMerchant.initColumn();
|
var table = new BSTable(MemMerchant.id, "/memMerchant/list", defaultColunms);
|
// 设置物理分页server(逻辑分页client)
|
table.setPaginationType("server");
|
// 表单提交参数
|
var queryData = {};
|
queryData['beginTime'] = $("#beginTime").val();
|
queryData['endTime'] = $("#endTime").val();
|
queryData['condition'] = $("#condition").val();
|
table.setQueryParams(queryData);
|
MemMerchant.table = table.init();
|
|
// 初始化开始时间、结束时间
|
laydate.render({
|
elem: '#beginTime'
|
});
|
laydate.render({
|
elem: '#endTime'
|
});
|
|
|
Feng.initValidator( "address_form", {
|
address: Feng.def_valid_info(true),
|
takeName: Feng.def_valid_info(true),
|
phone: Feng.def_valid_info(true),
|
});
|
});
|