index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. loading: true,
  5. active: 0,
  6. content: {
  7. nocache: true,
  8. isExport: 0,
  9. pageNumber: 1,
  10. pageTotal: 1,
  11. pageSize: 20,
  12. total: 0,
  13. where: {
  14. condition: "",
  15. tablefilter: {}
  16. },
  17. sort: []
  18. },
  19. filter: []
  20. },
  21. onLoad(options) {
  22. this.getList()
  23. },
  24. /* 处理筛选 */
  25. handleFilter({
  26. detail
  27. }) {
  28. console.log(detail)
  29. },
  30. getList(init = false) {
  31. if (init.detail != undefined) init = init.detail;
  32. let content = this.data.content;
  33. if (init) content.pageNumber = 1;
  34. if (content.pageNumber > content.pageTotal) return;
  35. _Http.basic({
  36. "id": 20230320160203,
  37. content
  38. }).then(res => {
  39. console.log("发货单列表", res)
  40. this.selectComponent('#ListBox').RefreshToComplete();
  41. this.setData({
  42. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  43. "content.pageNumber": res.pageNumber + 1,
  44. "content.pageTotal": res.pageTotal,
  45. "content.sort": res.sort,
  46. "content.total": res.total,
  47. loading: false
  48. })
  49. })
  50. },
  51. /* 搜索 */
  52. onSearch({
  53. detail
  54. }) {
  55. this.setData({
  56. "content.where.condition": detail
  57. });
  58. this.getList(true)
  59. },
  60. /* 切换tabs */
  61. tabsChange(e) {
  62. this.setData({
  63. active: e.detail.index,
  64. "content.where.status": e.detail.title == '全部' ? "" : e.detail.title
  65. });
  66. this.getList(true);
  67. },
  68. onReady() {
  69. this.setListHeight()
  70. },
  71. /* 设置页面高度 */
  72. setListHeight() {
  73. this.selectComponent("#ListBox").setHeight(".head", this);
  74. },
  75. })