index.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. loading: true,
  8. navList: [{
  9. label: "我负责的",
  10. icon: "icon-webxialaxuanxiangjiantou",
  11. color: "",
  12. width: "",
  13. id: "1"
  14. }, {
  15. label: "排序",
  16. icon: "icon-jiangxu1",
  17. color: "",
  18. width: "",
  19. id: "sort"
  20. }, {
  21. label: "筛选",
  22. icon: "icon-shaixuan",
  23. color: "",
  24. width: "",
  25. id: "2"
  26. }],
  27. classShow: false,
  28. "content": {
  29. "nocache": true,
  30. "isExport": 0,
  31. "pageNumber": 1,
  32. "pageTotal": 1,
  33. "pageSize": 20,
  34. "where": {
  35. "condition": "",
  36. "tablefilter": {},
  37. // "cluetype": "业务员",
  38. "allocationstatus": "", //分配状态
  39. "status": "", //跟进状态
  40. "tradefield": "", //领域
  41. "tag": "", //标签
  42. },
  43. },
  44. filtrate: false
  45. },
  46. onLoad(options) {
  47. this.setData({
  48. insert: wx.getStorageSync('auth').worderclue_admin.options.some(v => v == 'insert'), //查询新增权限
  49. classActions: wx.getStorageSync('templetList').map(v => {
  50. return {
  51. name: v.templetname,
  52. index: v.templetid
  53. }
  54. }),
  55. 'navList[0].label': wx.getStorageSync('templetList')[0].templetname,
  56. "content.type": wx.getStorageSync('templetList')[0].templetid,
  57. });
  58. this.getList()
  59. this.getClueArea()
  60. },
  61. /* 获取列表 */
  62. getList(init = false) {
  63. if (init.detail != undefined) init = init.detail;
  64. let content = this.data.content;
  65. if (init) content.pageNumber = 1;
  66. if (content.pageNumber > content.pageTotal) return;
  67. _Http.basic({
  68. "id": 20221101094302,
  69. content
  70. }).then(res => {
  71. console.log("线索管理", res)
  72. this.selectComponent('#ListBox').RefreshToComplete();
  73. if (res.msg != '成功') return wx.showToast({
  74. title: res.msg,
  75. icon: "none"
  76. })
  77. this.setData({
  78. loading: false,
  79. 'content.pageNumber': res.pageNumber + 1,
  80. 'content.pageTotal': res.pageTotal,
  81. 'content.total': res.total,
  82. 'content.sort': res.sort,
  83. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  84. });
  85. this.setListHeight();
  86. this.getTags();
  87. })
  88. },
  89. /* 获取线索状态 */
  90. getClueArea() {
  91. let filtratelist = [{
  92. label: "分配状态",
  93. index: null,
  94. showName: "value", //显示字段
  95. valueKey: "allocationstatus", //返回Key
  96. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  97. value: "", //选中值
  98. list: [{
  99. value: "待分配"
  100. }, {
  101. value: "已分配"
  102. }]
  103. }];
  104. _Http.basic({
  105. "classname": "sysmanage.develop.optiontype.optiontype",
  106. "method": "optiontypeselect",
  107. "content": {
  108. "typename": 'clueprivate'
  109. }
  110. }).then(res => {
  111. console.log("线索范围", res)
  112. if (res.msg != '成功') return wx.showToast({
  113. title: res.data,
  114. icon: "none"
  115. })
  116. filtratelist.push({
  117. label: "线索状态",
  118. index: null,
  119. showName: "value", //显示字段
  120. valueKey: "status", //返回Key
  121. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  122. value: "", //选中值
  123. list: res.data
  124. })
  125. this.setData({
  126. filtratelist
  127. })
  128. this.setListHeight();
  129. })
  130. _Http.basic({
  131. "id": 20221223141802,
  132. "content": {
  133. "pageNumber": 1,
  134. "pageSize": 9999,
  135. "where": {
  136. "condition": ""
  137. }
  138. }
  139. }, false).then(res => {
  140. console.log("获取领域", res)
  141. if (res.msg == '成功') {
  142. filtratelist.push({
  143. label: "领域",
  144. index: null,
  145. showName: "tradefield", //显示字段
  146. valueKey: "tradefield", //返回Key
  147. selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
  148. value: "", //选中值
  149. list: res.data
  150. })
  151. this.setData({
  152. filtratelist
  153. })
  154. }
  155. })
  156. _Http.basic({
  157. "id": 20221013104401,
  158. "content": {
  159. "nochace": true,
  160. "isExport": 1,
  161. "pageNumber": 1,
  162. sys_systemtagid: 14,
  163. "pageSize": 1000,
  164. "where": {
  165. "condition": ""
  166. }
  167. }
  168. }, false).then(res => {
  169. console.log("获取标签", res)
  170. if (res.msg == '成功') {
  171. filtratelist.push({
  172. label: "标签",
  173. index: null,
  174. showName: "tag", //显示字段
  175. valueKey: "tag", //返回Key
  176. selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
  177. value: "", //选中值
  178. list: res.data
  179. })
  180. this.setData({
  181. filtratelist
  182. })
  183. }
  184. })
  185. },
  186. /* 处理搜索 */
  187. onSearch({
  188. detail
  189. }) {
  190. this.setData({
  191. "content.where.condition": detail
  192. });
  193. this.getList(true);
  194. },
  195. /* 获取列表标签 */
  196. getTags() {
  197. let list = this.data.list,
  198. ownerids = list.map(v => v.sat_orderclueid);
  199. _Http.basic({
  200. "id": 20221018102001,
  201. "content": {
  202. nocache: true,
  203. "ownertable": "sat_orderclue",
  204. ownerids
  205. }
  206. }).then(res => {
  207. console.log("标签", res)
  208. for (let key in res.data) {
  209. let index = list.findIndex(v => v.sat_orderclueid == key);
  210. list[index].tags = res.data[key]
  211. };
  212. this.setData({
  213. list
  214. })
  215. })
  216. },
  217. /* 去添加 */
  218. openType() {
  219. wx.navigateTo({
  220. url: '/packageA/saleAdmin/insert',
  221. })
  222. },
  223. onReady() {
  224. this.setListHeight();
  225. },
  226. setListHeight() {
  227. this.selectComponent("#ListBox").setHeight(".total", this);
  228. },
  229. /* 顶部条件导航回调 */
  230. navClick({
  231. detail
  232. }) {
  233. switch (detail.id) {
  234. case '1':
  235. this.setData({
  236. classShow: true
  237. })
  238. break;
  239. case '2':
  240. this.setData({
  241. filtrate: true
  242. })
  243. break;
  244. }
  245. },
  246. classClose() {
  247. this.setData({
  248. classShow: false
  249. })
  250. },
  251. classSelect({
  252. detail
  253. }) {
  254. if (this.data.content.type == detail.index) return this.classClose();
  255. this.setData({
  256. "content.type": detail.index,
  257. 'navList[0].label': detail.name
  258. })
  259. this.classClose();
  260. this.getList(true)
  261. },
  262. /* 处理筛选 */
  263. handleFilter({
  264. detail
  265. }) {
  266. detail.condition = this.data.content.where.condition;
  267. this.data.content.where = detail;
  268. this.getList(true)
  269. }
  270. })