parent
202ee764ba
commit
a08e05ea8b
|
@ -12,10 +12,10 @@
|
|||
<view class='text'>
|
||||
<view class='line1'>{{ item.name }}</view>
|
||||
<view class='money font-color'>¥<text class='num'>{{ fen2yuan(item.price) }}</text></view>
|
||||
<view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">¥{{item.vip_price || 0}}
|
||||
<image src='../../static/images/vip.png'></image><text class='num'>已售{{Number(item.sales) + Number(item.ficti) || 0}}{{item.unitName}}</text>
|
||||
<view class='vip-money acea-row row-middle' v-if="item.vipPrice > 0">¥{{ fen2yuan(item.vipPrice || 0) }}
|
||||
<image src='../../static/images/vip.png'></image><text class='num'>已售{{ item.salesCount }}{{item.unitName}}</text>
|
||||
</view>
|
||||
<view class='vip-money acea-row row-middle' v-else><text class='num'>已售{{Number(item.sales) + Number(item.ficti) || 0}}{{item.unitName}}</text></view>
|
||||
<view class='vip-money acea-row row-middle' v-else><text class='num'>已售{{ item.salesCount }}{{item.unitName}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='iconfont icon-gouwuche cart-color acea-row row-center-wrapper'></view>
|
||||
|
|
|
@ -20,16 +20,18 @@
|
|||
<div class="line"></div>
|
||||
</div>
|
||||
<view class="wrapper">
|
||||
<GoodList :bastList="goodsList" :is-sort="false"></GoodList>
|
||||
<GoodList :bastList="goodsList" :is-sort="false" />
|
||||
<view class="txt-bar" v-if="goodsList.length>0 && !isScroll">我是有底线的~</view>
|
||||
<emptyPage v-if="goodsList.length==0 && !isScroll" title="暂无数据~"></emptyPage>
|
||||
<emptyPage v-if="goodsList.length === 0 && !isScroll" title="暂无数据~"></emptyPage>
|
||||
</view>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import emptyPage from '@/components/emptyPage.vue'
|
||||
import GoodList from "@/components/goodList";
|
||||
import { getGroomList } from "@/api/store";
|
||||
import * as ProductSpuApi from '@/api/product/spu.js';
|
||||
import * as PromotionActivityApi from '@/api/promotion/activity.js';
|
||||
import * as ProductUtil from '@/utils/product.js';
|
||||
export default {
|
||||
name: "HotNewGoods",
|
||||
components: {
|
||||
|
@ -39,18 +41,19 @@ export default {
|
|||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
imgUrls: [],
|
||||
imgUrls: [], // TODO @芋艿:没想好,读取哪里的 banner
|
||||
goodsList: [],
|
||||
name: "",
|
||||
icon: "",
|
||||
type:0,
|
||||
autoplay:true,
|
||||
circular:true,
|
||||
type: 0,
|
||||
autoplay: true,
|
||||
circular: true,
|
||||
interval: 3000,
|
||||
duration: 500,
|
||||
page:1,
|
||||
limit:8,
|
||||
isScroll:true
|
||||
recommendType: '',
|
||||
page: 1,
|
||||
limit: 8,
|
||||
isScroll: true
|
||||
};
|
||||
},
|
||||
onLoad: function(option) {
|
||||
|
@ -66,42 +69,57 @@ export default {
|
|||
uni.setNavigationBarTitle({
|
||||
title:"精品推荐"
|
||||
})
|
||||
this.recommendType = 'best';
|
||||
} else if (this.type === "2") {
|
||||
this.name = "热门榜单";
|
||||
this.icon = "icon-remen";
|
||||
uni.setNavigationBarTitle({
|
||||
title:"热门榜单"
|
||||
})
|
||||
this.recommendType = 'hot';
|
||||
} else if (this.type === "3") {
|
||||
this.name = "首发新品";
|
||||
this.icon = "icon-xinpin";
|
||||
uni.setNavigationBarTitle({
|
||||
title:"首发新品"
|
||||
})
|
||||
}else if (this.type === "4") {
|
||||
this.recommendType = 'new';
|
||||
} else if (this.type === "4") {
|
||||
this.name = "促销单品";
|
||||
this.icon = "icon-xinpin";
|
||||
uni.setNavigationBarTitle({
|
||||
title:"促销单品"
|
||||
})
|
||||
this.recommendType = 'benefit';
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获得推荐商品列表
|
||||
*/
|
||||
getIndexGroomList: function() {
|
||||
if(!this.isScroll) return
|
||||
let that = this;
|
||||
let type = this.type;
|
||||
getGroomList(type,{
|
||||
page:this.page,
|
||||
limit:this.limit
|
||||
}).then(res => {
|
||||
that.imgUrls = res.data.banner;
|
||||
that.goodsList = that.goodsList.concat(res.data.list);
|
||||
that.isScroll = res.data.list.length>=that.limit
|
||||
that.page++
|
||||
})
|
||||
.catch(function(res) {
|
||||
that.$util.Tips({ title: res });
|
||||
});
|
||||
if(!this.isScroll) {
|
||||
return
|
||||
}
|
||||
ProductSpuApi.getSpuPage({
|
||||
recommendType: this.recommendType,
|
||||
pageNo: this.page,
|
||||
pageSize: this.limit
|
||||
}).then(res => {
|
||||
const good_list = res.data.list;
|
||||
this.isScroll = good_list.length >= this.limit
|
||||
this.page++
|
||||
|
||||
// 设置营销活动
|
||||
const spuIds = good_list.map(item => item.id);
|
||||
if (spuIds.length > 0) {
|
||||
PromotionActivityApi.getActivityListBySpuIds(spuIds).then(res => {
|
||||
ProductUtil.setActivityList(good_list, res.data);
|
||||
this.goodsList = this.goodsList.concat(good_list); // 放在此处,避免 Vue 监控不到数组里的元素变化
|
||||
});
|
||||
}
|
||||
}).catch(res => {
|
||||
this.$util.Tips({ title: res });
|
||||
});
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
|
@ -112,7 +130,7 @@ export default {
|
|||
<style lang="scss">
|
||||
/deep/ .empty-box{
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
}
|
||||
.swiper,swiper,swiper-item,.slide-image{
|
||||
width: 100%;
|
||||
height: 280rpx;
|
||||
|
@ -131,7 +149,7 @@ export default {
|
|||
height: 2rpx;
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.txt-bar{
|
||||
padding: 20rpx 0;
|
||||
|
@ -140,4 +158,4 @@ export default {
|
|||
color: #666;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
@ -534,7 +534,6 @@
|
|||
this.iSshowH = true
|
||||
}
|
||||
this.loading = true
|
||||
console.log(this.goodType, '====')
|
||||
const type = this.goodType === 1 ? 'best' :
|
||||
this.goodType === 2 ? 'hot' :
|
||||
this.goodType === 3 ? 'new' :
|
||||
|
|
Loading…
Reference in New Issue