Procházet zdrojové kódy

feat(takePhoto): 添加智能服务功能

- 新增 getIntelligentService 方法获取智能服务数据
- 在页面中添加船舶年检、船舶证书、证书办理联系人等智能服务相关的信息展示
- 优化列表项样式,增加到期提醒和联系人列表
wzg před 8 měsíci
rodič
revize
362a001f74

+ 23 - 0
miniprogram/pages/takePhoto/takePhoto.js

@@ -11,6 +11,10 @@ Page({
     waterLevels: [], // 水位数据
     demolitionPolicy: [], // 拆解政策
     shipbuildingPolicy: [], // 造船政策
+    shipAnnualInspection: [],
+    shipCertificate: [],
+    shipCrewCertificate: [],
+    certOperationContact: [],
   },
 
   /**
@@ -20,6 +24,7 @@ Page({
     this.getTerminalServices();
     this.getWaterLevel();
     this.getNewEnergyPolicy();
+    this.getIntelligentService();
   },
 
   /**
@@ -181,4 +186,22 @@ Page({
       });
     }
   },
+
+  // intelligent/service获取智能服务
+  async getIntelligentService() {
+    let { data } = await postApi("/pallet/intelligent/service", {});
+    if (data.status === 0) {
+      this.setData(data.result);
+    } else {
+      this.setData({
+        shipAnnualInspection: [],
+        shipCertificate: [],
+        shipCrewCertificate: [],
+        certOperationContact: [],
+      });
+      wx.showToast({
+        title: data.msg,
+      });
+    }
+  },
 });

+ 36 - 28
miniprogram/pages/takePhoto/takePhoto.wxml

@@ -88,45 +88,53 @@
     <view class="card">
       <view class="card-header">智能服务</view>
       <view class="card-content">
-        <view class="list-item">
+        <!-- 船舶年检 -->
+        <view class="list-item" wx:if="{{shipAnnualInspection && shipAnnualInspection.length > 0}}">
           <view class="tag tag-warning">提醒</view>
-          您的船舶年检即将到期,到期日期:2023年12月31日
-        </view>
-        <view class="list-item">
-          <view class="tag tag-danger">提醒</view>
-          您有3本证书即将到期
+          您的船舶年检信息
           <view style="margin-top: 10px">
-            <view class="cert-item">
-              <view>船舶检验证书</view>
-              <view class="expire-date">到期时间:2023年12月15日</view>
-            </view>
-            <view class="cert-item">
-              <view>船舶营运证</view>
-              <view class="expire-date">到期时间:2023年12月20日</view>
+            <view class="cert-item c7">
+              <view>年检证书</view>
+              <view>到期时间</view>
             </view>
-            <view class="cert-item">
-              <view>船员适任证书</view>
-              <view class="expire-date">到期时间:2023年12月25日</view>
+          </view>
+          <view>
+            <view class="cert-item" wx:for="{{shipAnnualInspection}}" wx:key="index">
+              <view>{{item.shipCertName}}</view>
+              <view class="expire-date {{item.expireType === 1 ? 'text-danger' : ''}}">
+                {{item.validityPeriodEndTime}}
+              </view>
             </view>
           </view>
         </view>
-        <view class="list-item">
-          <view class="tag">提醒</view>
-          您有2个船员资质可升级
+        <!-- 船舶证书 -->
+        <view class="list-item" wx:if="{{shipCertificate && shipCertificate.length > 0}}">
+          <view class="tag tag-danger">提醒</view>
+          您有{{shipCertificate.length}}个证书即将到期
           <view style="margin-top: 10px">
-            <view class="cert-item">
-              <view>三副</view>
-              <view class="upgrade-info">可升级为:二副</view>
+            <view class="cert-item c7">
+              <view>证书名称</view>
+              <view>到期时间</view>
             </view>
-            <view class="cert-item">
-              <view>机工</view>
-              <view class="upgrade-info">可升级为:三管轮</view>
+          </view>
+          <view>
+            <view class="cert-item" wx:for="{{shipCertificate}}" wx:key="index">
+              <view>{{item.shipCertName}}</view>
+              <view class="expire-date {{item.shipCertValid.expireType === 1 ? 'text-danger' : ''}}">
+                {{item.shipCertValid.validityPeriodEndTime}}
+              </view>
             </view>
           </view>
         </view>
-        <view class="list-item contact-info">
-          <view class="mb20">船舶年检证书办理与资质请联系朱经理</view>
-          <view class="btn btn-phone" data-phone="13800138000">拨打电话</view>
+        <!-- 证书办理联系人 -->
+        <view class="list-item contact-info" wx:if="{{certOperationContact && certOperationContact.length > 0}}">
+          <view class="mb20">证书办理联系人</view>
+          <view wx:for="{{certOperationContact}}" wx:key="id" class="contact-item">
+            <view>{{item.officeName}} - {{item.contactPerson}}</view>
+            <view class="btn btn-phone" data-phone="{{item.contactPhone}}" bindtap="makePhoneCall">
+              拨打电话
+            </view>
+          </view>
         </view>
       </view>
     </view>

+ 20 - 1
miniprogram/pages/takePhoto/takePhoto.wxss

@@ -125,7 +125,7 @@ page {
 
 /* 列表样式 */
 .list-item {
-  padding: 12px 15px;
+  padding: 12px 6px;
   border-bottom: 1px solid #eee;
 }
 
@@ -176,6 +176,25 @@ page {
   text-align: center;
 }
 
+.contact-item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 10rpx 0;
+  margin-bottom: 10rpx;
+}
+
+.text-danger {
+  color: #f44336;
+}
+
+.cert-status {
+  display: flex;
+  flex-direction: column;
+  font-size: 12px;
+  margin-top: 5rpx;
+}
+
 /* 热门推荐服务样式 */
 .section-title {
   background-color: #1e88e5;