order.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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: 'order/index' + location.search,
  8. add_url: 'order/add',
  9. // edit_url: 'order/edit',
  10. // del_url: 'order/del',
  11. multi_url: 'order/multi',
  12. import_url: 'order/import',
  13. table: '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: 'product_name', title: __('Product_name'), operate: 'LIKE'},
  29. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  30. {field: 'pay_fee', title: __('Pay_fee'), operate:'BETWEEN'},
  31. // {field: 'usera.nickname', title: __('Usera.nickname'), operate: 'LIKE'},
  32. // {field: 'usera.mobile', title: __('Usera.mobile'), operate: 'LIKE'},
  33. {field: 'realname', title: __('Realname'), operate: 'LIKE'},
  34. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  35. {field: 'ticket_str', title: __('Ticket_str'), operate: 'LIKE'},
  36. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"10":__('Status 10'),"21":__('Status 21'),"22":__('Status 22')}, formatter: Table.api.formatter.status},
  37. {field: 'roadname', title: __('Roadname'), operate: 'LIKE'},
  38. {field: 'roadtype', title: __('Roadtype'), searchList: {"1":__('Roadtype 1'),"2":__('Roadtype 2'),"3":__('Roadtype 3')}, formatter: Table.api.formatter.normal},
  39. {field: 'go_chufatime', title: __('Go_chufatime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'go_chufaname', title: __('Go_chufaname'), operate: 'LIKE'},
  41. {field: 'back_chufatime', title: __('Back_chufatime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. {field: 'back_chufaname', title: __('Back_chufaname'), operate: 'LIKE'},
  43. {field: 'paytime', title: __('Paytime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'finishtime', title: __('Finishtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. {field: 'user_id', title: __('User_id')},
  46. {field: 'product_id', title: __('Product_id')},
  47. {field: 'road_id', title: __('Road_id')},
  48. {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  49. {field: 'pay_out_trade_no', title: __('Pay_out_trade_no'), operate: 'LIKE'},
  50. {field: 'cancle_time', title: __('Cancle_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  51. // {field: 'refund_reason', title: __('Refund_reason'), operate: 'LIKE'},
  52. // {field: 'refund_time', title: __('Refund_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  53. // {field: 'refund_remark', title: __('Refund_remark'), operate: 'LIKE'},
  54. // {field: 'refund_fee', title: __('Refund_fee'), operate:'BETWEEN'},
  55. {field: 'jxtype', title: __('Jxtype'), searchList: {"0":__('Jxtype 0'),"1":__('Jxtype 1')}, formatter: Table.api.formatter.normal},
  56. // {field: 'product.name', title: __('Product.name'), operate: 'LIKE'},
  57. {field: 'share_uid', title: __('Share_uid')},
  58. {field: 'userb.nickname', title: __('Userb.nickname'), operate: 'LIKE'},
  59. {field: 'userb.mobile', title: __('Userb.mobile'), operate: 'LIKE'},
  60. {field: 'operate', title: __('Operate'), table: table,
  61. buttons:[
  62. {
  63. name:'refund',
  64. text:'退款',
  65. title:'退款',
  66. icon:'fa fa-exclamation-circle',
  67. classname:'btn btn-xs btn-danger btn-dialog',
  68. url:'order/refund/id/{ids}',
  69. target:'_self',
  70. refresh:true,
  71. hidden:function($row){
  72. if($row.status == 21 || $row.status == 22){
  73. return false;
  74. }
  75. return true;
  76. }
  77. },
  78. {
  79. name:'xieyipdf',
  80. text:'协议导出',
  81. title:'协议导出',
  82. icon:'fa fa-exclamation-circle',
  83. classname:'btn btn-xs btn-success btn-addtabs',
  84. url:'order/xieyipdf/id/{ids}',
  85. target:'_blank',
  86. refresh:true,
  87. hidden:function($row){
  88. if($row.xieyi_id == 0){
  89. return true;
  90. }
  91. return false;
  92. }
  93. },
  94. {
  95. name:'refundcancel',
  96. text:'取消售后',
  97. title:'取消售后',
  98. icon:'fa fa-exclamation-circle',
  99. classname:'btn btn-xs btn-danger btn-ajax',
  100. url:'order/refundcancel/id/{ids}',
  101. target:'_self',
  102. refresh:true,
  103. hidden:function($row){
  104. if($row.status == 21){
  105. return false;
  106. }
  107. return true;
  108. }
  109. },
  110. ],
  111. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  112. ]
  113. ]
  114. });
  115. // 为表格绑定事件
  116. Table.api.bindevent(table);
  117. },
  118. add: function () {
  119. Controller.api.bindevent();
  120. },
  121. edit: function () {
  122. Controller.api.bindevent();
  123. },
  124. xieyipdf: function () {
  125. Controller.api.bindevent();
  126. },
  127. refund: function () {
  128. Controller.api.bindevent();
  129. },
  130. refundcancel: function () {
  131. Controller.api.bindevent();
  132. },
  133. api: {
  134. bindevent: function () {
  135. Form.api.bindevent($("form[role=form]"));
  136. }
  137. }
  138. };
  139. return Controller;
  140. });