index.js 3.3 KB

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