index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. "content": {
  5. nocache: true,
  6. sys_enterpriseid: "",
  7. pageNumber: 1,
  8. pageTotal: 1,
  9. "where": {
  10. "condition": "",
  11. "workaddress": 1
  12. }
  13. }
  14. },
  15. onLoad(options) {
  16. this.setData({
  17. "content.sys_enterpriseid": options.id
  18. })
  19. this.getList(true);
  20. },
  21. /* 获取产品 */
  22. getList(init = false) {
  23. if (init.detail != undefined) init = init.detail;
  24. let content = this.data.content;
  25. if (init) content.pageNumber = 1;
  26. if (content.pageNumber > content.pageTotal) return;
  27. _Http.basic({
  28. "id": "20221009155803",
  29. content
  30. }).then(res => {
  31. console.log("我的地址列表", res)
  32. this.selectComponent('#ListBox').RefreshToComplete();
  33. if (res.msg != '成功') return wx.showToast({
  34. title: res.msg,
  35. icon: "none",
  36. mask: true
  37. });
  38. content.pageNumber = res.pageNumber + 1;
  39. content.pageTotal = res.pageTotal;
  40. this.setData({
  41. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  42. })
  43. })
  44. },
  45. /* 开始搜索 */
  46. onSearch({
  47. detail
  48. }) {
  49. if (detail == this.data.content.where.condition) return;
  50. this.data.content.where.condition = detail;
  51. this.getList(true);
  52. },
  53. onClear(e) {
  54. this.data.content.where.condition = "";
  55. this.getList(true);
  56. },
  57. onReady() {
  58. this.selectComponent("#ListBox").setHeight(".top", this);
  59. }
  60. })