|
@@ -1,66 +1,106 @@
|
|
|
-// pages/index/weather/weatherList.js
|
|
|
|
|
-Page({
|
|
|
|
|
|
|
+const {
|
|
|
|
|
+ postApi
|
|
|
|
|
+} = require("../../../apis/api")
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 页面的初始数据
|
|
|
|
|
- */
|
|
|
|
|
- data: {
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ datetimeFormat
|
|
|
|
|
+} from "../../../utils/utils"
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
|
|
- */
|
|
|
|
|
- onLoad(options) {
|
|
|
|
|
|
|
+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: ''
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
- */
|
|
|
|
|
- onReady() {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ selectDiscPort(e) {
|
|
|
|
|
+ this.data.discPortId = e.detail.value
|
|
|
|
|
+ this.data.discPort = e.detail.label
|
|
|
|
|
+ this.getList()
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
|
|
- */
|
|
|
|
|
- onShow() {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ 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,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
|
|
- */
|
|
|
|
|
- onHide() {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ goToDetail(e) {
|
|
|
|
|
+ return
|
|
|
|
|
+ let {
|
|
|
|
|
+ id,
|
|
|
|
|
+ } = e.currentTarget.dataset
|
|
|
|
|
+ wx.navigateTo({
|
|
|
|
|
+ url: `/pages/index/declarePort/detail?id=${id}`
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
|
|
- */
|
|
|
|
|
- onUnload() {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ scrollList() {
|
|
|
|
|
+ if (this.data.total == 0 || this.data.total <= this.data.size * this.data.currentPage) return
|
|
|
|
|
+ this.data.currentPage += 1
|
|
|
|
|
+ this.getList(true)
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
- */
|
|
|
|
|
- onPullDownRefresh() {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ scrollDownList() {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ currentPage: 1,
|
|
|
|
|
+ list: []
|
|
|
|
|
+ })
|
|
|
|
|
+ this.getList()
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
|
|
- */
|
|
|
|
|
- onReachBottom() {
|
|
|
|
|
|
|
+ onLoad() {
|
|
|
|
|
+ this.getList()
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户点击右上角分享
|
|
|
|
|
- */
|
|
|
|
|
- onShareAppMessage() {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ onShow() {}
|
|
|
})
|
|
})
|