index.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. options: {
  4. addGlobalClass: true
  5. },
  6. data: {
  7. sheetTitle: "",
  8. showWhere: "所有日期",
  9. timeRangeShow: false,
  10. sat_orderclueid: 0,
  11. detailsData: null,
  12. followList: null,
  13. isdesc: 1,
  14. whereType: {
  15. value: "start",
  16. list: {
  17. "start": "",
  18. "end": ""
  19. }
  20. },
  21. where: {
  22. "start": "",
  23. "end": ""
  24. },
  25. teamList: [],
  26. },
  27. /**
  28. * 生命周期函数--监听页面加载
  29. */
  30. onLoad(options) {
  31. this.setData({
  32. sat_orderclueid: options.id,
  33. tagColor: options.color
  34. })
  35. this.selectDetail();
  36. this.getFollowList();
  37. this.query_teamList();
  38. },
  39. /* 团队成员 */
  40. query_teamList(i=0) {
  41. if (i == 5) return;
  42. _Http.basic({
  43. "classname": "sale.team.team",
  44. "method": "query_teamList",
  45. "content": {
  46. "pageNumber": 1,
  47. "pageSize": 99999,
  48. "where": {
  49. "condition": ""
  50. }
  51. }
  52. }).then(res => {
  53. if (res.msg != '成功') return this.selectDetail(i + 1);
  54. this.setData({
  55. teamList: res.data
  56. })
  57. })
  58. },
  59. /* 查询详情 */
  60. selectDetail(i = 0) {
  61. if (i == 5) return wx.showToast({
  62. title: '详情信息查询失败!',
  63. icon: "none"
  64. })
  65. _Http.basic({
  66. "classname": "saletool.orderclue.web.orderclue",
  67. "method": "selectDetail",
  68. "content": {
  69. "sat_orderclueid": this.data.sat_orderclueid
  70. }
  71. }).then(res => {
  72. if (res.msg != '成功') return this.selectDetail(i + 1);
  73. let data = res.data;
  74. for (let i in data) {
  75. if (data[i] == '') data[i] = '-';
  76. }
  77. this.setData({
  78. detailsData: data
  79. })
  80. })
  81. },
  82. /* 跟进列表 */
  83. getFollowList(i = 0) {
  84. if (i == 5) return wx.showToast({
  85. title: '跟进记录查询失败!',
  86. icon: "none"
  87. })
  88. _Http.basic({
  89. "classname": "saletool.orderclue.web.orderclue",
  90. "method": "getFollowList",
  91. "content": {
  92. "sat_orderclueid": this.data.sat_orderclueid,
  93. "isdesc": this.data.isdesc,
  94. where: this.data.where
  95. }
  96. }).then(res => {
  97. console.log(res)
  98. if (res.msg != '成功') return this.getFollowList(i + 1);
  99. this.setData({
  100. followList: res.data
  101. })
  102. })
  103. },
  104. /* 打开弹出 */
  105. openPoput(e) {
  106. const {
  107. name
  108. } = e.currentTarget.dataset;
  109. if (name == '线索编辑') this.selectComponent("#edit").initData();
  110. this.setData({
  111. sheetTitle: name
  112. })
  113. },
  114. /* 结束编辑 */
  115. endEdit() {
  116. this.setData({
  117. sheetTitle: ""
  118. })
  119. this.selectDetail();
  120. },
  121. /* 修改排序方式 */
  122. changeIsdesc() {
  123. this.setData({
  124. isdesc: this.data.isdesc == 1 ? 0 : 1
  125. });
  126. this.getFollowList();
  127. },
  128. /* 打开选择时间 */
  129. openSelectDate() {
  130. this.setData({
  131. timeRangeShow: true
  132. })
  133. },
  134. /* 查看所有日期 */
  135. toSeeAll() {
  136. this.setData({
  137. showWhere: "所有日期"
  138. })
  139. this.timeRangeClose();
  140. this.getFollowList();
  141. },
  142. /* 关闭时间范围选择 */
  143. timeRangeClose() {
  144. this.setData({
  145. timeRangeShow: false,
  146. "where": {
  147. "start": "",
  148. "end": ""
  149. }
  150. })
  151. },
  152. /* 选择日期类型 */
  153. selectDateType(e) {
  154. const {
  155. name
  156. } = e.target.dataset;
  157. this.setData({
  158. "whereType.value": name
  159. })
  160. },
  161. /* 得到选择时间 */
  162. getDate({
  163. detail
  164. }) {
  165. let obj = this.data.whereType;
  166. obj.list[obj.value] = detail;
  167. this.setData({
  168. whereType: obj
  169. })
  170. },
  171. /* 确定时间范围 */
  172. determineScope() {
  173. const {
  174. list
  175. } = this.data.whereType;
  176. this.setData({
  177. "where": list,
  178. showWhere: list.start + '~' + list.end,
  179. timeRangeShow: false
  180. });
  181. this.getFollowList();
  182. },
  183. })