Browse Source

兑换大厅商品列表显示修改

hwb0 3 years ago
parent
commit
3dbd62f366
1 changed files with 92 additions and 89 deletions
  1. 92 89
      pages/core/index.vue

+ 92 - 89
pages/core/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="core-cla">
-		<u-navbar leftIconSize="0" :placeholder="true" bgColor="#ffffff" >
-			<view class="u-nav-slot" slot="left" >
+		<u-navbar leftIconSize="0" :placeholder="true" bgColor="#ffffff">
+			<view class="u-nav-slot" slot="left">
 				<text>兑换大厅</text>
 			</view>
 		</u-navbar>
@@ -10,10 +10,10 @@
 			<view class="uni-padding-wrap">
 				<view class="page-section swiper">
 					<view class="page-section-spacing">
-						
 						<swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
 							:duration="duration">
-							<swiper-item v-for="(item,index) in imgTop" :key="index" @click="toCoreRange(item.type,item.type=='link'?item.linkUrl:item.goodsTags)">
+							<swiper-item v-for="(item,index) in imgTop" :key="index"
+								@click="toCoreRange(item.type,item.type=='link'?item.linkUrl:item.goodsTags, item.name)">
 								<!-- <web-view :src="item.linkUrl" v-if="item.type=='link'"></web-view> -->
 								<img :src="item.picUrl" alt="">
 							</swiper-item>
@@ -26,31 +26,30 @@
 
 		<!-- 分类部分开始 -->
 		<view class="classificationBox">
-			<view v-for="(item,index) in goods" :key="index" @click="toCoreRange('category',item.categoryId)" class="ificationBox-mar">
+			<view v-for="(item,index) in goods" :key="index" @click="toCoreRange('category',item.categoryId, item.name)"
+				class="ificationBox-mar">
 				<img :src="item.picUrl" alt="">
 				<view v-text="item.name" style=" "></view>
 			</view>
 		</view>
 		<!-- 分类部分结束 -->
 
-		
-
 		<!-- 限时秒杀部分开始 -->
-		<view v-for="(item,index) in exclusive" :key="index">
+		<view v-for="(item,index) in exclusiveSingle" :key="index">
 			<view class=" sticky-bac">
 				<text class="sticky-bac-text1" v-text="item.name"></text>
-				<view @click="toCoreRange('tag',item.tagId)" class="sticky-bac-text2">
+				<view @click="toCoreRange('tag',item.tagId, item.name)" class="sticky-bac-text2">
 					<view></view>
 					<view class="flex ">
 						<text>更多</text>
 						<u-icon name="arrow-right" color="#9c9c9c" size="16"></u-icon>
 					</view>
-				</view>	
+				</view>
 			</view>
 			<view class="Seckill-bom">
-				<view class="Seckill-bom-grid" >
-					<view :url="`/pages/goods/detail?id=${ itemExc.goodsId }`" class="core-list-item"
-						hover-class="navigator-hover" v-for="(itemExc, indexNum) in exclusiveSingle[index]" :key="indexNum" >
+				<view class="Seckill-bom-grid">
+					<navigator :url="`/pages/goods/detail?id=${ itemExc.goodsId }`" class="core-list-item"
+						hover-class="navigator-hover" v-for="(itemExc, indexNum) in item.data" :key="indexNum">
 						<view class="flex iamge-wrap">
 							<image :src="itemExc.picUrl" mode=""></image>
 						</view>
@@ -59,7 +58,7 @@
 							<image src="../../static/icon/bean.png" mode="aspectFill"></image>
 							<view>× {{ itemExc.exchangePrice }}</view>
 						</view>
-					</view>
+					</navigator>
 					<view></view>
 				</view>
 			</view>
@@ -90,11 +89,12 @@
 					</view>
 				</view>
 				<view class="screen-coin-list" v-if="ascShow">
-					<view class="flex screen-coin-list-item" v-for="(item, index) in ascList" :key="index" @click="selectCoinTwo(item, index)">
+					<view class="flex screen-coin-list-item" v-for="(item, index) in ascList" :key="index"
+						@click="selectCoinTwo(item, index)">
 						<text :class="{ 'action': ascListIndex == index }">{{ item.text }}</text>
 					</view>
 				</view>
-				
+
 				<view class="screen-coin-list" v-if="coinShow">
 					<view class="flex screen-coin-list-item" v-for="(item, index) in coinList" :key="index"
 						@click="selectCoin(item, index)">
@@ -151,9 +151,9 @@
 				duration: 2000,
 				imgTop: [],
 				goods: [],
-				exclusive:[],
-				exclusiveSingle:[],
-					
+				exclusive: [],
+				exclusiveSingle: [],
+
 				pageNum: 1,
 				total: 0,
 				list: [],
@@ -220,25 +220,24 @@
 					startPrice: null,
 					endPrice: null
 				},
-				orderByColumn:'',//默认exchangePrice
-				isAsc:'',//从低到高asc isAsc:'desc'从高到低
-				ascShow:false,
-				ascList:[
-					{
-						data:'',
-						text:'默认排序'
+				orderByColumn: '', //默认exchangePrice
+				isAsc: '', //从低到高asc isAsc:'desc'从高到低
+				ascShow: false,
+				ascList: [{
+						data: '',
+						text: '默认排序'
 					},
 					{
-						data:'asc',
-						text:'价格从低到高'
+						data: 'asc',
+						text: '价格从低到高'
 					},
 					{
-						data:'desc',
-						text:'价格从高到低'
+						data: 'desc',
+						text: '价格从高到低'
 					},
 				],
-				ascListsingle:{},
-				ascListIndex:0,
+				ascListsingle: {},
+				ascListIndex: 0,
 			};
 		},
 		onShow() {
@@ -256,28 +255,30 @@
 			changeIndicatorDots(e) {
 				this.indicatorDots = true
 			},
+			
 			changeAutoplay(e) {
 				this.autoplay = true
 			},
+			
 			intervalChange(e) {
 				this.interval = e.target.value
 			},
+			
 			durationChange(e) {
 				this.duration = e.target.value
 			},
+			
 			// 跳转点击事件
-			toCoreRange(type,data) {
-				if(type == "link"){
+			toCoreRange(type, data, name) {
+				if (type == "link") {
 					// web-view
-				}else{
+				} else {
 					uni.navigateTo({
-					url: `/pages/coreRange/coreRange?type=${type}&data=${data}`,
-				})
+						url: `/pages/coreRange/coreRange?type=${ type }&data=${ data }&name=${ name }`,
+					})
 				}
-				// 跳转指令
-				
-				console.log(`标签是${type},数据是${data}`)
 			},
+			
 			//轮播图
 			getSwiper() {
 				$http.post(`/api/v1/mp/user/exchange/banner/list`, {
@@ -291,9 +292,12 @@
 					this.imgTop = this.imgTop.concat(res.data)
 				})
 			},
+			
 			// 分类列表
-			getListIficationBox(){
-				$http.post(`/api/v1/mp/user/exchange/category/list`, {noToken: true}).then(res => {
+			getListIficationBox() {
+				$http.post(`/api/v1/mp/user/exchange/category/list`, {
+					noToken: true
+				}).then(res => {
 					res.data.forEach(item => {
 						let picUrlArr = item.picUrl.split(',')
 						item.picUrl = env.filePublic + picUrlArr[0]
@@ -301,27 +305,31 @@
 					this.goods = this.goods.concat(res.data)
 				})
 			},
+			
 			// 秒杀
-			getExclusive(){
-				$http.post(`/api/v1/mp/user/exchange/activity/list`, {noToken: true}).then(res => {
-					this.exclusive = res.data
-					console.log(res)
-					let arr = []
-					res.data.forEach(item=>{
-						$http.post(`/api/v1/mp/user/exchange/goods/list?pageNum=1&pageSize=4`, {
-							noToken: true,
-							tagIds: item.tagId, // 分类ID,可空
-							}).then(r => {
-								r.rows.forEach(ite => {
-									let picUrlArr = ite.picUrl.split(',')
-									ite.picUrl = env.filePublic + picUrlArr[0]
-								})
-								arr.push(r.rows)
-						})
+			async getExclusive() {
+				let resData = await $http.post(`/api/v1/mp/user/exchange/activity/list`, {
+					noToken: true
+				})
+				let goodsList = []
+				for (let item of resData.data) {
+
+					let resDatas = await $http.post(`/api/v1/mp/user/exchange/goods/list?pageNum=1&pageSize=4`, {
+						noToken: true,
+						tagIds: item.tagId
+					})
+					goodsList.push({
+						data: resDatas.rows,
+						name: item.name,
+						tagId: item.tagId
+					})
+				}
+				goodsList.forEach(item => {
+					item.data.forEach(items => {
+						items.picUrl = env.filePublic + items.picUrl.split(',')[0]
 					})
-					this.exclusiveSingle = arr
 				})
-	
+				this.exclusiveSingle = goodsList
 			},
 
 
@@ -336,7 +344,9 @@
 					...this.coinNum,
 					noToken: true
 				}
-				$http.post(`/api/v1/mp/user/exchange/goods/list?pageNum=${this.pageNum}&pageSize=20&orderByColumn=${this.orderByColumn}&isAsc=${this.isAsc}`, data).then(
+				$http.post(
+					`/api/v1/mp/user/exchange/goods/list?pageNum=${this.pageNum}&pageSize=20&orderByColumn=${this.orderByColumn}&isAsc=${this.isAsc}`,
+					data).then(
 					res => {
 						uni.hideLoading();
 						if (res.code == 0) {
@@ -365,32 +375,21 @@
 				this.getList()
 			},
 			
-			// openSelect() {
-			// 	uni.createSelectorQuery().select(".uSticky-toTop").boundingClientRect((data) => {
-			// 		uni.createSelectorQuery().select(".core-cla").boundingClientRect((res) => {
-			// 			uni.pageScrollTo({
-			// 				duration: 100, //过渡时间必须为0,uniapp bug,否则运行到手机会报错
-			// 				scrollTop: data.top - res.top,
-			// 			})
-			// 			console.log(res.top)
-			// 			console.log(data.top)
-			// 		}).exec()
-			// 	}).exec()
-			// },
-			openSelect(){
-				if(this.coinShow == false){
+			openSelect() {
+				if (this.coinShow == false) {
 					this.coinShow = true
 					this.ascShow = false
-				}else{
+				} else {
 					this.coinShow = false
 				}
 			},
+			
 			//排序切换
-			ascSelect(){
-				if(this.ascShow == false){
+			ascSelect() {
+				if (this.ascShow == false) {
 					this.ascShow = true
 					this.coinShow = false
-				}else{
+				} else {
 					this.ascShow = false
 				}
 			},
@@ -403,19 +402,19 @@
 				this.coinNum.endPrice = item.max
 				this.pageList()
 			},
-			selectCoinTwo(item, index){
+			selectCoinTwo(item, index) {
 				this.ascListIndex = index
 				this.ascListsingle = this.ascList[this.ascListIndex]
 				this.ascShow = false
-				
-				if(item.data == ''){
+
+				if (item.data == '') {
 					this.orderByColumn = ''
 					this.isAsc = ''
-				}else{
+				} else {
 					this.isAsc = item.data
 					this.orderByColumn = 'exchangePrice'
 				}
-			
+
 				this.pageListTwo()
 			},
 		},
@@ -444,7 +443,8 @@
 			overflow: hidden;
 		}
 	}
-	.uni-padding-wrap img{
+
+	.uni-padding-wrap img {
 		width: 100%;
 		height: 100%;
 	}
@@ -480,7 +480,9 @@
 			line-height: 25px;
 			display: inline-block;
 			padding: 8px;
-		};
+		}
+
+		;
 
 		.sticky-bac-text2 {
 			width: 128px;
@@ -498,9 +500,9 @@
 		padding: 0 0.3rem;
 		// margin-bottom: 10px;
 		background-color: #FFFFFF;
-		
+
 		.Seckill-bom-grid {
-			min-height:550rpx ;
+			min-height: 550rpx;
 			display: flex;
 			flex-wrap: wrap;
 			justify-content: space-between;
@@ -508,7 +510,8 @@
 			margin-bottom: 10px;
 		}
 	}
-	.screen-coin-shopin{
+
+	.screen-coin-shopin {
 		color: #2f2f2f;
 		font-size: 18px;
 		line-height: 25px;