You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

invoice.js 2.9 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. (function () {
  2. var page = {
  3. grid: null,
  4. init: function ($page) {
  5. page.grid = $('#lr_crminvoice_list').lrpagination({
  6. lclass: page.lclass,
  7. rows: 10, // 每页行数
  8. getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
  9. page.loadData(param, callback, $page);
  10. },
  11. renderData: function (_index, _item, _$item) {// 渲染数据模板
  12. return page.rowRender(_index, _item, _$item, $page);
  13. },
  14. click: function (item, $item) {// 列表行点击事件
  15. page.click(item, $item, $page);
  16. }
  17. });
  18. // 点击搜索按钮
  19. $page.find('#lr_crminvoice_search_btn').on('tap', function () {
  20. learun.nav.go({ path: 'search', title: '', isBack: true, isHead: true, param: 'crm/invoice' });// 告诉搜索页本身所在的地址
  21. });
  22. // 新增开票信息
  23. $page.find('#crm_invoice_addbtn').on('tap', function () {
  24. learun.nav.go({ path: 'crm/invoice/form', title: '新增开票信息', type: 'right', param: {} });
  25. });
  26. },
  27. lclass: 'lr-list',
  28. loadData: function (param, callback, $page) {// 列表加载后台数据
  29. var _postParam = {
  30. pagination: {
  31. rows: param.rows,
  32. page: param.page,
  33. sidx: 'F_CreateDate',
  34. sord: 'DESC'
  35. },
  36. queryJson: '{}'
  37. };
  38. if (param.keyword) {
  39. _postParam.queryJson = JSON.stringify({ keyword: param.keyword });
  40. }
  41. learun.httpget(config.webapi + "learun/adms/crm/invoice/list", _postParam, (data) => {
  42. $page.find('.lr-badge').text('0');
  43. if (data) {
  44. $page.find('.lr-badge').text(data.records);
  45. callback(data.rows, parseInt(data.records));
  46. }
  47. else {
  48. callback([], 0);
  49. }
  50. });
  51. },
  52. rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据
  53. var _html = '<div class="lr-list-item lr-list-item-multi">\
  54. <p class="lr-ellipsis"><span>客户名称:</span>'+ _item.F_CustomerName + '</p>\
  55. <p class="lr-ellipsis"><span>开票信息:</span>'+ _item.F_InvoiceContent + '</p>\
  56. </div >';
  57. return _html;
  58. },
  59. click: function (item, $item, $page) {// 列表行点击触发方法
  60. learun.nav.go({ path: 'crm/invoice/form', title: '开票信息', type: 'right', param: { data: item, type: 'detail' } });
  61. },
  62. rowBtns: [] // 列表行左滑按钮
  63. };
  64. return page;
  65. })();