Browse Source

Merge branch 'master' of http://git.zthymaoyi.com/zyw/tourism

高敬炎 2 năm trước cách đây
mục cha
commit
425feafe93

+ 1 - 1
uni_applet/App.vue

@@ -61,7 +61,7 @@
 		align-items: center;
 		align-items: center;
 	}
 	}
 	.detailedAddress{
 	.detailedAddress{
-		width:120rpx;
+		width:600rpx;
 		overflow:hidden;
 		overflow:hidden;
 		white-space: nowrap;
 		white-space: nowrap;
 		text-overflow: ellipsis;
 		text-overflow: ellipsis;

+ 177 - 0
uni_applet/pageA/food/menu.vue

@@ -0,0 +1,177 @@
+<template>
+	<view class="content">
+
+		<view class="">
+			<u-search placeholder="日照香炉生紫烟" v-model="keyword" clearabled :show-action='false'></u-search>
+			<view class="head flex">
+				<image :src="dataObj.coverImage" style="width:60rpx;height:60rpx;border-radius:50%;"></image>
+				<view class="right">
+					{{dataObj.shopNames}}
+				</view>
+			</view>
+			<view class="wrap" v-if="dataObj.dishClassifyInfoList.length>0">
+				<view class="item1" v-for="item in dataObj.dishClassifyInfoList" v-if="item.foodDishesInfoList&&item.foodDishesInfoList.length>0">
+					<view class="row">
+						{{item.classifyName}}
+					</view>
+					<view class="" v-if="item.foodDishesInfoList&&item.foodDishesInfoList.length>0">
+						<view class="item2" v-for="item1 in item.foodDishesInfoList">
+							<image :src="item1.dishImage" mode="" class="img"></image>
+							<view class="bottom">
+								<view class="name">
+									{{item1.dishName}}
+								</view>
+								<view class="price" v-if="item1.dishPrice">
+									¥{{item1.dishPrice}}
+								</view>
+								<view class="" v-else>
+									暂无价格
+								</view>
+							</view>
+							
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="bottom-wrap">
+			<view class="left">
+				<text>营业时间:</text>
+				<text>123</text>
+			</view>
+			<view class="right">
+				电话订餐
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	var that;
+	export default {
+		data() {
+			return {
+				keyword: '遥看瀑布挂前川',
+				dataObj: {
+					shopNames: ''
+				}
+			};
+		},
+		onLoad(options) {
+			that = this
+			console.log(options.val)
+			this.id = JSON.parse(options.val).id
+			this.init()
+
+		},
+		methods: {
+			init() {
+				uni.showLoading({
+					title: '数据加载中'
+				})
+				that.$request.baseRequest('admin.tourism.foodInfo', 'list', {
+					page: 1,
+					limit: 10,
+					id: this.id
+
+				}, failres => {
+					uni.showToast({
+						icon: "none",
+						title: failres.errmsg,
+						duration: 3000
+					});
+
+				}).then(res => {
+					uni.hideLoading()
+					this.dataObj = res.data.items[0]
+					console.log(this.dataObj)
+
+				})
+			},
+
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background: #fff;
+	}
+
+	.content {
+		box-sizing: border-box;
+	}
+
+	.head {
+		padding: 20rpx;
+
+		.right {
+			margin-left: 20rpx;
+		}
+	}
+
+	.wrap {
+		.item1{
+			// margin-bottom: 20rpx;
+		}
+		.item1 .row{
+			position: relative;
+			padding-left: 20rpx;
+			margin: 20rpx;
+		}
+		.item1 .row:before{
+			position: absolute;
+			content: '';
+			background: red;
+			width: 6rpx;
+			height: 40rpx;
+			    top: 2px;
+			    left: 0px;
+		}
+		.item2 {
+			display: inline-block;
+			width: calc(50vw - 40rpx);
+			margin: 10rpx;
+			box-shadow: 0px 1px 2px 0px #ccc;
+			border-radius: 20rpx;
+			.bottom{
+				padding: 20rpx;
+				.name{
+					margin-bottom: 20rpx;
+				}
+				.price{
+					color: #E95700;
+				}
+			}
+		}
+
+		.img {
+			border-radius: 20rpx 20rpx 0 0 ;
+			width: calc(50vw - 40rpx);
+			height: calc(50vw - 40rpx);
+			// width: 344rpx;
+			// height: 344rpx;
+		}
+
+	}
+	.bottom-wrap{
+		position: fixed;
+		width: 100vw;
+		bottom: 0;
+		display: flex;
+		.left{
+			
+			padding: 40rpx;
+			background: red;
+			width: 60vw;
+			box-sizing: border-box;
+			
+		}
+		.right{
+			box-sizing: border-box;
+			padding: 40rpx;
+			width: 40vw;
+			background: #E95700;
+		}
+	}
+</style>

+ 3 - 84
uni_applet/pageA/food/search.vue

@@ -2,8 +2,8 @@
 	<view>
 	<view>
 		<d-search-log :placeholder="'搜索美食'" :color_border="color_border" :color_text="color_border"
 		<d-search-log :placeholder="'搜索美食'" :color_border="color_border" :color_text="color_border"
 			:search_list_old_man_num='15' :search_list_hot="search_list_hot" :store_key="store_key" :input_text="input_text"
 			:search_list_old_man_num='15' :search_list_hot="search_list_hot" :store_key="store_key" :input_text="input_text"
-			@onClickDelAllApi="onClickDelAll" @onSearchNameApi="onSearchName" @onSearchvoiceApi='onSearchvoice'></d-search-log>
-		<u-popup :show="isRecorderManager" mode="bottom">
+			@onClickDelAllApi="onClickDelAll" @onSearchNameApi="onSearchName"></d-search-log>
+<!-- 		<u-popup :show="isRecorderManager" mode="bottom">
 			<view class="shqx" v-if="longPress == '2'">
 			<view class="shqx" v-if="longPress == '2'">
 				上划取消
 				上划取消
 			</view>
 			</view>
@@ -23,7 +23,7 @@
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
-		</u-popup>
+		</u-popup> -->
 		<u-toast ref="uToast"></u-toast>
 		<u-toast ref="uToast"></u-toast>
 	</view>
 	</view>
 </template>
 </template>
@@ -61,86 +61,6 @@
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
-			onSearchvoice(e){
-				this.isRecorderManager = true
-			},
-			handleTouchMove: function(e) {
-				console.log("滑动")
-				if (Math.abs(e.touches[e.touches.length - 1].clientY - this.startPoint.clientY) > 35) {
-
-					this.is_clock = false
-				} else {
-
-					this.is_clock = true
-				}
-			},
-			longpressBtn(e) {
-				this.longPress = '2';
-				this.is_clock = true,
-					console.log(e);
-				this.startPoint = e.touches[0],
-					recorderManager.onStop((res) => {
-						console.log("录音结束")
-						this.tempFilePath = res.tempFilePath;
-					})
-				const options = {
-					duration: this.duration, // 指定录音的时长,单位 ms
-					sampleRate: 16000, // 采样率
-					numberOfChannels: 1, // 录音通道数
-					encodeBitRate: 96000, // 编码码率
-					// format: 'mp3', // 音频格式,有效值 aac/mp3
-					frameSize: 10, // 指定帧大小,单位 KB
-				}
-				recorderManager.start(options);
-				// 监听音频开始事件
-				recorderManager.onStart((res) => {
-					console.log(res)
-				})
-			},
-			touchendBtn() {
-				console.log("录音结束")
-				let that = this
-				this.longPress = '1'; 
-				that.isRecorderManager = false
-				recorderManager.onStop((res) => {
-					this.tempFilePath = res.tempFilePath
-					let _file = ''
-					if (that.is_clock) {
-						_file = uni.getFileSystemManager().readFileSync(res.tempFilePath, "base64")
-						console.log(_file)
-						uni.showLoading({
-							title:"正在识别"
-						})
-						that.$request.baseRequest('admin.tourism.productManagement', 'speechRecognition', {
-							voiceMessage: _file,
-						}, failres => {
-							console.log('res+++++', failres.errmsg)
-							uni.hideLoading()
-							uni.showToast({
-								icon:"none",
-								title: failres.errmsg,
-								duration: 3000
-							});
-						}).then(res => {
-							uni.hideLoading()
-							console.log(res)
-							if(res.data.text.length>10){
-								var text = res.data.text.substring(0, 10)
-							}else{
-								var text = res.data.text
-							}
-							that.input_text = text
-							// uni.setStorageSync('search_val', text);
-							// uni.switchTab({
-							// 	url: "/pages/cardHolder/search"
-
-							// })
-
-						})
-					}
-					recorderManager.stop()
-				})
-			},
 			onClickDelAll() {},
 			onClickDelAll() {},
 			onSearchName(e) {
 			onSearchName(e) {
 				if(e.length>10){
 				if(e.length>10){
@@ -148,7 +68,6 @@
 				}else{
 				}else{
 					var text = e
 					var text = e
 				}
 				}
-				
 				uni.setStorageSync('search_val', text);
 				uni.setStorageSync('search_val', text);
 				uni.switchTab({
 				uni.switchTab({
 					url: "/pages/food/food"
 					url: "/pages/food/food"

+ 77 - 82
uni_applet/pages.json

@@ -3,15 +3,22 @@
 		"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue"
 		"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue"
 	},
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
-		
 		{
 		{
-		    "path" : "pages/accommodation/accommodation",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "住宿",
-		        "enablePullDownRefresh": false
-		    }
-		    
+			"path": "pages/food/food",
+			"style": {
+				"navigationBarTitleText": "美食推荐",
+				"enablePullDownRefresh": false,
+				"navigationBarBackgroundColor": "#fff"
+			}
+
+		},
+		{
+			"path": "pages/accommodation/accommodation",
+			"style": {
+				"navigationBarTitleText": "住宿",
+				"enablePullDownRefresh": false
+			}
+
 		},
 		},
 		{
 		{
 			"path": "pages/my/my",
 			"path": "pages/my/my",
@@ -19,34 +26,23 @@
 				"navigationBarTitleText": "我的"
 				"navigationBarTitleText": "我的"
 			}
 			}
 		}
 		}
-        ,{
-            "path" : "pages/food/food",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "美食",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/play/play",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "游玩",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/find/find",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "发现",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-    ],
+
+		, {
+			"path": "pages/play/play",
+			"style": {
+				"navigationBarTitleText": "游玩",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/find/find",
+			"style": {
+				"navigationBarTitleText": "发现",
+				"enablePullDownRefresh": false
+			}
+
+		}
+	],
 	"tabBar": {
 	"tabBar": {
 		"custom": false,
 		"custom": false,
 		"color": "#656765",
 		"color": "#656765",
@@ -92,53 +88,52 @@
 		"backgroundColor": "#F8F8F8"
 		"backgroundColor": "#F8F8F8"
 	},
 	},
 	"uniIdRouter": {},
 	"uniIdRouter": {},
-	"subPackages": [
-		{
-			"root":"pageA",
-			"pages": [
-				{
-                    "path" : "find/createLifeService",
-                    "style" :                                                                                    
-                {
-                    "navigationBarTitleText": "全品类入驻",
-                    "enablePullDownRefresh": false
-                }
-                
-                },
-				{
-				    "path" : "find/search",
-				    "style" :                                                                                    
-				{
-				    "navigationBarTitleText": "搜索",
-				    "enablePullDownRefresh": false
+	"subPackages": [{
+		"root": "pageA",
+		"pages": [{
+				"path": "find/createLifeService",
+				"style": {
+					"navigationBarTitleText": "全品类入驻",
+					"enablePullDownRefresh": false
 				}
 				}
-				
+
+			},
+			{
+				"path": "find/search",
+				"style": {
+					"navigationBarTitleText": "搜索",
+					"enablePullDownRefresh": false
 				}
 				}
-                ,{
-                    "path" : "food/search",
-                    "style" :                                                                                    
-                {
-                    "navigationBarTitleText": "",
-                    "enablePullDownRefresh": false
-                }
-                
-                }
-                ,{
-                    "path" : "food/groupBuying",
-                    "style" :                                                                                    
-                {
-                    "navigationBarTitleText": "",
-                    "enablePullDownRefresh": false
-                }
-                
-                }
-            ]
-		}
-	],
-	"preloadRule": {
-			"pages/accommodation/accommodation": {
-				"network": "all",
-				"packages": ["pageA"]
+
+			}, {
+				"path": "food/search",
+				"style": {
+					"navigationBarTitleText": "美食搜索",
+					"enablePullDownRefresh": false
+				}
+
+			}, {
+				"path": "food/groupBuying",
+				"style": {
+					"navigationBarTitleText": "",
+					"enablePullDownRefresh": false
+				}
+
+			}, {
+				"path": "food/menu",
+				"style": {
+					"navigationBarTitleText": "菜单",
+					"enablePullDownRefresh": false,
+					"navigationBarBackgroundColor": "#fff"
+				}
+
 			}
 			}
+		]
+	}],
+	"preloadRule": {
+		"pages/accommodation/accommodation": {
+			"network": "all",
+			"packages": ["pageA"]
+		}
 	}
 	}
-}
+}

+ 351 - 233
uni_applet/pages/food/food.vue

@@ -1,9 +1,9 @@
 <template>
 <template>
-	<view>
+	<view class="content">
 		<view class="flex content1">
 		<view class="flex content1">
 			<view @click='placeSelect' class='address flex'>
 			<view @click='placeSelect' class='address flex'>
-			<view class='detailedAddress'>{{detailedAddress}}</view>
-			<view class='iconfont applet-xiala'></view>
+				<view class='detailedAddress'>{{detailedAddress}}</view>
+				<view class='iconfont applet-xiala'></view>
 			</view>
 			</view>
 			<view class=" search-wrap">
 			<view class=" search-wrap">
 				<view class="search flex justify-space-between align-item-center flex-between" @click="search">
 				<view class="search flex justify-space-between align-item-center flex-between" @click="search">
@@ -11,70 +11,83 @@
 						<uni-icons type="search" size="24" color="#9199af"></uni-icons>
 						<uni-icons type="search" size="24" color="#9199af"></uni-icons>
 						<text class="search-val"> {{searchVal?searchVal:'搜索美食'}}</text>
 						<text class="search-val"> {{searchVal?searchVal:'搜索美食'}}</text>
 					</view>
 					</view>
-			
+
 					<view class="right">
 					<view class="right">
-						<!-- <image style='width:32rpx;height:32rpx;' v-if="searchVal" @click.native.stop="delSearchVal"
-							src="../../static/imgs/card/searchdel.png" mode="widthFix"></image> -->
+						<image style='width:32rpx;height:32rpx;' v-if="searchVal" @click.stop="delSearchVal"
+							src="@/static/image/card/searchdel.png" mode="widthFix"></image>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="tag-type">
 		<view class="tag-type">
-			<uni-tag :circle="true" :text="item.iname" type="warning"  :inverted="inverted" style="width: 61px;text-align: center; margin-left: 20px;"  v-for='item in jobs'  @click="change(item)"/>
+			<uni-tag :circle="true" :text="item.iname" :inverted="inverted"
+				style="width: 61px;text-align: center; margin-left: 20px;" v-for='item in jobs' @click="change(item)" />
 		</view>
 		</view>
-		<scroll-view  scroll-x="true" scroll-with-animation="true" class='list-type'>
-			<view  v-for='item in searchTypes' @click='changetype(item)' :class='searchType==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='changetype(item)'
+				:class='searchType==item.value?"Semibold active":"Regular"' class="typeitem">{{item.name}}</view>
 		</scroll-view>
 		</scroll-view>
 		<view>
 		<view>
-			<mescroll-uni :up="upOption" :down="downOption" ref="mescrollRef" @init="mescrollInit"
-				@up="upCallback" @down="downCallback" height="660">
-				<view class='findItem' v-for='item in findList'>
+			<mescroll-uni :up="upOption" :down="downOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback"
+				@down="downCallback" :top="250">
+				<view class='findItem' v-for='item in findList' @click="toShop(item)">
 					<view style='align-items: flex-start;' class='flex'>
 					<view style='align-items: flex-start;' class='flex'>
 						<view class="left">
 						<view class="left">
 							<view class='cover'>
 							<view class='cover'>
-								<u--image radius='4' :showLoading="true" :src="item.coverImage" width="80px" height="80px"></u--image>
+								<u--image radius='4' :showLoading="true" :src="item.coverImage" width="80px"
+									height="80px"></u--image>
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="right">
 						<view class="right">
 							<view class='cover'>
 							<view class='cover'>
-								<u--image radius='4' :showLoading="true" :src="item.indoorImage" width="80px" height="80px"></u--image>
+								<u--image radius='4' :showLoading="true" :src="item.indoorImage" width="80px"
+									height="80px"></u--image>
 							</view>
 							</view>
 						</view>
 						</view>
 					</view>
 					</view>
-					<view class='flex'>
+					<view class='flex row2'>
 						<view v-if='item.mainBody=="商铺"' class='iconfont applet-dianpu1'></view>
 						<view v-if='item.mainBody=="商铺"' class='iconfont applet-dianpu1'></view>
-						<u--image v-if='item.mainBody=="个人"'  :showLoading="true" src="/static/image/find/geren.png" width="20px" height="20px"></u--image>
-						<view  class='name'>{{item.shopNames}}</view>
+						<u--image v-if='item.mainBody=="个人"' :showLoading="true" src="/static/image/find/geren.png"
+							width="20px" height="20px"></u--image>
+						<view class='name'>{{item.shopNames}}</view>
 					</view>
 					</view>
-					<view class="tag-type">
-						<uni-tag :inverted="true"  :text="item" type="warning"  style="width: 61px;text-align: center; margin-left: 10px;"  v-for='item in item.labels'/>
+					<view class="tag-type flex">
+						<text class="text" v-for='item1 in item.labels'> {{item1}}</text>
 					</view>
 					</view>
 					<view class='address flex justify-space-between'>
 					<view class='address flex justify-space-between'>
-						<view  class='flex'>
+						<view class='flex'>
 							<view class='iconfont applet-dizhi'></view>
 							<view class='iconfont applet-dizhi'></view>
-							<view>{{item.province}}{{item.city}}{{item.area}}</view>
+							<view class="detailedAddress">
+								{{item.detailedAddress}}
+							</view>
+							<!-- <view>{{item.province}}{{item.city}}{{item.area}}</view> -->
+							
+						</view>
+						<view style="color: #888;">
+							{{item.distance}}km
 						</view>
 						</view>
-						<view>{{item.distance}}
-						<text style='font-weight:600;'>km</text></view>
 					</view>
 					</view>
 				</view>
 				</view>
 			</mescroll-uni>
 			</mescroll-uni>
 			<!-- <mescroll-body ref="mescrollRef" :up="upOption" :down="downOption" @init="mescrollInit" @up="upCallback" @down="downCallback"></mescroll-body> -->
 			<!-- <mescroll-body ref="mescrollRef" :up="upOption" :down="downOption" @init="mescrollInit" @up="upCallback" @down="downCallback"></mescroll-body> -->
 		</view>
 		</view>
-		<view class='group' @click='group'>
+		<!-- <view class='group' @click='group'>
 			<button class="tuan">团</button>
 			<button class="tuan">团</button>
-		</view>
+		</view> -->
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
 	var that;
 	var that;
 	var QQMapWX = require('@/js_sdk/qqmap-wx-jssdk.min.js');
 	var QQMapWX = require('@/js_sdk/qqmap-wx-jssdk.min.js');
-	 var qqmapsdk = new QQMapWX({
-	        key: 'HQ6BZ-RMALQ-TGF5H-BXJQB-UFYN3-Q5BYM'
-	    });
+	var qqmapsdk = new QQMapWX({
+		key: 'HQ6BZ-RMALQ-TGF5H-BXJQB-UFYN3-Q5BYM'
+	});
 	import MoteLinesDivide from "@/components/text-over-flow/text-over-flow.vue"
 	import MoteLinesDivide from "@/components/text-over-flow/text-over-flow.vue"
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	import {
+		authorizedLocation
+	} from '@/util/util.js'
 	export default {
 	export default {
 		components: {
 		components: {
 			MoteLinesDivide
 			MoteLinesDivide
@@ -82,29 +95,39 @@
 		mixins: [MescrollMixin],
 		mixins: [MescrollMixin],
 		data() {
 		data() {
 			return {
 			return {
-				searchVal:uni.getStorageSync("search_val")?uni.getStorageSync("search_val"):"",
-				current:0,
-				mescroll:null,
-				findList:[],
+				place: '',
+				searchVal:  "",
+				current: 0,
+				mescroll: null,
+				findList: [],
 				inverted: true,
 				inverted: true,
-				handleList:[],
-				labels:[],
-				searchType:'1',
-				label:'',
-				longitude:uni.getStorageSync("findlongitude")?uni.getStorageSync("findlongitude"):"",
-				latitude:uni.getStorageSync("findlatitude")?uni.getStorageSync("findlatitude"):'',
-				curPageLen:0,
-				totalPage:0,
-				detailedAddress:uni.getStorageSync("detailedAddress")?uni.getStorageSync("detailedAddress"):'',
+				handleList: [],
+				labels: [],
+				searchType: '1',
+				label: '',
+				longitude: '',
+				latitude: '',
+				curPageLen: 0,
+				totalPage: 0,
+				detailedAddress: '正在定位...',
 				downOption: {
 				downOption: {
 					auto: false,
 					auto: false,
 					textColor: '#bbb'
 					textColor: '#bbb'
 				},
 				},
-				searchTypes:[
-				{name:'默认排序',value:'1'},{name:'距离最近',value:'2'},{name:'最多点赞',value:'3'},{name:'我的收藏',value:'4'}
-				],
-				jobs: [
-					{
+				searchTypes: [{
+					name: '默认排序',
+					value: '1'
+				}, {
+					name: '距离最近',
+					value: '2'
+				}, {
+					name: '最多点赞',
+					value: '3'
+				}, {
+					name: '我的收藏',
+					value: '4'
+				}],
+				jobs: [{
 						id: 1,
 						id: 1,
 						iname: '海鲜',
 						iname: '海鲜',
 					},
 					},
@@ -137,45 +160,94 @@
 		},
 		},
 		onLoad() {
 		onLoad() {
 			that = this
 			that = this
-		// this.getList()
-		console.log(this)
-		// this.mescroll.resetUpScroll();
+			// this.getList()
+			// this.getLocation()
+			// this.mescroll.resetUpScroll();
 		},
 		},
-		onShow(){
-			if(!this.detailedAddress){
-				this.placeSelect()
-			}else{
-				that.upCallback({
-					num:1,
-					size:10
-				})
-			}
+		onShow() {
+			//判断是否有定位权限
+			this.searchVal = uni.getStorageSync("search_val")
+			this.isdingwei()
 		},
 		},
 		methods: {
 		methods: {
+			toShop(val){
+				uni.navigateTo({
+					url: "/pageA/food/menu?val="+JSON.stringify(val)
+				})
+			},
+			delSearchVal(){
+				this.searchVal = ''
+				that.mescroll.resetUpScroll()
+			},
+			isdingwei() {
+				authorizedLocation().then(res => {
+					let _obj = {}
+					if (res == '取消授权') {
+						//获取上一次,无上一次山海广场
+						let _place = uni.getStorageSync("LocationPlace")
+						if (_place && _place.latitude) {
+							_obj = {
+								latitude: _place.latitude,
+								longitude: _place.longitude
+							}
+						} else {
+							_obj = {
+								latitude: 40.22086204872,
+								longitude: 122.08338497727
+							}
+						}
+
+					} else {
+						_obj = {
+							latitude: res.latitude,
+							longitude: res.longitude
+						}
+					}
+					this.longitude = _obj.longitude
+					this.latitude = _obj.latitude
+					qqmapsdk.reverseGeocoder({
+						location: _obj,
+						success: function(res) {
+							console.log(res)
+							that.detailedAddress = res.result.formatted_addresses.recommend
+							that.mescroll.resetUpScroll()
+						},
+						fail: function(error) {
+							console.error(error);
+						},
+						complete: function(res) {
+							// console.log(res);
+						}
+
+					})
+
+				})
+			},
 			search() {
 			search() {
 				uni.navigateTo({
 				uni.navigateTo({
 					url: "/pageA/food/search"
 					url: "/pageA/food/search"
 				})
 				})
 			},
 			},
-			change(item){
-				if(this.label==item.iname){
-					this.label=''
-				}
-				else{
-					this.label=item.iname
-					
-				}
-				this.inverted = !this.inverted;
-				that.upCallback({
-					num:1,
-					size:10
-				})
+			change(item) {
+				this.searchVal = item.iname
+				this.mescroll.resetUpScroll()
+				// if (this.label == item.iname) {
+				// 	this.label = ''
+				// } else {
+				// 	this.label = item.iname
+
+				// }
+				// this.inverted = !this.inverted;
+				// that.upCallback({
+				// 	num: 1,
+				// 	size: 10
+				// })
 			},
 			},
-			changetype(item){
-				this.searchType=item.value
+			changetype(item) {
+				this.searchType = item.value
 				that.upCallback({
 				that.upCallback({
-					num:1,
-					size:10
+					num: 1,
+					size: 10
 				})
 				})
 			},
 			},
 			placeSelect() {
 			placeSelect() {
@@ -184,15 +256,15 @@
 						console.log(res);
 						console.log(res);
 						that.latitude = res.latitude
 						that.latitude = res.latitude
 						that.longitude = res.longitude
 						that.longitude = res.longitude
-						uni.setStorageSync("findlatitude",res.latitude)
-						uni.setStorageSync("findlongitude",res.longitude)
+						uni.setStorageSync("findlatitude", res.latitude)
+						uni.setStorageSync("findlongitude", res.longitude)
 						let _address = that.$helper.formatLocation(res.address)
 						let _address = that.$helper.formatLocation(res.address)
 						that.detailedAddress = _address.Village
 						that.detailedAddress = _address.Village
-						uni.setStorageSync("detailedAddress",_address.Village)
+						uni.setStorageSync("detailedAddress", _address.Village)
 						that.$forceUpdate()
 						that.$forceUpdate()
 						that.upCallback({
 						that.upCallback({
-							num:1,
-							size:10
+							num: 1,
+							size: 10
 						})
 						})
 					}
 					}
 				});
 				});
@@ -207,105 +279,114 @@
 					that.mescroll.endBySize(0, 0)
 					that.mescroll.endBySize(0, 0)
 					this.showAuthorizePhone = true
 					this.showAuthorizePhone = true
 				}
 				}
-			
+
 			},
 			},
-			getDistance(latitude,longitude){
-				console.log(latitude,longitude,that.latitude,that.longitude)
+			getDistance(latitude, longitude) {
+				console.log(latitude, longitude, that.latitude, that.longitude)
 				return new Promise((resolve, reject) => {
 				return new Promise((resolve, reject) => {
 					qqmapsdk.direction({
 					qqmapsdk.direction({
-					                    mode: 'driving', //可选值:'driving'(驾车)  trucking 货车
-					                    //from参数不填默认当前地址
-					                    // latitude纬度    longitude 经度
-					                    from: {
-					                        latitude: that.latitude,
-					                        longitude: that.longitude
-					                    },
-					                    to: {
-					                        latitude: latitude,
-					                        longitude:longitude
-					                    },
-					                    size: 4, // 车型 1: 微型车  2: 轻型车 3: 中型车 4: 重型车
-					                    policy: 'LEAST_TIME', //'9',  //参考实时路况,高速优先,尽量躲避拥堵
-					                    height: 4,
-					                    width: 2.5,
-					                    length: 13,
-					                    weight: 6.8,
-					                    axle_weight: 34,
-					                    axle_count: 6,
-					                    is_trailer: 1,
-					                 success: function(res1, data) {
-										 console.log(res1,data[0].distance,data)
-										 resolve(data[0])
-										 
-									 }
+						mode: 'driving', //可选值:'driving'(驾车)  trucking 货车
+						//from参数不填默认当前地址
+						// latitude纬度    longitude 经度
+						from: {
+							latitude: that.latitude,
+							longitude: that.longitude
+						},
+						to: {
+							latitude: latitude,
+							longitude: longitude
+						},
+						size: 4, // 车型 1: 微型车  2: 轻型车 3: 中型车 4: 重型车
+						policy: 'LEAST_TIME', //'9',  //参考实时路况,高速优先,尽量躲避拥堵
+						height: 4,
+						width: 2.5,
+						length: 13,
+						weight: 6.8,
+						axle_weight: 34,
+						axle_count: 6,
+						is_trailer: 1,
+						success: function(res1, data) {
+							console.log(res1, data[0].distance, data)
+							resolve(data[0])
+
+						}
 					})
 					})
 				})
 				})
 			},
 			},
 			async upCallback(page) {
 			async upCallback(page) {
-						uni.showLoading({
-							title: '数据加载中'
-						})
-						await that.$request.baseRequest('admin.tourism.foodInfo', 'foodList', {
-							page: page.num,
-							limit: page.size,
-							searchType: this.searchType,
-							label: this.label,
-							place:this.detailedAddress,
-						}, failres => {
-							uni.showToast({
-								icon: "none",
-								title: failres.errmsg,
-								duration: 3000
-							});
-							uni.hideLoading()
-						}).then(res => {
-							if (page.num == 1) that.findList = [],that.handleList = [];
-							that.curPageLen = res.data.items.length;
-							that.handleList = res.data.items
-							that.totalPage = res.data.total;
-						})
-						if(that.handleList.length>0){
-						for(var i=0;i<that.handleList.length;i++){
-							
-							that.handleList[i].latitude=that.handleList[i].location.split(',')[0]
-							that.handleList[i].longitude=that.handleList[i].location.split(',')[1]
-							var data=await that.getDistance(that.handleList[i].latitude,that.handleList[i].longitude) 
-							that.handleList[i].distance=(data.distance/1000).toFixed(2)
-							if(that.handleList[i].label){
-								that.handleList[i].labels = that.handleList[i].label.split(",")
-							}
-							if(i==that.handleList.length-1){
-								setTimeout(()=>{
-									console.log(that.handleList)
-									that.findList = that.handleList
-									that.loading = false
-									that.$nextTick(() => {
-										that.mescroll.endBySize(that.curPageLen, that.totalPage)
-									});
-												
-									uni.hideLoading()
-								},100)
-							}
+				uni.showLoading({
+					title: '数据加载中'
+				})
+				await that.$request.baseRequest('admin.tourism.foodInfo', 'foodList', {
+					page: page.num,
+					limit: page.size,
+					searchType: this.searchType,
+					searchKeyWord: this.searchVal,
+					place: this.detailedAddress,
+					userLongitude:this.longitude,
+					userLatitude:this.latitude,
+				}, failres => {
+					uni.showToast({
+						icon: "none",
+						title: failres.errmsg,
+						duration: 3000
+					});
+
+				}).then(res => {
+					uni.hideLoading()
+					if (page.num == 1) that.findList = [], that.handleList = [];
+					that.curPageLen = res.data.items.length;
+					that.handleList = res.data.items
+					that.totalPage = res.data.total;
+				})
+				if (that.handleList.length > 0) {
+					for (var i = 0; i < that.handleList.length; i++) {
+
+						that.handleList[i].latitude = that.handleList[i].location.split(',')[0]
+						that.handleList[i].longitude = that.handleList[i].location.split(',')[1]
+						var data = await that.getDistance(that.handleList[i].latitude, that.handleList[i].longitude)
+						that.handleList[i].distance = (data.distance / 1000).toFixed(2)
+						if (that.handleList[i].label) {
+							that.handleList[i].labels = that.handleList[i].label.split(",")
 						}
 						}
+						// if (i == that.handleList.length - 1) {
+						// 	setTimeout(() => {
+						// 		console.log(that.handleList)
+						// 		that.findList = that.handleList
+						// 		that.loading = false
+						// 		that.$nextTick(() => {
+						// 			that.mescroll.endBySize(that.curPageLen, that.totalPage)
+						// 		});
+
+						// 		uni.hideLoading()
+						// 	}, 100)
+						// }
 					}
 					}
-					else{
-						uni.hideLoading()
-					}
+					that.findList = that.handleList
+					
+				} else {
+					uni.hideLoading()
+				}
+				that.$nextTick(() => {
+					that.mescroll.endBySize(that.curPageLen, that.totalPage)
+				});
+			},
+			group() {
+				uni.navigateTo({
+					url: '/pageA/food/groupBuying'
+				})
 			},
 			},
-		 group(){
-			uni.navigateTo({
-				url: '/pageA/food/groupBuying'
-			})
-		 },
 		}
 		}
 	}
 	}
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
-	
+	.content {}
+
 	.content1 {
 	.content1 {
 		padding: 20rpx;
 		padding: 20rpx;
-		background-color: #fbb612;
+		background-color: #fff;
+
 		.search {
 		.search {
 			// color: #9199af;
 			// color: #9199af;
 			// background: #f9d27d;
 			// background: #f9d27d;
@@ -324,7 +405,7 @@
 				overflow: scroll;
 				overflow: scroll;
 				position: relative;
 				position: relative;
 				margin-left: 20rpx;
 				margin-left: 20rpx;
-				color:#9199af;
+				color: #9199af;
 			}
 			}
 		}
 		}
 
 
@@ -333,98 +414,135 @@
 			margin-right: 20rpx
 			margin-right: 20rpx
 		}
 		}
 	}
 	}
-	.search-wrap{
-		width:78%;
-		background: #ffff;
-		border: 1px solid #f9d27d;
+
+	.search-wrap {
+		width: 70%;
+		background: rgb(249, 249, 249);
+		// border: 1px solid #f9d27d;
 		border-radius: 50rpx;
 		border-radius: 50rpx;
 	}
 	}
-	.address{
-		width:22%;
+
+	.address {
+		width: 30%;
 	}
 	}
-	.findItem{
-		background:#fff;
-		margin:10rpx;
-		border-radius:20rpx;
-		padding:20rpx;
-		font-size:32rpx;
-		.left{
-			margin-right:20rpx;
-			.cover{
+
+	.findItem {
+		background: #fff;
+		margin: 10rpx;
+		border-radius: 20rpx;
+		padding: 20rpx;
+		.row2{
+			margin: 20rpx 0;
+		}
+		.left {
+			margin-right: 20rpx;
+
+			.cover {
 				border-radius: 8rpx;
 				border-radius: 8rpx;
 			}
 			}
 		}
 		}
-		.name{
-			font-size:36rpx;
-			color:#333;
-			margin-left:10rpx;
+
+		.name {
+			color: #333;
+			margin-left: 10rpx;
 		}
 		}
-		.description{
-			color:#666;
-			margin-top:10rpx;
+
+		.description {
+			color: #666;
+			margin-top: 10rpx;
 		}
 		}
-		.address{
-			margin-top:20rpx;
-			width:100%;
-			font-size:28rpx;
-			color:#393733;
+
+		.address {
+			margin-top: 20rpx;
+			width: 100%;
+			color: #393733;
 		}
 		}
 	}
 	}
-	.applet-dianpu1{
-		font-size:44rpx;
-		color:#eaad1a;
+
+	.applet-dianpu1 {
+		color: #999999;
 	}
 	}
 
 
-	.applet-dizhi{
-		font-size:38rpx;
-		color:#393733;
+	.applet-dizhi {
+		color: #393733;
 	}
 	}
-	.group{
+
+	.group {
 		position: fixed;
 		position: fixed;
-		margin-left:350px;bottom:10px;
+		// margin-left: 350px;
+		bottom: 40rpx;
+		right: 40rpx;
+		z-index: 999;
 	}
 	}
-	.tuan{
-		background:#eaad1a;
-		border-radius:50px;
-		color:#fff;
-	}
-	.applet-colors-tianjia2{
-		font-size:30px;
+
+	.tuan {
+		background: #eaad1a;
+		border-radius: 50px;
+		color: #fff;
 	}
 	}
-	.text {
-		font-size: 26rpx;
-		font-weight: 500;
-		color: #eaad1a;
-		opacity: 0.5;
-		margin-right: 56rpx;
+
+	.applet-colors-tianjia2 {
 	}
 	}
-	.tag-type{
-		background: #fff;
+
+	// .text {
+	// 	font-size: 26rpx;
+	// 	font-weight: 500;
+	// 	color: #eaad1a;
+	// 	opacity: 0.5;
+	// 	margin-right: 56rpx;
+	// }
+
+	.tag-type {
+		.text{
+			border-radius: 4px;
+			background-color: rgba(253, 242, 229, 1);
+			color: rgba(233, 87, 0, 1);
+			margin-right: 30rpx;
+			padding: 10rpx 20rpx;
+			font-size: 24rpx;
+		}
+		
 	}
 	}
-	.list-type{
+
+	.list-type {
 		background: #fff;
 		background: #fff;
-		width:100vw;
-		padding-top:5px;
-		height:49px;
+		width: 100vw;
+		padding-top: 5px;
+		height: 86rpx;
 		overflow-x: scroll;
 		overflow-x: scroll;
 		white-space: nowrap;
 		white-space: nowrap;
 	}
 	}
-	.typeitem{
-		margin:10px;
-		position:relative;
-		display:inline-block;
-		padding-bottom:10px;
-		font-size:17px;
+
+	.typeitem {
+		margin: 20rpx 20rpx 0 20rpx;
+		position: relative;
+		display: inline-block;
+		padding-bottom: 10px;
+		font-size: 28rpx;
+		color: #888;
+	}
+
+	.typeitem.active {
+		color: #eaad1a;
 	}
 	}
-	.typeitem.active:after{
-		content:'';
-		display:block;
-		position:absolute;
-		height:3px;
-		bottom:0;
-		background:#eaad1a;
-		width:18px;
-		left:50%;
+
+	.typeitem.active:after {
+		content: '';
+		display: block;
+		position: absolute;
+		height: 3px;
+		bottom: 0;
+		background: #eaad1a;
+		width: 18px;
+		left: 50%;
 		transform: translateX(-50%);
 		transform: translateX(-50%);
 	}
 	}
-</style>
+	.detailedAddress{
+		width: 70vw;
+		overflow: hidden;
+		text-overflow: ellipsis;
+	}
+	.tag-type{
+		background: #fff;
+	}
+</style>

+ 1 - 1
uni_applet/uni_modules/d-search-log/components/d-search-log/d-search-log.vue

@@ -9,7 +9,7 @@
 					<!-- <u-icon name="close" size="20"></u-icon> -->
 					<!-- <u-icon name="close" size="20"></u-icon> -->
 					<!-- <image src="/static/icon_img/del.png" class="dSLComVueTopLeftDelImg" style="width: 35rpx;height: 35rpx;flex: none;" ></image> -->
 					<!-- <image src="/static/icon_img/del.png" class="dSLComVueTopLeftDelImg" style="width: 35rpx;height: 35rpx;flex: none;" ></image> -->
 				</view>
 				</view>
-				<image @click='onClickvoice' src="@/static/image/card/voice.png" class="dSLComVueTopLeftDelImg" style="width: 30rpx;height: 39rpx;flex: none;" ></image>
+				<!-- <image @click='onClickvoice' src="@/static/image/card/voice.png" class="dSLComVueTopLeftDelImg" style="width: 30rpx;height: 39rpx;flex: none;" ></image> -->
 			</view>
 			</view>
 			<view class="dSLComVueTopRight">
 			<view class="dSLComVueTopRight">
 				<view class="dSLComVueTopRightBtn" @click="onClickInput" >{{search_name?search_name:'搜索'}}</view>
 				<view class="dSLComVueTopRightBtn" @click="onClickInput" >{{search_name?search_name:'搜索'}}</view>

+ 158 - 56
uni_applet/util/util.js

@@ -1,41 +1,42 @@
-
 // 日期格式化1
 // 日期格式化1
 export function parseTime(time, pattern) {
 export function parseTime(time, pattern) {
-  if (arguments.length === 0) {
-    return null
-  }
-  const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
-  let date
-  if (typeof time === 'object') {
-    date = time
-  } else {
-    if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
-      time = parseInt(time)
-    }
-    if ((typeof time === 'number') && (time.toString().length === 10)) {
-      time = time * 1000
-    }
-    date = new Date(time)
-  }
-  const formatObj = {
-    y: date.getFullYear(),
-    m: date.getMonth() + 1,
-    d: date.getDate(),
-    h: date.getHours(),
-    i: date.getMinutes(),
-    s: date.getSeconds(),
-    a: date.getDay()
-  }
-  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
-    let value = formatObj[key]
-    // Note: getDay() returns 0 on Sunday
-    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
-    if (result.length > 0 && value < 10) {
-      value = '0' + value
-    }
-    return value || 0
-  })
-  return time_str
+	if (arguments.length === 0) {
+		return null
+	}
+	const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
+	let date
+	if (typeof time === 'object') {
+		date = time
+	} else {
+		if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
+			time = parseInt(time)
+		}
+		if ((typeof time === 'number') && (time.toString().length === 10)) {
+			time = time * 1000
+		}
+		date = new Date(time)
+	}
+	const formatObj = {
+		y: date.getFullYear(),
+		m: date.getMonth() + 1,
+		d: date.getDate(),
+		h: date.getHours(),
+		i: date.getMinutes(),
+		s: date.getSeconds(),
+		a: date.getDay()
+	}
+	const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
+		let value = formatObj[key]
+		// Note: getDay() returns 0 on Sunday
+		if (key === 'a') {
+			return ['日', '一', '二', '三', '四', '五', '六'][value]
+		}
+		if (result.length > 0 && value < 10) {
+			value = '0' + value
+		}
+		return value || 0
+	})
+	return time_str
 }
 }
 /**
 /**
  * 防止小程序多次点击跳转
  * 防止小程序多次点击跳转
@@ -43,24 +44,125 @@ export function parseTime(time, pattern) {
  * @returns 
  * @returns 
  */
  */
 export function throttle(fn, gapTime) {
 export function throttle(fn, gapTime) {
-    if (gapTime == null || gapTime == undefined) {
-        gapTime = 1500
-    }
- 
-    let _lastTime = null
- uni.scanCode({
- 	success: function(res) {
- 		console.log('条码类型:' + res.scanType);
- 		console.log('条码内容:' + res.result);
- 		
- 	}
- });
-    // 返回新的函数
-    return function () {
-        let _nowTime = + new Date()
-        if (_nowTime - _lastTime > gapTime || !_lastTime) {
-            fn.apply(this, arguments)   //将this和参数传给原函数
-            _lastTime = _nowTime
-        }
-    }
+	if (gapTime == null || gapTime == undefined) {
+		gapTime = 1500
+	}
+
+	let _lastTime = null
+	uni.scanCode({
+		success: function(res) {
+			console.log('条码类型:' + res.scanType);
+			console.log('条码内容:' + res.result);
+
+		}
+	});
+	// 返回新的函数
+	return function() {
+		let _nowTime = +new Date()
+		if (_nowTime - _lastTime > gapTime || !_lastTime) {
+			fn.apply(this, arguments) //将this和参数传给原函数
+			_lastTime = _nowTime
+		}
+	}
+}
+
+export function authorizedLocation() {
+	return new Promise((resolve, reject) => {
+		uni.getSetting({
+			success: (res) => {
+				// res.authSetting['scope.userLocation'] === undefined  表示 初始化进入,从未授权
+				// res.authSetting['scope.userLocation'] === true       表示 已授权
+				// res.authSetting['scope.userLocation'] === false      表示 授权拒绝
+				if (res.authSetting['scope.userLocation'] === undefined) {
+					// console.log("弹出位置授权框")
+					getLocation().then((res) => {
+							// 授权位置成功
+							uni.setStorageSync("LocationPlace", res)
+							resolve(res)
+						})
+						.catch((err) => {
+							// 授权位置失败
+							reject(err)
+							uni.showToast({
+								title: '授权位置失败',
+								icon: 'none',
+								duration: 3000
+							})
+						})
+
+				} else if (res.authSetting['scope.userLocation'] === true) {
+					// console.log("已经授权")
+					getLocation().then((res) => {
+							uni.setStorageSync("LocationPlace", res)
+							// 授权位置成功
+							resolve(res)
+						})
+						.catch((err) => {
+							// 授权位置失败
+							reject(err)
+							uni.showToast({
+								title: '授权位置失败',
+								icon: 'none',
+								duration: 3000
+							})
+						})
+
+				} else if (res.authSetting['scope.userLocation'] === false) {
+					// console.log("弹出允许授权设置框")
+					uni.authorize({
+						scope: 'scope.userLocation',
+						success() {
+							getLocation().then((res) => {
+									// 授权位置成功
+									uni.setStorageSync("LocationPlace", res)
+									resolve(res)
+								})
+								.catch((err) => {
+									// 授权位置失败
+									reject(err)
+									uni.showToast({
+										title: '授权位置失败',
+										icon: 'none',
+										duration: 3000
+									})
+								})
+						},
+						fail() {
+							uni.showModal({
+								title: '您未开启地理位置授权',
+								content: '是否前往授权?',
+								success: res => {
+									if (res.confirm) {
+										uni.openSetting()
+									} else {
+										console.log("取消授权")
+										resolve('取消授权')
+									}
+								},
+							})
+						}
+					})
+				}
+			}
+		})
+	})
+}
+
+// 获取用户当前位置
+export function getLocation() {
+	return new Promise((resolve, reject) => {
+		uni.getLocation({
+			type: 'wgs84',
+			success: (res) => {
+				resolve(res)
+				// console.log(res)
+				// console.log('当前位置的经度:' + res.longitude);
+				// console.log('当前位置的纬度:' + res.latitude);
+			},
+			fail: (err) => {
+				reject(err)
+				console.log(err)
+			}
+		})
+	})
 }
 }

+ 1 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/tourism/IFoodInfoService.java

@@ -24,6 +24,7 @@ public interface IFoodInfoService{
 
 
 	@HttpMethod(description = "列表", permissionName = "餐饮入驻信息管理")
 	@HttpMethod(description = "列表", permissionName = "餐饮入驻信息管理")
 	public Page<FoodInfo> list(
 	public Page<FoodInfo> list(
+			@HttpParam(name = "id", type = HttpParamType.COMMON, description = "id") Long id,
 								@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId,
 								@HttpParam(name = "commonId", type = HttpParamType.COMMON, description = "个人id") Long commonId,
 							@HttpParam(name = "mainBody", type = HttpParamType.COMMON, description = "主体(商铺/个人)") String mainBody,
 							@HttpParam(name = "mainBody", type = HttpParamType.COMMON, description = "主体(商铺/个人)") String mainBody,
 							@HttpParam(name = "shopNames", type = HttpParamType.COMMON, description = "店铺名称") String shopNames,
 							@HttpParam(name = "shopNames", type = HttpParamType.COMMON, description = "店铺名称") String shopNames,

+ 59 - 34
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/tourism/impl/FoodInfoServiceImpl.java

@@ -1,9 +1,15 @@
 package com.iotechn.unimall.admin.api.tourism.impl;
 package com.iotechn.unimall.admin.api.tourism.impl;
 
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Comparator;
 import java.util.List;
 import java.util.List;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.iotechn.unimall.admin.api.tourism.IFoodInfoService;
 import com.iotechn.unimall.admin.api.tourism.IFoodInfoService;
 import com.iotechn.unimall.data.domain.*;
 import com.iotechn.unimall.data.domain.*;
 import com.iotechn.unimall.data.mapper.*;
 import com.iotechn.unimall.data.mapper.*;
@@ -46,6 +52,7 @@ public class FoodInfoServiceImpl implements IFoodInfoService {
 	 * 地球半径,单位 km
 	 * 地球半径,单位 km
 	 */
 	 */
 	private static final double EARTH_RADIUS = 6378.137;
 	private static final double EARTH_RADIUS = 6378.137;
+	private static final String KEY = "OKDBZ-G3GC3-3C53F-3FWLN-HOGIV-FWBZM";
 
 
 	@Override
 	@Override
 	public Boolean add(FoodInfo foodInfo) throws ServiceException {
 	public Boolean add(FoodInfo foodInfo) throws ServiceException {
@@ -58,8 +65,11 @@ public class FoodInfoServiceImpl implements IFoodInfoService {
 	}
 	}
 
 
 	@Override
 	@Override
-	public Page<FoodInfo> list(Long commonId,String mainBody,String shopNames,String coverImage,String indoorImage,String province,String city,String area,String location,String detailedAddress,String operater,String operaterPhone,String contacts,String contactsPhone,String label,String businessLicense,String operateCertificate,Date operateCertificateDate,String startDate,String endDate,Long lookFlag,String status,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
+	public Page<FoodInfo> list(Long id,Long commonId,String mainBody,String shopNames,String coverImage,String indoorImage,String province,String city,String area,String location,String detailedAddress,String operater,String operaterPhone,String contacts,String contactsPhone,String label,String businessLicense,String operateCertificate,Date operateCertificateDate,String startDate,String endDate,Long lookFlag,String status,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
 		Wrapper<FoodInfo> wrapper = new EntityWrapper<FoodInfo>();
 		Wrapper<FoodInfo> wrapper = new EntityWrapper<FoodInfo>();
+				if (!StringUtils.isEmpty(id)) {
+					wrapper.eq("id", id);
+				}
 														if (!StringUtils.isEmpty(commonId)) {
 														if (!StringUtils.isEmpty(commonId)) {
 					wrapper.eq("common_id", commonId);
 					wrapper.eq("common_id", commonId);
 				}
 				}
@@ -191,46 +201,61 @@ public class FoodInfoServiceImpl implements IFoodInfoService {
 			//查询发货地经纬度
 			//查询发货地经纬度
 			for (int i = 0; i < list.size(); i++) {
 			for (int i = 0; i < list.size(); i++) {
 				FoodInfo foodInfo = list.get(i);
 				FoodInfo foodInfo = list.get(i);
-				String [] tempArray = foodInfo.getLocation().split(",");
-				//店铺经纬度
-				double longitude = Double.parseDouble(tempArray[0]);
-				double latitude = Double.parseDouble(tempArray[1]);
 				//根据用户经纬度求距离
 				//根据用户经纬度求距离
 				if (!StringUtils.isEmpty(userLatitude) && !StringUtils.isEmpty(userLongitude)) {
 				if (!StringUtils.isEmpty(userLatitude) && !StringUtils.isEmpty(userLongitude)) {
-					double lat1 = Math.toRadians(Double.valueOf(userLatitude));
-					double lng1 = Math.toRadians(Double.valueOf(userLongitude));
-					// 纬度之差
-					double a = lat1 - latitude;
-					// 经度之差
-					double b = lng1 - longitude;
-					// 计算两点距离的公式
-					double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
-							Math.cos(lat1) * Math.cos(latitude) * Math.pow(Math.sin(b / 2), 2)));
-
-					// 弧长乘地球半径, 返回单位: 千米
-					s = s * EARTH_RADIUS;
-					foodInfo.setDistance(Math.floor(s));
+					 // 参数解释:lng:经度,lat:维度。KEY:腾讯地图key
+					String urlString = "https://apis.map.qq.com/ws/direction/v1/driving/?from=" + userLatitude + "," + userLongitude+ "&to=" + foodInfo.getLocation()  + "&key=" + KEY ;
+					//输入流的缓冲
+					StringBuffer sb = new StringBuffer();
+					try {
+						URL url = new URL(urlString);
+						BufferedReader in =  new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
+						String line;
+						// 获取地址解析结果
+						while ((line = in.readLine()) != null) {
+							sb.append(line);
+						}
+						in.close();
+					} catch (Exception e) {
+						e.getMessage();
+					}
+					String result = sb.toString();
+					JSONObject jsonObj = JSONObject.parseObject(result);
+					JSONObject obj = jsonObj.getJSONObject("result");
+					JSONArray jsonArray = obj.getJSONArray("routes");
+					if(jsonArray != null&&jsonArray.size() > 0){
+						String distance=JSONObject.parseObject(jsonArray.get(0).toString()).getString("distance");
+						foodInfo.setDistance(Double.valueOf(distance));
+					}
 				}
 				}
 				//根据用户定位的位置求距离
 				//根据用户定位的位置求距离
 				else if (!StringUtils.isEmpty(place)) {
 				else if (!StringUtils.isEmpty(place)) {
 					//根据装货城市获取经纬度
 					//根据装货城市获取经纬度
 					String str = EntCoordUtil.getCoordinate(place);
 					String str = EntCoordUtil.getCoordinate(place);
-					String str1 = str.substring(0, str.indexOf(","));//经度
-					String str2 = str.substring(str1.length() + 1, str.length());//纬度
-
-					//装货地经纬度
-					double lng1 = Math.toRadians(Double.valueOf(str1));
-					double lat1 = Math.toRadians(Double.valueOf(str2));
-					// 纬度之差
-					double a = lat1 - latitude;
-					// 经度之差
-					double b = lng1 - longitude;
-					// 计算两点距离的公式
-					double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
-							Math.cos(lat1) * Math.cos(latitude) * Math.pow(Math.sin(b / 2), 2)));
-					// 弧长乘地球半径, 返回单位: 千米
-					s = s * EARTH_RADIUS;
-					foodInfo.setDistance(Math.floor(s));
+					// 参数解释:lng:经度,lat:维度。KEY:腾讯地图key
+					String urlString = "https://apis.map.qq.com/ws/direction/v1/driving/?from=" + str+ "&to=" + foodInfo.getLocation()  + "&key=" + KEY ;
+					//输入流的缓冲
+					StringBuffer sb = new StringBuffer();
+					try {
+						URL url = new URL(urlString);
+						BufferedReader in =  new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
+						String line;
+						// 获取地址解析结果
+						while ((line = in.readLine()) != null) {
+							sb.append(line);
+						}
+						in.close();
+					} catch (Exception e) {
+						e.getMessage();
+					}
+					String result = sb.toString();
+					JSONObject jsonObj = JSONObject.parseObject(result);
+					JSONObject obj = jsonObj.getJSONObject("result");
+					JSONArray jsonArray = obj.getJSONArray("routes");
+					if(jsonArray != null&&jsonArray.size() > 0){
+						String distance=JSONObject.parseObject(jsonArray.get(0).toString()).getString("distance");
+						foodInfo.setDistance(Double.valueOf(distance));
+					}
 				}
 				}
 			}
 			}
 			//按距离排序
 			//按距离排序

+ 3 - 1
unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/FoodInfoMapper.xml

@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND lci.delete_flag = 0
                 AND lci.delete_flag = 0
                 AND lci.interaction_flag = 1
                 AND lci.interaction_flag = 1
                 AND lci.common_id = #{commonId}
                 AND lci.common_id = #{commonId}
+        LEFT JOIN food_dishes_info fdi ON fdi.food_id=f.id and fdi.delete_flag = 0
         WHERE
         WHERE
             f.delete_flag = 0
             f.delete_flag = 0
           AND f.`status` = '显示中'
           AND f.`status` = '显示中'
@@ -47,7 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         </if>
         <if test="searchKeyWord != null and searchKeyWord != ''">
         <if test="searchKeyWord != null and searchKeyWord != ''">
             AND (lower(f.label) like lower(CONCAT('%',#{searchKeyWord},'%'))
             AND (lower(f.label) like lower(CONCAT('%',#{searchKeyWord},'%'))
-            OR lower(f.shop_names) like lower(CONCAT('%',#{searchKeyWord},'%')))
+            OR lower(f.shop_names) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(fdi.dish_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
         </if>
         </if>
         <if test="searchType != null and searchType == 4">
         <if test="searchType != null and searchType == 4">
             and lci.id is not null
             and lci.id is not null