Browse Source

添加定位

wangchao 3 years ago
parent
commit
71c17a01bc
1 changed files with 245 additions and 153 deletions
  1. 245 153
      pages/grain_pulse/home.vue

+ 245 - 153
pages/grain_pulse/home.vue

@@ -2,11 +2,13 @@
 	<view>
 		<view class="header">
 			<view class="flex justify-between map">
-				<view class='Medium flex align-item-center locationwrap' @click='naviageToPage("/pages/grain_pulse/position/position")'>
+				<view class='Medium flex align-item-center locationwrap'
+					@click='naviageToPage("/pages/grain_pulse/position/position")'>
 					<image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
-					黑龙江中天昊元…
+					{{position}}
 				</view>
-				<view @click='naviageToPage("/pages/grain_pulse/distribution/distribution")' class='Regular flex align-item-center distribution justify-center'>
+				<view @click='naviageToPage("/pages/grain_pulse/distribution/distribution")'
+					class='Regular flex align-item-center distribution justify-center'>
 					<image class='cangku' src="../../static/img/liangmai/cangku.png" mode=""></image>
 					分布
 				</view>
@@ -18,7 +20,7 @@
 				</view>
 			</view>
 		</view>
-		<view class="content" >
+		<view class="content">
 			<view @click='friendcircle' class="friendcircle">
 				<view class='title flex align-item-center Medium'>
 					<image class='icon-friendcircle' src="../../static/img/liangmai/icon.png" mode=""></image>
@@ -27,15 +29,25 @@
 				<view class='friendcircle-content flex justify-between'>
 					<image class='bg' src="../../static/img/liangmai/bg.png" mode=""></image>
 					<view class='friendcircle-content-right'>
-						<view class='friendcircle-content-right-item Regular flex align-item-center'><image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…</view>
-						<view class='friendcircle-content-right-item Regular flex align-item-center'><image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…</view>
-						<view class='friendcircle-content-right-item Regular flex align-item-center'><image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…</view>
-						<view class='friendcircle-content-right-item Regular flex align-item-center'><image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…</view>
+						<view class='friendcircle-content-right-item Regular flex align-item-center'>
+							<image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
+						</view>
+						<view class='friendcircle-content-right-item Regular flex align-item-center'>
+							<image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
+						</view>
+						<view class='friendcircle-content-right-item Regular flex align-item-center'>
+							<image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
+						</view>
+						<view class='friendcircle-content-right-item Regular flex align-item-center'>
+							<image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
+						</view>
 					</view>
 				</view>
 			</view>
-			<scroll-view  scroll-x="true" scroll-with-animation="true" class='list-type'>
-				<view  v-for='item in searchTypes' @click='mainBusinessTypecahnge(item)' :class='mainBusinessTypeKey==item.value?"Semibold active":"Regular"' class="typeitem">{{item.name}}</view>
+			<scroll-view scroll-x="true" scroll-with-animation="true" class='list-type'>
+				<view v-for='item in searchTypes' @click='mainBusinessTypecahnge(item)'
+					:class='mainBusinessTypeKey==item.value?"Semibold active":"Regular"' class="typeitem">{{item.name}}
+				</view>
 			</scroll-view>
 			<view v-for='item in datalist' @click='todetails(item)' class="listitem">
 				<view class="flex">
@@ -46,7 +58,8 @@
 					</view>
 				</view>
 				<view class="flex  align-item-center justify-between">
-					<view  @click.stop='naviageToPage("/pages/grain_pulse/localtion/localtion")' class='companylocation flex align-item-center Regular'>
+					<view @click.stop='naviageToPage("/pages/grain_pulse/localtion/localtion")'
+						class='companylocation flex align-item-center Regular'>
 						<image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
 						辽宁省营口市鲅鱼圈区xx路108号
 					</view>
@@ -58,70 +71,112 @@
 			<image style='width:56.5px;height:28px;' src="../../static/img/liangmai/ruzhu.png" mode=""></image>
 			<view class='enter-content'>入驻</view>
 		</view>
-		
+
 	</view>
 </template>
 
 <script>
 	export default {
-        components: {
-            
-        },
+		components: {
+
+		},
 		data() {
 			return {
-				status:0,
-				mainBusinessType:'',
-				mainBusinessTypeKey:'0',
+				position: "未设置",
+				status: 0,
+				mainBusinessType: '',
+				mainBusinessTypeKey: '0',
 				pageSize: 10,
 				currentPage: 1,
-				searchTypes:[
-				{name:'全部',value:'0'},{name:'粮库',value:'1'},{name:'加工厂',value:'2'},
-				{name:'烘干塔',value:'3'},{name:'饲料厂',value:'4'},{name:'养殖场',value:'5'},
-				{name:'粮贸',value:'6'},{name:'期货',value:'7'}
+				searchTypes: [{
+						name: '全部',
+						value: '0'
+					}, {
+						name: '粮库',
+						value: '1'
+					}, {
+						name: '加工厂',
+						value: '2'
+					},
+					{
+						name: '烘干塔',
+						value: '3'
+					}, {
+						name: '饲料厂',
+						value: '4'
+					}, {
+						name: '养殖场',
+						value: '5'
+					},
+					{
+						name: '粮贸',
+						value: '6'
+					}, {
+						name: '期货',
+						value: '7'
+					}
 				],
-				datalist:[]
+				datalist: []
 			}
 		},
-		onShow(){
-			this.$api.doRequest('get','/settledCompanyInfo/selectSettledCompanyInfo',{mainBusinessType:this.mainBusinessType,pageSize: this.pageSize,
-						currentPage: this.currentPage,pcFlag:2}).then(res => {
-				if(res.data.code==200){
-					this.datalist=res.data.data.records
+		onShow(val) {
+
+			this.$api.doRequest('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
+				mainBusinessType: this.mainBusinessType,
+				pageSize: this.pageSize,
+				currentPage: this.currentPage,
+				pcFlag: 2
+			}).then(res => {
+				if (res.data.code == 200) {
+					this.datalist = res.data.data.records
 				}
 			})
+			uni.getStorage({
+				key: 'setLocaltion',
+				success: (res) => {
+					console.log(res.data)
+					this.position = res.data
+					uni.removeStorage({
+						key: 'setLocaltion'
+					})
+				},
+
+			})
 		},
-		onLoad(){
-			
+		onLoad(option) {
+			debugger
+			if (option.position)
+				this.position = option.position
 		},
 		methods: {
-			mainBusinessTypecahnge(item){
-				if(item.name!='全部'){
-					this.mainBusinessType=item.name
-				}else{
-					this.mainBusinessType=''
+			mainBusinessTypecahnge(item) {
+				if (item.name != '全部') {
+					this.mainBusinessType = item.name
+				} else {
+					this.mainBusinessType = ''
 				}
-				this.mainBusinessTypeKey=item.value
+				this.mainBusinessTypeKey = item.value
 			},
-			enter(){
+			enter() {
 				//入驻
 				uni.navigateTo({
-					url:'/pages/grain_pulse/enter'
+					url: '/pages/grain_pulse/enter'
 				})
 			},
-			friendcircle(){
+			friendcircle() {
 				uni.navigateTo({
-					url:'/pages/grain_pulse/friendcircle'
+					url: '/pages/grain_pulse/friendcircle'
 				})
 			},
-			todetails(item){
+			todetails(item) {
 				uni.navigateTo({
-					url:'/pages/grain_pulse/details?id='+item.id
+					url: '/pages/grain_pulse/details?id=' + item.id
 				})
 			},
-			naviageToPage(item){
+			naviageToPage(item) {
 				console.log(item)
 				uni.navigateTo({
-					url:item
+					url: item
 				})
 			}
 		}
@@ -130,164 +185,201 @@
 
 <style scoped>
 	/* 《--头部 */
-	.header{
-		padding:0 12.5px;
-		background:#fff;
-		border-radius:0 0 10px 10px;
+	.header {
+		padding: 0 12.5px;
+		background: #fff;
+		border-radius: 0 0 10px 10px;
 	}
+
 	/* 头部--》 */
 	/* 《--定位 */
-	.location{
-		width:15.5px;height:17.5px;margin-right:2.5px;
+	.location {
+		width: 15.5px;
+		height: 17.5px;
+		margin-right: 2.5px;
 	}
-	.locationwrap{
-		font-size:16px;
+
+	.locationwrap {
+		font-size: 16px;
 	}
+
 	/* 定位 --》 */
 	/* 《--分布 */
-	.map{
-		padding:8.5px 0;
+	.map {
+		padding: 8.5px 0;
 	}
-	.cangku{
-		width:16.5px;height:16.5px;margin-right:5px;
+
+	.cangku {
+		width: 16.5px;
+		height: 16.5px;
+		margin-right: 5px;
 	}
-	.distribution{
-		background:#F5F6FA;
+
+	.distribution {
+		background: #F5F6FA;
 		width: 71.5px;
-		height:32px;
-		border-radius:15px;
-		font-size:12px;
+		height: 32px;
+		border-radius: 15px;
+		font-size: 12px;
 	}
+
 	/* 分布--》 */
 	/* 《--搜索 */
-	.cu-bar .search-form{
-		background:#F5F6F9;
-		margin:0;
-		margin-bottom:18px;
-		padding:10px 18px;
+	.cu-bar .search-form {
+		background: #F5F6F9;
+		margin: 0;
+		margin-bottom: 18px;
+		padding: 10px 18px;
 	}
-	.icon-scarch{
-		width:15px;
-		height:15px;
-		margin-right:5px;
+
+	.icon-scarch {
+		width: 15px;
+		height: 15px;
+		margin-right: 5px;
 	}
+
 	/* 搜索--》 */
 	/* 《--内容 */
-	.content{
-		margin-top:13px;
+	.content {
+		margin-top: 13px;
 	}
+
 	/* 内容--》 */
 	/* 《--圈友说 */
-	.friendcircle{
-		background:#fff;
-		margin:0 9px;
-		border-radius:4px;
+	.friendcircle {
+		background: #fff;
+		margin: 0 9px;
+		border-radius: 4px;
 	}
-	.friendcircle .title{
-		font-size:16px;
-		padding:11.5px 14.5px;
+
+	.friendcircle .title {
+		font-size: 16px;
+		padding: 11.5px 14.5px;
 	}
-	.icon-friendcircle{
-		width:17px;height: 17px;margin-right:5.5px;
+
+	.icon-friendcircle {
+		width: 17px;
+		height: 17px;
+		margin-right: 5.5px;
 	}
-	.bg{
-		width:110px;height:124px;
+
+	.bg {
+		width: 110px;
+		height: 124px;
 	}
-	.friendcircle-content{
-		padding:0 17px 18px;
+
+	.friendcircle-content {
+		padding: 0 17px 18px;
 	}
-	.friendcircle-content-right{
-		margin-left:15.5px;
+
+	.friendcircle-content-right {
+		margin-left: 15.5px;
 	}
-	.friendcircle-content-right-item{
+
+	.friendcircle-content-right-item {
 		background: linear-gradient(90deg, #F5F6FA 0%, #FFFFFF 100%);
-		border-radius:12.5px;
-		margin-bottom:10px;
-		width:205.5px;
-		font-size:12px;
-		padding:3px 0;
+		border-radius: 12.5px;
+		margin-bottom: 10px;
+		width: 205.5px;
+		font-size: 12px;
+		padding: 3px 0;
 	}
-	.headportrait{
-		width:22.5px;height:22.5px;
-		margin-right:8.5px;
+
+	.headportrait {
+		width: 22.5px;
+		height: 22.5px;
+		margin-right: 8.5px;
 	}
+
 	/* 圈友说--》 */
 	/* 《--类型 */
-	.list-type{
+	.list-type {
 		background: linear-gradient(180deg, #F5F6FA 0%, #FFFFFF 100%);
-		width:100vw;
-		padding-top:5px;
-		height:49px;
+		width: 100vw;
+		padding-top: 5px;
+		height: 49px;
 		overflow-x: scroll;
 		white-space: nowrap;
 	}
-	.typeitem{
-		margin:10px;
-		position:relative;
-		display:inline-block;
-		padding-top:8px;
-		padding-bottom:5px;
+
+	.typeitem {
+		margin: 10px;
+		position: relative;
+		display: inline-block;
+		padding-top: 8px;
+		padding-bottom: 5px;
 	}
-	.typeitem.active{
-		font-size:16px;
+
+	.typeitem.active {
+		font-size: 16px;
 	}
-	.typeitem.active:after{
-		content:'';
-		display:block;
-		position:absolute;
-		height:3px;
-		bottom:0;
-		background:#22C572;
-		width:50%;
-		left:50%;
+
+	.typeitem.active:after {
+		content: '';
+		display: block;
+		position: absolute;
+		height: 3px;
+		bottom: 0;
+		background: #22C572;
+		width: 50%;
+		left: 50%;
 		transform: translateX(-50%);
 	}
+
 	/* 类型--》 */
 	/* 《--数据 */
-	.listitem{
-		background:#fff;
-		margin:10px;
-		padding:15px 19px;
+	.listitem {
+		background: #fff;
+		margin: 10px;
+		padding: 15px 19px;
 	}
-	.listitem-left{
-		width:98.5px;
-		height:96.5px;
-		margin-right:8px;
-		border-radius:5px;
+
+	.listitem-left {
+		width: 98.5px;
+		height: 96.5px;
+		margin-right: 8px;
+		border-radius: 5px;
 	}
-	.companyname{
-		font-size:14px;
-		color:#333;
+
+	.companyname {
+		font-size: 14px;
+		color: #333;
 	}
-	.introduce{
-		font-size:12px;
-		color:#676E80;
+
+	.introduce {
+		font-size: 12px;
+		color: #676E80;
 	}
-	.companylocation{
-		color:#676E80;
-		background:#F5F6FA;
-		margin-top:8px;
-		padding:4px 10px;
-		border-radius:15px;
+
+	.companylocation {
+		color: #676E80;
+		background: #F5F6FA;
+		margin-top: 8px;
+		padding: 4px 10px;
+		border-radius: 15px;
 	}
-	.distance{
-		color:#AFB3BF;
-		padding:4px;
-		margin-top:8px;
+
+	.distance {
+		color: #AFB3BF;
+		padding: 4px;
+		margin-top: 8px;
 	}
+
 	/* 数据--》 */
-	.enter{
-		position:fixed;
-		right:0;
-		top:80%;
-		width:56.5px;height:28px;
+	.enter {
+		position: fixed;
+		right: 0;
+		top: 80%;
+		width: 56.5px;
+		height: 28px;
 	}
-	.enter-content{
-		position:absolute;
-		right:5px;
-		top:50%;
+
+	.enter-content {
+		position: absolute;
+		right: 5px;
+		top: 50%;
 		transform: translateY(-50%);
-		color:#fff;
-		
+		color: #fff;
+
 	}
 </style>