index.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. list: [],
  5. filtrate: false,
  6. "content": {
  7. "nocache": true,
  8. "pageNumber": 1,
  9. "pageSize": 20,
  10. "pageTotal": 1,
  11. "where": {
  12. "condition": ""
  13. }
  14. },
  15. filtratelist: [{
  16. label: "红蓝字",
  17. index: null,
  18. showName: "name", //显示字段
  19. valueKey: "rb", //返回Key
  20. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  21. value: "", //选中值
  22. list: [{
  23. name: "红字",
  24. value: 0
  25. }, {
  26. name: "蓝字",
  27. value: 1
  28. }]
  29. }, {
  30. label: "是否收货",
  31. index: null,
  32. showName: "name", //显示字段
  33. valueKey: "isreceiver", //返回Key
  34. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  35. value: "", //选中值
  36. list: [{
  37. name: "未收货",
  38. value: 0
  39. }, {
  40. name: "已收货",
  41. value: 1
  42. }]
  43. }]
  44. },
  45. onLoad(options) {
  46. this.getList(true);
  47. },
  48. // {"id":20230719154303,"content":{"st_stockbillid":"1","pageNumber":1,"pageSize":20,"where":{"condition":""}},"accesstoken":"cc80c07dec16ecad16b9e71eac20b05d","systemappid":372}
  49. getList(init = false) {
  50. if (init.detail != undefined) init = init.detail;
  51. let content = this.data.content;
  52. if (init) content.pageNumber = 1;
  53. if (content.pageNumber > content.pageTotal) return;
  54. _Http.basic({
  55. id: 2025061311114103,
  56. content: content
  57. }).then(res => {
  58. console.log("到货列表", res)
  59. this.selectComponent('#ListBox').RefreshToComplete();
  60. if (res.msg != '成功') return wx.showToast({
  61. title: res.msg,
  62. icon: "none"
  63. })
  64. this.setData({
  65. total: res.total,
  66. list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
  67. 'content.pageNumber': res.pageNumber + 1,
  68. 'content.pageTotal': res.pageTotal
  69. })
  70. })
  71. },
  72. onReady() {
  73. this.selectComponent("#ListBox").setHeight(".top", this);
  74. },
  75. startSearch({
  76. detail
  77. }) {
  78. if (detail == this.data.content.where.condition) return;
  79. this.data.content.where.condition = detail;
  80. this.getList(true);
  81. },
  82. /* 取消搜索 */
  83. onClear() {
  84. this.data.content.where.condition = "";
  85. this.getList(true);
  86. },
  87. openFiltrate() {
  88. this.setData({
  89. filtrate: true
  90. })
  91. },
  92. /* 处理筛选 */
  93. handleFilter(e) {
  94. e.detail.condition = this.data.content.where.condition;
  95. e.detail.begindate = e.detail.startdate
  96. this.setData({
  97. "content.where": e.detail
  98. })
  99. console.log("this.data.content", this.data.content)
  100. this.getList(true)
  101. },
  102. })