公司演示版e鹿悦游
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CjyTravel/subPageA/food/fooddetial/fooddetial.vue

222 lines
6.1 KiB

2 years ago
<template>
11 months ago
<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" />
2 years ago
</view>
</view>
11 months ago
<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>
2 years ago
</view>
11 months ago
</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">
2 years ago
<image :src="item.logo" class="an_ls_img2" mode="aspectFill"></image>
</view>
11 months ago
<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>
2 years ago
</view>
11 months ago
<view v-if="restaurantList.length <= 0" style="text-align: center;color: gray;">暂无数据</view>
2 years ago
</view>
</view>
</view>
</template>
<script>
11 months ago
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() {
2 years ago
uni.showToast({
title: that.$param.netMsg,
icon: "none",
duration: 2000
2 years ago
})
that.netType = false;
}
11 months ago
)
if (!that.netType) {
return;
2 years ago
}
11 months ago
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);
1 year ago
11 months ago
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 => {
2 years ago
if (!that.$util.isSuccess(res)) {
return;
}
11 months ago
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)
2 years ago
});
11 months ago
},
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);
2 years ago
return;
}
11 months ago
window.location.href = 'https://uri.amap.com/navigation?to=' + lon + ',' + lat + ',' + businessname +
'&mode=car&src=nyx_super&callnative=1';
// #endif
2 years ago
11 months ago
// #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;
2 years ago
}
}
11 months ago
);
} else if (hasAmap) {
plus.runtime.openURL(urlAmap);
} else if (hasBaiduMap) {
plus.runtime.openURL(urlBaiduMap);
}
2 years ago
}
11 months ago
// #endif
},
goToRetaurant: function(guid) {
uni.navigateTo({
url: '/subPageA/store/storedetail/storedetail?id=' + guid
});
2 years ago
}
}
11 months ago
};
2 years ago
</script>
<style>
11 months ago
</style>