doum
2026-04-21 3539d67072a5fd179bd44385ebefce0d1a6e8cb4
small-program/pages/index/index.vue
@@ -51,22 +51,29 @@
         </view>
         <view class="recommend-list">
            <view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
               <view class="point-thumb">
                  <image class="point-thumb-image" :src="item.coverImg" mode="widthFix"></image>
               </view>
               <view class="point-main">
                  <view class="point-head">
                     <text class="point-name">{{ item.name }}</text>
                     <text class="point-distance">{{ item.distanceText }}</text>
            <template v-if="pointList.length > 0">
               <view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
                  <view class="point-thumb">
                     <image class="point-thumb-image" :src="item.coverImg" mode="widthFix"></image>
                  </view>
                  <view class="point-address">
                     <image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
                     <text>{{ item.address }}</text>
                  <view class="point-main">
                     <view class="point-head">
                        <text class="point-name">{{ item.name }}</text>
                        <text class="point-distance">{{ item.distanceText }}</text>
                     </view>
                     <view class="point-address">
                        <image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
                        <text>{{ item.address }}</text>
                     </view>
                     <text class="point-time">{{ item.shopHours }}</text>
                  </view>
                  <text class="point-time">{{ item.shopHours }}</text>
               </view>
            </view>
            </template>
            <template v-else>
               <view class="no-data">
                  <image src="/static/image/default_nodata_white@2x.png" mode="widthFix"></image>
               </view>
            </template>
         </view>
      </view>
@@ -77,13 +84,19 @@
         </view>
         <view class="toast-btn" @click="handleLocation">开启定位</view>
      </view>
      <custom-tabbar></custom-tabbar>
   </view>
</template>
<script>
   import { mapState } from 'vuex'
   import amapFile from '@/utils/amap-wx.130.js'
   import CustomTabbar from '@/components/custom-tabbar/custom-tabbar.vue'
   export default {
      components: {
         CustomTabbar
      },
      computed: {
         ...mapState(['navHeight', 'statusbarHeight', 'address', 'latitude', 'cityId', 'longitude']),
         currentAddress() {
@@ -163,28 +176,23 @@
               isHighAccuracy: true,
               success: function (addr) {
                  const locParam = { latitude: addr.latitude, longitude: addr.longitude };
                  const qqmapsdk = new QQMapWX({
                     key: 'WE3BZ-HN6WS-ONDOH-62QCV-MNL6F-5NFNE'
                  });
                  qqmapsdk.reverseGeocoder({
                     locParam,
                     success: async function(res) {
                        console.log(res, '==================获取地址');
                        let info = res.result;
                        locParam.province = info.address_component.province;
                        locParam.city = info.address_component.city;
                        locParam.area = info.address_component.district;
                        locParam.street = info.address_component.street;
                        var ta = info.address  || '地址获取失败' ;
                        if(info.formatted_addresses  && info.formatted_addresses.recommend){
                           ta =info.formatted_addresses.recommend
                        }
                        locParam.address = ta
                  var myAmapFun = new amapFile.AMapWX({ key: 'f2e6c0bfcac14c27b4f0d6d0d5b9d7d' });
                  myAmapFun.getRegeo({
                     location: addr.longitude + ',' + addr.latitude,
                     success: async function(data) {
                        console.log(data, '==================获取地址');
                        let info = data[0];
                        locParam.province = info.province;
                        locParam.city = info.city;
                        locParam.area = info.district;
                        locParam.street = info.street;
                        var ta = info.name || '地址获取失败';
                        locParam.address = ta
                        const resCity = await that.$u.api.getCityByName({ cityName: locParam.city })
                        if (resCity.code === 200) {
                           locParam.cityId = resCity.data.id
                        }
                        that.$store.commit('setPosition',locParam)
                        }
                        that.$store.commit('setPosition', locParam)
                        that.$isResolve()
                     },
                     fail: (err) => {
@@ -410,6 +418,18 @@
      margin-top: 32rpx;
   }
   .no-data {
      width: 100%;
      margin-top: 80rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      image {
         width: 320rpx;
         height: 320rpx;
      }
   }
   .point-card {
      display: flex;
      gap: 18rpx;