From 8a55298d7e388113c05bd70a549f17a6e7aacee8 Mon Sep 17 00:00:00 2001
From: zhaojs <349234519@qq.com>
Date: 星期一, 26 六月 2023 10:51:37 +0800
Subject: [PATCH] 返利页添加轮播图

---
 uniapp/pages/active/tmsearch.vue |   55 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/uniapp/pages/active/tmsearch.vue b/uniapp/pages/active/tmsearch.vue
index 7d7f19d..a95608f 100644
--- a/uniapp/pages/active/tmsearch.vue
+++ b/uniapp/pages/active/tmsearch.vue
@@ -76,11 +76,13 @@
 					</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>
+					<view class="goods-items borderBox" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)">
+						<!-- <colGoodsImg :popBannerSList="popBannerSList"></colGoodsImg> -->
+						  <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>
@@ -91,17 +93,19 @@
 
 <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,
 				navList: [],
-
 				fiexdHeight: '',
 				fiexdtop: '',
 				goodsList: [],
@@ -109,6 +113,7 @@
 				canloadmore: false,
 				loadstatus: 'loading',
 				nowsec:0,
+				isinsert:false,
 				secrendSearch:[
 					{
 						id:0,
@@ -142,7 +147,9 @@
 			}
 		},
 		onLoad() {
-			this.getNav()
+			this.getNav();
+			this.getPageImg();
+			
 		},
 		onPageScroll(e) {
 			this.scrollTop = e.scrollTop
@@ -154,11 +161,9 @@
 		},
 		mounted() {
 			uni.createSelectorQuery().in(this).select('.fixed-container').boundingClientRect(data => {
-				console.log(data.top);
 				this.fiexdHeight = data.height
 			}).exec();
 			uni.createSelectorQuery().in(this).select('.rangeList-container').boundingClientRect(data => {
-				console.log(data.top);
 				this.fiexdtop = data.top - this.fiexdHeight
 			}).exec();
 		},
@@ -166,7 +171,6 @@
 			getNav() {
 				var that = this;
 			    this.$u.api.getTopCalss({ctype:1,parentId:0}).then(e => {
-				    console.log(e);
 					if(e.code != 0)return that.$alert(e.msg)
 					e.data.list.unshift({cid:"-1",cname:"澶╃尗瓒呭競",ctype:"1"});
 					e.data.list.unshift({cid:"0",cname:"鍏ㄩ儴",ctype:"1"});
@@ -188,7 +192,6 @@
 					tchaoshi:tchaoshi,
 					secrend_search:this.nowsec
 				}).then(e => {
-					console.log(e);
 					if (e.code != 0) return that.$alert(e.msg)
 					var res = e.data;
 					uni.stopPullDownRefresh();
@@ -203,8 +206,30 @@
 						that.loadstatus = 'loading'
 						that.pageCurrent ++
 					}
+					/* if(!that.isinsert&&res&&res.length>0)
+					{
+						that.goodsList.unshift(res[0]);
+						that.isinsert=true;
+					} */
 					that.goodsList = that.goodsList.concat(res)
 				}).catch(function(err) {})
+			},
+			getPageImg()
+			{
+			 	var that=this;
+				this.$u.api.getBanner({
+					type: '11,16'
+				}).then(e => {
+					if (e.code == 1) return that.$alert(e.msg);
+					var res = e.data.info;
+					this.popBannerSList=res.tmImg;
+					if(res.tmImg&&res.tmImg.length>0)
+					{
+						that.goodsList.unshift(res[0]);
+					}
+				}).catch(function(err) {
+					console.log(err)
+				})
 			},
 			changeRange(id) {
 				this.pageCurrent = 1
@@ -224,9 +249,13 @@
 			},
 
 			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() {

--
Gitblit v1.9.3