| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- 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: ''
- },
- 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() {}
- })
|