index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. getApp().globalData.Language.getLanguagePackage(this, '我的地址');
  21. },
  22. /* 获取产品 */
  23. getList(init = false) {
  24. if (init.detail != undefined) init = init.detail;
  25. let content = this.data.content;
  26. if (init) content.pageNumber = 1;
  27. if (content.pageNumber > content.pageTotal) return;
  28. _Http.basic({
  29. "id": "20221009155803",
  30. content
  31. }).then(res => {
  32. console.log("我的地址列表", res)
  33. this.selectComponent('#ListBox').RefreshToComplete();
  34. if (res.code != '1') return wx.showToast({
  35. title: res.msg,
  36. icon: "none",
  37. mask: true
  38. });
  39. content.pageNumber = res.pageNumber + 1;
  40. content.pageTotal = res.pageTotal;
  41. this.setData({
  42. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  43. })
  44. })
  45. },
  46. /* 开始搜索 */
  47. onSearch({
  48. detail
  49. }) {
  50. if (detail == this.data.content.where.condition) return;
  51. this.data.content.where.condition = detail;
  52. this.getList(true);
  53. },
  54. onClear(e) {
  55. this.data.content.where.condition = "";
  56. this.getList(true);
  57. },
  58. })