新建
This commit is contained in:
188
public/assets/js/backend/junka_purchcard_log.js
Normal file
188
public/assets/js/backend/junka_purchcard_log.js
Normal file
@@ -0,0 +1,188 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'junka_purchcard_log/index' + location.search,
|
||||
add_url: 'junka_purchcard_log/add',
|
||||
// edit_url: 'junka_purchcard_log/edit',
|
||||
del_url: '',
|
||||
multi_url: 'junka_purchcard_log/multi',
|
||||
import_url: 'junka_purchcard_log/import',
|
||||
table: 'junka_purchcard_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: 'card_list_name', title: __('card_type'), operate: 'LIKE'},
|
||||
{field: 'product_code', title: __('Product_code'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 't_price', title: __('Price'), operate: 'LIKE'},
|
||||
{field: 'card_price', title: __('Card_price'), operate: 'LIKE'},
|
||||
{field: 'total_num', title: __('数量')},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'status', title: __('Status'), searchList: {
|
||||
1 : __('购买成功'),
|
||||
0 : __('购买失败'),
|
||||
2 : __('退货中'),
|
||||
3 : __('已退货'),
|
||||
4 : __('拒绝退货'),
|
||||
5 : __('已锁定'),
|
||||
}, formatter: Table.api.formatter.status},
|
||||
{
|
||||
field: 'operate',
|
||||
width: "150px",
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
// {
|
||||
// name: 'savereject',
|
||||
// title: __('去审核'),
|
||||
// text: __('去审核'),
|
||||
// classname: 'btn btn-xs btn-primary btn-dialog',
|
||||
// icon: 'fa',
|
||||
// url: 'junka_reject/examine',
|
||||
// visible:function (data) {
|
||||
// if(data.is_examine == 1) {
|
||||
// return true;
|
||||
// }else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
{
|
||||
name: 'click',
|
||||
title: __('查看卡密'),
|
||||
text: __('卡密'),
|
||||
classname: 'btn btn-xs btn-info btn-click',
|
||||
icon: '',
|
||||
// dropdown: '更多',//如果包含dropdown,将会以下拉列表的形式展示
|
||||
click: function (data, row) {
|
||||
Layer.alert(row.data);
|
||||
}
|
||||
},
|
||||
// {
|
||||
// name: 'subreject',
|
||||
// title: __('退货'),
|
||||
// text: __('退货'),
|
||||
// classname: 'btn btn-xs btn-success btn-magic btn-ajax',
|
||||
// icon: 'fa',
|
||||
// confirm: '确认退货吗?',
|
||||
// url: 'junka_purchcard_log/subreject',
|
||||
// visible:function (data) {
|
||||
// if(data.is_reject == 1) {
|
||||
// return true;
|
||||
// }else {
|
||||
// return false;
|
||||
// }
|
||||
// },
|
||||
// success: function (data, ret) {
|
||||
// window.parent.location.reload();
|
||||
// //如果需要阻止成功提示,则必须使用return false;
|
||||
// //return false;
|
||||
// },
|
||||
// error: function (data, ret) {
|
||||
// console.log(data, ret);
|
||||
// Layer.alert(ret.msg);
|
||||
// return false;
|
||||
// }
|
||||
// },
|
||||
{
|
||||
name: 'sk',
|
||||
title: __('锁卡'),
|
||||
text: __('锁卡'),
|
||||
classname: 'btn btn-xs btn-success btn-magic btn-ajax',
|
||||
icon: 'fa',
|
||||
confirm: '确认锁卡吗?',
|
||||
url: 'junka_purchcard_log/sk',
|
||||
visible:function (data) {
|
||||
if(data.status == 1 && data.is_suo == 0) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
// return true;
|
||||
}
|
||||
},
|
||||
success: function (data, ret) {
|
||||
Layer.msg(ret.msg);
|
||||
// 刷新
|
||||
$("#table").bootstrapTable("refresh","");
|
||||
//如果需要阻止成功提示,则必须使用return false;
|
||||
return false;
|
||||
},
|
||||
error: function (data, ret) {
|
||||
console.log(data, ret);
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'js',
|
||||
title: __('解锁'),
|
||||
text: __('解锁'),
|
||||
classname: 'btn btn-xs btn-primary btn-magic btn-ajax',
|
||||
icon: 'fa',
|
||||
confirm: '确认解锁吗?',
|
||||
url: 'junka_purchcard_log/js',
|
||||
visible:function (data) {
|
||||
if(data.status == 5 || data.is_suo == 1) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
// return true;
|
||||
}
|
||||
},
|
||||
success: function (data, ret) {
|
||||
Layer.msg(ret.msg);
|
||||
// 刷新
|
||||
$("#table").bootstrapTable("refresh","");
|
||||
//如果需要阻止成功提示,则必须使用return false;
|
||||
return false;
|
||||
},
|
||||
error: function (data, ret) {
|
||||
console.log(data, ret);
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
],
|
||||
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;
|
||||
});
|
||||
Reference in New Issue
Block a user