index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {},
  4. data: {
  5. content: {
  6. nocache: true,
  7. pageNumber: 1,
  8. pageSize: 20,
  9. pageTotal: 1,
  10. total: null,
  11. },
  12. total: 0,
  13. list: []
  14. },
  15. methods: {
  16. getList(id, init = false) {
  17. if (id == 0) return;
  18. let content = this.data.content;
  19. content.sys_phonebookid = id;
  20. if (init) content.pageNumber = 1
  21. _Http.basic({
  22. id: "20231215134204",
  23. content
  24. }).then(res => {
  25. console.log("关联客户", res)
  26. if (res.msg != '成功') return wx.showToast({
  27. title: res.data,
  28. icon: "none"
  29. });
  30. this.setData({
  31. "content.pageNumber": res.pageNumber + 1,
  32. "content.pageTotal": res.pageTotal,
  33. "content.total": res.total,
  34. total: res.total,
  35. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  36. })
  37. })
  38. }
  39. }
  40. })