quanwei
2025-11-05 0368a9e52986b67493f10b7e21e8b6536a25fa6a
mobile/pages/plus/business/detail.vue
@@ -10,19 +10,19 @@
            <!-- 操作按钮区域 -->
            <view class="action-buttons">
               <view class="action-btn" @click="makePhoneCall(businessInfo.mobile)">
                  <text class="btn-icon">📞</text>
                  <image src="@/static/icon/bddh.png" class="btn-icon"></image>
                  <text class="btn-text">拨打电话</text>
               </view>
               <view class="action-btn" @click="shareToWechat">
                  <text class="btn-icon">💬</text>
                  <image src="@/static/wx.png" class="btn-icon"></image>
                  <text class="btn-text">分享微信</text>
               </view>
               <view class="action-btn" @click="openLocation(businessInfo)">
                  <text class="btn-icon">📍</text>
                  <image src="@/static/icon/address_icon.png" class="btn-icon"></image>
                  <text class="btn-text">导航地址</text>
               </view>
               <button open-type="share" class="action-btn">
                  <text class="btn-icon">➤</text>
                  <image src="@/static/icon/fenx.png" class="btn-icon"></image>
                  <text class="btn-text">分享名片</text>
               </button>
            </view>
@@ -115,6 +115,18 @@
            // 预览图片
            uni.previewImage({
               urls: [_this.businessInfo.mp],
               longPressActions: {
                  itemList: ['转发给朋友', '保存图片', '收藏', '翻译图片中的文字', '提取文字'],
                  success: function(data) {
                     if (data.tapIndex == 1) {
                           _this.recordVisit(20)
                        }
                        console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
                  },
                  fail: function(err) {
                     console.log(err.errMsg);
                  }
               },
               complete: function(res) {
                  console.log(res);
               }
@@ -142,11 +154,11 @@
            });
         },
         // 记录访问
         recordVisit() {
         recordVisit(type=10) {
            let _this = this;
            const params = {
               business_card_id: _this.business_card_id,
               type: 10
               type: type
            };
            _this._post('plus.business.saving/add', params, function() {
               // 无需处理返回结果
@@ -184,45 +196,22 @@
               this.showError('暂无地址信息');
               return;
            }
            // 使用腾讯地图API进行地理编码
            const apiKey = 'LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR';
            const url = `https://apis.map.qq.com/ws/geocoder/v1/?address=${encodeURIComponent(address)}&key=${apiKey}`;
            uni.request({
               url: url,
               success: (res) => {
                  if (res.data.status === 0 && res.data.result) {
                     const location = res.data.result.location;
                     uni.openLocation({
                        latitude: location.lat,
                        longitude: location.lng,
                        name: address,
                        address: address,
                        scale: 18
                     });
                  } else {
                     // 地理编码失败,使用默认方式
                     uni.openLocation({
                        latitude: 0,
                        longitude: 0,
                        name: address,
                        address: address,
                        scale: 18
                     });
                  }
               },
               fail: () => {
                  // 请求失败,使用默认方式
                  uni.openLocation({
                     latitude: 0,
                     longitude: 0,
                     name: address,
                     address: address,
                     scale: 18
                  });
            console.log( businessInfo.latitude);
            console.log( businessInfo.longitude);
            let latitude=Number(businessInfo.latitude)
            let longitude=Number(businessInfo.longitude)
            uni.openLocation({
               latitude: latitude,
               longitude: longitude,
               name: businessInfo.address,
               address: address,
               scale: 18,
               complete: function(res) {
                  console.log(res);
               }
            });
         },
         // 分享名片
         shareCard() {
@@ -442,6 +431,8 @@
         .btn-icon {
            font-size: 56rpx;
            width: 56rpx;
            height: 56rpx;
            margin-bottom: 12rpx;
         }
@@ -562,7 +553,7 @@
      gap: 10rpx;
      .create-card-btn {
         background: linear-gradient(90deg, #0078d7, #00b4ff);
         background: linear-gradient(90deg, #ff1529, #ff435f);
         color: #fff;
         font-weight: bold;
         padding: 10rpx 0;
@@ -681,7 +672,7 @@
            .confirm-btn {
               color: #fff;
               background-color: #37bde6;
               background-color: #D41003;
            }
         }
      }