|
@@ -11,28 +11,36 @@
|
|
|
<text class="uni-extra" @click="navigateToXiangqing">设施/详情></text>
|
|
<text class="uni-extra" @click="navigateToXiangqing">设施/详情></text>
|
|
|
<text class="uni-body">宜春市靖安县北高速路口什么路899号</text>
|
|
<text class="uni-body">宜春市靖安县北高速路口什么路899号</text>
|
|
|
<image class="uni-phone" @click="telphone(phone)" src="../../static/index/index_phone.svg"></image>
|
|
<image class="uni-phone" @click="telphone(phone)" src="../../static/index/index_phone.svg"></image>
|
|
|
- <image class="uni-map" @click="mapDaohang('115.387261','28.788671')" src="../../static/index/index_map.svg"></image>
|
|
|
|
|
- <br><text class="uni-body2">距离我520km</text>
|
|
|
|
|
|
|
+ <a href="https://uri.amap.com/marker?position=115.387261,28.788671&name=南昌交通学院智慧公寓">
|
|
|
|
|
+ <image class="uni-map" @click="mapDaohang('115.387261','28.788671')" src="../../static/index/index_map.svg"></image>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <br><text class="uni-body2">距离我{{distance}}km</text>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 第二层工具 -->
|
|
<!-- 第二层工具 -->
|
|
|
<view class="item-list">
|
|
<view class="item-list">
|
|
|
<view class="item-list-one" @click="navigateToXuzhi">
|
|
<view class="item-list-one" @click="navigateToXuzhi">
|
|
|
- <image src="../../static/index/index_xuzhi.svg" class="img-btn" height="100%" width="100%"></image>
|
|
|
|
|
|
|
+ <image src="../../static/index/xuzhi.png" class="img-btn" height="100%" width="100%"></image>
|
|
|
<text class="list-txt">入住须知</text>
|
|
<text class="list-txt">入住须知</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="item-list-one" @click="navigateToDairuzhu">
|
|
<view class="item-list-one" @click="navigateToDairuzhu">
|
|
|
- <image src="../../static/index/index_ruzhu.svg" class="img-btn"></image>
|
|
|
|
|
|
|
+ <image src="../../static/index/ruzhu.png" class="img-btn"></image>
|
|
|
<text class="list-txt">办理入住</text>
|
|
<text class="list-txt">办理入住</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="item-list-one" @click="navigateToXuzhu">
|
|
|
|
|
|
|
+ <!-- <view class="item-list-one" @click="navigateToXuzhu">
|
|
|
<image src="../../static/index/index_xuzhu.svg" class="img-btn"></image>
|
|
<image src="../../static/index/index_xuzhu.svg" class="img-btn"></image>
|
|
|
<text class="list-txt">办理续住</text>
|
|
<text class="list-txt">办理续住</text>
|
|
|
- </view>
|
|
|
|
|
|
|
+ </view> -->
|
|
|
<view class="item-list-one" @click="navigateToTuifang">
|
|
<view class="item-list-one" @click="navigateToTuifang">
|
|
|
- <image src="../../static/index/index_tuifang.svg" class="img-btn"></image>
|
|
|
|
|
|
|
+ <image src="../../static/index/tuifang.png" class="img-btn"></image>
|
|
|
<text class="list-txt">办理退房</text>
|
|
<text class="list-txt">办理退房</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <!-- 退房失败时弹框 -->
|
|
|
|
|
+ <uni-popup ref="popup_tui" type="center" width="300rpx" height="300rpx" background-color="#fff">
|
|
|
|
|
+ <view class="kuang_txt">
|
|
|
|
|
+ <text>请先订房</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </uni-popup>
|
|
|
<!-- 第三层订房 -->
|
|
<!-- 第三层订房 -->
|
|
|
<view class="room-list">
|
|
<view class="room-list">
|
|
|
<!-- 选择住房日期 -->
|
|
<!-- 选择住房日期 -->
|
|
@@ -43,7 +51,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="select-center">
|
|
<view class="select-center">
|
|
|
<view class="select-line1"></view>
|
|
<view class="select-line1"></view>
|
|
|
- <view class="select-circle">1晚</view>
|
|
|
|
|
|
|
+ <view class="select-circle">{{ruzhu_num}}晚</view>
|
|
|
<view class="select-line2"></view>
|
|
<view class="select-line2"></view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="select-time-one">
|
|
<view class="select-time-one">
|
|
@@ -62,7 +70,7 @@
|
|
|
<!-- 房型列表 -->
|
|
<!-- 房型列表 -->
|
|
|
<view class="room-kuang">
|
|
<view class="room-kuang">
|
|
|
<view class="room-xinxi" v-for="(item,index) in roomType" :key="index">
|
|
<view class="room-xinxi" v-for="(item,index) in roomType" :key="index">
|
|
|
- <image class="room-image" src="item.masterImage" @click="inputDialogToggle(item.id)"></image>
|
|
|
|
|
|
|
+ <image class="room-image" :src="item.masterImage" @click="inputDialogToggle(item.id)"></image>
|
|
|
<view class="room-name">{{item.typeName}}</view>
|
|
<view class="room-name">{{item.typeName}}</view>
|
|
|
<view class="room-mark">{{item.typeShortDesc}}</view>
|
|
<view class="room-mark">{{item.typeShortDesc}}</view>
|
|
|
<view class="room-icon">
|
|
<view class="room-icon">
|
|
@@ -73,9 +81,9 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="before-price"><strike>¥{{item.usualPrice}}</strike></view>
|
|
<view class="before-price"><strike>¥{{item.usualPrice}}</strike></view>
|
|
|
<view class="room-price">¥{{item.discountPrice}}</view>
|
|
<view class="room-price">¥{{item.discountPrice}}</view>
|
|
|
- <view class="room-button" :class="{'room-button2': item.enableNum == 0}" @click="navigateToOrderRoom(item.enableNum,item.id,item.typeName)">
|
|
|
|
|
|
|
+ <view class="room-button" :class="{'room-button2': item.enableNum == 0}">
|
|
|
<text v-if="item.enableNum==0">已满</text>
|
|
<text v-if="item.enableNum==0">已满</text>
|
|
|
- <text v-else>订</text>
|
|
|
|
|
|
|
+ <text v-else @click="navigateToOrderRoom(item.enableNum,item.id,item.typeName)">订</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="room-line" v-if="index<(roomType.length-1)"></view>
|
|
<view class="room-line" v-if="index<(roomType.length-1)"></view>
|
|
|
</view>
|
|
</view>
|
|
@@ -179,8 +187,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 导入图片
|
|
// 导入图片
|
|
|
- import room1 from '../../static/index/swiper_img1.svg'
|
|
|
|
|
- import room2 from '../../static/index/swiper_img1.svg'
|
|
|
|
|
import AMap from "../../lib/qqmap-wx-jssdk.js"
|
|
import AMap from "../../lib/qqmap-wx-jssdk.js"
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
@@ -195,12 +201,16 @@
|
|
|
date:'',
|
|
date:'',
|
|
|
endDate:''
|
|
endDate:''
|
|
|
},
|
|
},
|
|
|
|
|
+ distance: 0, //"距离"
|
|
|
startTime:'',//默认到店日期
|
|
startTime:'',//默认到店日期
|
|
|
endTime:'',//默认离店日期
|
|
endTime:'',//默认离店日期
|
|
|
startDate:'',//默认到店日期接口数据
|
|
startDate:'',//默认到店日期接口数据
|
|
|
endDate:'',//默认离店日期接口数据
|
|
endDate:'',//默认离店日期接口数据
|
|
|
startWeek:'',// 默认入店日
|
|
startWeek:'',// 默认入店日
|
|
|
endWeek:'',// 默认离店
|
|
endWeek:'',// 默认离店
|
|
|
|
|
+ payMount:0,//房间价格
|
|
|
|
|
+ freeRoom:0,//房间剩余
|
|
|
|
|
+ ruzhu_num:1,//入住夜晚数
|
|
|
//续住里选择器
|
|
//续住里选择器
|
|
|
infoXu: {
|
|
infoXu: {
|
|
|
lunar: true,
|
|
lunar: true,
|
|
@@ -214,20 +224,9 @@
|
|
|
roomType:[],
|
|
roomType:[],
|
|
|
typeText:'',//房型详细描述
|
|
typeText:'',//房型详细描述
|
|
|
indicatorDots: true,//滚动图片提示条默认出现
|
|
indicatorDots: true,//滚动图片提示条默认出现
|
|
|
- img:[
|
|
|
|
|
- {
|
|
|
|
|
- value: '1',
|
|
|
|
|
- srcUrl:room1,
|
|
|
|
|
- name: '图1'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- value: '2',
|
|
|
|
|
- srcUrl:room2,
|
|
|
|
|
- name: '图2'
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- phone:'15079248859',//电话
|
|
|
|
|
- latitude: '', // 默认定在首都
|
|
|
|
|
|
|
+ img:[],//轮播图里图片
|
|
|
|
|
+ phone:'0791-82293574',//电话
|
|
|
|
|
+ latitude: '', // 默认当前纬度
|
|
|
longitude:'',
|
|
longitude:'',
|
|
|
scale: 12, // 默认16
|
|
scale: 12, // 默认16
|
|
|
markers: [],
|
|
markers: [],
|
|
@@ -241,6 +240,9 @@
|
|
|
this.endDate = getDate(new Date(),1).fullDate2
|
|
this.endDate = getDate(new Date(),1).fullDate2
|
|
|
this.getRoomType()
|
|
this.getRoomType()
|
|
|
},
|
|
},
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
onReady() {
|
|
onReady() {
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.showCalendar = true
|
|
this.showCalendar = true
|
|
@@ -269,23 +271,57 @@
|
|
|
this.getLocationInfo();
|
|
this.getLocationInfo();
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
|
|
+ const that = this;
|
|
|
|
|
+ uni.getLocation({
|
|
|
|
|
+ type: "gcj02",
|
|
|
|
|
+ success: function(res) {
|
|
|
|
|
+ // 暂时
|
|
|
|
|
+ that.longitude = res.longitude;
|
|
|
|
|
+ that.latitude = res.latitude;
|
|
|
|
|
+ var long = 0;
|
|
|
|
|
+ var lat = 0;
|
|
|
|
|
+ //小数点保留六位 经度
|
|
|
|
|
+ if (that.longitude.toString().indexOf('.') > 0) {
|
|
|
|
|
+ const longlatsplit = that.longitude.toString().split('.');
|
|
|
|
|
+ if (longlatsplit.length >= 2) {
|
|
|
|
|
+ long = parseFloat(longlatsplit[0] === "" ? 0 : longlatsplit[0]) + parseFloat("." + longlatsplit[1].slice(0,6));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (that.latitude.toString().indexOf('.') > 0) {
|
|
|
|
|
+ const longlatsplit1 = that.latitude.toString().split('.');
|
|
|
|
|
+ if (longlatsplit1.length >= 2) {
|
|
|
|
|
+ lat = parseFloat(longlatsplit1[0] === "" ? 0 : longlatsplit1[0]) + parseFloat("." + longlatsplit1[1].slice(0,6));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ that.distance = that.getMapDistance(lat,long,'28.788671','115.387261');
|
|
|
|
|
+ that.markers = [{
|
|
|
|
|
+ id: "",
|
|
|
|
|
+ latitude: res.latitude,
|
|
|
|
|
+ longitude: res.longitude,
|
|
|
|
|
+ iconPath: "../../static/img/phone.png",
|
|
|
|
|
+ width: that.markerHeight, //宽
|
|
|
|
|
+ height: that.markerHeight, //高
|
|
|
|
|
+ }, ];
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
// 不同意给出弹框,再次确认
|
|
// 不同意给出弹框,再次确认
|
|
|
- this.openConfirm()
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- this.getLocationInfo();
|
|
|
|
|
- })
|
|
|
|
|
- .catch(() => {
|
|
|
|
|
- this.rejectGetLocation();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // this.openConfirm()
|
|
|
|
|
+ // .then(() => {
|
|
|
|
|
+ // this.getLocationInfo();
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(() => {
|
|
|
|
|
+ // this.rejectGetLocation();
|
|
|
|
|
+ // });
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+
|
|
|
// 房型接口
|
|
// 房型接口
|
|
|
getRoomType() {
|
|
getRoomType() {
|
|
|
let _self = this
|
|
let _self = this
|
|
|
_self.roomType = []
|
|
_self.roomType = []
|
|
|
- this.$axios.get("/ihotel/roomType/list?startTime="+this.startDate+"&endTime="+this.endDate).then(res => {
|
|
|
|
|
|
|
+ this.$axios.get("/ihotel/roomType/list?startDate="+this.startDate.substring(0,10)+"&endDate="+this.endDate.substring(0,10)).then(res => {
|
|
|
res = res.data
|
|
res = res.data
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
// console.log(res)
|
|
// console.log(res)
|
|
@@ -323,16 +359,15 @@
|
|
|
this.$axios.get("/ihotel/hotelOrder/user/order/page?curPage=1&pageSize=100",
|
|
this.$axios.get("/ihotel/hotelOrder/user/order/page?curPage=1&pageSize=100",
|
|
|
{
|
|
{
|
|
|
headers:{
|
|
headers:{
|
|
|
- 'user_token':localStorage.getItem('user_token')
|
|
|
|
|
|
|
+ 'user_token':localStorage.getItem('token')
|
|
|
}
|
|
}
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
res = res.data
|
|
res = res.data
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
- // console.log(res)
|
|
|
|
|
res.data.list.forEach(data => {
|
|
res.data.list.forEach(data => {
|
|
|
if (data.flag !== '-1') {
|
|
if (data.flag !== '-1') {
|
|
|
_self.xuzhu_type.push(data.orderStatu)
|
|
_self.xuzhu_type.push(data.orderStatu)
|
|
|
- console.log(_self.xuzhu_type)
|
|
|
|
|
|
|
+ // console.log(_self.xuzhu_type)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
@@ -355,11 +390,26 @@
|
|
|
},
|
|
},
|
|
|
// 订房间
|
|
// 订房间
|
|
|
navigateToOrderRoom(enableNum,id,typeName) {
|
|
navigateToOrderRoom(enableNum,id,typeName) {
|
|
|
- if (enableNum>=1){
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: "../order_room/order_room?roomTypeId="+id +"&enableStartTime="+this.startDate+"&enableEndTime="+this.endDate+"&startTime="+this.startTime+"&endTime="+this.endTime+"&startWeek="+this.startWeek+"&endWeek="+this.endWeek+"&typeName="+typeName,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let _self = this
|
|
|
|
|
+ _self.roomType = []
|
|
|
|
|
+ this.$axios.get("/ihotel/hotelOrder/user/order/confirm?startTime="+this.startDate.substring(0,10)+"&endTime="+this.endDate.substring(0,10)+'&roomTypeId='+id).then(res => {
|
|
|
|
|
+ res = res.data
|
|
|
|
|
+ if (res.success) {
|
|
|
|
|
+ // console.log(res)
|
|
|
|
|
+ this.payMount=res.data.totalAmount
|
|
|
|
|
+ this.freeRoom=res.data.freeNum
|
|
|
|
|
+ this.ruzhu_num=res.data.nums
|
|
|
|
|
+ if (enableNum>=1){
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: "../order_room/order_room?roomTypeId="+id +"&enableStartTime="+this.startDate+"&enableEndTime="+this.endDate+"&startTime="+this.startTime+"&endTime="+this.endTime+"&typeName="+typeName+"&payMount="+this.payMount+"&freeRoom="+this.freeRoom+'&ruzhu_num='+this.ruzhu_num,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ this.getRoomType()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ alert(res.message)
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
//办理入住跳转
|
|
//办理入住跳转
|
|
@@ -370,9 +420,26 @@
|
|
|
},
|
|
},
|
|
|
//办理退房
|
|
//办理退房
|
|
|
navigateToTuifang(){
|
|
navigateToTuifang(){
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url:"../my_orderlist/my_orderlist?Inv=3"
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.xuzhu_panduan=[]
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.getOrderPage()
|
|
|
|
|
+ },1)
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ for (let i=0;i<this.xuzhu_type.length;i++){
|
|
|
|
|
+ this.xuzhu_type.forEach(val => {
|
|
|
|
|
+ if(val[i]==3) {
|
|
|
|
|
+ this.xuzhu_panduan.push(val)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.xuzhu_panduan.length>1) {
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url:"../my_orderlist/my_orderlist?Inv=3"
|
|
|
|
|
+ })
|
|
|
|
|
+ }else if(this.xuzhu_panduan.length<1) {
|
|
|
|
|
+ this.$refs.popup_tui.open()
|
|
|
|
|
+ }
|
|
|
|
|
+ },150)
|
|
|
},
|
|
},
|
|
|
//户型详情弹窗
|
|
//户型详情弹窗
|
|
|
inputDialogToggle(id) {
|
|
inputDialogToggle(id) {
|
|
@@ -420,17 +487,16 @@
|
|
|
this.$refs.popup_picker.open()
|
|
this.$refs.popup_picker.open()
|
|
|
},
|
|
},
|
|
|
change(e) {
|
|
change(e) {
|
|
|
- console.log('1change 返回:', e)
|
|
|
|
|
- // 模拟动态打卡
|
|
|
|
|
- // if (this.info.selected.length > 3) return
|
|
|
|
|
- this.info.selected.push({
|
|
|
|
|
- date: e.range.before,
|
|
|
|
|
- info: '到店'
|
|
|
|
|
- })
|
|
|
|
|
- this.info.selected.push({
|
|
|
|
|
- date: e.range.after,
|
|
|
|
|
- info: '离店'
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.info.selected=[
|
|
|
|
|
+ {
|
|
|
|
|
+ date: e.range.before,
|
|
|
|
|
+ info: '到店'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ date: e.range.after,
|
|
|
|
|
+ info: '离店'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
if(e.range.before!=''&&e.range.after=='') {
|
|
if(e.range.before!=''&&e.range.after=='') {
|
|
|
this.startWeek='周'+e.lunar.ncWeek.substring(2,3)
|
|
this.startWeek='周'+e.lunar.ncWeek.substring(2,3)
|
|
|
} else if(e.range.before!=''&&e.range.after!=''){
|
|
} else if(e.range.before!=''&&e.range.after!=''){
|
|
@@ -440,6 +506,7 @@
|
|
|
this.endTime=e.range.after.substring(5,7)+'月'+e.range.after.substring(8,10)+'日'
|
|
this.endTime=e.range.after.substring(5,7)+'月'+e.range.after.substring(8,10)+'日'
|
|
|
this.startDate = e.range.before +' 14:00:00'
|
|
this.startDate = e.range.before +' 14:00:00'
|
|
|
this.endDate = e.range.after +' 12:00:00'
|
|
this.endDate = e.range.after +' 12:00:00'
|
|
|
|
|
+ this.ruzhu_num=parseInt(((new Date(e.range.after).getTime())-(new Date(e.range.before).getTime()))/1000/60/60/24)
|
|
|
if(this.endDate !=' 12:00:00') {
|
|
if(this.endDate !=' 12:00:00') {
|
|
|
this.getRoomType()
|
|
this.getRoomType()
|
|
|
}
|
|
}
|
|
@@ -509,10 +576,9 @@
|
|
|
lat = parseFloat(longlatsplit1[0] === "" ? 0 : longlatsplit1[0]) + parseFloat("." + longlatsplit1[1].slice(0,6));
|
|
lat = parseFloat(longlatsplit1[0] === "" ? 0 : longlatsplit1[0]) + parseFloat("." + longlatsplit1[1].slice(0,6));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // cookie.set("longitude", long);
|
|
|
|
|
- // cookie.set("latitude", lat);
|
|
|
|
|
console.log("纬度", lat);
|
|
console.log("纬度", lat);
|
|
|
- // this.distance(that.latitude,that.longitude);
|
|
|
|
|
|
|
+ that.distance = that.getMapDistance(lat,long,'28.788671','115.387261');
|
|
|
|
|
+ console.log(that.distance)
|
|
|
that.markers = [{
|
|
that.markers = [{
|
|
|
id: "",
|
|
id: "",
|
|
|
latitude: res.latitude,
|
|
latitude: res.latitude,
|
|
@@ -521,7 +587,6 @@
|
|
|
width: that.markerHeight, //宽
|
|
width: that.markerHeight, //宽
|
|
|
height: that.markerHeight, //高
|
|
height: that.markerHeight, //高
|
|
|
}, ];
|
|
}, ];
|
|
|
- that.getList();
|
|
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -530,19 +595,20 @@
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: "请求授权当前位置",
|
|
title: "请求授权当前位置",
|
|
|
- content: "我们需要获取地理位置信息,为您推荐附近的美食",
|
|
|
|
|
|
|
+ content: "我们需要获取地理位置信息,为您推荐路线",
|
|
|
success: (res) => {
|
|
success: (res) => {
|
|
|
- if (res.confirm) {
|
|
|
|
|
- uni.openSetting().then((res) => {
|
|
|
|
|
- if (res[1].authSetting["scope.userLocation"] === true) {
|
|
|
|
|
- resolve(); // 打开地图权限设置
|
|
|
|
|
- } else {
|
|
|
|
|
- reject();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- } else if (res.cancel) {
|
|
|
|
|
- reject();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (res.confirm) {
|
|
|
|
|
+ // uni.openSetting().then((res) => {
|
|
|
|
|
+ // if (res[1].authSetting["scope.userLocation"] === true) {
|
|
|
|
|
+ // resolve(); // 打开地图权限设置
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // reject();
|
|
|
|
|
+ // console.log('reject')
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // } else if (res.cancel) {
|
|
|
|
|
+ // reject();
|
|
|
|
|
+ // }
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -558,32 +624,33 @@
|
|
|
},
|
|
},
|
|
|
//打开地图导航
|
|
//打开地图导航
|
|
|
mapDaohang(lon,lat){
|
|
mapDaohang(lon,lat){
|
|
|
- console.log("获取经纬度ssssfff", lon, lat);
|
|
|
|
|
- //打开地图,并将门店位置传入
|
|
|
|
|
- uni.getLocation({
|
|
|
|
|
- success: res => {
|
|
|
|
|
- // res.latitude=lat;
|
|
|
|
|
- // res.longitude=lon;
|
|
|
|
|
- console.log('location success', parseFloat(lat), parseFloat(lon))
|
|
|
|
|
- uni.openLocation({
|
|
|
|
|
- latitude: parseFloat(lat),
|
|
|
|
|
- longitude: parseFloat(lon),
|
|
|
|
|
- scale: 18
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
- // uni.chooseLocation({
|
|
|
|
|
- // success: (res) => {
|
|
|
|
|
- // console.log('位置名称:' + res.name);
|
|
|
|
|
- // console.log('详细地址:' + res.address);
|
|
|
|
|
- // console.log('纬度:' + res.latitude);
|
|
|
|
|
- // console.log('经度:' + res.longitude);
|
|
|
|
|
- // this.positionName = res.name
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ //进行经纬度转换为距离的计算
|
|
|
|
|
+ Rad(d) {
|
|
|
|
|
+ return d * Math.PI / 180.0; //经纬度转换成三角函数中度分表形式。
|
|
|
|
|
+ },
|
|
|
|
|
+ /*
|
|
|
|
|
+ 计算距离,参数分别为第一点的纬度,经度;第二点的纬度,经度
|
|
|
|
|
+ 默认单位km
|
|
|
|
|
+ */
|
|
|
|
|
+ getMapDistance(lat1, lng1, lat2, lng2) {
|
|
|
|
|
+ // console.log(this.Rad(lat1))
|
|
|
|
|
+ // console.log(this.Rad(lng1))
|
|
|
|
|
+ // console.log(this.Rad(lat2))
|
|
|
|
|
+ // console.log(this.Rad(lng2))
|
|
|
|
|
+ // console.log(this.Rad(28.678651))
|
|
|
|
|
+ var radLat1 = this.Rad(lat1);
|
|
|
|
|
+ var radLat2 = this.Rad(lat2);
|
|
|
|
|
+ var a = radLat1 - radLat2;
|
|
|
|
|
+ var b = this.Rad(lng1) - this.Rad(lng2);
|
|
|
|
|
+ var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
|
|
|
|
|
+ Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
|
|
|
|
|
+ s = s * 6378.137; // EARTH_RADIUS;
|
|
|
|
|
+ s = Math.round(s * 10000) / 10000; //输出为公里
|
|
|
|
|
+ s=s.toFixed(2);
|
|
|
|
|
+ return s;
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|