// pages/voyages/detail/detail.js import { postApi } from "../../../apis/api" Page({ data: { id: '', tab: 1, recordCurrentPage: 1, dischargeCurrentPage: 1, coordinates: [], medias: [], policys: [], voyage: [], waybills: [], infoType:'ship' }, changeTab(e) { let { tab } = e.currentTarget.dataset this.setData({ tab }) }, async getVoyageDetail() { let res = await postApi("/voyage/detail", { voyageId: this.data.id, }) let { coordinates, medias, policys, voyage, waybills } = res.data.result this.setData({ coordinates, medias, policys, voyage, waybills }) }, async getCarLoadRecordList(isScroll) { let res = await postApi("/voyage/getCarLoadRecordList", { voyageId: this.data.id, size: 10, currentPage: this.data.recordCurrentPage }) }, async getDischargeList(isScroll) { let res = await postApi("/voyage/getDischargeList", { voyageId: this.data.id, size: 10, currentPage: this.data.dischargeCurrentPage }) }, previewImage(e) { let { src } = e.currentTarget.dataset wx.previewImage({ current: src, // 当前显示图片的http链接 urls: [src] // 需要预览的图片http链接列表 }) }, changeInfoType(e){ let {type} = e.currentTarget.dataset this.setData({ infoType:type }) }, onLoad(options) { this.setData({ id: options.id }) this.getVoyageDetail() this.getCarLoadRecordList() this.getDischargeList() }, })