index.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. options: {
  4. addGlobalClass: true
  5. },
  6. data: {
  7. showWhere: "所有日期",
  8. timeRangeShow: false,
  9. sat_orderclueid: 0,
  10. detailsData: null,
  11. followList: null,
  12. isdesc: 1,
  13. whereType: {
  14. value: "start",
  15. list: {
  16. "start": "",
  17. "end": ""
  18. }
  19. },
  20. where: {
  21. "start": "",
  22. "end": ""
  23. }
  24. },
  25. /**
  26. * 生命周期函数--监听页面加载
  27. */
  28. onLoad(options) {
  29. this.setData({
  30. sat_orderclueid: options.id
  31. })
  32. this.selectDetail();
  33. this.getFollowList();
  34. },
  35. /* 查询详情 */
  36. selectDetail(i = 0) {
  37. if (i == 5) return;
  38. _Http.basic({
  39. "classname": "saletool.orderclue.web.orderclue",
  40. "method": "selectDetail",
  41. "content": {
  42. "sat_orderclueid": this.data.sat_orderclueid
  43. }
  44. }).then(res => {
  45. if (res.msg != '成功') return this.selectDetail(i + 1);
  46. let data = res.data;
  47. for (let i in data) {
  48. if (data[i] == '') data[i] = '-';
  49. }
  50. this.setData({
  51. detailsData: data
  52. })
  53. })
  54. },
  55. /* 跟进列表 */
  56. getFollowList(i = 0) {
  57. if (i == 5) return;
  58. _Http.basic({
  59. "classname": "saletool.orderclue.web.orderclue",
  60. "method": "getFollowList",
  61. "content": {
  62. "sat_orderclueid": this.data.sat_orderclueid,
  63. "isdesc": this.data.isdesc,
  64. where: this.data.where
  65. }
  66. }).then(res => {
  67. console.log(res)
  68. if (res.msg != '成功') return this.getFollowList(i + 1);
  69. this.setData({
  70. followList: res.data
  71. })
  72. })
  73. },
  74. /* 修改排序方式 */
  75. changeIsdesc() {
  76. this.setData({
  77. isdesc: this.data.isdesc == 1 ? 0 : 1
  78. });
  79. this.getFollowList();
  80. },
  81. /* 查看所有日期 */
  82. toSeeAll() {
  83. this.setData({
  84. showWhere: "所有日期"
  85. })
  86. this.timeRangeClose();
  87. this.getFollowList();
  88. },
  89. /* 打开选择时间 */
  90. openSelectDate() {
  91. this.setData({
  92. timeRangeShow: true
  93. })
  94. },
  95. /* 关闭时间范围选择 */
  96. timeRangeClose() {
  97. this.setData({
  98. timeRangeShow: false,
  99. "where": {
  100. "start": "",
  101. "end": ""
  102. }
  103. })
  104. },
  105. /* 选择日期类型 */
  106. selectDateType(e) {
  107. const {
  108. name
  109. } = e.target.dataset;
  110. this.setData({
  111. "whereType.value": name
  112. })
  113. },
  114. /* 得到选择时间 */
  115. getDate({
  116. detail
  117. }) {
  118. let obj = this.data.whereType;
  119. obj.list[obj.value] = detail;
  120. this.setData({
  121. whereType: obj
  122. })
  123. },
  124. /* 确定时间范围 */
  125. determineScope() {
  126. const {
  127. list
  128. } = this.data.whereType;
  129. this.setData({
  130. "where": list,
  131. showWhere: list.start + '~' + list.end,
  132. timeRangeShow: false
  133. });
  134. this.getFollowList();
  135. },
  136. })