/**
|
* 跨城站点管理管理初始化
|
*/
|
var TSite = {
|
id: "TSiteTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1,
|
picture:"",
|
fileUrl:"",
|
img:"",
|
plan:"",
|
goodsPicArray:[],
|
validateFields: {
|
}
|
};
|
/**
|
* 初始化表格的列
|
*/
|
TSite.initColumn = function () {
|
return [
|
{field: 'selectItem', checkbox: true},
|
{title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '运营商名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',},
|
{title: '管理员姓名', field: 'userName', visible: true, align: 'center', valign: 'middle',
|
},
|
{title: '管理员手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'},
|
{title: '管理区域', field: 'type', visible: true, align: 'center', valign: 'middle',
|
formatter:function (data) {
|
return {1:"全国",2:"指定区域"}[data]
|
}
|
},
|
{title: '商户绑定状态', field: 'status', visible: true, align: 'center', valign: 'middle',
|
formatter: function (data,row) {
|
var btn = "";
|
if(data==1) {
|
var str = '<button class="btn btn-outline btn-primary" onclick="TSite.Allocationratio('+row.id+')" >去绑定</button>'
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="" onfocus="TUser.tooltip()">' + str + '</p>']
|
}else{
|
var str = '<h3>已绑定</h3>'
|
btn = [str]
|
}
|
return btn;
|
}
|
},
|
{title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter:function (data) {
|
return {1:"正常",2:"冻结",3:"删除"}[data]
|
}
|
},
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TSite.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TSite.seItem = selected[0];
|
return true;
|
}
|
};
|
/**
|
* 商户号认证
|
*/
|
TSite.Allocationratio = function (e) {
|
|
var index = layer.open({
|
type: 2,
|
title: "商户认证",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/operatorUser'
|
});
|
this.layerIndex = index;
|
};
|
/**
|
* 商户号认证页面
|
*/
|
TSite.auth = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: "商户认证",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/operator/proportionAuth/' + TSite.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
/**
|
* 分账比例
|
*/
|
TSite.proportion = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length >1 ){
|
Feng.info("只能选择一个运营商商户设置分账比例!");
|
}else {
|
if (this.check()) {
|
console.log("看看状态")
|
console.log(TSite.seItem.status)
|
if (TSite.seItem.status==1){
|
Feng.error("当前运营商没有绑定商户号,请先绑定商户号!")
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: "认证",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/operator/proportion/' + TSite.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
};
|
TSite.addSubmit = function(){
|
var alipayType = $("input[name='alipayType']:checked").val();
|
var wechatType = $("input[name='wechatType']:checked").val();
|
var alipayNum = $("#alipayNum").val();
|
var wechatNum = $("#wechatNum").val();
|
var operatorId = $("#operatorId").val();
|
if($("#alipayNum").val()=='' ){
|
Feng.info("请输入支付宝商户号")
|
return;
|
}
|
if($("#wechatNum").val()=='' ){
|
Feng.info("请输入微信商户号")
|
return;
|
}
|
var ajax = new $ax(Feng.ctxPath + "/operator/auth", function(data){
|
Feng.success("认证成功")
|
TSite.close();
|
TSite.search();
|
});
|
ajax.set("alipayType",alipayType);
|
ajax.set("wechatType",wechatType);
|
ajax.set("alipayNum",alipayNum);
|
ajax.set("wechatNum",wechatNum);
|
ajax.set("operatorId",operatorId);
|
ajax.start();
|
};
|
TSite.addSubmit1 = function(){
|
var alipayProportion = $("#alipayProportion").val();
|
var wechatProportion = $("#wechatProportion").val();
|
var operatorIdOne = $("#operatorIdOne").val();
|
if($("#alipayNum").val()=='' ){
|
Feng.info("请输入支付宝分账比例")
|
return;
|
}
|
if($("#wechatNum").val()=='' ){
|
Feng.info("请输入微信分账比例")
|
return;
|
}
|
if (Number(alipayProportion)+Number(wechatProportion)!=100){
|
Feng.info("总比例应该是100%,当前比例:"+Number(Number(alipayProportion)+Number(wechatProportion)));
|
return;
|
}
|
var ajax = new $ax(Feng.ctxPath + "/operator/proportion", function(data){
|
Feng.success("分账比例设置成功")
|
window.parent.TSite.table.refresh();
|
TSite.close();
|
TSite.search();
|
});
|
ajax.set("alipayProportion",alipayProportion);
|
ajax.set("wechatProportion",wechatProportion);
|
ajax.set("operatorIdOne",operatorIdOne);
|
ajax.start();
|
};
|
/**
|
* 上架
|
*/
|
TSite.onShelf = function () {
|
if (this.check()){
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
const data1 = {
|
ids:[],
|
state:null
|
};
|
selected.forEach(function(obj) {
|
console.log("查看选中")
|
console.log(obj)
|
var id = obj.id;
|
data1.ids.push(id);
|
});
|
data1.state = 1;
|
|
$.ajax({
|
url: Feng.ctxPath + "/operator/changeState",
|
type: "POST",
|
contentType: "application/json", // 设置请求头的 Content-Type
|
data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
|
success: function(response) {
|
Feng.success("解冻成功!");
|
TSite.search();
|
},
|
error: function(xhr, status, error) {
|
var errorMessage = xhr.responseText ? xhr.responseText : "解冻失败!";
|
}
|
});
|
}
|
};
|
|
/**
|
* 下架
|
*/
|
TSite.offShelf = function () {
|
if (this.check()){
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
const data1 = {
|
ids:[],
|
state:null
|
};
|
selected.forEach(function(obj) {
|
var id = obj.id;
|
data1.ids.push(id);
|
});
|
data1.state = 2;
|
$.ajax({
|
url: Feng.ctxPath + "/operator/changeState",
|
type: "POST",
|
contentType: "application/json", // 设置请求头的 Content-Type
|
data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
|
success: function(response) {
|
Feng.success("冻结成功!");
|
TSite.search();
|
},
|
error: function(xhr, status, error) {
|
var errorMessage = xhr.responseText ? xhr.responseText : "冻结失败!";
|
}
|
});
|
}
|
};
|
|
|
/**
|
* 跳转添加运营商页面
|
*/
|
TSite.openAddTSite = function () {
|
|
var index = layer.open({
|
type: 2,
|
title: "添加运营商",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/operator/add'
|
});
|
this.layerIndex = index;
|
};
|
/**
|
* 打开场地管理查看详情
|
*/
|
TSite.openInfo = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length >1 ){
|
Feng.info("只能选择一个问题进行编辑!");
|
}else {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: "编辑运营商",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/operator/update/' + TSite.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
};
|
TSite.reload = function () {
|
if (this.check()) {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
const data1 = {
|
ids:[],
|
password:null
|
};
|
selected.forEach(function(obj) {
|
var id = obj.id;
|
data1.ids.push(id);
|
});
|
data1.state = 2;
|
var operation = function() {
|
$.ajax({
|
url: Feng.ctxPath + "/operator/pwd",
|
type: "POST",
|
contentType: "application/json", // 设置请求头的 Content-Type
|
data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
|
success: function (response) {
|
TSite.search();
|
},
|
error: function (xhr, status, error) {
|
var errorMessage = xhr.responseText ? xhr.responseText : "冻结失败!";
|
}
|
});
|
}
|
|
Feng.confirm("确认重置密码?重置后密码为:a123456", operation);
|
}
|
};
|
/**
|
* 关闭此对话框
|
*/
|
TSite.close = function() {
|
parent.layer.close(window.parent.TSite.layerIndex);
|
};
|
|
TSite.search = function () {
|
var queryData = {};
|
queryData['userName'] = $("#name").val();
|
queryData['phone'] =$("#phone").val();
|
queryData['type'] =$("#type").val();
|
TSite.table.refresh({query: queryData});
|
};
|
|
TSite.resetSearch = function () {
|
$("#name").val("");
|
$("#phone").val("");
|
$("#type").val("");
|
TSite.search();
|
};
|
|
$(function () {
|
var defaultColunms = TSite.initColumn();
|
var table = new BSTable(TSite.id, "/operator/listAll", defaultColunms);
|
table.setPaginationType("server");
|
TSite.table = table.init();
|
});
|