/**
|
* 管理初始化
|
*/
|
var TDriverPromotionActivity = {
|
id: "TDriverPromotionActivityTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TDriverPromotionActivity.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '序号', field: 'sort', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row, index) {
|
// 使用序号作为排名,index从0开始,所以需要+1
|
return index + 1;
|
}
|
},
|
{title: '用户Id', field: 'userId', visible: true, align: 'center', valign: 'middle'},
|
{title: '用户昵称', field: 'userName', visible: true, align: 'center', valign: 'middle'},
|
{title: '用户手机号', field: 'userPhone', visible: true, align: 'center', valign: 'middle'},
|
{title: '绑定时间', field: 'bindDate', visible: true, align: 'center', valign: 'middle',
|
},
|
{title: '有效期至', field: 'bindExpireDate', visible: true, align: 'center', valign: 'middle',
|
},
|
{title: '产生收益合计', field: 'money', visible: true, align: 'center', valign: 'middle',
|
},
|
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TDriverPromotionActivity.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
} else {
|
TDriverPromotionActivity.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加
|
*/
|
TDriverPromotionActivity.openAddTDriverPromotionActivity = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriverPromotionActivity/tDriverPromotionActivity_add'
|
});
|
this.layerIndex = index;
|
};
|
|
|
/**
|
* 打开查看详情
|
*/
|
TDriverPromotionActivity.viewUser = function (e) {
|
var index = layer.open({
|
type: 2,
|
title: '司机推广下级用户',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriverPromotionActivity/tDriverPromotionActivity_viewUser/' + e
|
});
|
this.layerIndex = index;
|
};
|
|
|
/**
|
* 打开查看详情
|
*/
|
TDriverPromotionActivity.update = function (e) {
|
var index = layer.open({
|
type: 2,
|
title: '编辑',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriverPromotionActivity/tDriverPromotionActivity_update/' + e
|
});
|
this.layerIndex = index;
|
};
|
TDriverPromotionActivity.info = function (e) {
|
var index = layer.open({
|
type: 2,
|
title: '编辑',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriverPromotionActivity/tDriverPromotionActivity_info/' + e
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 删除
|
*/
|
TDriverPromotionActivity.delete = function (e) {
|
var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/delete", function (data) {
|
Feng.success("删除成功!");
|
TDriverPromotionActivity.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tDriverPromotionActivityId", e);
|
ajax.start();
|
};
|
TDriverPromotionActivity.stop = function (e) {
|
var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/stop", function (data) {
|
Feng.success("暂停成功!");
|
TDriverPromotionActivity.table.refresh();
|
}, function (data) {
|
Feng.error("暂停失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id", e);
|
ajax.start();
|
};
|
|
TDriverPromotionActivity.start = function (e) {
|
var ajax = new $ax(Feng.ctxPath + "/tDriverPromotionActivity/start", function (data) {
|
Feng.success("暂停成功!");
|
TDriverPromotionActivity.table.refresh();
|
}, function (data) {
|
Feng.error("暂停失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id", e);
|
ajax.start();
|
};
|
|
|
TDriverPromotionActivity.startOrStop = function () {
|
if (this.check()) {
|
if (TDriverPromotionActivity.seItem.status == 1) {
|
TDriverPromotionActivity.stop(TDriverPromotionActivity.seItem.id);
|
} else {
|
TDriverPromotionActivity.start(TDriverPromotionActivity.seItem.id);
|
}
|
}
|
};
|
|
/**
|
* 查询列表
|
*/
|
TDriverPromotionActivity.search = function () {
|
var queryData = {};
|
queryData['name'] = $("#name").val();
|
queryData['driverId'] = $("#driverId").val();
|
TDriverPromotionActivity.table.refresh({query: queryData});
|
};
|
TDriverPromotionActivity.research = function () {
|
$("#name").val('');
|
TDriverPromotionActivity.search()
|
};
|
TDriverPromotionActivity.exportExcel = function () {
|
let p = "";
|
let name = $('#name').val();
|
let driverId = $('#driverId').val();
|
if(null != name && '' != name){
|
p += "name=" + name + "&";
|
}
|
if(null != driverId && '' != driverId){
|
p += "driverId=" + driverId + "&";
|
}
|
if('' != p){
|
p = "?" + p.substring(0, p.length - 1);
|
}
|
console.log('p['+p+']')
|
window.location.href = Feng.ctxPath + '/tDriverPromotionActivity/export1' + p;
|
};
|
|
|
$(function () {
|
var defaultColunms = TDriverPromotionActivity.initColumn();
|
var table = new BSTable(TDriverPromotionActivity.id, "/tDriverPromotionActivity/list2", defaultColunms);
|
table.setPaginationType("client");
|
TDriverPromotionActivity.table = table.init();
|
TDriverPromotionActivity.search()
|
});
|