activeorder.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'activeorder/index/active_id/'+ Config.active_id + location.search,
  8. // add_url: 'activeorder/add',
  9. // edit_url: 'activeorder/edit',
  10. // del_url: 'activeorder/del',
  11. // multi_url: 'activeorder/multi',
  12. // import_url: 'activeorder/import',
  13. table: 'active_order',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'order_sn', title: __('Order_sn'), operate: 'LIKE'},
  29. {field: 'active_id', title: __('Active_id')},
  30. // {field: 'active.title', title: __('Active.title'), operate: 'LIKE'},
  31. // {field: 'active.desc', title: __('Active.desc'), operate: 'LIKE'},
  32. {field: 'user_id', title: __('User_id')},
  33. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  34. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  35. // {field: 'collectionplace', title: __('集合地点'), operate: 'LIKE'},
  36. {field: 'paytype', title: __('Paytype'), searchList: {"0":__('Paytype 0'),"1":__('Paytype 1')}, formatter: Table.api.formatter.normal},
  37. {field: 'price', title: __('Price'), operate: 'LIKE'},
  38. {field: 'number', title: __('Number')},
  39. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  40. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. {field: 'transaction_id', title: __('Transaction_id'), operate: 'LIKE'},
  43. {field: 'refund_no', title: __('Refund_no'), operate: 'LIKE'},
  44. {field: 'refundstatus', title: __('Refundstatus'), searchList: {"0":__('Refundstatus 0'),"1":__('Refundstatus 1'),"2":__('Refundstatus 2')}, formatter: Table.api.formatter.status},
  45. {field: 'refundprice', title: __('Refundprice'), operate: 'LIKE'},
  46. {field: 'refundtime', title: __('Refundtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  48. buttons: [
  49. {
  50. name: 'refund',
  51. text: '退款',
  52. title: __('退款'),
  53. extend: 'data-area=\'["85%", "85%"]\'',
  54. classname: 'btn btn-xs btn-success btn-ajax',
  55. icon: 'fa fa-pencil',
  56. confirm: '确认退款?',
  57. url: 'activeorder/refund',
  58. refresh: true,
  59. // success: function (data, ret) {
  60. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  61. // Layer.alert(ret.msg);
  62. // //如果需要阻止成功提示,则必须使用return false;
  63. // return false;
  64. // },
  65. // error: function (data, ret) {
  66. // // console.log(data, ret);
  67. // Layer.alert(ret.msg);
  68. // return false;
  69. // },
  70. // callback: function (data) {
  71. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  72. // },
  73. visible: function (row) {
  74. if ((row.status == 1 && Config.active_status == 3) || row.refundstatus == 2) {
  75. return true;
  76. } else {
  77. return false;
  78. }
  79. }
  80. }
  81. ]
  82. }
  83. ]
  84. ]
  85. });
  86. // 为表格绑定事件
  87. Table.api.bindevent(table);
  88. },
  89. add: function () {
  90. Controller.api.bindevent();
  91. },
  92. edit: function () {
  93. Controller.api.bindevent();
  94. },
  95. api: {
  96. bindevent: function () {
  97. Form.api.bindevent($("form[role=form]"));
  98. }
  99. }
  100. };
  101. return Controller;
  102. });