|
|
|
<template>
|
|
|
|
<view class="v-pages-bg bgcolor p-b-24">
|
|
|
|
<view class="fod_det_pic">
|
|
|
|
<image :src="rootPath + foodDetail.imagelist[0]" mode="aspectFill" class="ms_top_img"></image>
|
|
|
|
</view>
|
|
|
|
<view class="v-card container-fluid m-t--80">
|
|
|
|
<view class="card-name"><text class="text">{{ foodDetail.title }}</text></view>
|
|
|
|
<view class="v-card-content m-t-24">
|
|
|
|
<u-parse :content="foodDetail.content" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="v-card container-fluid m-t-24" v-if="isShowBusiness == 'YES' && (restaurantList != null && restaurantList.length > 0)">
|
|
|
|
<view class="v-card-title">
|
|
|
|
<view class="text">
|
|
|
|
<text>附近商家推荐</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="v-card-list">
|
|
|
|
<view @tap="goToRetaurant(item.guid)" class="v-card-list-item row"
|
|
|
|
v-for="(item, index) in restaurantList" :key="index" :item-id="index" :data-year="index">
|
|
|
|
<view class="item_img">
|
|
|
|
<image :src="item.logo" class="an_ls_img2" mode="aspectFill"></image>
|
|
|
|
</view>
|
|
|
|
<view class="item_content">
|
|
|
|
<text class="lst_tit word_1">{{ item.title }}</text>
|
|
|
|
<text class="lsinf word_1">{{ item.address }}</text>
|
|
|
|
<text @click="goToNavigation(item.lng, item.lat, item.address, item.title)" class="lsinf">{{ item.distance
|
|
|
|
}}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view v-if="restaurantList.length <= 0" style="text-align: center;color: gray;">暂无数据!</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import uParse from '@/components/gaoyia-parse/parse.vue';
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
uParse
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
strings: '',
|
|
|
|
fid: '',
|
|
|
|
zhankai: 0,
|
|
|
|
shouqi: 1,
|
|
|
|
fareacode: '',
|
|
|
|
foodDetail: {},
|
|
|
|
restaurantList: [],
|
|
|
|
lon: '',
|
|
|
|
lat: '',
|
|
|
|
isShowBusiness: 'NO',
|
|
|
|
rootPath: this.$config.ROOTPATH,
|
|
|
|
netType: true
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onLoad: function(option) {
|
|
|
|
var that = this;
|
|
|
|
this.$util.getNetworkType(
|
|
|
|
function(res) {
|
|
|
|
if (res.networkType === 'none') {
|
|
|
|
uni.showToast({
|
|
|
|
title: that.$param.netMsg,
|
|
|
|
icon: "none",
|
|
|
|
duration: 2000
|
|
|
|
})
|
|
|
|
that.netType = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
function() {
|
|
|
|
uni.showToast({
|
|
|
|
title: that.$param.netMsg,
|
|
|
|
icon: "none",
|
|
|
|
duration: 2000
|
|
|
|
})
|
|
|
|
that.netType = false;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
if (!that.netType) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$util.hideLoadingByTime();
|
|
|
|
this.fid = option.fid;
|
|
|
|
this.fareacode = option.fareacode;
|
|
|
|
(this.lon = this.$param.clng), (this.lat = this.$param.clat);
|
|
|
|
this.getIsShow();
|
|
|
|
this.getFoodDetail(option.fid, option.fareacode);
|
|
|
|
|
|
|
|
that.$util.saveOperatorLog(that, 'FOOD', option.fid);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getIsShow: function() {
|
|
|
|
var that = this;
|
|
|
|
this.$Request
|
|
|
|
.post(this.$config.getSysParamFormRegion, {
|
|
|
|
userkey: this.$param.userkey
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
if (!that.$util.isSuccess(res)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//console.log(res.data);
|
|
|
|
var d = res.data;
|
|
|
|
this.isShowBusiness = d.isShowBusiness;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
preview(src, e) {
|
|
|
|
// do something
|
|
|
|
},
|
|
|
|
navigate(href, e) {
|
|
|
|
// do something
|
|
|
|
},
|
|
|
|
getFoodDetail: function(guid, region) {
|
|
|
|
var that = this;
|
|
|
|
var data = {
|
|
|
|
userkey: this.$param.userkey,
|
|
|
|
type: this.$param.foodType,
|
|
|
|
guid: guid,
|
|
|
|
lng: this.lon,
|
|
|
|
lat: this.lat
|
|
|
|
};
|
|
|
|
this.$Request.post(this.$config.getMessgeInfoDetailFormId, data).then(res => {
|
|
|
|
if (!that.$util.isSuccess(res)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var data = res.data;
|
|
|
|
data.logo = this.$config.ROOTPATH + data.logo;
|
|
|
|
var shangjia = data[that.$param.shangjiakey];
|
|
|
|
for (let i = 0; i < shangjia.length; i++) {
|
|
|
|
shangjia[i].logo = this.$config.ROOTPATH + shangjia[i].logo;
|
|
|
|
shangjia[i].distance = this.$util.formatDistance(shangjia[i].distance);
|
|
|
|
}
|
|
|
|
this.restaurantList = shangjia;
|
|
|
|
this.foodDetail = data;
|
|
|
|
console.log("adsf", this.foodDetail)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
opens: function() {
|
|
|
|
(this.zhankai = 1), (this.shouqi = 0);
|
|
|
|
},
|
|
|
|
goToNavigation: function(lon, lat, address, businessname) {
|
|
|
|
// #ifdef H5
|
|
|
|
|
|
|
|
if (this.$wechat.isWechat()) {
|
|
|
|
var mapParam = {
|
|
|
|
latitude: lat,
|
|
|
|
longitude: lon,
|
|
|
|
scale: 18,
|
|
|
|
name: businessname,
|
|
|
|
address: address
|
|
|
|
};
|
|
|
|
this.$util.openLocation(mapParam);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window.location.href = 'https://uri.amap.com/navigation?to=' + lon + ',' + lat + ',' + businessname +
|
|
|
|
'&mode=car&src=nyx_super&callnative=1';
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
if (plus.os.name == 'Android') {
|
|
|
|
//判断手机是否安装了百度地图 判断hasBaiduMap的true false
|
|
|
|
var hasBaiduMap = plus.runtime.isApplicationExist({
|
|
|
|
pname: 'com.baidu.BaiduMap',
|
|
|
|
action: 'baidumap://'
|
|
|
|
});
|
|
|
|
//判断手机是否安装了高德地图 判断hasAmap的true false
|
|
|
|
var hasAmap = plus.runtime.isApplicationExist({
|
|
|
|
pname: 'com.autonavi.minimap',
|
|
|
|
action: 'androidamap://'
|
|
|
|
});
|
|
|
|
//打开百度app导航url
|
|
|
|
var urlBaiduMap =
|
|
|
|
'baidumap://map/direction?origin=' + this.lat + ',' + this.lon + '&destination=' + lat + ',' +
|
|
|
|
lon + '&coord_type=bd09ll&src=andr.baidu.openAPIdemo';
|
|
|
|
//打开高德app导航url dlat dlon dname为终点经纬度和地名。不传起点默认为当前位置。
|
|
|
|
var urlAmap = 'androidamap://route?slat=' + this.lat + '&slon=' + this.lon + '&dlat=' + lat +
|
|
|
|
'&dlon=' + lon + '&dev=0&t=2';
|
|
|
|
//底部弹框选择打开的应用
|
|
|
|
if (hasBaiduMap && hasAmap) {
|
|
|
|
plus.nativeUI.actionSheet({
|
|
|
|
title: '选择地图应用',
|
|
|
|
cancel: '取消',
|
|
|
|
buttons: [{
|
|
|
|
title: '百度地图'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '高德地图'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
function(e) {
|
|
|
|
switch (e.index) {
|
|
|
|
case 1:
|
|
|
|
plus.runtime.openURL(urlBaiduMap);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
plus.runtime.openURL(urlAmap);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
} else if (hasAmap) {
|
|
|
|
plus.runtime.openURL(urlAmap);
|
|
|
|
} else if (hasBaiduMap) {
|
|
|
|
plus.runtime.openURL(urlBaiduMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// #endif
|
|
|
|
},
|
|
|
|
goToRetaurant: function(guid) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: '/subPageA/store/storedetail/storedetail?id=' + guid
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|