achao 2 years ago
parent
commit
287da6e0cc

+ 1 - 1
uni_applet/App.vue

@@ -61,7 +61,7 @@
 		align-items: center;
 	}
 	.detailedAddress{
-		width:120rpx;
+		width:600rpx;
 		overflow:hidden;
 		white-space: nowrap;
 		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>
 		<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"
-			@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>
@@ -23,7 +23,7 @@
 					</view>
 				</view>
 			</view>
-		</u-popup>
+		</u-popup> -->
 		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
@@ -61,86 +61,6 @@
 			}
 		},
 		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() {},
 			onSearchName(e) {
 				if(e.length>10){
@@ -148,7 +68,6 @@
 				}else{
 					var text = e
 				}
-				
 				uni.setStorageSync('search_val', text);
 				uni.switchTab({
 					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"
 	},
 	"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",
@@ -19,34 +26,23 @@
 				"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": {
 		"custom": false,
 		"color": "#656765",
@@ -92,53 +88,52 @@
 		"backgroundColor": "#F8F8F8"
 	},
 	"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>
-	<view>
+	<view class="content">
 		<view class="flex content1">
 			<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 class=" search-wrap">
 				<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>
 						<text class="search-val"> {{searchVal?searchVal:'搜索美食'}}</text>
 					</view>
-			
+
 					<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 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>
-		<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>
 		<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 class="left">
 							<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 class="right">
 							<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 class='flex'>
+					<view class='flex row2'>
 						<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 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 class='address flex justify-space-between'>
-						<view  class='flex'>
+						<view class='flex'>
 							<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>{{item.distance}}
-						<text style='font-weight:600;'>km</text></view>
 					</view>
 				</view>
 			</mescroll-uni>
 			<!-- <mescroll-body ref="mescrollRef" :up="upOption" :down="downOption" @init="mescrollInit" @up="upCallback" @down="downCallback"></mescroll-body> -->
 		</view>
-		<view class='group' @click='group'>
+		<!-- <view class='group' @click='group'>
 			<button class="tuan">团</button>
-		</view>
+		</view> -->
 	</view>
 </template>
 
 <script>
 	var that;
 	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 MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	import {
+		authorizedLocation
+	} from '@/util/util.js'
 	export default {
 		components: {
 			MoteLinesDivide
@@ -82,29 +95,39 @@
 		mixins: [MescrollMixin],
 		data() {
 			return {
-				searchVal:uni.getStorageSync("search_val")?uni.getStorageSync("search_val"):"",
-				current:0,
-				mescroll:null,
-				findList:[],
+				place: '',
+				searchVal:  "",
+				current: 0,
+				mescroll: null,
+				findList: [],
 				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: {
 					auto: false,
 					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,
 						iname: '海鲜',
 					},
@@ -137,45 +160,94 @@
 		},
 		onLoad() {
 			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: {
+			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() {
 				uni.navigateTo({
 					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({
-					num:1,
-					size:10
+					num: 1,
+					size: 10
 				})
 			},
 			placeSelect() {
@@ -184,15 +256,15 @@
 						console.log(res);
 						that.latitude = res.latitude
 						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)
 						that.detailedAddress = _address.Village
-						uni.setStorageSync("detailedAddress",_address.Village)
+						uni.setStorageSync("detailedAddress", _address.Village)
 						that.$forceUpdate()
 						that.upCallback({
-							num:1,
-							size:10
+							num: 1,
+							size: 10
 						})
 					}
 				});
@@ -207,105 +279,114 @@
 					that.mescroll.endBySize(0, 0)
 					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) => {
 					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) {
-						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>
 
 <style lang="scss" scoped>
-	
+	.content {}
+
 	.content1 {
 		padding: 20rpx;
-		background-color: #fbb612;
+		background-color: #fff;
+
 		.search {
 			// color: #9199af;
 			// background: #f9d27d;
@@ -324,7 +405,7 @@
 				overflow: scroll;
 				position: relative;
 				margin-left: 20rpx;
-				color:#9199af;
+				color: #9199af;
 			}
 		}
 
@@ -333,98 +414,135 @@
 			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;
 	}
-	.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;
 			}
 		}
-		.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;
-		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;
-		width:100vw;
-		padding-top:5px;
-		height:49px;
+		width: 100vw;
+		padding-top: 5px;
+		height: 86rpx;
 		overflow-x: scroll;
 		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%);
 	}
-</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> -->
 					<!-- <image src="/static/icon_img/del.png" class="dSLComVueTopLeftDelImg" style="width: 35rpx;height: 35rpx;flex: none;" ></image> -->
 				</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 class="dSLComVueTopRight">
 				<view class="dSLComVueTopRightBtn" @click="onClickInput" >{{search_name?search_name:'搜索'}}</view>

+ 158 - 56
uni_applet/util/util.js

@@ -1,41 +1,42 @@
-
 // 日期格式化1
 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 
  */
 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)
+			}
+		})
+	})
 }