index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. /* 修改总数 */
  48. changeTotal() {
  49. this.setData({
  50. "content.total": this.data.content.total - 1
  51. })
  52. }
  53. }
  54. })