detail.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../utils/currency"),
  3. CNY = (value, symbol = "¥", precision = 2) => currency(value, {
  4. symbol,
  5. precision
  6. }).format();
  7. Page({
  8. data: {
  9. content: {},
  10. searchShow: false
  11. },
  12. onLoad(options) {
  13. getApp().globalData.Language.getLanguagePackage(this, "客户账户余额明细")
  14. if (options.content) {
  15. let content = JSON.parse(options.content)
  16. content.pageNUmber = 1;
  17. content.pageSize = 20;
  18. content.where.accountno = content.accountno;
  19. delete content.accountno;
  20. this.setData({
  21. content
  22. })
  23. }
  24. this.getList(true)
  25. let page = getCurrentPages()[getCurrentPages().length - 2],
  26. model = page.selectComponent("#organization"),
  27. organization = this.selectComponent("#organization"),
  28. {
  29. username,
  30. isleave
  31. } = page.data;
  32. organization.setData({
  33. ...model.data
  34. })
  35. this.setData({
  36. username,
  37. isleave
  38. })
  39. },
  40. getList(init = false) {
  41. _Http.init(this.data.content, init).then(content => {
  42. _Http.basic({
  43. "id": 20231020131504,
  44. content
  45. }).then(res => {
  46. console.log("客户账户余额明细", res)
  47. this.selectComponent('#ListBox').automaticSetHei();
  48. this.selectComponent('#ListBox').RefreshToComplete();
  49. if (res.code != '1') return wx.showToast({
  50. title: res.data,
  51. icon: "none"
  52. })
  53. res.data = res.data.map(v => {
  54. v.balance = CNY(v.balance)
  55. v.creditquota = CNY(v.creditquota)
  56. return v
  57. })
  58. this.setData({
  59. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  60. "content.pageNumber": res.pageNumber + 1,
  61. "content.pageSize": res.pageSize,
  62. "content.pageTotal": res.pageTotal,
  63. "total": res.total,
  64. })
  65. })
  66. })
  67. },
  68. openFiltrate() {
  69. this.setData({
  70. showFiltrate: true
  71. })
  72. },
  73. handleFilter({
  74. detail
  75. }) {
  76. if (detail.name == "close") return;
  77. if (detail.name == 'reset') {
  78. this.selectComponent("#organization").setData({
  79. isleave: 1
  80. })
  81. this.selectComponent("#organization").initDepAndUser()
  82. this.setData({
  83. "content.dataid": wx.getStorageSync('userMsg').userid,
  84. "content.type": 0,
  85. "content.where.isleave": 1,
  86. username: wx.getStorageSync('userMsg').name,
  87. isleave: 1
  88. })
  89. } else {
  90. let active = this.selectComponent("#organization").data.result,
  91. isleave = this.selectComponent("#organization").data.isleave;
  92. let type = active.userid ? 0 : 1,
  93. dataid = type == 0 ? active.userid : active.sa_saleareaid
  94. this.setData({
  95. "content.dataid": dataid,
  96. "content.type": type,
  97. "content.where.isleave": isleave,
  98. username: active.name
  99. })
  100. }
  101. this.getList(true);
  102. },
  103. enddateChange(e) {
  104. if (e.detail.value == this.data.content.enddate) return;
  105. this.setData({
  106. "content.enddate": e.detail.value
  107. })
  108. this.getList(true)
  109. },
  110. changeSearchShow() {
  111. this.setData({
  112. searchShow: !this.data.searchShow
  113. })
  114. setTimeout(() => {
  115. this.selectComponent('#ListBox').automaticSetHei();
  116. if (this.data.searchShow) {
  117. if (this.selectComponent("#Yl_Filtrate1").data.show) return
  118. this.setData({
  119. focus: true
  120. })
  121. } else {
  122. this.setData({
  123. focus: false
  124. })
  125. }
  126. }, 350)
  127. },
  128. onSearch() {
  129. this.data.content.where.condition = this.data.searchValue;
  130. this.getList(true);
  131. },
  132. onChange(event) {
  133. this.setData({
  134. searchValue: event.detail
  135. })
  136. },
  137. onClear() {
  138. this.setData({
  139. searchValue: "",
  140. "content.where.condition": ""
  141. })
  142. this.getList(true);
  143. },
  144. toDateil(e) {
  145. const {
  146. item
  147. } = e.currentTarget.dataset;
  148. wx.navigateTo({
  149. url: '/salesPanel/customerBlance/Pipeline?sys_enterpriseid=' + item.sys_enterpriseid + '&sa_accountclassid=' + item.sa_accountclassid + '&enddate=' + this.data.content.enddate,
  150. })
  151. },
  152. })