/**
|
* 积分兑换订单管理初始化
|
*/
|
var TIntegralOrder = {
|
id: "TIntegralOrderTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TIntegralOrder.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '兑换时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.insertTime != '' && row.insertTime != null) {
|
var time = row.insertTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.insertTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '兑换用户ID', field: 'userId', visible: false, align: 'center', valign: 'middle'},
|
{title: '兑换用户', field: 'userName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.userName != '' && row.userName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.userName + '" onfocus="TUser.tooltip()">' + row.userName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '兑换商品ID', field: 'goodsId', visible: false, align: 'center', valign: 'middle'},
|
{title: '兑换商品', field: 'goodsName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.goodsName != '' && row.goodsName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.goodsName + '" onfocus="TUser.tooltip()">' + row.goodsName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '兑换数量', field: 'num', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.num != '' && row.num != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.num + '" onfocus="TUser.tooltip()">' + row.num + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '收货人', field: 'consigneeName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.consigneeName != '' && row.consigneeName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.consigneeName + '" onfocus="TUser.tooltip()">' + row.consigneeName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '联系电话', field: 'consigneePhone', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.consigneePhone != '' && row.consigneePhone != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.consigneePhone + '" onfocus="TUser.tooltip()">' + row.consigneePhone + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '收货地址', field: 'consigneeAddress', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.consigneeAddress != '' && row.consigneeAddress != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.consigneeAddress + '" onfocus="TUser.tooltip()">' + row.consigneeAddress + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '处理备注', field: 'remark', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.remark != '' && row.remark != null) {
|
var str = row.remark;
|
if (str.length > 20){
|
str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TIntegralOrder.buttonClick(' + row.id + ')">查看更多</button>';
|
}
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.remark + '" onfocus="TUser.tooltip()">' + str + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.state != '' && row.state != null) {
|
if(row.state == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="待处理" onfocus="TUser.tooltip()">待处理</p>']
|
}else if (row.state == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已处理" onfocus="TUser.tooltip()">已处理</p>']
|
}
|
}
|
return btn;
|
}
|
}
|
];
|
};
|
|
/**
|
* 查看更多按钮
|
* @param con
|
*/
|
TIntegralOrder.buttonClick = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '查看详情',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tIntegralOrder/lookDetail/'+id
|
});
|
this.layerIndex = index;
|
}
|
|
/**
|
* 检查是否选中
|
*/
|
TIntegralOrder.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TIntegralOrder.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加积分兑换订单
|
*/
|
TIntegralOrder.openAddTIntegralOrder = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加积分兑换订单',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tIntegralOrder/tIntegralOrder_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 立即处理
|
*/
|
TIntegralOrder.immediately = function () {
|
if (this.check()) {
|
if (TIntegralOrder.seItem.state != 1){
|
swal("处理失败", "【待处理】状态下才能执行此操作", "warning");
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: '立即处理',
|
area: ['800px', '420px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tIntegralOrder/tIntegralOrder_immediately/' + TIntegralOrder.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除积分兑换订单
|
*/
|
TIntegralOrder.delete = function () {
|
if (this.check()) {
|
var state = TIntegralOrder.seItem.state;
|
if (state != 2){
|
swal("删除失败", "【已处理】状态下才能执行此操作!", "warning");
|
return;
|
}
|
swal({
|
title: "您是否确认删除当前兑换订单记录?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tIntegralOrder/delete", function (data) {
|
swal("删除成功", "您已经删除了兑换订单数据。", "success");
|
TIntegralOrder.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message + "!", "warning");
|
});
|
ajax.set("tIntegralOrderId",TIntegralOrder.seItem.id);
|
ajax.start();
|
});
|
}
|
};
|
|
/**
|
* 查询积分兑换订单列表
|
*/
|
TIntegralOrder.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['userName'] = $("#userName").val();
|
queryData['goodsName'] = $("#goodsName").val();
|
queryData['consigneeName'] = $("#consigneeName").val();
|
queryData['consigneePhone'] = $("#consigneePhone").val();
|
queryData['state'] = $("#state").val();
|
TIntegralOrder.table.refresh({query: queryData});
|
};
|
|
TIntegralOrder.resetSearch = function () {
|
$("#insertTime").val("");
|
$("#userName").val("");
|
$("#goodsName").val("");
|
$("#consigneeName").val("");
|
$("#consigneePhone").val("");
|
$("#state").val("");
|
TIntegralOrder.search();
|
};
|
|
|
$(function () {
|
var defaultColunms = TIntegralOrder.initColumn();
|
var table = new BSTable(TIntegralOrder.id, "/tIntegralOrder/list", defaultColunms);
|
table.setPaginationType("server");
|
TIntegralOrder.table = table.init();
|
});
|