clue.js 6.1 KB

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