|
|
|
@ -40,6 +40,20 @@ |
|
|
|
<text class="lf-iconfont lf-icon-xiangyou lf-text-vertical"></text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view v-if="goods_detail.product.type == 0"> |
|
|
|
<view class="lf-row-between list-item lf-m-t-20"> |
|
|
|
<view class="lf-row-center"> |
|
|
|
<text class="lf-font-28 lf-color-gray">出发地</text> |
|
|
|
<text class="lf-text-vertical lf-m-l-40 lf-font-28 lf-color-black">{{goods_detail.product.extends.field_0_departure_place}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="lf-row-between list-item"> |
|
|
|
<view class="lf-row-center"> |
|
|
|
<text class="lf-font-28 lf-color-gray">目的地</text> |
|
|
|
<text class="lf-text-vertical lf-m-l-40 lf-font-28 lf-color-black">{{goods_detail.product.extends.field_0_destination}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 景区类型 --> |
|
|
|
<view v-if="goods_detail.product.extends && goods_detail.product && goods_detail.product.type == 2"> |
|
|
|
<view class="goods-detail" |
|
|
|
@ -50,7 +64,10 @@ |
|
|
|
<view class="lf-row-between"> |
|
|
|
<view class="lf-line-2 lf-font-28 lf-color-333"> |
|
|
|
{{goods_detail.product.extends.field_2_address}}</view> |
|
|
|
<view class="lf-iconfont lf-icon-dizhi lf-color-blue"></view> |
|
|
|
<view class="lf-flex-column lf-row-center"> |
|
|
|
<view class="lf-iconfont lf-icon-dizhi lf-color-blue"></view> |
|
|
|
<view class="lf-font-24 lf-color-222 lf-m-t-10" v-if="$isRight(shop_distance)">距您{{shop_distance}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="goods-detail" v-if="goods_detail.product.extends.field_2_open_time"> |
|
|
|
@ -514,7 +531,8 @@ |
|
|
|
//uview picker |
|
|
|
show: false, |
|
|
|
hotel_show_range: false, |
|
|
|
hotel_show_single: false |
|
|
|
hotel_show_single: false, |
|
|
|
shop_distance: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
@ -531,6 +549,56 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getGoodsDetail() { |
|
|
|
this.$http(this.API.API_ADVICEDETAILS, { |
|
|
|
id: this.goods_id |
|
|
|
}).then(res => { |
|
|
|
this.skeletonLoading = false; |
|
|
|
this.goods_detail = res.data; |
|
|
|
if(this.goods_detail) { |
|
|
|
this.getShopDistance(); |
|
|
|
} |
|
|
|
this.is_collect = Boolean(res.data.is_collect) || false; |
|
|
|
}).catch(err => { |
|
|
|
this.skeletonLoading = false; |
|
|
|
setTimeout(() => { |
|
|
|
this.$toBack(); |
|
|
|
}, 1000); |
|
|
|
}) |
|
|
|
}, |
|
|
|
//获取当前位置 计算商店距离 |
|
|
|
getShopDistance() { |
|
|
|
let that = this; |
|
|
|
wx.getLocation({ |
|
|
|
type: 'wgs84', |
|
|
|
isHighAccuracy: true, |
|
|
|
success (res) { |
|
|
|
const self_latitude = res.latitude |
|
|
|
const self_longitude = res.longitude |
|
|
|
console.log('当前经纬度',self_latitude,self_longitude,res); |
|
|
|
if(that.$isRight(that.goods_detail.product.extends)) { |
|
|
|
const shop_latitude = that.goods_detail.product.extends.field_2_latitude; |
|
|
|
const shop_longitude = that.goods_detail.product.extends.field_2_longitude; |
|
|
|
console.log('商家经纬度',shop_latitude,shop_longitude); |
|
|
|
//计算 |
|
|
|
var radLat1 = self_latitude* Math.PI / 180.0; |
|
|
|
var radLat2 = shop_latitude* Math.PI / 180.0; |
|
|
|
var a = radLat1 - radLat2; |
|
|
|
var b = (self_longitude* Math.PI / 180.0) - (shop_longitude* Math.PI / 180.0); |
|
|
|
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;//地球半径 |
|
|
|
s = Math.round(s * 10000) / 10000; |
|
|
|
s = s.toFixed(2) + 'km' //保留两位小数 |
|
|
|
that.shop_distance = s |
|
|
|
console.log('经纬度计算的距离:' + s) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
fail(err) { |
|
|
|
console.log(err) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
valChange(e) { |
|
|
|
this.buy_num = e.value; |
|
|
|
}, |
|
|
|
@ -667,20 +735,6 @@ |
|
|
|
name: address |
|
|
|
}); |
|
|
|
}, |
|
|
|
getGoodsDetail() { |
|
|
|
this.$http(this.API.API_ADVICEDETAILS, { |
|
|
|
id: this.goods_id |
|
|
|
}).then(res => { |
|
|
|
this.skeletonLoading = false; |
|
|
|
this.goods_detail = res.data; |
|
|
|
this.is_collect = Boolean(res.data.is_collect) || false; |
|
|
|
}).catch(err => { |
|
|
|
this.skeletonLoading = false; |
|
|
|
setTimeout(() => { |
|
|
|
this.$toBack(); |
|
|
|
}, 1000); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 切换商品收藏 |
|
|
|
switchCollect() { |
|
|
|
let userInfo = uni.getStorageSync('userinfo') || {}; |
|
|
|
|