voyages.js 836 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // components/voyages/Voyages.js
  2. import {
  3. postApi
  4. } from "../../apis/api"
  5. Component({
  6. properties: {
  7. },
  8. data: {
  9. term: '',
  10. status: 1,
  11. currentPage: 1,
  12. size: 10,
  13. list: []
  14. },
  15. methods: {
  16. async getVoyageList() {
  17. let res = await postApi('/voyage/list', {
  18. cargoOwnerId: wx.getStorageSync('cargoOwnerId'),
  19. term: this.data.term,
  20. status: this.data.status,
  21. currentPage: this.data.currentPage,
  22. size: this.data.size
  23. })
  24. this.setData({
  25. list: [...res.data.result,...res.data.result,...res.data.result]
  26. })
  27. console.log(res)
  28. },
  29. changeStatus(e) {
  30. let {
  31. status
  32. } = e.currentTarget.dataset
  33. this.setData({
  34. status,
  35. currentPage: 1,
  36. size: 10
  37. })
  38. this.getVoyageList()
  39. },
  40. }
  41. })