rows.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. if (res.msg != '成功') return wx.showToast({
  48. title: res.msg,
  49. icon: "none"
  50. })
  51. this.selectComponent('#ListBox').RefreshToComplete();
  52. content.pageNumber = res.pageNumber + 1
  53. content.pageTotal = res.pageTotal
  54. this.setData({
  55. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  56. content
  57. })
  58. })
  59. },
  60. /* 修改查看日期 */
  61. changeDate(e) {
  62. this.data.content.where[e.currentTarget.dataset.name] = e.detail.value;
  63. this.getList(true)
  64. },
  65. initialize() {
  66. this.data.content.where.enddate = "";
  67. this.data.content.where.begindate = "";
  68. this.getList(true)
  69. },
  70. /* 搜索 */
  71. onSearch({
  72. detail
  73. }) {
  74. this.data.content.where.condition = detail;
  75. this.getList(true)
  76. },
  77. /* 设置页面高度 */
  78. setListHeight() {
  79. this.selectComponent("#ListBox").setHeight(".top", this);
  80. }
  81. })