order.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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: 'pricing/order/index' + location.search,
  8. add_url: 'pricing/order/add',
  9. edit_url: 'pricing/order/edit',
  10. del_url: 'pricing/order/del',
  11. multi_url: 'pricing/order/multi',
  12. import_url: 'pricing/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: 'uid', title: __('Uid')},
  29. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  30. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  31. {field: 'type', title: __('Type'), operate: 'LIKE',},
  32. // {field: 'goods_id', title: __('Goods_id')},
  33. {field: 'goods_name', title: __('Goods_name'), operate: 'LIKE'},
  34. {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  35. {field: 'amount_real', title: __('Amount_real'), operate:'BETWEEN'},
  36. // {field: 'discount_id', title: __('Discount_id')},
  37. // {field: 'discount', title: __('Discount'), operate:'BETWEEN'},//优惠金额
  38. // {field: 'payment_type', title: __('Payment_type'), operate: 'LIKE'},
  39. // {field: 'payment_code', title: __('Payment_code'), operate: 'LIKE'},
  40. // {field: 'payment_trade', title: __('Payment_trade'), operate: 'LIKE'},
  41. // {field: 'payment_status', title: __('Payment_status')},
  42. // {field: 'payment_amount', title: __('Payment_amount'), operate:'BETWEEN'},
  43. {field: 'number_goods', title: __('Number_goods')},
  44. {field: 'status', title: __('Status'),formatter: function (d){
  45. if(d == 1){
  46. return '待支付';
  47. }else if(2){
  48. return '已支付';
  49. }else if(3){
  50. return '已发货';
  51. }else if(4){
  52. return '已完成';
  53. }else if(5){
  54. return '已完成';
  55. }
  56. }},//(0已取消,1待支付,2已支付,3已发货,4已发货,5已完成)
  57. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  58. // {field: 'cancel_datetime', title: __('Cancel_datetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  59. // {field: 'after_sale', title: __('After_sale'), operate: 'LIKE'},
  60. {field: 'deploy', title: __('Deploy'), operate: 'LIKE'},
  61. {field: 'deploy_type', title: __('Deploy_type'),formatter: function (d){
  62. if(d == 0){
  63. return '自己部署';
  64. }else if(1){
  65. return '授权部署';
  66. }
  67. }},//0自己部署 1授权部署
  68. {field: 'billing_status', title: __('Billing_status'),formatter: function (d){
  69. if(d == 0){
  70. return '未开票';
  71. }else if(1){
  72. return '已开票';
  73. }
  74. }},// 0未开票
  75. // {field: 'valid_time', title: __('Valid_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  76. // {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  77. // {field: 'user.email', title: __('User.email'), operate: 'LIKE'},
  78. // {field: 'goods.id', title: __('Goods.id')},
  79. // {field: 'goods.code', title: __('Goods.code'), operate: 'LIKE'},
  80. // {field: 'goods.name', title: __('Goods.name'), operate: 'LIKE'},
  81. // {field: 'goods.remark', title: __('Goods.remark'), operate: 'LIKE'},
  82. // {field: 'goods.price', title: __('Goods.price'), operate:'BETWEEN'},
  83. // {field: 'goods.retail', title: __('Goods.retail'), operate:'BETWEEN'},
  84. // {field: 'goods.image', title: __('Goods.image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  85. // {field: 'goods.sales_volume', title: __('Goods.sales_volume')},
  86. // {field: 'goods.inventory', title: __('Goods.inventory')},
  87. // {field: 'goods.after_sale', title: __('Goods.after_sale'), operate: 'LIKE'},
  88. // {field: 'goods.discount_id', title: __('Goods.discount_id')},
  89. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  90. ]
  91. ]
  92. });
  93. // 为表格绑定事件
  94. Table.api.bindevent(table);
  95. },
  96. add: function () {
  97. Controller.api.bindevent();
  98. },
  99. edit: function () {
  100. Controller.api.bindevent();
  101. },
  102. api: {
  103. bindevent: function () {
  104. Form.api.bindevent($("form[role=form]"));
  105. }
  106. }
  107. };
  108. return Controller;
  109. });