index.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. },
  5. data: {
  6. "sa_projectid": null,
  7. "content": {
  8. "nocache": true,
  9. "pageNumber": 1,
  10. "pageTotal": 1,
  11. "pageSize": 20,
  12. "total": null,
  13. "where": {
  14. "condition": "",
  15. "type": 4
  16. }
  17. },
  18. },
  19. methods: {
  20. /* 获取地址列表 */
  21. getList(id, init) {
  22. let content = this.data.content;
  23. content.where.sa_projectid = id;
  24. if (init) {
  25. content.pageNumber = 1
  26. content.pageTotal = 1
  27. }
  28. _Http.basic({
  29. "id": "20220920083901",
  30. content
  31. }).then(res => {
  32. console.log("关联客户列表", res)
  33. if (res.msg != '成功') return wx.showToast({
  34. title: res.data,
  35. icon: "none"
  36. })
  37. this.getTags(res.data.map(v => v.sa_customersid));
  38. this.setData({
  39. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  40. "content.pageNumber": res.pageNumber + 1,
  41. "content.pageSize": res.pageSize,
  42. "content.pageTotal": res.pageTotal,
  43. "content.total": res.total,
  44. sa_projectid: id
  45. })
  46. })
  47. },
  48. /* 获取列表标签 */
  49. getTags(ownerids = []) {
  50. _Http.basic({
  51. "id": 20221018102001,
  52. "content": {
  53. "ownertable": "sa_customers",
  54. ownerids
  55. }
  56. }).then(res => {
  57. console.log("标签", res)
  58. let list = this.data.list;
  59. for (let key in res.data) {
  60. let index = list.findIndex(v => v.sa_customersid == key);
  61. list[index].tags = res.data[key]
  62. };
  63. this.setData({
  64. list
  65. })
  66. })
  67. },
  68. }
  69. })