rows.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. content: {
  5. pageNumber: 1,
  6. pageTotal: 1,
  7. pageSize: 20,
  8. where: {
  9. condition: "",
  10. begindate: "",
  11. enddate: ""
  12. }
  13. }
  14. },
  15. onLoad(options) {
  16. this.getList()
  17. },
  18. tabsChange({
  19. detail
  20. }) {
  21. let where = this.data.content.where;
  22. if (detail.index == 0) {
  23. delete(where.isuncheckout);
  24. where.datetype = ""
  25. } else if (detail.index == 1) {
  26. where.isuncheckout = 1;
  27. where.datetype = ""
  28. } else {
  29. where.isuncheckout = 1;
  30. where.datetype = detail.name;
  31. }
  32. this.data.content.where = where;
  33. this.getList(true)
  34. },
  35. /* 获取产品 */
  36. getList(init = false) {
  37. if (init.detail != undefined) init = init.detail;
  38. let content = this.data.content;
  39. if (init) content.pageNumber = 1;
  40. if (content.pageNumber > content.pageTotal) return;
  41. this.setListHeight();
  42. _Http.basic({
  43. "id": 20230508111703,
  44. content
  45. }).then(res => {
  46. console.log("订单列表", res)
  47. this.selectComponent('#ListBox').RefreshToComplete();
  48. content.pageNumber = res.pageNumber + 1
  49. content.pageTotal = res.pageTotal
  50. this.setData({
  51. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  52. content
  53. })
  54. })
  55. },
  56. /* 修改查看日期 */
  57. changeDate(e) {
  58. this.data.content.where[e.currentTarget.dataset.name] = e.detail.value;
  59. this.getList(true)
  60. },
  61. initialize() {
  62. this.data.content.where.enddate = "";
  63. this.data.content.where.begindate = "";
  64. this.getList(true)
  65. },
  66. /* 搜索 */
  67. onSearch({
  68. detail
  69. }) {
  70. this.data.content.where.condition = detail;
  71. this.getList(true)
  72. },
  73. /* 设置页面高度 */
  74. setListHeight() {
  75. this.selectComponent("#ListBox").setHeight(".top", this);
  76. }
  77. })