index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. const getHeight = require("../../utils/getRheRemainingHeight");
  2. const _Http = getApp().globalData.http;
  3. Page({
  4. data: {
  5. content: {
  6. "pageNumber": 1,
  7. "pageSize": 20,
  8. "where": {
  9. "condition": "",
  10. "status": "待跟进"
  11. }
  12. },
  13. list: [],
  14. sort: null,
  15. tagColor: '#FA8C16'
  16. },
  17. onLoad(options) {
  18. this.getList()
  19. },
  20. /* 查询列表 */
  21. getList(init = false) {
  22. if (init.detail != undefined) init = init.detail;
  23. if (init) this.setData({
  24. ['content.pageNumber']: 1
  25. })
  26. if (this.data.content.pageNumber > this.data.content.pageTotal) return;
  27. let content = this.data.content;
  28. if (this.data.sort != null) content.sort = this.data.sort;
  29. _Http.basic({
  30. "classname": "saletool.orderclue.web.orderclue",
  31. "method": "selectList",
  32. content
  33. }).then(res => {
  34. console.log("列表", res)
  35. this.selectComponent('#ListBox').RefreshToComplete();
  36. if (res.msg != '成功') return wx.showToast({
  37. title: res.data,
  38. icon: "none"
  39. });
  40. this.setData({
  41. list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
  42. ['content.pageNumber']: res.pageNumber + 1,
  43. ['content.pageTotal']: res.pageTotal,
  44. sort: res.sort
  45. })
  46. })
  47. },
  48. /* 切换tab分类 */
  49. tabsChange({
  50. detail
  51. }) {
  52. let tagColor = '#BBBBBB';
  53. switch (detail.title) {
  54. case '待跟进':
  55. tagColor = '#FA8C16'
  56. break;
  57. case '跟进中':
  58. tagColor = '#52C41A'
  59. break;
  60. case '已成交':
  61. tagColor = '#ffffff'
  62. break;
  63. case '丢单':
  64. tagColor = '#FF3B30'
  65. break;
  66. }
  67. this.setData({
  68. 'content.where.status': detail.title,
  69. tagColor,
  70. list: []
  71. })
  72. this.getList(true);
  73. },
  74. /* 搜索 */
  75. inputSharch({
  76. detail
  77. }) {
  78. this.setData({
  79. 'content.where.condition': detail
  80. });
  81. this.getList(true);
  82. },
  83. /* 选择排序方式 */
  84. selectSort() {
  85. if (this.data.sort[0].sorted == 1) {
  86. this.setData({
  87. 'sort[0].sorted': 0,
  88. 'sort[1].sorted': 1,
  89. })
  90. } else {
  91. this.setData({
  92. 'sort[0].sorted': 1,
  93. 'sort[1].sorted': 0,
  94. })
  95. };
  96. this.getList(true)
  97. },
  98. onReady() {
  99. getHeight.getHeight('.tabs', this).then(res => {
  100. this.setData({
  101. scrollHeight: res
  102. })
  103. })
  104. },
  105. /**
  106. * 生命周期函数--监听页面显示
  107. */
  108. onShow() {
  109. },
  110. /**
  111. * 生命周期函数--监听页面隐藏
  112. */
  113. onHide() {
  114. },
  115. /**
  116. * 生命周期函数--监听页面卸载
  117. */
  118. onUnload() {
  119. },
  120. /**
  121. * 页面相关事件处理函数--监听用户下拉动作
  122. */
  123. onPullDownRefresh() {
  124. },
  125. /**
  126. * 页面上拉触底事件的处理函数
  127. */
  128. onReachBottom() {
  129. },
  130. /**
  131. * 用户点击右上角分享
  132. */
  133. onShareAppMessage() {
  134. }
  135. })