detail.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. const _Http = getApp().globalData.http;
  2. import currency from "../../utils/currency";
  3. let CNY = value => currency(value, {
  4. symbol: "",
  5. precision: 2
  6. }).format();
  7. Page({
  8. data: {
  9. sumWidth: 0,
  10. "content": {
  11. "pageNumber": 1,
  12. "pageSize": 30,
  13. "dataid": "4222", // 按业务员时 传userid 按客户时传 sa_customersid
  14. "querytype": "1", //0按业务员 1按客户
  15. "point": "全部", //入账节点
  16. "where": {
  17. "condition": ""
  18. }
  19. }
  20. },
  21. onLoad(options) {
  22. let content = JSON.parse(options.content),
  23. table = [{
  24. title: '客户名',
  25. width: 330,
  26. key: 'enterprisename',
  27. fun: 'toDetail'
  28. }, {
  29. title: '业务员',
  30. width: 200,
  31. key: 'name'
  32. }, {
  33. title: '订单号',
  34. width: 300,
  35. key: 'sonum'
  36. }, {
  37. title: '审核时间',
  38. width: 300,
  39. key: 'checkdate'
  40. }, {
  41. title: '订单行号',
  42. width: 200,
  43. key: 'rowno'
  44. }, {
  45. title: '商品编码',
  46. width: 300,
  47. key: 'itemno'
  48. }, {
  49. title: '商品名称',
  50. width: 300,
  51. key: 'itemname'
  52. }, {
  53. title: '型号',
  54. width: 200,
  55. key: 'model'
  56. }, {
  57. title: '规格',
  58. width: 200,
  59. key: 'spec'
  60. }, {
  61. title: '数量',
  62. width: 200,
  63. key: 'qty'
  64. }, {
  65. title: '金额',
  66. width: 200,
  67. key: 'amount'
  68. }];
  69. content.pageNumber = 1;
  70. content.pageTotal = 1;
  71. this.data.content = content;
  72. table.push({
  73. title: content.point == '开票' ? '开票金额' : '出货金额',
  74. width: 300,
  75. key: 'overdueamount'
  76. })
  77. this.setData({
  78. table
  79. })
  80. setTimeout(() => {
  81. this.setData({
  82. sumWidth: this.data.table.reduce((prev, cur) => {
  83. return prev.width ? prev.width + cur.width : prev + cur.width
  84. })
  85. })
  86. });
  87. this.getList()
  88. getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
  89. },
  90. getList(init = false) {
  91. if (init.detail != undefined) init = init.detail;
  92. let content = this.data.content;
  93. if (init) content.pageNumber = 1;
  94. if (content.pageNumber > content.pageTotal) return;
  95. _Http.basic({
  96. "id": 20241217135903,
  97. content
  98. }).then(res => {
  99. this.setListHeight()
  100. this.selectComponent('#ListBox').RefreshToComplete();
  101. console.log("逾期账款明细", res)
  102. let list = res.data.map(v => {
  103. v.amount = CNY(v.amount)
  104. v.overdueamount = CNY(v.overdueamount)
  105. return v
  106. })
  107. this.setData({
  108. list: res.pageNumber == 1 ? list : this.data.list.concat(list),
  109. "content.pageNumber": res.pageNumber + 1,
  110. "content.pageTotal": res.pageTotal,
  111. "content.total": res.total,
  112. })
  113. })
  114. },
  115. onReady() {
  116. this.setListHeight()
  117. },
  118. /* 设置页面高度 */
  119. setListHeight() {
  120. this.selectComponent("#ListBox").setHeight(".roof", this);
  121. },
  122. })