Browse Source

前端gjy

gjy 3 years ago
parent
commit
eb6b249e27
2 changed files with 45 additions and 3 deletions
  1. 45 3
      pages/business/business.vue
  2. BIN
      static/img/jiaoyi/back@3x.png

+ 45 - 3
pages/business/business.vue

@@ -93,6 +93,9 @@
 		<view style='height:65vh;background:#F5F6FA;line-height:65vh;text-align:center;' v-if='buyInfo.length==0'>
 			当前暂无结果
 		</view>
+		<image v-if='topState' @click='top' class='back' src="../../static/img/jiaoyi/back@3x.png" mode=""></image>
+		<image @click='show=true' class='fabu' src="../../static/img/jiaoyi/ic_fabu@3x.png" mode=""></image>
+		<u-picker mode="selector" @confirm='confirmrelease' v-model="show"   :range="releaseType"></u-picker>
 		<u-back-top :scroll-top="scrollTop" tips="顶部" :custom-style="{backgroundColor: '#a0cfff',color: '#2979ff'}"
 			:iconStyle="{color: '#2979ff',fontSize: '34rpx'}" mode="square" icon="arrow-up"></u-back-top>
 
@@ -106,11 +109,13 @@
 			return {
 				PageCur: "buy",
 				buyInfo: [],
+				releaseType: ["我要卖粮", "我要买粮"],
 				limit: 10, //每次取条目数
 				loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
 				isLoadMore: false, //是否加载中
 				showTran: true,
 				scrollTop: 0,
+				show:false,
 				status: false,
 				pageSize: 10,
 				searchKeyWord: '',
@@ -123,6 +128,7 @@
 					title: '我要卖粮',
 					id: '1'
 				}],
+				topState:false,
 				TabCur: 0,
 				current: 1,
 				location: '全国',
@@ -136,6 +142,13 @@
 				statusBarHeight: "height:"
 			}
 		},
+		onPageScroll(e){ //根据距离顶部距离是否显示回到顶部按钮
+		    if(e.scrollTop>300){ //当距离大于600时显示回到顶部按钮
+		        this.topState = true
+		    }else{ //当距离小于600时显示回到顶部按钮
+		        this.topState = false
+		    }
+		},
 		onShow() {
 			uni.showTabBar()
 			uni.hideKeyboard()
@@ -192,9 +205,9 @@
 			this.keywords = options.keywords ? options.keywords : ''
 			this.loadData();
 		},
-		onPageScroll(e) {
-			this.scrollTop = e.scrollTop;
-		},
+		// onPageScroll(e) {
+		// 	this.scrollTop = e.scrollTop;
+		// },
 		//下拉刷新
 		onPullDownRefresh() {
 			this.currentPage = 1
@@ -213,6 +226,23 @@
 			}
 		},
 		methods: {
+			top() { //回到顶部  
+			    uni.pageScrollTo({ 
+			      scrollTop: 0, duration: 300 
+			    }); 
+			},
+			confirmrelease(e){
+				console.log(e)
+				if(e[0]==1){
+					uni.navigateTo({
+						url: `/pageD/myRelease/buyGrain`
+					})
+				}else{
+					uni.navigateTo({
+						url: `/pageD/myRelease/sellGrain`
+					})
+				}
+			},
 			sousuo(name) {
 				var page = '/pageA/product/lookup?TabCur=' + this.TabCur + '&searchKeyWord=' + name
 				uni.navigateTo({
@@ -873,4 +903,16 @@
 	.number-style{
 		font-size: 44rpx;
 	}
+	.fabu{
+		position:fixed;
+		bottom:60px;right:0;
+		width:64px;
+		height:64px;
+	}
+	.back{
+		position:fixed;
+		bottom:130px;right:7px;
+		width:52px;
+		height:52px;
+	}
 </style>

BIN
static/img/jiaoyi/back@3x.png