123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'activeorder/index/active_id/'+ Config.active_id + location.search,
- // add_url: 'activeorder/add',
- // edit_url: 'activeorder/edit',
- // del_url: 'activeorder/del',
- // multi_url: 'activeorder/multi',
- // import_url: 'activeorder/import',
- table: 'active_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: 'order_sn', title: __('Order_sn'), operate: 'LIKE'},
- {field: 'active_id', title: __('Active_id')},
- // {field: 'active.title', title: __('Active.title'), operate: 'LIKE'},
- // {field: 'active.desc', title: __('Active.desc'), operate: 'LIKE'},
- {field: 'user_id', title: __('User_id')},
- {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
- // {field: 'collectionplace', title: __('集合地点'), operate: 'LIKE'},
- {field: 'paytype', title: __('Paytype'), searchList: {"0":__('Paytype 0'),"1":__('Paytype 1')}, formatter: Table.api.formatter.normal},
- {field: 'price', title: __('Price'), operate: 'LIKE'},
- {field: 'number', title: __('Number')},
- {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
- {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: 'transaction_id', title: __('Transaction_id'), operate: 'LIKE'},
- {field: 'refund_no', title: __('Refund_no'), operate: 'LIKE'},
- {field: 'refundstatus', title: __('Refundstatus'), searchList: {"0":__('Refundstatus 0'),"1":__('Refundstatus 1'),"2":__('Refundstatus 2')}, formatter: Table.api.formatter.status},
- {field: 'refundprice', title: __('Refundprice'), operate: 'LIKE'},
- {field: 'refundtime', title: __('Refundtime'), 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: 'refund',
- text: '退款',
- title: __('退款'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-success btn-ajax',
- icon: 'fa fa-pencil',
- confirm: '确认退款?',
- url: 'activeorder/refund',
- refresh: true,
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- visible: function (row) {
- if ((row.status == 1 && Config.active_status == 3) || row.refundstatus == 2) {
- return true;
- } else {
- return false;
- }
- }
- }
- ]
- }
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|