/**
|
* 车辆品牌管理管理初始化
|
*/
|
var Coupon = {
|
id: "MerchantCouponTable", //表格id
|
seItem: null, //选中的条目
|
seItemIds: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
Coupon.initColumn = function () {
|
return [
|
{field: 'selectItem', checkbox: true},
|
{title: '主键id', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '所属商家', field: 'merchantName', visible: true, align: 'center', valign: 'middle'},
|
{title: '商家券名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '优惠金额', field: 'discountName', visible: true, align: 'center', valign: 'middle'},
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
Coupon.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
} else {
|
Coupon.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/***
|
* 多选
|
* @returns {boolean}
|
*/
|
Coupon.checkMulti = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
} else {
|
Coupon.seItemIds = selected;
|
return true;
|
}
|
}
|
|
|
Coupon.determine = function () {
|
if (this.checkMulti()) {
|
window.parent.MerchantActivityInfoDlg.choiceCouponAll(Coupon.seItemIds, $("#type").val());
|
parent.layer.closeAll();
|
}
|
};
|
|
|
/**
|
* 查询家卷列表
|
*/
|
Coupon.search = function () {
|
|
var ids = $("#ids").val();
|
var type = $("#type").val();
|
var merchantIds = $("#merchantIds").val();
|
|
var queryData = {};
|
|
queryData['type'] = type;
|
queryData['ids'] = ids;
|
queryData['merchantIds'] = merchantIds;
|
|
var time = $("#time").val();
|
if (time != null && time != '') {
|
queryData['startTime'] = time.substring(0, 10);
|
queryData['endTime'] = time.substring(13, 23);
|
} else {
|
queryData['startTime'] = "";
|
queryData['endTime'] = "";
|
}
|
queryData['merchantName'] = $("#merchantName").val();
|
queryData['name'] = $("#name").val();
|
|
Coupon.table.refresh({query: queryData});
|
};
|
|
Coupon.resetSearch = function () {
|
$("#time").val("");
|
$("#name").val("");
|
$("#merchantName").val("");
|
Coupon.search();
|
};
|
|
$(function () {
|
|
var ids = $("#ids").val();
|
var type = $("#type").val();
|
var merchantIds = $("#merchantIds").val();
|
|
var defaultColunms = Coupon.initColumn();
|
var table = new BSTable(Coupon.id, "/merchantActivity/getCouponList", defaultColunms);
|
table.setPaginationType("server");
|
var queryData = {};
|
queryData['ids'] = ids;
|
queryData['type'] = type;
|
queryData['merchantIds'] = merchantIds;
|
|
table.setQueryParams(queryData);
|
|
if (type == 1) {
|
table.columns[4].title = "商家券名称";
|
table.columns[5].title = "优惠金额";
|
table.columns[5].field = "discountName";
|
}
|
if (type == 2) {
|
table.columns[4].title = "商品券名称";
|
table.columns[5].title = "商品详情";
|
table.columns[5].field = "content";
|
}
|
Coupon.table = table.init();
|
});
|