zhaojs
2023-06-30 ba3d748f9eb65a66fca9bd74fc7796b90a0a70ae
uniapp/pages/active/vipsearch.vue
@@ -29,7 +29,6 @@
                  </view>
               </view>
            </view>
            <view class="searchContent rowCenBet" @tap="gosearch()">
               <view class="leftcontent rowCen">
                  <view class="search-icon iconfont">
@@ -46,7 +45,6 @@
         </view>
         <view class="emptybar" :style="'width:100%;height:'+(scrollTop>fiexdtop?'90':'0')+'rpx;'">
         </view>
         <view class="rangeList-container rowCen" :class="scrollTop>fiexdtop?'tofixed':''" :style="'top:'+(scrollTop>fiexdtop?fiexdHeight:'0')+'px;'">
            <scroll-view class="scrollview-content" scroll-x scroll-with-animation="true">
               <block v-for="(items,index) in navList" :key="index">
@@ -61,11 +59,12 @@
               </block>
            </scroll-view>
         </view>
         <view class="goodsList-container colCen borderBox">
            <view class="goods-content rowStaBet">
               <view class="goods-items borderBox colCen" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)">
                  <colGoods :items="items"></colGoods>
                   <colGoodsImg v-if="index==0&&popBannerSList&&popBannerSList.length>0" :popBannerSList="popBannerSList"></colGoodsImg>
                  <colGoods v-else :items="items"></colGoods>
               </view>
               <aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999"></aLoadMore>
            </view>
@@ -76,12 +75,15 @@
<script>
   import colGoods from '../../components/colGoods.vue'
   import colGoodsImg from '../../components/colGoodsImg.vue'
   export default {
      components:{
         colGoods
         colGoods,
         colGoodsImg
      },
      data() {
         return {
            popBannerSList:[],
            pageTop: 0,
            nowCurrent: 0,
            scrollTop:0,
@@ -96,7 +98,8 @@
         }
      },
      onLoad() {
         this.getNav()
         this.getNav();
         this.getPageImg();
      },
      onPageScroll(e) {
         this.scrollTop = e.scrollTop
@@ -115,6 +118,24 @@
         }).exec();
      },
      methods: {
         getPageImg()
         {
             var that=this;
            this.$u.api.getBanner({
               type: '11,20'
            }).then(e => {
               if (e.code == 1) return that.$alert(e.msg);
               var res = e.data.info;
               that.popBannerSList=res.wphImg;
               console.log(that.popBannerSList);
               if(res.wphImg&&res.wphImg.length>0)
               {
                  that.goodsList.unshift(res[0]);
               }
            }).catch(function(err) {
               console.log(err)
            })
         },
         getNav() {
            var that = this;
            this.$u.api.getTopCalss({ctype:9}).then(e => {
@@ -127,6 +148,7 @@
         },
         getData() {
            var that = this;
            console.log(this.nowCurrent)
            this.$u.api.wphGoodsList({
               cate: this.nowCurrent,
               pageSize: 10,
@@ -134,6 +156,13 @@
            }).then(e => {
               if(e.code != 0)return that.$alert(e.msg)
               var res = e.data;
               if(res.list==null)
               {
                  that.pageCurrent++
                  that.canloadmore = false
                  that.loadstatus = 'nomarl'
                  return;
               }
               if (res.list < 10) {
                  that.pageCurrent++
                  that.canloadmore = false
@@ -144,7 +173,9 @@
                  that.pageCurrent ++
               }
               that.goodsList = that.goodsList.concat(res.list)
               console.log(that.goodsList)
            }).catch(function (err) {
               console.log(err)
            })
         },
         
@@ -158,9 +189,12 @@
         },
         
         goDetail(info) {
            uni.navigateTo({
               url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info))
            })
            if(info&&info!=undefined)
            {
               uni.navigateTo({
                  url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info))
               })
            }
         },
         
         goback() {
@@ -358,6 +392,8 @@
               flex-wrap: wrap;
               
               .goods-items{
                  width: 350rpx;
                  height: 546rpx;
                  margin-bottom: 20rpx;
               }
            }