/**
|
* 管理初始化
|
*/
|
var TUserRedPacketRecord = {
|
id: "TUserRedPacketRecordTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TUserRedPacketRecord.initColumn = function () {
|
return [
|
{title: '', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '领取时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '领取人', field: 'nickName', visible: true, align: 'center', valign: 'middle'},
|
{title: '领取人电话', field: 'phone', visible: true, align: 'center', valign: 'middle'},
|
{title: '领取金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
|
{title: '到期时间', field: 'expirationTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if(value==1){
|
return "未使用";
|
}else if(value==2){
|
return "已使用";
|
}else if(value==3){
|
return "已过期";
|
}else{
|
return "";
|
}
|
}
|
},
|
{title: '使用时间', field: 'useTime', visible: true, align: 'center', valign: 'middle'}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TUserRedPacketRecord.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TUserRedPacketRecord.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加
|
*/
|
TUserRedPacketRecord.openAddTUserRedPacketRecord = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tUserRedPacketRecord/tUserRedPacketRecord_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看详情
|
*/
|
TUserRedPacketRecord.openTUserRedPacketRecordDetail = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tUserRedPacketRecord/tUserRedPacketRecord_update/' + TUserRedPacketRecord.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除
|
*/
|
TUserRedPacketRecord.delete = function () {
|
if (this.check()) {
|
var ajax = new $ax(Feng.ctxPath + "/tUserRedPacketRecord/delete", function (data) {
|
Feng.success("删除成功!");
|
TUserRedPacketRecord.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tUserRedPacketRecordId",this.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 查询列表
|
*/
|
TUserRedPacketRecord.search = function () {
|
var queryData = {};
|
queryData['createTime'] = $("#createTime").val();
|
queryData['couponActivityId'] = $("#couponActivityId").val();
|
queryData['userName'] = $("#userName").val();
|
queryData['userPhone'] = $("#userPhone").val();
|
queryData['state'] = $("#state").val();
|
TUserRedPacketRecord.table.refresh({query: queryData});
|
};
|
TUserRedPacketRecord.resetSearch = function () {
|
$("#createTime").val("");
|
$("#userName").val("");
|
$("#userPhone").val("");
|
$("#state").val("");
|
TUserRedPacketRecord.search();
|
};
|
$(function () {
|
var defaultColunms = TUserRedPacketRecord.initColumn();
|
var table = new BSTable(TUserRedPacketRecord.id, "/tUserRedPacketRecord/list", defaultColunms);
|
table.setPaginationType("server");
|
|
var queryData = {};
|
queryData['createTime'] = $("#createTime").val();
|
queryData['couponActivityId'] = $("#couponActivityId").val();
|
table.setQueryParams(queryData);
|
TUserRedPacketRecord.table = table.init();
|
});
|