/**
|
* 管理初始化
|
*/
|
var TUserToCoupon = {
|
id: "TUserToCouponTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TUserToCoupon.initColumn = function () {
|
return [
|
{title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '用户名', field: 'nickname', visible: true, align: 'center', valign: 'middle'},
|
{title: '手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'},
|
{title: '领取优惠券', field: 'couponName', visible: true, align: 'center', valign: 'middle'},
|
{title: '领取时间', field: 'createTimeStr', visible: true, align: 'center', valign: 'middle'},
|
{title: '当前状态', field: 'couponStatus', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (row.couponStatus == 1){
|
return '<span>未使用</span>'
|
}else if (row.couponStatus == 2){
|
return '<span>已使用</span>'
|
}
|
}
|
},
|
{title: '使用时间', field: 'useTime', visible: false, align: 'center', valign: 'middle'},
|
{title: '使用订单号', field: 'code', visible: false, align: 'center', valign: 'middle'}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TUserToCoupon.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TUserToCoupon.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 查询列表
|
*/
|
TUserToCoupon.search = function () {
|
var queryData = {};
|
queryData['activityId'] = $("#id").val();
|
TUserToCoupon.table.refresh({query: queryData});
|
};
|
|
/**
|
* 重置
|
*/
|
TUserToCoupon.resetSearch = function (){
|
$("#couponType").val('');
|
TUserToCoupon.search();
|
}
|
|
$(function () {
|
var defaultColunms = TUserToCoupon.initColumn();
|
var table = new BSTable(TUserToCoupon.id, "/tCoupon/userToCouponList", defaultColunms);
|
table.setPaginationType("client");
|
TUserToCoupon.table = table.init();
|
});
|