index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {},
  4. data: {
  5. list: [],
  6. content: {
  7. "nacache": true,
  8. "pageNumber": 1,
  9. "pageSize": 10,
  10. "pageTotal": 1,
  11. "total": null,
  12. "where": {
  13. "condition": "",
  14. "workaddress": 0
  15. }
  16. },
  17. },
  18. methods: {
  19. getList(id, init) {
  20. let content = this.data.content;
  21. content.sys_enterpriseid = id;
  22. if (init) {
  23. content.pageNumber = 1
  24. content.pageTotal = 1
  25. }
  26. _Http.basic({
  27. "id": "20221022165503",
  28. content
  29. }).then(res => {
  30. console.log("联系人", res)
  31. if (res.msg != '成功') return wx.showToast({
  32. title: res.data,
  33. icon: "none"
  34. })
  35. this.setData({
  36. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  37. "content.pageNumber": res.pageNumber + 1,
  38. "content.pageSize": res.pageSize,
  39. "content.pageTotal": res.pageTotal,
  40. "content.total": res.total,
  41. sys_enterpriseid: id
  42. })
  43. })
  44. },
  45. changeTotal() {
  46. this.setData({
  47. "content.total": this.data.content.total - 1
  48. })
  49. }
  50. }
  51. })