DELL 3 жил өмнө
parent
commit
7dde1b4af3

+ 123 - 31
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>
@@ -14,6 +14,7 @@
 						<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)">
+								<!-- <web-view :src="item.linkUrl" v-if="item.type=='link'"></web-view> -->
 								<img :src="item.picUrl" alt="">
 							</swiper-item>
 						</swiper>
@@ -25,13 +26,15 @@
 
 		<!-- 分类部分开始 -->
 		<view class="classificationBox">
-			<view v-for="(item,index) in goods" :key="index" @click="toCoreRange('tag',item.categoryId)" class="ificationBox-mar">
+			<view v-for="(item,index) in goods" :key="index" @click="toCoreRange('category',item.categoryId)" 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 class=" sticky-bac">
@@ -46,7 +49,7 @@
 			</view>
 			<view class="Seckill-bom">
 				<view class="Seckill-bom-grid" >
-					<navigator :url="`/pages/goods/detail?id=${ itemExc.goodsId }`" class="core-list-item"
+					<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="flex iamge-wrap">
 							<image :src="itemExc.picUrl" mode=""></image>
@@ -56,7 +59,8 @@
 							<image src="../../static/icon/bean.png" mode="aspectFill"></image>
 							<view>× {{ itemExc.exchangePrice }}</view>
 						</view>
-					</navigator>
+					</view>
+					<view></view>
 				</view>
 			</view>
 		</view>
@@ -66,15 +70,31 @@
 		<!-- 精选商品部份开始 -->
 		<u-sticky offset-top="60" class="">
 			<view class="screen-coin uSticky-toTop">
-				<view class="flex screen-coin-select" @click="openSelect">
-					<view class="title">
-						<text v-if="actionInfo.min">{{ actionInfo.min }}</text>
-						<text v-if="actionInfo.max">-{{ actionInfo.max }}</text>
-						<text>{{ actionInfo.desc }}</text>
+				<view class="screen-coin-shopin">精选商品</view>
+				<view class="flex screen-coin-select">
+					<view @click="ascSelect" class="flex">
+						<view class="title">
+							<text>{{ ascListsingle.text}}</text>
+						</view>
+						<u-icon name="arrow-up" color="#333" size="18" v-if="ascShow"></u-icon>
+						<u-icon name="arrow-down" color="#333" size="18" v-else></u-icon>
+					</view>
+					<view @click="openSelect" class="flex">
+						<view class="title">
+							<text v-if="actionInfo.min">{{ actionInfo.min }}</text>
+							<text v-if="actionInfo.max">-{{ actionInfo.max }}</text>
+							<text>{{ actionInfo.desc }}</text>
+						</view>
+						<u-icon name="arrow-up" color="#333" size="18" v-if="coinShow"></u-icon>
+						<u-icon name="arrow-down" color="#333" size="18" v-else></u-icon>
+					</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)">
+						<text :class="{ 'action': ascListIndex == index }">{{ item.text }}</text>
 					</view>
-					<u-icon name="arrow-up" color="#333" size="18" v-if="coinShow"></u-icon>
-					<u-icon name="arrow-down" color="#333" size="18" v-else></u-icon>
 				</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)">
@@ -108,7 +128,7 @@
 		<custom-tab-bar :activeValue="'core'" />
 
 		<u-overlay :show="coinShow" @click="coinShow = false" zIndex="1"></u-overlay>
-
+		<u-overlay :show="ascShow" @click="ascShow = false" zIndex="1"></u-overlay>
 		<!-- 精选商品结束 -->
 		<custom-tab-bar :activeValue="'core'" />
 	</view>
@@ -199,7 +219,26 @@
 				coinNum: {
 					startPrice: null,
 					endPrice: null
-				}
+				},
+				orderByColumn:'',//默认exchangePrice
+				isAsc:'',//从低到高asc isAsc:'desc'从高到低
+				ascShow:false,
+				ascList:[
+					{
+						data:'',
+						text:'默认排序'
+					},
+					{
+						data:'asc',
+						text:'价格从低到高'
+					},
+					{
+						data:'desc',
+						text:'价格从高到低'
+					},
+				],
+				ascListsingle:{},
+				ascListIndex:0,
 			};
 		},
 		onShow() {
@@ -208,6 +247,7 @@
 		onLoad() {
 			this.pageList()
 			this.actionInfo = this.coinList[this.actionIndex]
+			this.ascListsingle = this.ascList[this.ascListIndex]
 			this.getSwiper()
 			this.getListIficationBox()
 			this.getExclusive()
@@ -227,10 +267,15 @@
 			},
 			// 跳转点击事件
 			toCoreRange(type,data) {
-				// 跳转指令
-				uni.navigateTo({
+				if(type == "link"){
+					// web-view
+				}else{
+					uni.navigateTo({
 					url: `/pages/coreRange/coreRange?type=${type}&data=${data}`,
 				})
+				}
+				// 跳转指令
+				
 				console.log(`标签是${type},数据是${data}`)
 			},
 			//轮播图
@@ -260,9 +305,10 @@
 			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&orderByColumn=exchangePrice&isAsc=asc`, {
+						$http.post(`/api/v1/mp/user/exchange/goods/list?pageNum=1&pageSize=4`, {
 							noToken: true,
 							tagIds: item.tagId, // 分类ID,可空
 							}).then(r => {
@@ -285,11 +331,12 @@
 					title: '加载中'
 				});
 				let data = {
-					categoryId: '',
+					categoryId: this.categoryId,
+					tagIds: this.tagIds,
 					...this.coinNum,
 					noToken: true
 				}
-				$http.post(`/api/v1/mp/user/exchange/goods/list?pageNum=${this.pageNum}&pageSize=20`, 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) {
@@ -311,17 +358,41 @@
 				this.list = []
 				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,
-						})
-					}).exec()
-				}).exec()
-
-				this.coinShow = !this.coinShow
+			pageListTwo() {
+				this.pageNum = 1
+				this.total = 0
+				this.list = []
+				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){
+					this.coinShow = true
+					this.ascShow = false
+				}else{
+					this.coinShow = false
+				}
+			},
+			//排序切换
+			ascSelect(){
+				if(this.ascShow == false){
+					this.ascShow = true
+					this.coinShow = false
+				}else{
+					this.ascShow = false
+				}
 			},
 
 			selectCoin(item, index) {
@@ -332,6 +403,21 @@
 				this.coinNum.endPrice = item.max
 				this.pageList()
 			},
+			selectCoinTwo(item, index){
+				this.ascListIndex = index
+				this.ascListsingle = this.ascList[this.ascListIndex]
+				this.ascShow = false
+				
+				if(item.data == ''){
+					this.orderByColumn = ''
+					this.isAsc = ''
+				}else{
+					this.isAsc = item.data
+					this.orderByColumn = 'exchangePrice'
+				}
+			
+				this.pageListTwo()
+			},
 		},
 		//精选商品
 		onReachBottom() {
@@ -422,7 +508,13 @@
 			margin-bottom: 10px;
 		}
 	}
-
+	.screen-coin-shopin{
+		color: #2f2f2f;
+		font-size: 18px;
+		line-height: 25px;
+		display: inline-block;
+		padding: 8px;
+	}
 
 
 	//================

+ 2 - 13
pages/coreRange/coreRange.vue

@@ -1,17 +1,10 @@
 <template>
 	<view>
-		<u-navbar leftIconSize="0" :placeholder="true" bgColor="#ffffff">
-			<view class="flex u-nav-slot" slot="left" @click="toBackCore">
-				<u-icon name="arrow-left" bold="true" color="#151515" size="18"></u-icon>
-				<text>兑换大厅</text>
-			</view>
-		</u-navbar>
+		<u-navbar :border="true" :placeholder="true" :autoBack="true" bgColor="#ffffff" title="兑换大厅"></u-navbar>
 		<view class="screen-coin">
 			<view class="flex screen-coin-select">
 				<view @click="ascSelect" class="flex">
 					<view class="title">
-						<!-- <text v-if="actionInfo.min">{{ actionInfo.min }}</text>
-						<text v-if="actionInfo.max">-{{ actionInfo.max }}</text> -->
 						<text>{{ ascListsingle.text}}</text>
 					</view>
 					<u-icon name="arrow-up" color="#333" size="18" v-if="ascShow"></u-icon>
@@ -166,9 +159,6 @@
 				],
 				ascListsingle:{},
 				ascListIndex:0,
-				ascListNum:{
-					
-				}
 				
 			};
 		},
@@ -176,7 +166,7 @@
 	// 跳转接参数
 		onLoad(opthios) {
 			console.log(opthios)
-			if(opthios.type = 'link'){
+			if(opthios.type == 'category'){
 				this.categoryId = opthios.data
 			}else{
 				this.tagIds = opthios.data
@@ -264,7 +254,6 @@
 				this.ascListsingle = this.ascList[this.ascListIndex]
 				this.ascShow = false
 				
-				console.log(1111111111,item.data)
 				if(item.data == ''){
 					this.orderByColumn = ''
 					this.isAsc = ''