index.js 1.5 KB

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