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,41 +69,56 @@ 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 | ||||
| 			if(!this.isScroll) { | ||||
|         return | ||||
|       } | ||||
|       ProductSpuApi.getSpuPage({ | ||||
|         recommendType: this.recommendType, | ||||
|         pageNo: this.page, | ||||
|         pageSize: 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 }); | ||||
|         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 }); | ||||
|       }); | ||||
|     } | ||||
|   }, | ||||
|  |  | |||
|  | @ -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
	
	 YunaiV
						YunaiV