index.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {},
  4. data: {
  5. list: [],
  6. sys_enterpriseid: "",
  7. content: {
  8. "nacache": true,
  9. "pageNumber": 1,
  10. "pageSize": 10,
  11. "pageTotal": 1,
  12. "total": null,
  13. "where": {
  14. "condition": "",
  15. "workaddress": 0
  16. }
  17. },
  18. },
  19. methods: {
  20. getList(id, init) {
  21. let content = this.data.content;
  22. content.sys_enterpriseid = id;
  23. console.log("id", id)
  24. if (init) {
  25. content.pageNumber = 1
  26. content.pageTotal = 1
  27. }
  28. _Http.basic({
  29. "id": "20221022165503",
  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.setData({
  38. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  39. "content.pageNumber": res.pageNumber + 1,
  40. "content.pageSize": res.pageSize,
  41. "content.pageTotal": res.pageTotal,
  42. "content.total": res.total,
  43. sys_enterpriseid: id
  44. })
  45. })
  46. },
  47. toSearch() {
  48. wx.navigateTo({
  49. url: '/packageA/setclient/modules/contacts/search/index?perams=' + JSON.stringify({
  50. sys_enterpriseid: this.data.sys_enterpriseid,
  51. "nacache": true,
  52. "pageNumber": 1,
  53. "pageSize": 20,
  54. "pageTotal": 1,
  55. "total": 0,
  56. "where": {
  57. "condition": "",
  58. "workaddress": 0
  59. }
  60. }),
  61. })
  62. },
  63. /* 修改总数 */
  64. changeTotal() {
  65. this.setData({
  66. "content.total": this.data.content.total - 1
  67. })
  68. }
  69. }
  70. })