ClientFollow.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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": 20230717100904,
  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. try {
  55. res.data = res.data.map(item => {
  56. try {
  57. if (!item.followname.length) item.followname = ' --'
  58. } catch (error) {
  59. item.followname = ' --'
  60. }
  61. item.cons = item.content.split(';').filter(v => v).map(v => {
  62. let arr = v.split(':')
  63. return {
  64. label: arr[0] || "--",
  65. value: arr[1] || "--"
  66. }
  67. })
  68. return item
  69. })
  70. } catch (error) {
  71. console.log("error", error)
  72. }
  73. this.setData({
  74. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  75. content,
  76. id: id,
  77. });
  78. this.selectComponent("#TimeRange").onCancel()
  79. })
  80. },
  81. changeDate({
  82. detail
  83. }) {
  84. let isAll = 99;
  85. switch (detail.dateType) {
  86. case '全部':
  87. isAll = 0
  88. break;
  89. case '本年':
  90. isAll = 1
  91. break;
  92. case '本季':
  93. isAll = 2
  94. break;
  95. case '本月':
  96. isAll = 3
  97. break;
  98. }
  99. this.setData({
  100. dateType: detail.dateType,
  101. isAll,
  102. "content.where.begdate": detail.begdate || "",
  103. "content.where.enddate": detail.enddate || ""
  104. })
  105. this.getList(this.data.id, true)
  106. }
  107. }
  108. })