MrShi
3 天以前 1e6a4364d6e2636522aa4e1f679fb3b8f8997046
mini-program/pages/index/index.vue
@@ -6,7 +6,7 @@
            <view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view>
            <view class="head-bar-nav" :style="{ height: navHeight + 'px' }" @click="openLoacing">
               <image src="/static/icon/home_ic_location@2x.png" mode="widthFix"></image>
               <text>{{position.formatted_addresses.recommend}}</text>
               <text>{{position.formatted_addresses.recommend || '点击定位'}}</text>
               <u-icon name="arrow-right" color="#222222" size="13"></u-icon>
            </view>
         </view>
@@ -20,7 +20,7 @@
         <u-scroll-list indicatorActiveColor="#004096">
            <view class="scroll-list">
               <view class="scroll-list__line" v-for="(item, index) in labels" :key="index">
                  <view class="cate-item" v-for="(child, index) in item" :key="index" @click="jumpSearch(child, 1)">
                  <view class="cate-item" v-for="(child, a) in item" :key="a" @click="jumpSearch1(child, 1)">
                     <view class="cate-item-image">
                        <image :src="child.imgUrl" mode="widthFix"></image>
                     </view>
@@ -35,7 +35,7 @@
         <u-scroll-list indicatorActiveColor="#004096">
            <view class="scroll-list" style="padding: 0;">
               <view class="scroll-list__line" v-for="(item, index) in brand" :key="index">
                  <view class="cate-item1" v-for="(child, index) in item" :key="index" @click="jumpSearch(child, 2)">
                  <view class="cate-item1" v-for="(child, a) in item" :key="a" @click="jumpSearch1(child, 2)">
                     <image :src="child.imgUrl" mode="widthFix"></image>
                     <text>{{child.name}}</text>
                  </view>
@@ -51,15 +51,15 @@
         </view>
         <view class="quality">
            <view class="quality-item" @click="jumpShopZ(specialZone[0])">
               <image class="quality-item-image" :src="specialZone[0].imgUrl" mode="widthFix"></image>
               <image class="quality-item-image" :src="specialZone[0].imgUrl || '/static/icon/default2.png'" mode="widthFix"></image>
            </view>
            <view style="width: 22rpx; height: 100%;"></view>
            <view class="quality-item">
               <view class="quality-item-row" @click="jumpShopZ(specialZone[1])">
                  <image class="quality-item-row-image" :src="specialZone[1].imgUrl" mode="widthFix"></image>
                  <image class="quality-item-row-image" :src="specialZone[1].imgUrl || '/static/icon/default2.png'" mode="widthFix"></image>
               </view>
               <view class="quality-item-row" @click="jumpShopZ(specialZone[2])">
                  <image class="quality-item-row-image" :src="specialZone[2].imgUrl" mode="widthFix"></image>
                  <image class="quality-item-row-image" :src="specialZone[2].imgUrl || '/static/icon/default2.png'" mode="widthFix"></image>
               </view>
            </view>
         </view>
@@ -69,7 +69,7 @@
         <view class="commodity">
            <view class="commodity-item" v-for="(item, i) in goodsList" :key="i" @click="jumpDetails(item.id)">
               <view class="commodity-item-image">
                  <image :src="item.imgurl" mode="widthFix"></image>
                  <image :src="item.imgurl || '/static/icon/default2.png'" mode="widthFix"></image>
               </view>
               <view class="commodity-item-box">
                  <view class="commodity-item-box-title">
@@ -92,7 +92,7 @@
            </view>
         </view>
      </view>
      <view class="dingwei" v-if="!position">
      <view class="dingwei" v-if="isShow">
         <view class="dingwei-left">
            <text>未授权定位</text>
            <text>我们无法获得您当前位置信息为您推荐附近经销商</text>
@@ -114,7 +114,7 @@
         Login
      },
      computed: {
         ...mapState(['navHeight', 'statusbarHeight', 'position'])
         ...mapState(['navHeight', 'statusbarHeight', 'position', 'userInfo'])
      },
      data() {
         return {
@@ -130,11 +130,15 @@
            specialZone: [],
            goodsList: [],
            page: 1,
            next: true
            next: true,
            isShow: false
         }
      },
      async onLoad() {
         await this.$onLaunched;
         if (!this.position) {
            this.isShow = true
         }
         this.getBanner()
         this.getLabels()
         this.getGoodsList()
@@ -149,9 +153,13 @@
            })
         },
         addCard(e) {
            if (!this.userInfo) {
               this.$refs.loginRef.open()
               return
            }
            this.$u.api.addCart({
               goodsId: e.id,
               goodsSkuId: e.skuResponsesList[0].id,
               goodsSkuId: e.goodsSkuResponseList[0].id,
               num: 1
            }).then(res => {
               if (res.code === 200) {
@@ -195,7 +203,7 @@
            this.$u.api.getGoodsLabelsByType({ type: 12 })
               .then(res => {
                  if (res.code === 200) {
                     this.specialZone = res.data
                     this.specialZone = res.data.length > 0 ? res.data.slice(0, 3) : []
                  }
               })
         },
@@ -295,20 +303,20 @@
               }
            })
         },
         jumpSearch(row, type) {
            if (row) {
               if (type === 1) {
                  uni.navigateTo({
                     url: '/pages/search/search?categoryId=' + row.id
                  })
               } else {
                  uni.navigateTo({
                     url: '/pages/search/search?applicableBrandId=' + row.id
                  })
               }
         jumpSearch() {
            uni.navigateTo({
               url: '/pages/search/search'
            })
         },
         jumpSearch1(row, type) {
            console.log(row)
            if (type === 1) {
               uni.navigateTo({
                  url: '/pages/search/search?categoryId=' + row.id
               })
            } else {
               uni.navigateTo({
                  url: '/pages/search/search'
                  url: '/pages/search/search?applicableBrandId=' + row.id
               })
            }
         }