90 lines
3.9 KiB
JavaScript
90 lines
3.9 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||
|
||
var Controller = {
|
||
index: function () {
|
||
// 初始化表格参数配置
|
||
Table.api.init({
|
||
extend: {
|
||
index_url: 'junka_card_log/index' + location.search,
|
||
add_url: 'junka_card_log/add',
|
||
edit_url: 'junka_card_log/edit',
|
||
del_url: 'junka_card_log/del',
|
||
multi_url: 'junka_card_log/multi',
|
||
import_url: 'junka_card_log/import',
|
||
table: 'junka_card_log',
|
||
}
|
||
});
|
||
|
||
var table = $("#table");
|
||
|
||
// 初始化表格
|
||
table.bootstrapTable({
|
||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||
pk: 'id',
|
||
sortName: 'id',
|
||
fixedColumns: true,
|
||
fixedRightNumber: 1,
|
||
columns: [
|
||
[
|
||
{checkbox: true},
|
||
{field: 'id', title: __('Id')},
|
||
{field: 'store.name', title: __('Store_id')},
|
||
{field: 'bill_id', title: __('Bill_id'), operate: 'LIKE'},
|
||
{field: 'bill_time', title: __('Bill_time'), operate: 'LIKE'},
|
||
{field: 'product_code', title: __('Product_code'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||
{field: 'card_price', title: __('Card_price'), operate: 'LIKE'},
|
||
{field: 'product_num', title: __('Product_num')},
|
||
{
|
||
field: 'status',
|
||
title: __('Status'),
|
||
searchList: {
|
||
0:__('购买失败'),
|
||
1:__('购买成功'),
|
||
},
|
||
formatter: Table.api.formatter.status
|
||
},
|
||
{field: 'error_msg', title: __('Error'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||
{
|
||
field: 'operate',
|
||
width: "150px",
|
||
title: __('Operate'),
|
||
table: table,
|
||
events: Table.api.events.operate,
|
||
buttons: [
|
||
{
|
||
name: 'click',
|
||
title: __('查看卡密'),
|
||
classname: 'btn btn-xs btn-info btn-click',
|
||
icon: 'fa fa-leaf',
|
||
// dropdown: '更多',//如果包含dropdown,将会以下拉列表的形式展示
|
||
click: function (data, row) {
|
||
console.log(row);
|
||
Layer.alert("卡看看i米");
|
||
}
|
||
},
|
||
],
|
||
formatter: Table.api.formatter.operate
|
||
},
|
||
]
|
||
]
|
||
});
|
||
|
||
// 为表格绑定事件
|
||
Table.api.bindevent(table);
|
||
},
|
||
add: function () {
|
||
Controller.api.bindevent();
|
||
},
|
||
edit: function () {
|
||
Controller.api.bindevent();
|
||
},
|
||
api: {
|
||
bindevent: function () {
|
||
Form.api.bindevent($("form[role=form]"));
|
||
}
|
||
}
|
||
};
|
||
return Controller;
|
||
});
|