index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. disabled: Boolean
  5. },
  6. options: {
  7. addGlobalClass: true
  8. },
  9. data: {
  10. sys_enterpriseid: 0,
  11. list: [],
  12. content: {
  13. "nacache": true,
  14. "pageNumber": 1,
  15. "pageSize": 15,
  16. "pageTotal": 1,
  17. "total": null,
  18. "where": {
  19. "condition": "",
  20. "workaddress": 1
  21. }
  22. }
  23. },
  24. methods: {
  25. changeTotal() {
  26. this.setData({
  27. "content.total": this.data.content.total - 1
  28. })
  29. },
  30. /* 获取地址列表 */
  31. getList(id, init) {
  32. let content = this.data.content;
  33. content.sys_enterpriseid = id;
  34. if (init) {
  35. content.pageNumber = 1
  36. content.pageTotal = 1
  37. }
  38. _Http.basic({
  39. "id": "20221022165503",
  40. content
  41. }).then(res => {
  42. console.log("地址列表", res)
  43. if (res.msg != '成功') return wx.showToast({
  44. title: res.data,
  45. icon: "none"
  46. })
  47. this.setData({
  48. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  49. "content.pageNumber": res.pageNumber + 1,
  50. "content.pageSize": res.pageSize,
  51. "content.pageTotal": res.pageTotal,
  52. "content.total": res.total,
  53. sys_enterpriseid: id
  54. })
  55. this.getTags();
  56. setTimeout(() => {
  57. this.selectComponent("#List").initRadio();
  58. }, 300)
  59. })
  60. },
  61. /* 获取列表标签 */
  62. getTags() {
  63. let list = this.data.list,
  64. ownerids = list.map(v => v.contactsid);
  65. _Http.basic({
  66. "id": 20221018102001,
  67. "content": {
  68. nocache: true,
  69. "ownertable": "sys_enterprise_contacts",
  70. ownerids
  71. }
  72. }).then(res => {
  73. console.log("地址标签", res)
  74. for (let key in res.data) {
  75. let index = list.findIndex(v => v.contactsid == key);
  76. list[index].tags = res.data[key]
  77. };
  78. this.setData({
  79. list
  80. })
  81. console.log(list)
  82. })
  83. },
  84. toSearch() {
  85. wx.navigateTo({
  86. url: '/packageA/setclient/modules/address/search/index?perams=' + JSON.stringify({
  87. sys_enterpriseid: this.data.sys_enterpriseid,
  88. "nacache": true,
  89. "pageNumber": 1,
  90. "pageSize": 20,
  91. "pageTotal": 1,
  92. "total": 0,
  93. "where": {
  94. "condition": "",
  95. "workaddress": 1
  96. }
  97. }),
  98. })
  99. }
  100. }
  101. })