/**
|
* 管理初始化
|
*/
|
var SysCouponRecord = {
|
id: "SysCouponRecordTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
SysCouponRecord.initColumn = function () {
|
return [
|
{title: '', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '添加时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '优惠券名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '优惠金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
|
{title: '条件金额', field: 'fullMoney', visible: true, align: 'center', valign: 'middle'},
|
{title: '优惠券类型', field: 'couponUseType', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if(value==0){
|
return "通用券";
|
}else if(value==1){
|
return "专车券";
|
}else if(value==2){
|
return "出租券";
|
}else if(value==3){
|
return "跨城出行券";
|
}else{
|
return "";
|
}
|
}
|
},
|
{title: '服务类型', field: 'couponType', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if(value==1){
|
return "抵扣";
|
}else if(value==2){
|
return "满减";
|
}else{
|
return "";
|
}
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
SysCouponRecord.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
SysCouponRecord.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加
|
*/
|
SysCouponRecord.openAddSysCouponRecord = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/sysCouponRecord/sysCouponRecord_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看详情
|
*/
|
SysCouponRecord.openSysCouponRecordDetail = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/sysCouponRecord/sysCouponRecord_update/' + SysCouponRecord.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除
|
*/
|
SysCouponRecord.delete = function () {
|
if (this.check()) {
|
var ajax = new $ax(Feng.ctxPath + "/sysCouponRecord/delete", function (data) {
|
Feng.success("删除成功!");
|
SysCouponRecord.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("sysCouponRecordId",this.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 查询列表
|
*/
|
SysCouponRecord.search = function () {
|
var queryData = {};
|
queryData['createTime'] = $("#createTime").val();
|
queryData['couponUseType'] = $("#couponUseType").val();
|
queryData['couponType'] = $("#couponType").val();
|
SysCouponRecord.table.refresh({query: queryData});
|
};
|
SysCouponRecord.resetSearch = function () {
|
$("#createTime").val("");
|
$("#couponUseType").val("");
|
$("#couponType").val("");
|
SysCouponRecord.search();
|
};
|
$(function () {
|
var defaultColunms = SysCouponRecord.initColumn();
|
var table = new BSTable(SysCouponRecord.id, "/sysCouponRecord/list", defaultColunms);
|
table.setPaginationType("server");
|
SysCouponRecord.table = table.init();
|
});
|