index.js 3.2 KB

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