/**
|
* 管理初始化
|
*/
|
var TCouponExamine = {
|
id: "TCouponExamineTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TCouponExamine.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '发布省', field: 'province', visible: true, align: 'center', valign: 'middle'},
|
{title: '发布城市', field: 'city', visible: true, align: 'center', valign: 'middle'},
|
{title: '所属账号', field: 'account', visible: true, align: 'center', valign: 'middle'},
|
{title: '优惠券名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '适用范围', field: 'useScope', visible: true, align: 'center', valign: 'middle'},
|
{title: '优惠券类型', field: 'type', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row, index) {
|
return {1: "满减券", 2: "代金券", 3: "体验券"}[value]
|
}},
|
{title: '发放方式', field: 'distributionMethod', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row, index) {
|
return {1: "积分购买", 2: "注册赠送", 3: "自动发券"}[value]
|
}},
|
{title: '有效期', field: 'timeValue', visible: true, align: 'center', valign: 'middle'},
|
{title: '用户人群', field: 'userPopulation', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row, index) {
|
return {1: "全部用户", 2: "年度会员", 3: "已有学员用户"}[value]
|
}},
|
{title: '发放数量', field: 'quantityIssued', visible: true, align: 'center', valign: 'middle'},
|
{title: '限领数量', field: 'pickUpQuantity', visible: true, align: 'center', valign: 'middle'},
|
{title: '审核状态', field: 'auditStatus', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row, index) {
|
return {1: "上架", 2: "下架"}[value]
|
}}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TCouponExamine.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TCouponExamine.seItem = selected[0];
|
return true;
|
}
|
};
|
|
|
/**
|
* 打开查看详情
|
*/
|
TCouponExamine.openDetail = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['95%', '95%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tCouponExamine/couponOfDetail/' + TCouponExamine.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
|
/**
|
* 打开审核页面
|
*/
|
TCouponExamine.openExamine = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tCouponExamine/couponExaminePage/' + TCouponExamine.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
|
|
/**
|
* 查询列表
|
*/
|
TCouponExamine.search = function () {
|
var queryData = {};
|
queryData['name'] = $("#name").val();
|
queryData['type'] = $("#type").val();
|
queryData['distributionMethod'] = $("#distributionMethod").val();
|
queryData['userPopulation'] = $("#userPopulation").val();
|
queryData['auditStatus'] = $("#auditStatus").val();
|
TCouponExamine.table.refresh({query: queryData});
|
};
|
|
|
/**
|
* 重置搜索
|
*/
|
TCouponExamine.resetSearch = function () {
|
$("#name").val('');
|
$("#type").val('');
|
$("#distributionMethod").val('');
|
$("#userPopulation").val('');
|
$("#auditStatus").val('');
|
TCouponExamine.search();
|
};
|
|
$(function () {
|
var defaultColunms = TCouponExamine.initColumn();
|
var table = new BSTable(TCouponExamine.id, "/tCouponExamine/list", defaultColunms);
|
table.setPaginationType("client");
|
TCouponExamine.table = table.init();
|
});
|