1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'order/order/index' + location.search,
- add_url: 'order/order/add',
- edit_url: 'order/order/edit',
- del_url: 'order/order/del',
- multi_url: 'order/order/multi',
- import_url: 'order/order/import',
- table: 'order',
- }
- });
- 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: 'user.nickname', title: __('用户')},
- {field: 'order_on', title: __('Order_on'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'status', title: __('订单状态'), searchList: {"-1":__('已取消'),"0":__('未支付'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
- // {field: 'is_deleted', title: __('Is_deleted'), searchList: {"0":__('Is_deleted 0'),"1":__('Is_deleted 1')}, formatter: Table.api.formatter.normal},
- {field: 'paytime', title: __('Paytime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'type', title: __('购买类型'), searchList: {"0":__('教材'),"1":__('视频')}, formatter: Table.api.formatter.normal},
- {field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
- {field: 'pay_type', title: __('支付方式'), searchList: {"0":__('微信'),"1":__('支付宝')}, formatter: Table.api.formatter.normal},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {
- field: 'operate',
- title: __('Operate'),
- table: table,
- events: Table.api.events.operate,
- formatter: Table.api.formatter.operate,
- buttons: [{
- name: '订单商品',
- text:'订单商品',
- title: '订单商品',
- classname: 'btn btn-xs btn-primary btn-dialog',
- url: 'order.order_goods/index?order_id={id}',
- extend: 'data-area=\'["75%","75%"]\'',
- callback: function (data) {
- Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- }
- },],
- }
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|