salesList.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. options: {
  4. addGlobalClass: true
  5. },
  6. lifetimes: {
  7. attached: function () {
  8. getApp().globalData.Language.getLanguagePackage(this)
  9. }
  10. },
  11. properties: {
  12. },
  13. data: {
  14. dateType: "本年",
  15. showList: false,
  16. list: [],
  17. "isAll": 1,
  18. "content": {
  19. "nocache": true,
  20. "pageNumber": 1,
  21. "pageTotal": 1,
  22. "total": null,
  23. "where": {
  24. begdate: "",
  25. enddate: "",
  26. }
  27. },
  28. followSize: 0,
  29. },
  30. methods: {
  31. getList(id, init) {
  32. let content = this.data.content;
  33. content.hrid = id;
  34. content.type = this.data.isAll;
  35. if (init) {
  36. content.pageNumber = 1;
  37. content.total = null;
  38. }
  39. if (!this.data.showList && content.total != null) return;
  40. if (content.pageNumber > content.pageTotal) return;
  41. _Http.basic({
  42. "id": 20230717100604,
  43. content
  44. }).then(res => {
  45. console.log("业务员销售线索", res)
  46. if (res.code != '1') return wx.showToast({
  47. title: res.data,
  48. icon: "none"
  49. })
  50. content.pageNumber = res.pageNumber + 1;
  51. content.pageSize = res.pageSize;
  52. content.pageTotal = res.pageTotal;
  53. content.total = res.total;
  54. this.setData({
  55. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  56. content,
  57. id: id,
  58. });
  59. this.selectComponent("#TimeRange").onCancel()
  60. })
  61. _Http.basic({
  62. "id": 20230717100704,
  63. content: {
  64. ...content,
  65. pageSize: 0
  66. }
  67. }).then(res => {
  68. console.log("跟进次数", res)
  69. try {
  70. this.setData({
  71. followSize: res.data[0].followSize || 0
  72. })
  73. } catch (error) {
  74. }
  75. })
  76. },
  77. upDateList() {
  78. let content = JSON.parse(JSON.stringify(this.data.content));
  79. try {
  80. content.hrid = this.data.id;
  81. content.type = this.data.isAll;
  82. content.pageSize = (content.pageNumber - 1) * content.pageSize;
  83. content.pageNumber = 1;
  84. } catch (error) {
  85. console.log("error", error)
  86. }
  87. _Http.basic({
  88. id: '20230717100604',
  89. content
  90. }).then(res => {
  91. console.log("更新线索列表", res);
  92. if (res.code == '1') {
  93. page.setData({
  94. list: res.data,
  95. "content.total": res.total
  96. })
  97. }
  98. })
  99. },
  100. changeDate({
  101. detail
  102. }) {
  103. let isAll = 99;
  104. switch (detail.dateType) {
  105. case '全部':
  106. isAll = 0
  107. break;
  108. case '本年':
  109. isAll = 1
  110. break;
  111. case '本季':
  112. isAll = 2
  113. break;
  114. case '本月':
  115. isAll = 3
  116. break;
  117. }
  118. this.setData({
  119. dateType: detail.dateType,
  120. isAll,
  121. "content.where.begdate": detail.begdate || "",
  122. "content.where.enddate": detail.enddate || ""
  123. })
  124. this.getList(this.data.id, true)
  125. },
  126. shrinkChange({
  127. detail
  128. }) {
  129. this.setData({
  130. showList: detail
  131. })
  132. }
  133. }
  134. })