index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. },
  5. onLoad(options) {
  6. this.setData({
  7. content: JSON.parse(options.perams)
  8. })
  9. this.getList();
  10. },
  11. /* 开始搜索 */
  12. startSearch({
  13. detail
  14. }) {
  15. this.setData({
  16. "content.where.condition": detail
  17. });
  18. this.getList(true);
  19. },
  20. onClear() {
  21. this.setData({
  22. "content.where.condition": ""
  23. });
  24. this.getList(true);
  25. },
  26. /* 获取地址列表 */
  27. getList(init) {
  28. let content = this.data.content;
  29. if (init) content.pageNumber = 1;
  30. if (content.pageNumber > content.pageTotal) return;
  31. _Http.basic({
  32. "id": "20221022165503",
  33. content
  34. }).then(res => {
  35. console.log("地址列表", res)
  36. if (res.msg != '成功') return wx.showToast({
  37. title: res.data,
  38. icon: "none"
  39. })
  40. this.setData({
  41. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  42. "content.pageNumber": res.pageNumber + 1,
  43. "content.pageSize": res.pageSize,
  44. "content.pageTotal": res.pageTotal,
  45. "content.total": res.total
  46. })
  47. setTimeout(() => {
  48. this.selectComponent("#List").initRadio();
  49. }, 300)
  50. })
  51. },
  52. onReachBottom() {
  53. this.getList();
  54. },
  55. })