/**
|
* 管理初始化
|
*/
|
var TPayInfo = {
|
id: "TPayInfoTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1,
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TPayInfo.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '选择', field: '', visible: true, align: 'center', valign: 'middle'},
|
{title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '联系方式', field: 'phone', visible: true, align: 'center', valign: 'middle'},
|
{title: '使用状态', field: 'status', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row, index) {
|
return {1: "未使用", 2: "已核销"}[value]
|
}
|
},
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TPayInfo.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TPayInfo.seItem = selected[0];
|
return true;
|
}
|
};
|
|
|
/**
|
* 核销操作
|
* @constructor
|
*/
|
TPayInfo.WriteOff = function (){
|
if (TPayInfo.check()) {
|
if (TPayInfo.seItem.status === 2){
|
return Feng.error("重复核销!");
|
}
|
var ajax = new $ax(Feng.ctxPath + "/tGoods/write_off", function (data) {
|
Feng.success("核销成功!");
|
TPayInfo.table.refresh();
|
}, function (data) {
|
Feng.error("核销失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",TPayInfo.seItem.id);
|
ajax.start();
|
}
|
}
|
|
|
/**
|
* 关闭此对话框
|
*/
|
TPayInfo.close = function() {
|
parent.layer.close(window.parent.TPointProducts.layerIndex);
|
}
|
|
|
/**
|
* 查询列表
|
*/
|
TPayInfo.search = function () {
|
var queryData = {};
|
queryData['name'] = $("#name").val();
|
queryData['phone'] = $("#phone").val();
|
queryData['status'] = $("#status").val();
|
queryData['id'] = $("#id").val();
|
TPayInfo.table.refresh({query: queryData});
|
};
|
|
|
/**
|
* 重置搜索
|
*/
|
TPayInfo.resetSearch = function () {
|
$("#name").val('');
|
$("#phone").val('');
|
$("#status").val('');
|
TPayInfo.search();
|
};
|
|
$(function () {
|
let goodsId = $("#id").val();
|
var defaultColunms = TPayInfo.initColumn();
|
var table = new BSTable(TPayInfo.id, "/tGoods/payList/"+goodsId, defaultColunms);
|
table.setPaginationType("client");
|
TPayInfo.table = table.init();
|
});
|