Explorar el Código

todo 分页;我;登录/注册

wzh hace 3 años
padre
commit
12fd05c20a

+ 38 - 0
miniprogram/app.wxss

@@ -152,4 +152,42 @@ cover-view {
 
 .p50 {
   padding: 50rpx;
+}
+
+.pb20 {
+  padding-bottom: 20rpx;
+}
+
+.fz20 {
+  font-size: 20rpx;
+}
+
+.fz24 {
+  font-size: 24rpx;
+}
+
+.fz28 {
+  font-size: 28rpx;
+}
+
+.fz32 {
+  font-size: 32rpx;
+}
+
+.fz36 {
+  font-size: 36rpx;
+}
+
+.fz40 {
+  font-size: 40rpx;
+}
+
+.scrollx {
+  overflow-x: scroll;
+  white-space: nowrap;
+
+}
+
+.scrolly {
+  overflow-y: scroll;
 }

+ 81 - 4
miniprogram/pages/voyages/detail/detail.js

@@ -13,7 +13,9 @@ Page({
     policys: [],
     voyage: [],
     waybills: [],
-    infoType:'ship'
+    infoType: 'ship',
+    shipDischargeList: [],
+    truckLoadList: []
   },
   changeTab(e) {
     let {
@@ -46,19 +48,83 @@ Page({
   },
 
   async getCarLoadRecordList(isScroll) {
+    if (isScroll) {
+      this.data.recordCurrentPage += 1
+    } else {
+      this.data.recordCurrentPage = 1
+    }
     let res = await postApi("/voyage/getCarLoadRecordList", {
       voyageId: this.data.id,
       size: 10,
       currentPage: this.data.recordCurrentPage
     })
+
+    if (0 == res.data.status) {
+      if (isScroll) {
+
+
+        let truckLoadList = [...this.data.truckLoadList, ...res.data.result]
+        for (let i of truckLoadList) {
+          i.weighTime = this.cutTimeString(i.weighTime)
+        }
+        this.setData({
+          truckLoadList
+        })
+      } else {
+        let truckLoadList = res.data.result
+
+        for (let i of truckLoadList) {
+          i.weighTime = this.cutTimeString(i.weighTime)
+        }
+        this.setData({
+          truckLoadList
+        })
+      }
+    } else {
+      this.setData({
+        truckLoadList: []
+      })
+    }
   },
 
   async getDischargeList(isScroll) {
+    if (isScroll) {
+      this.data.dischargeCurrentPage += 1
+    } else {
+      this.data.dischargeCurrentPage = 1
+    }
     let res = await postApi("/voyage/getDischargeList", {
       voyageId: this.data.id,
       size: 10,
       currentPage: this.data.dischargeCurrentPage
     })
+
+    if (0 == res.data.status) {
+      if (isScroll) {
+
+        let shipDischargeList = [...this.data.shipDischargeList, ...res.data.result]
+        for (let i of shipDischargeList) {
+          i.dischargeTime = this.cutTimeString(i.dischargeTime)
+        }
+        this.setData({
+          shipDischargeList
+        })
+      } else {
+
+        let shipDischargeList = res.data.result
+        for (let i of shipDischargeList) {
+          i.dischargeTime = this.cutTimeString(i.dischargeTime)
+        }
+        this.setData({
+          shipDischargeList
+        })
+      }
+    } else {
+      this.setData({
+        shipDischargeList: []
+      })
+    }
+
   },
 
   previewImage(e) {
@@ -71,13 +137,24 @@ Page({
     })
   },
 
-  changeInfoType(e){
-    let {type} = e.currentTarget.dataset
+  changeInfoType(e) {
+    let {
+      type
+    } = e.currentTarget.dataset
     this.setData({
-      infoType:type
+      infoType: type
     })
   },
 
+  cutTimeString(str) {
+    let index = str.indexOf(' ')
+    return index == -1 ? str : str.substring(0, index)
+  },
+
+  test() {
+    console.log('test')
+  },
+
 
   onLoad(options) {
     this.setData({

+ 33 - 19
miniprogram/pages/voyages/detail/detail.wxml

@@ -6,7 +6,7 @@
   <view class="tabsview" bindtap="changeTab" data-tab="{{4}}" style="color:{{tab==4?'#0d8fcc':''}};border-bottom:{{tab==4?'2rpx solid #0d8fcc':''}}">卸货信息</view>
   <view class="tabsview" bindtap="changeTab" data-tab="{{5}}" style="color:{{tab==5?'#0d8fcc':''}};border-bottom:{{tab==5?'2rpx solid #0d8fcc':''}}">航次照片</view>
 </view>
-<scroll-view scroll-y="true" style="padding: 30rpx 50rpx;font-size: 28rpx;color:#222">
+<scroll-view scroll-y="true" style="height:calc(100vh - 494rpx);padding: 30rpx 50rpx;font-size: 28rpx;color:#222" lower-threshold="50" bindscrolltolower="test">
   <view wx:if="{{tab==1}}">
     <view class="line">
       <view class="line-full-item">
@@ -107,28 +107,41 @@
       </view>
     </view>
   </view>
-  <view wx:if="{{tab==3}}">单据信息</view>
+  <view wx:if="{{tab==3}}">
+    <view>保险单</view>
+    <view wx:for="{{policys}}" wx:key="index" style="text-align: center;">
+      <image data-src="{{item.viewUrl}}" bindtap="previewImage" src="{{item.viewUrl}}" style="width: 60%;height: 240rpx;" mode="aspectFit"></image>
+      <view wx:if="{{policys.length&&policys.length!=1}}" class="mt10 mb10" style="border-bottom: 2rpx solid #eee;"></view>
+    </view>
+    <view class="mt30 mb30" style="border-bottom: 2rpx solid #ccc;"></view>
+    <view>运单</view>
+    <view wx:for="{{waybills}}" wx:key="index" style="text-align: center;">
+      <image data-src="{{item.viewUrl}}" bindtap="previewImage" src="{{item.viewUrl}}" style="width: 60%;height: 240rpx;" mode="aspectFit"></image>
+      <view wx:if="{{waybills.length&&waybills.length!=1}}" class="mt10 mb10" style="border-bottom: 2rpx solid #eee;"></view>
+    </view>
+  </view>
   <view wx:if="{{tab==4}}">
-    <view class="df aic jcsb">
+    <view class="df aic jcsb pb20" style="border-bottom: 2rpx solid #ddd;">
       <view bindtap="changeInfoType" data-type="ship" style="color:{{infoType=='ship'?'#0d8fcc':''}};border-bottom:{{infoType=='ship'?'2rpx solid #0d8fcc':''}}">船舶卸货记录</view>
       <view bindtap="changeInfoType" data-type="truck" style="color:{{infoType=='truck'?'#0d8fcc':''}};border-bottom:{{infoType=='truck'?'2rpx solid #0d8fcc':''}}">汽车装货记录</view>
     </view>
-    <view wx:if="{{infoType=='ship'}}">
-      <view class="df aic jcsb">
+    <view class="ship-discharge-list" wx:if="{{infoType=='ship'}}">
+      <view class="df aic jcsb mb20 mt10 fz20">
         <view>卸货时间</view>
         <view>卸货吨位</view>
         <view>卸货件数</view>
         <view>磅单</view>
       </view>
-      <view wx:for="{{shipDischargeList}}" class="df aic jcsb">
-        <view></view>
-        <view></view>
-        <view></view>
-        <view></view>
+      <view wx:for="{{shipDischargeList}}" wx:key="index" class="df aic jcsb mb20 fz20">
+        <view>{{item.dischargeTime}}</view>
+        <view>{{item.dischargeTons||''}}</view>
+        <view>{{item.dischargePieces||''}}</view>
+        <view wx:if="{{item.files&&item.files.length}}" bindtap="previewImage" data-src="{{item.files[0].viewUrl}}" data-files="{{item.files}}">查看</view>
+        <view wx:else>暂无</view>
       </view>
     </view>
-    <view wx:if="{{infoType=='truck'}}">
-      <view class="df aic jcsb">
+    <view class="truck-load-list" wx:if="{{infoType=='truck'}}">
+      <view class="df aic jcsb mb20 mt10 fz20">
         <view>车号</view>
         <view>毛重</view>
         <view>皮重</view>
@@ -136,13 +149,14 @@
         <view>称重时间</view>
         <view>单据</view>
       </view>
-      <view wx:for="{{truckLoadList}}" class="df aic jcsb">
-        <view></view>
-        <view></view>
-        <view></view>
-        <view></view>
-        <view></view>
-        <view></view>
+      <view wx:for="{{truckLoadList}}" wx:key="index" class="df aic jcsb mb20 fz20">
+        <view>{{item.carNum}}</view>
+        <view>{{item.grossWeight}}</view>
+        <view>{{item.tare}}</view>
+        <view>{{item.netWeight}}</view>
+        <view>{{item.weighTime}}</view>
+        <view wx:if="{{item.file}}" bindtap="previewImage" data-src="{{item.file.viewUrl}}">查看</view>
+        <view wx:else>暂无</view>
       </view>
     </view>
   </view>

+ 20 - 0
miniprogram/pages/voyages/detail/detail.wxss

@@ -87,4 +87,24 @@ page {
 
 .type2 .line-full-title {
   width: 50%;
+}
+
+.ship-discharge-list>view:first-child {
+  font-size: 26rpx;
+}
+
+.ship-discharge-list>view>view {
+  width: 160rpx;
+  text-align: center;
+  color: #444;
+}
+
+.truck-load-list>view:first-child {
+  font-size: 26rpx;
+}
+
+.truck-load-list>view>view {
+  width: 160rpx;
+  text-align: center;
+  color: #444;
 }

+ 1 - 1
project.private.config.json

@@ -19,7 +19,7 @@
         {
           "name": "",
           "pathName": "pages/voyages/detail/detail",
-          "query": "id=46",
+          "query": "id=42",
           "launchMode": "default",
           "scene": null
         }