Browse Source

首页新增企业地址

QAQ 陈 3 months ago
parent
commit
d9b7146ae3
3 changed files with 55 additions and 6 deletions
  1. 23 6
      pages/homepage/homepage.js
  2. 5 0
      pages/homepage/homepage.wxml
  3. 27 0
      pages/homepage/homepage.wxss

+ 23 - 6
pages/homepage/homepage.js

@@ -17,7 +17,8 @@ Page({
       accountNumber: "",
       address: ""
     },
-
+    //企业地址信息
+    enterPriseAddress:"",
     // 账单信息
     billInfo: {
       totalAmount: "", // 总计应缴
@@ -114,7 +115,7 @@ Page({
       wx.request({
         url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
         method: 'GET',
-        header: {
+        header: { 
           'content-type': 'application/json', // 默认值
           'token': app.globalData.userWxInfo.token,
           'source': "wc",
@@ -163,7 +164,6 @@ Page({
               unreadCount: unreadCount
             });
           }
-          
           // 更新页面数据
           _this.setData({
             billInfo: {
@@ -175,7 +175,8 @@ Page({
               name: apiReturnData.data.username,
               accountNumber: apiReturnData.data.usernumber,
               address: apiReturnData.data.address
-            }
+            },
+            enterPriseAddress:apiReturnData.data.enterPriseAddress
           });
         },
         fail(error) {
@@ -325,7 +326,8 @@ Page({
             name: apiReturnData.data.username,
             accountNumber: apiReturnData.data.usernumber,
             address: apiReturnData.data.address
-          }
+          },
+          enterPriseAddress:apiReturnData.data.enterPriseAddress
         });
       },
       fail(error) {
@@ -682,7 +684,8 @@ Page({
             // 计算未读消息数量
             const unreadCount = app.globalData.userNoticesList.filter(notice => notice.readstate === '2').length;
             _this.setData({
-              unreadCount: unreadCount
+              unreadCount: unreadCount,
+              enterPriseAddress:apiReturnData.data.enterPriseAddress
             });
           }
         }
@@ -749,6 +752,7 @@ Page({
               accountNumber: apiReturnData.data.usernumber,
               address: apiReturnData.data.address
             },
+            enterPriseAddress:apiReturnData.data.enterPriseAddress,
             noticeList: data,
             isScrolling: true
           });
@@ -768,5 +772,18 @@ Page({
         });
       }
     });
+  },
+
+  // 显示地址弹窗并提供复制功能
+  showAddressPopup(e) {
+    const address = e.currentTarget.dataset.address;
+    if (!address) return;
+    
+    wx.showModal({
+      title: '地址信息',
+      content: address,
+      showCancel: false,
+      confirmText: '确定'
+    });
   }
 })

+ 5 - 0
pages/homepage/homepage.wxml

@@ -3,8 +3,13 @@
   <view class="header">
     <image class="background" src="{{images.background}}" mode="widthFix" />
     <image class="logo" src="{{images.logo}}" mode="aspectFit" />
+    <view class="address-container" bindtap="showAddressPopup" data-address="{{enterPriseAddress}}">
+      <image src="/static_file/location.png" class="address-icon"></image>
+      <text class="address-text">{{enterPriseAddress}}</text>
+    </view>
   </view>
 
+
   <!-- 卡片区域 -->
   <view class="cards-container">
     <!-- 用户信息卡片 -->

+ 27 - 0
pages/homepage/homepage.wxss

@@ -35,6 +35,32 @@
   z-index: 1;
 }
 
+.address-container {
+  position: absolute;
+  display: flex;
+  align-items: center;
+  top: 166rpx;
+  right: 50rpx;
+  z-index: 2;
+  padding: 6rpx 12rpx;
+  border-radius: 20rpx;
+}
+
+.address-icon {
+  width: 32rpx;
+  height: 32rpx;
+  margin-right: 8rpx;
+}
+
+.address-text {
+  color: #ffffff;
+  font-size: 30rpx;
+  max-width: 330rpx;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
 .user-info-section {
   padding: 10rpx;
   display: flex;
@@ -377,6 +403,7 @@
 }
 
 .address-row {
+  cursor: pointer;
   align-items: flex-start !important;
   min-height: 20rpx;
   margin-bottom: 10rpx;