index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. active: 1,
  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.pageNumber == 1 ? res.data : this.data.list.concat(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 || 0
  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 = "";
  60. switch (e.detail.title) {
  61. case '全部':
  62. status = "";
  63. break;
  64. case '待确认':
  65. status = "交期待确认";
  66. break;
  67. default:
  68. status = e.detail.title
  69. break;
  70. }
  71. this.setData({
  72. active: e.detail.index,
  73. "content.where.status": status
  74. });
  75. this.getList(true);
  76. },
  77. onReady() {
  78. this.setListHeight()
  79. },
  80. /* 设置页面高度 */
  81. setListHeight() {
  82. this.selectComponent("#ListBox").setHeight(".tips", this);
  83. },
  84. add() {
  85. wx.navigateTo({
  86. url: '/packageA/orderForm/add',
  87. })
  88. },
  89. })