import { postApi } from "../../../apis/api" // pages/index/declarePort/detail.js Page({ data: { tab: 1, detail: { } }, changeTab(e) { this.setData({ tab: e.currentTarget.dataset.tab }) }, async getDetail(voyageId) { let res = await postApi('/port/report/detail', { voyageId }) this.setData({ detail: res.data.result }) }, preview(e) { let { url } = e.currentTarget.dataset wx.previewImage({ urls: [url], }) }, async report() { let res = await postApi('/port/report/report', { voyageId: this.data.detail.voyageId }) if (res.data.status == 0) { wx.showToast({ title: '报港成功!', success: e => { wx.navigateBack() } }) } else { wx.showToast({ title: res.data.msg, icon: "error" }) } }, onLoad(options) { let { id } = options this.getDetail(id) }, })