const { postApi } = require("../../../apis/api") import { datetimeFormat } from "../../../utils/utils" const app = getApp() Page({ data: { cargoOwnerId: 0, defaultParams: { loginAccountId: wx.getStorageSync('loginAccountId') }, maintab: 1, status: 0, currentPage: 1, size: 20, list: [], total: 0, term: "", isFreshing: false, apiArr: ['/voyage/wx/list', '/dayReport/list', '/bill/list'], discPortId: '', discPort: '', inputStyle: "width: 686rpx;height: 76rpx;background: #FFFFFF;box-shadow: 0rpx 3rpx 9rpx 3rpx rgba(92,123,111,0.26);border-radius: 12rpx;margin:30rpx auto", scrollStyle: "width: 686rpx;box-shadow: 0rpx 3rpx 9rpx 3rpx rgba(92,123,111,0.26);border-radius: 12rpx;margin:border:1rpx solid grey;margin-left:30rpx;top:-20rpx" }, selectDiscPort(e) { this.data.discPortId = e.detail.value this.data.discPort = e.detail.label this.getList() }, async getList(isScroll) { if (!wx.getStorageSync('loginAccountId')) { wx.showToast({ title: '尚未登录', icon: "error" }) return } this.setData({ isFreshing: true }) let res = await postApi('/port/weather/list', { loginAccountId: wx.getStorageSync('loginAccountId'), portId: this.data.discPortId, currentPage: this.data.currentPage, size: this.data.size, }) this.setData({ currentPage: this.data.currentPage, isFreshing: false }) if (res.data.status == 0) { if (isScroll) { this.setData({ list: [...this.data.list, ...res.data.result], total: res.data.total }) } else { this.setData({ list: res.data.result, total: res.data.total }) } } else { this.setData({ list: [], total: 0 }) wx.showToast({ icon: "none", title: res.data.msg, }) } }, goToDetail(e) { return let { id, } = e.currentTarget.dataset wx.navigateTo({ url: `/pages/index/declarePort/detail?id=${id}` }) }, scrollList() { if (this.data.total == 0 || this.data.total <= this.data.size * this.data.currentPage) return this.data.currentPage += 1 this.getList(true) }, scrollDownList() { this.setData({ total: 0, currentPage: 1, list: [] }) this.getList() }, onLoad() { this.getList() }, onShow() {} })