packageorder.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: 'service/card/packageorder/index' + location.search,
  8. multi_url: 'service/card/packageorder/multi',
  9. import_url: 'service/card/packageorder/import',
  10. table: 'service_package_order',
  11. }
  12. });
  13. var table = $("#table");
  14. // 初始化表格
  15. table.bootstrapTable({
  16. url: $.fn.bootstrapTable.defaults.extend.index_url,
  17. pk: 'id',
  18. sortName: 'id',
  19. fixedColumns: true,
  20. fixedRightNumber: 1,
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'user_id', title: __('User_id')},
  26. {field: 'nickname', title: __('用户昵称'),operate: false},
  27. {field: 'package_card_id', title: __('Package_card_id')},
  28. {field: 'name', title: __('Name'), operate: 'LIKE'},
  29. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  30. {field: 'paytype', title: __('Paytype'), searchList: {"0":__('Paytype 0'),"1":__('Paytype 1'),"2":__('Paytype 2'),"3":__('Paytype 3'),"4":__('Paytype 4')}, formatter: Table.api.formatter.normal},
  31. {field: 'orderId', title: __('Orderid'), operate: 'LIKE'},
  32. {field: 'original_price', title: __('Original_price'), operate:'BETWEEN'},
  33. {field: 'price', title: __('Price'), operate:'BETWEEN'},
  34. {field: 'discount', title: __('Discount')},
  35. {field: 'coupon_id', title: __('Coupon_id')},
  36. {field: 'coupon_price', title: __('Coupon_price'), operate:'BETWEEN'},
  37. {field: 'payprice', title: __('Payprice'), operate:'BETWEEN'},
  38. {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. //{field: 'trade_no', title: __('Trade_no'), operate: 'LIKE'},
  41. //{field: 'is_update', title: __('Is_update'), searchList: {"0":__('Is_update 0'),"1":__('Is_update 1')}, formatter: Table.api.formatter.normal},
  42. {field: 'total_nums', title: __('Total_nums')},
  43. {field: 'use_nums', title: __('Use_nums')},
  44. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"-1":__('Status -1'),"2":__('Status 2'),"-2":__('Status -2')}, formatter: Table.api.formatter.status},
  45. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {field: 'paytime', title: __('Paytime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  48. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  49. buttons: [
  50. {
  51. name: 'list',
  52. text: __('套餐卡内容'),
  53. title: __('套餐卡内容'),
  54. classname: 'btn btn-xs btn-info btn-dialog',
  55. icon: 'fa fa-list-ol',
  56. url: function(row){
  57. return 'service/card/packageorderdetail/index?package_order_id='+row.id;
  58. },
  59. },
  60. {
  61. name: 'list',
  62. text: __('订单列表'),
  63. title: __('订单列表'),
  64. classname: 'btn btn-xs btn-list btn-success btn-dialog',
  65. icon: 'fa fa-list-o',
  66. url: function(row){
  67. return 'service/order/order/index?ordertype=1&package_order_id='+row.id;
  68. },
  69. },
  70. ],
  71. formatter: Table.api.formatter.operate}
  72. ]
  73. ]
  74. });
  75. // 为表格绑定事件
  76. Table.api.bindevent(table);
  77. },
  78. add: function () {
  79. Controller.api.bindevent();
  80. },
  81. edit: function () {
  82. Controller.api.bindevent();
  83. },
  84. api: {
  85. bindevent: function () {
  86. Form.api.bindevent($("form[role=form]"));
  87. }
  88. }
  89. };
  90. return Controller;
  91. });