detail.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // pages/voyages/detail/detail.js
  2. import {
  3. postApi
  4. } from "../../../apis/api"
  5. Page({
  6. data: {
  7. id: '',
  8. tab: 1,
  9. recordCurrentPage: 1,
  10. dischargeCurrentPage: 1,
  11. coordinates: [],
  12. medias: [],
  13. policys: [],
  14. voyage: [],
  15. waybills: [],
  16. infoType:'ship'
  17. },
  18. changeTab(e) {
  19. let {
  20. tab
  21. } = e.currentTarget.dataset
  22. this.setData({
  23. tab
  24. })
  25. },
  26. async getVoyageDetail() {
  27. let res = await postApi("/voyage/detail", {
  28. voyageId: this.data.id,
  29. })
  30. let {
  31. coordinates,
  32. medias,
  33. policys,
  34. voyage,
  35. waybills
  36. } = res.data.result
  37. this.setData({
  38. coordinates,
  39. medias,
  40. policys,
  41. voyage,
  42. waybills
  43. })
  44. },
  45. async getCarLoadRecordList(isScroll) {
  46. let res = await postApi("/voyage/getCarLoadRecordList", {
  47. voyageId: this.data.id,
  48. size: 10,
  49. currentPage: this.data.recordCurrentPage
  50. })
  51. },
  52. async getDischargeList(isScroll) {
  53. let res = await postApi("/voyage/getDischargeList", {
  54. voyageId: this.data.id,
  55. size: 10,
  56. currentPage: this.data.dischargeCurrentPage
  57. })
  58. },
  59. previewImage(e) {
  60. let {
  61. src
  62. } = e.currentTarget.dataset
  63. wx.previewImage({
  64. current: src, // 当前显示图片的http链接
  65. urls: [src] // 需要预览的图片http链接列表
  66. })
  67. },
  68. changeInfoType(e){
  69. let {type} = e.currentTarget.dataset
  70. this.setData({
  71. infoType:type
  72. })
  73. },
  74. onLoad(options) {
  75. this.setData({
  76. id: options.id
  77. })
  78. this.getVoyageDetail()
  79. this.getCarLoadRecordList()
  80. this.getDischargeList()
  81. },
  82. })