define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'offline/order/index' + location.search, multi_url: 'offline/order/multi', import_url: 'offline/order/import', dragsort_url: "", table: 'product_order', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'weigh', fixedColumns: true, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id'), operate: false}, {field: 'users.address', title: __('User_id'),operate:'LIKE'}, {field: 'order_no', title: __('订单号')}, {field: 'order_id', title: __('Order_id'), operate: false}, {field: 'products.zh_name', title: __('Product_id'),operate:'LIKE'}, {field: 'areas.address', title: __('Area_id')}, {field: 'type_id', title: __('Type_id'), searchList: {0:__('热销'), 1:__('转让'), 2:__('赠送')}, formatter: Table.api.formatter.label}, {field: 'from_user', title: __('来源用户Id'), operate:false}, {field: 'price', title: __('Price'), operate:false}, {field: 'fees', title: __('手续费'), operate:false}, {field: 'status', title: __('Status'), searchList: {0:__('已下单'), 1:__('支付'), 2:__('转让'), 3:__('提货'), 4:__('取消'), 5:__('关闭')},formatter: Table.api.formatter.status}, {field: 'address.address', title: __('提货地址'), operate:false}, {field: 'address.status', title: __('发货状态'), searchList: {0:__('待发货'), 1:__('已发货'), 2:__('已完成')}, formatter: Table.api.formatter.flag}, {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, { field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [{ name: 'shipping', text: '发货', title: '发货', classname: 'btn btn-xs btn-primary btn-dialog btn-receivable', icon: 'fa fa-keyboard-o', url: 'offline/order/shipping', //extend: 'data-area=\'["50%", "50%"]\'', visible: function (row) { if(row.status == 3) return true; return false; } },], formatter: Table.api.formatter.operate } ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, shipping: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });