index.js 2.9 KB

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