define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'order/pdd/index' + location.search, add_url: 'order/pdd/add', edit_url: 'order/pdd/edit', del_url: 'order/pdd/del', multi_url: 'order/pdd/multi', import_url: 'order/pdd/import', table: 'order_pdd', } }); 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: __('User.nickname'), operate: 'LIKE'}, {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'}, {field: 'goods_name', title: __('Goods_name'), operate: 'LIKE'}, {field: 'goods_price', title: __('Goods_price'), operate: false,formatter:function(value, row, index){ if(value == "") return ""; return value/100; }}, {field: 'goods_quantity', title: __('Goods_quantity')}, {field: 'goods_thumbnail_url', title: __('Goods_thumbnail_url'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'order_amount', title: __('Order_amount'), operate: false,formatter:function(value, row, index){ if(value == "") return ""; return value/100; }}, {field: 'order_modify_at', title: __('Order_modify_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,dataTimeFormat:"YYYY-MM-DD HH:mm:ss"}, {field: 'order_pay_time', title: __('Order_pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,dataTimeFormat:"YYYY-MM-DD HH:mm:ss"}, {field: 'order_sn', title: __('Order_sn'), operate: 'LIKE'}, {field: 'order_status_desc', title: __('Order_status_desc'), operate: false}, {field: 'promotion_amount', title: __('Promotion_amount'), operate: false,formatter:function(value, row, index){ if(value == "") return ""; return value/100; }}, {field: 'promotion_rate', title: __('Promotion_rate'), operate: false,formatter:function(value, row, index){ if(value == "") return ""; return value/1000; }}, {field: 'price_compare_status', title: __('Price_compare_status'), searchList: {"0":__('正常'),"1":__('比价')}, formatter: Table.api.formatter.status} ] ] }); // 为表格绑定事件 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; });