index.js 1.6 KB

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