orderinvoice.js 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/orderinvoice/index' + location.search,
  8. add_url: 'pricing/orderinvoice/add',
  9. edit_url: 'pricing/orderinvoice/edit',
  10. del_url: 'pricing/orderinvoice/del',
  11. multi_url: 'pricing/orderinvoice/multi',
  12. import_url: 'pricing/orderinvoice/import',
  13. table: 'order_invoice',
  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: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  30. {field: 'invoice_type', title: __('Invoice_type'),formatter: function (d){
  31. if(d==1){
  32. return '普通发票';
  33. }else {
  34. return '增值税发票';
  35. }
  36. }},
  37. {field: 'invoice_shape', title: __('Invoice_shape'),formatter: function (d){
  38. if(d==1){
  39. return '纸质发票';
  40. }else {
  41. return '电子发票';
  42. }
  43. }},
  44. {field: 'type', title: __('Type'),formatter: function (d){
  45. if(d==1){
  46. return '个人';
  47. }else {
  48. return '企业';
  49. }
  50. }},
  51. {field: 'name', title: __('Name'), operate: 'LIKE'},
  52. {field: 'duty_paragraph', title: __('Duty_paragraph')},
  53. {field: 'address', title: __('Address'), operate: 'LIKE'},
  54. {field: 'company_phone', title: __('Company_phone')},
  55. {field: 'bank', title: __('Bank'), operate: 'LIKE'},
  56. {field: 'compellation', title: __('Compellation'), operate: 'LIKE'},
  57. {field: 'phone', title: __('Phone')},
  58. {field: 'location', title: __('Location'), operate: 'LIKE'},
  59. {field: 'postcode', title: __('Postcode'), operate: 'LIKE'},
  60. {field: 'emial', title: __('Emial'), operate: 'LIKE'},
  61. {field: 'apply_time', title: __('Apply_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  62. {field: 'status', title: __('Status'),formatter: function (d){
  63. if(d==1){
  64. return '待开票';
  65. }else if(d==2){
  66. return '已寄出';
  67. }else {
  68. return '已完成';
  69. }
  70. }},
  71. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, 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. });