clue.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. const _Http = getApp().globalData.http,
  2. file = require("../../../../utils/matchingFeilType");
  3. let queue = [],
  4. downCounter = null;
  5. Component({
  6. options: {
  7. addGlobalClass: true
  8. },
  9. data: {
  10. disabled: false,
  11. "content": {
  12. nocache: true,
  13. "pageNumber": 1,
  14. pageTotal: 1,
  15. total: null,
  16. cluetype:'',
  17. },
  18. filter: {
  19. show: false,
  20. type: ['业务员', '经销商'], //状态项
  21. typeActive: "",
  22. }
  23. },
  24. methods: {
  25. /* 筛选状态选择 */
  26. typeStatus(e) {
  27. const {
  28. item
  29. } = e.currentTarget.dataset;
  30. this.setData({
  31. "filter.typeActive": this.data.filter.typeActive == item ? "" : item
  32. })
  33. console.log(this.data.filter.typeActive);
  34. },
  35. /* 处理筛选 */
  36. handleFilter({
  37. detail
  38. }) {
  39. const data = this.data.filter;
  40. switch (detail) {
  41. case 'confirm':
  42. this.setData({
  43. 'filter.show': false
  44. });
  45. this.getList(this.data.sat_campaignid,true, data);
  46. break;
  47. case 'reset':
  48. this.setData({
  49. 'filter.typeActive': "",
  50. });
  51. this.getList(true, this.data.filter)
  52. break;
  53. case 'close':
  54. this.setData({
  55. 'filter.show': false
  56. });
  57. break;
  58. }
  59. },
  60. selectBtn () {
  61. this.setData({
  62. 'filter.show':true
  63. })
  64. },
  65. /* 获取产品列表 */
  66. getList(id, init=false,data) {
  67. let content = this.data.content;
  68. content.sat_campaignid = id;
  69. if (init) content.pageNumber = 1
  70. if (data) {
  71. content.cluetype = data.typeActive
  72. }
  73. _Http.basic({
  74. "id": "20221102102602",
  75. content
  76. }).then(res => {
  77. console.log("活动线索", res)
  78. if (res.msg != '成功') return wx.showToast({
  79. title: res.data,
  80. icon: "none"
  81. })
  82. this.setData({
  83. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  84. "content.pageNumber": res.pageNumber + 1,
  85. "content.pageTotal": res.pageTotal,
  86. "content.total": res.total,
  87. sat_campaignid: id
  88. })
  89. })
  90. },
  91. //详情按钮回调
  92. tabbarOnClick({
  93. detail
  94. }) {
  95. let data = this.data.detail;
  96. switch (detail.label) {
  97. case "跟进":
  98. wx.navigateTo({
  99. url: `/packageA/setclient/modules/trace/add/index?ownertable=sat_campaign&ownerid=${data.sat_campaignid}`,
  100. })
  101. break;
  102. case "作废":
  103. wx.showModal({
  104. title: '提示',
  105. content: '是否确认作废该报价单?',
  106. complete: ({
  107. confirm
  108. }) => {
  109. if (confirm) _Http.basic({
  110. "id": 20221020165503,
  111. "version": 1,
  112. "content": {
  113. "sat_campaignids": [this.data.detail.sat_campaignid]
  114. }
  115. }).then(res => {
  116. wx.showToast({
  117. title: res.msg == '成功' ? '已作废报价单' : res.msg,
  118. icon: "none"
  119. });
  120. if (res.msg == '成功') {
  121. setTimeout(() => {
  122. getCurrentPages().forEach(v => {
  123. if (v.__route__ == 'packageA/offers/index') {
  124. v.setData({
  125. list: v.data.list.filter(value => value.sat_campaignid != this.data.detail.sat_campaignid),
  126. 'content.total': v.data.content.total - 1
  127. })
  128. }
  129. })
  130. wx.navigateBack();
  131. }, 300)
  132. }
  133. })
  134. }
  135. })
  136. break;
  137. case "更换负责人":
  138. wx.navigateTo({
  139. url: `/packageA/group/select?data=${JSON.stringify({
  140. ownertable:"sat_campaign",
  141. ownerid:data.sat_campaignid,
  142. })}&radio=true&principal=true`,
  143. })
  144. break;
  145. }
  146. },
  147. /* 删除产品 */
  148. handleDelete({
  149. detail
  150. }) {
  151. _Http.basic({
  152. "id": 20221021145602,
  153. "content": {
  154. "deletereason": "",
  155. "sa_project_itemsids": detail
  156. }
  157. }).then(res => {
  158. console.log("批量删除产品", res);
  159. wx.showToast({
  160. title: res.msg == '成功' ? '删除成功!' : res.msg,
  161. icon: "none"
  162. })
  163. if (res.msg == '成功') this.setData({
  164. list: this.data.list.filter(v => detail.indexOf(v.sa_project_itemsid) == -1)
  165. })
  166. })
  167. },
  168. }
  169. })