order.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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/submitordernew',
  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. search:false,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field: 'id', title: __('Id')},
  29. {field: 'orderno', title: __('Orderno'), operate: 'LIKE'},
  30. {field: 'ordertype', title: __('Ordertype'), searchList: {"1":__('Ordertype 1'),"2":__('Ordertype 2'),"3":__('Ordertype 3')}, formatter: Table.api.formatter.normal},
  31. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status},
  32. {field: 'company_id', title: __('Company_id')},
  33. {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
  34. // {field: 'staff_id', title: __('Staff_id'), operate:false, visible:false},
  35. {field: 'staff.truename', title: __('Staff.truename'), operate: 'LIKE'},
  36. {field: 'staff.mobile', title: __('Staff.mobile'), operate: 'LIKE'},
  37. // {field: 'user_id', title: __('User_id'), operate:false, visible:false},
  38. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  39. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  40. {field: 'user_name', title: __('User_name'), operate: 'LIKE'},
  41. // {field: 'user_car_id', title: __('User_car_id'), operate: false, visible: false},
  42. {field: 'user_car_number', title: __('User_car_number'), operate: 'LIKE'},
  43. {field: 'user_mobile', title: __('User_mobile'), operate: 'LIKE'},
  44. {field: 'user_address', title: __('User_address'), operate: 'LIKE'},
  45. // {field: 'pre_order_id', title: __('Pre_order_id'), operate:false, visible:false},
  46. {field: 'pre_order.pre_order_no', title: __('Order.pre_order_no'), operate: 'LIKE'},
  47. // {field: 'servicetype_id', title: __('Servicetype_id'), operate:false, visible:false},
  48. {field: 'servicetype.title', title: __('Servicetype.title'), operate: 'LIKE'},
  49. {field: 'server_time', title: __('Server_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. {field: 'server_info', title: __('Server_info'), operate: 'LIKE'},
  51. {field: 'server_images', title: __('Server_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  52. // {field: 'package_id', title: __('Package_id'), operate:false, visible:false},
  53. {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  54. {field: 'paytype', title: __('Paytype'), searchList: {"1":__('Paytype 1'),"2":__('Paytype 2'),"3":__('Paytype 3')}, formatter: Table.api.formatter.normal},
  55. {field: 'pay_fee', title: __('Pay_fee'), operate:'BETWEEN'},
  56. {field: 'appen_fee', title: __('Appen_fee'), operate:'BETWEEN'},
  57. {field: 'total_fee', title: __('Total_fee'), operate:'BETWEEN'},
  58. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  59. {field: 'hexiao_time', title: __('Hexiao_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  60. {field: 'cancel_time', title: __('Cancel_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  61. {field: 'cancel_reason', title: __('Cancel_reason'), operate: 'LIKE'},
  62. {field: 'finish_time', title: __('Finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  63. {field: 'next_date', title: __('Next_date'), operate: 'LIKE'},
  64. {field: 'next_carlicheng', title: __('Next_carlicheng'), operate: 'LIKE'},
  65. // {field: 'pay_order_id', title: __('Pay_order_id'), operate: false, visible: false},
  66. {field: 'operate', title: __('Operate'), table: table,
  67. buttons:[
  68. {
  69. name:'appenlist',
  70. text:'追加服务项',
  71. title:'追加服务项',
  72. icon:'fa fa-exclamation-circle',
  73. classname:'btn btn-xs btn-info btn-dialog',
  74. url:'orderappen/index/order_id/{ids}?dialog=1',
  75. target:'_self',
  76. extend: 'data-area=["90%","90%"]',
  77. hidden:function($row){
  78. if($row['status'] == 1){
  79. return true;
  80. }
  81. return false;
  82. }
  83. },
  84. {
  85. name:'cancel',
  86. text:'取消',
  87. title:'取消',
  88. icon:'fa fa-exclamation-circle',
  89. classname:'btn btn-xs btn-info btn-dialog',
  90. url:'order/cancel/id/{ids}?dialog=1',
  91. target:'_self',
  92. extend: 'data-area=["90%","90%"]',
  93. hidden:function($row){
  94. if($row['ordertype'] != 3 && $row['status'] == 2){
  95. return false;
  96. }
  97. return true;
  98. }
  99. },
  100. {
  101. name:'finish',
  102. text:'完成',
  103. title:'完成',
  104. icon:'fa fa-exclamation-circle',
  105. classname:'btn btn-xs btn-info btn-dialog',
  106. url:'order/finish/id/{ids}?dialog=1',
  107. target:'_self',
  108. extend: 'data-area=["90%","90%"]',
  109. hidden:function($row){
  110. if($row['status'] == 2){
  111. return false;
  112. }
  113. return true;
  114. }
  115. },
  116. ],
  117. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  118. ]
  119. ]
  120. });
  121. // 为表格绑定事件
  122. Table.api.bindevent(table);
  123. },
  124. add: function () {
  125. Controller.api.bindevent();
  126. },
  127. edit: function () {
  128. Controller.api.bindevent();
  129. },
  130. submitordernew: function () {
  131. Controller.api.bindevent();
  132. },
  133. cancel: function () {
  134. Controller.api.bindevent();
  135. },
  136. finish: function () {
  137. Controller.api.bindevent();
  138. },
  139. api: {
  140. bindevent: function () {
  141. Form.api.bindevent($("form[role=form]"));
  142. }
  143. }
  144. };
  145. return Controller;
  146. });