|
|
@@ -30,6 +30,7 @@ |
|
|
|
<text>{{item.name}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 所有商品 --> |
|
|
|
<view class="seckill-section"> |
|
|
|
<view class="floor-list-whitelist"> |
|
|
|
<view v-for="(item, index) in cateList" :key="index" class="floor-item" @click="navToDetailPages(item)"> |
|
|
@@ -41,25 +42,22 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<uni-load-more :status="loadingType"></uni-load-more> |
|
|
|
<!-- 秒杀楼层 --> |
|
|
|
<view class="seckill-section" v-if="flashSale && flashSale.product.length > 0"> |
|
|
|
<!-- <view class="s-header" @click="navTo('/pages/flash/list')"> --> |
|
|
|
<!-- <text class="miaosha">Promotion</text> --> |
|
|
|
<!-- <text class="tip">{{(new Date(flashSale.starttime*1000)).getHours()}}点场</text> --> |
|
|
|
<!-- <text class="tip" v-if="flashSale.countdown">下一场倒计时</text> --> |
|
|
|
<!-- <text class="tip" v-else>{{flashSale.title}}</text> --> |
|
|
|
<!-- <uni-countdown ref="countd" v-if="flashSale.countdown" @timeup="timeup" :show-day="flashSale.countdown.day ? true : false" --> |
|
|
|
<!-- :day="day" :hour="hour" :minute="minute" :second="second" color="#FFFFFF" background-color="#00B26A" border-color="#00B26A"></uni-countdown> --> |
|
|
|
<!-- <text class="yticon icon-you"></text> --> |
|
|
|
<!-- <text class="miaosha">Promotion</text> --> |
|
|
|
<!-- <text class="tip">{{(new Date(flashSale.starttime*1000)).getHours()}}点场</text> --> |
|
|
|
<!-- <text class="tip" v-if="flashSale.countdown">下一场倒计时</text> --> |
|
|
|
<!-- <text class="tip" v-else>{{flashSale.title}}</text> --> |
|
|
|
<!-- <uni-countdown ref="countd" v-if="flashSale.countdown" @timeup="timeup" :show-day="flashSale.countdown.day ? true : false" --> |
|
|
|
<!-- :day="day" :hour="hour" :minute="minute" :second="second" color="#FFFFFF" background-color="#00B26A" border-color="#00B26A"></uni-countdown> --> |
|
|
|
<!-- <text class="yticon icon-you"></text> --> |
|
|
|
<!-- </view> --> |
|
|
|
<view class="floor-list-whitelist"> |
|
|
|
<view v-for="item in cateList" :key="item.id"> |
|
|
|
<view class="cate-item b-b two" :class="{active: item.id==fId}" @click="changeFirst(item.id)">{{item.name}}</view> |
|
|
|
<view |
|
|
|
v-for="tItem in item.child" :key="tItem.id" |
|
|
|
class="cate-item b-b" |
|
|
|
:class="{active: tItem.id==sId}" |
|
|
|
@click="changeSecond(tItem)"> |
|
|
|
<view class="cate-item b-b two" @click="changeFirst(item.id)">{{item.name}}</view> |
|
|
|
<view v-for="tItem in item.child" :key="tItem.id" class="cate-item b-b" :class="{active: tItem.id==sId}" @click="changeSecond(tItem)"> |
|
|
|
{{tItem.name}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
@@ -234,6 +232,7 @@ |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
loadingType: '', |
|
|
|
titleNViewBackground: '', |
|
|
|
swiperCurrent: 0, |
|
|
|
swiperLength: 0, |
|
|
@@ -261,16 +260,17 @@ |
|
|
|
// this.loadData(); |
|
|
|
}, |
|
|
|
onReachBottom() { |
|
|
|
this.getProduct(); |
|
|
|
this.loadCateList(); |
|
|
|
// this.getProduct(); |
|
|
|
}, |
|
|
|
onPullDownRefresh() { |
|
|
|
if (this.$refs && this.$refs.countd) { |
|
|
|
this.$refs.countd.syncFlag = false; |
|
|
|
} |
|
|
|
this.goodsList = []; |
|
|
|
this.page = 1; |
|
|
|
this.loadCateList(); |
|
|
|
this.loadData(); |
|
|
|
// this.goodsList = []; |
|
|
|
// this.page = 1; |
|
|
|
this.loadCateList('refresh'); |
|
|
|
// this.loadData(); |
|
|
|
}, |
|
|
|
onShareAppMessage(e) { |
|
|
|
|
|
|
@@ -301,11 +301,11 @@ |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
// uni.stopPullDownRefresh(); |
|
|
|
|
|
|
|
this.getFlash(); |
|
|
|
// this.getFlash(); |
|
|
|
|
|
|
|
this.getProduct(); |
|
|
|
// this.getProduct(); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
@@ -329,10 +329,39 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
async loadCateList(fid, sid){ |
|
|
|
async loadCateList(type) { |
|
|
|
if (type === 'refresh') { |
|
|
|
this.cateList = []; |
|
|
|
this.page = 1; |
|
|
|
} |
|
|
|
const that = this; |
|
|
|
//let list = await this.$api.json('cateList'); |
|
|
|
this.cateList = await this.$api.request('/product/lists', 'GET', {fid:"",sid:0,page:this.page,by:'weigh',desc:'desc'}); |
|
|
|
let cateList = await this.$api.request('/product/lists', 'GET', { |
|
|
|
fid: "", |
|
|
|
sid: 0, |
|
|
|
page: this.page, |
|
|
|
by: 'weigh', |
|
|
|
desc: 'desc' |
|
|
|
}); |
|
|
|
// uni.stopPullDownRefresh(); |
|
|
|
if (!cateList) { |
|
|
|
this.loadingType = 'nomore'; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.cateList = this.cateList.concat(cateList); |
|
|
|
|
|
|
|
//判断是否还有下一页,有是more 没有是nomore |
|
|
|
this.loadingType = cateList.length > 20 ? 'nomore' : 'more'; |
|
|
|
if (cateList.length < 20) { |
|
|
|
this.loadingType = 'nomore'; |
|
|
|
} else { |
|
|
|
this.loadingType = 'more'; |
|
|
|
this.page++; |
|
|
|
} |
|
|
|
|
|
|
|
if (type === 'refresh') { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 获取限时秒杀数据 |
|
|
|
async getFlash() { |
|
|
@@ -354,7 +383,7 @@ |
|
|
|
this.titleNViewBackground = this.carouselList[index].background; |
|
|
|
}, |
|
|
|
//详情 |
|
|
|
navToDetailPages(item){ |
|
|
|
navToDetailPages(item) { |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/product/product?id=${item.product_id}` |
|
|
|
}); |
|
|
@@ -500,6 +529,7 @@ |
|
|
|
width: 100%; |
|
|
|
height: 50vw; |
|
|
|
max-height: 400px; |
|
|
|
|
|
|
|
.carousel-item { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|