1

parent db32b6fd
......@@ -4,7 +4,7 @@
<view class="content">
<view class="shop">
<image src="@/static/ticket/logo.png" class="logo" mode="aspectFill"></image>
<image :src="fileDomain + shopDetail.shopLogo" class="logo" mode="aspectFill"></image>
<view class="info">
<view class="top">
<view class="left">
......@@ -26,7 +26,7 @@
</view>
</view>
<view class="btn">
<view class="btn" @tap="toShop">
<image src="@/static/ticket/shopmail.png"></image>
<text>进店</text>
</view>
......@@ -35,7 +35,7 @@
<image class="address" src="@/static/ticket/address.png"></image>
<view class="infobox">
<text class="addr">{{ shopDetail.shopAddress }}</text>
<text>距您400米</text>
<text>距您{{ shopDetail.distance }}</text>
</view>
<view class="iconbox">
<image class="img" src="@/static/ticket/map.png"></image>
......@@ -62,13 +62,16 @@ import { getDistance } from '@/utils/common';
import Header from '@/pages/order/components/Header/index.vue';
import TicketList from '@/pages/ticket/components/TicketList/index.vue';
const fileDomain = import.meta.env.VITE_APP_IMG_URL;
onShow(() => {
// 获取位置
getLocationFn();
});
// 当前位置的经纬度
const currentLatitudeAndLongitude = ref({ latitude: 0, longitude: 0 });
onLoad(() => {
})
const shopId = ref('1626126617850544129');
const getList = async () => {
......@@ -80,7 +83,9 @@ getList();
/**
* 获取商铺信息
*/
const shopDetail = ref();
const shopDetail = ref({
shopName: '店铺详情',
});
const getShopMailDetail = async () => {
const res = await getShopDetail({ shopId: shopId.value });
if (res.code === 0) {
......@@ -93,7 +98,7 @@ getShopMailDetail();
* 拨打商家电话
* @param {*} phoneNumber
*/
function callShopPhone(phoneNumber) {
function callShopPhone(phoneNumber) {
xma.makePhoneCall({
phoneNumber, // 仅为示例
});
......@@ -103,16 +108,22 @@ function getLocationFn() {
xma.getLocation({
type: 'wgs84',
success: function (res) {
const myLatitude = currentLatitudeAndLongitude.value.latitude;
const myLongitude = currentLatitudeAndLongitude.value.longitude;
const myLatitude = shopDetail.value.shopLat;
const myLongitude = shopDetail.value.shopLng;
const distance = getDistance(res.latitude, res.longitude, myLatitude, myLongitude, 1);
shopInfo.value.distance = distance;
shopDetail.value.distance = distance;
},
fail: function (err) {
return err;
},
});
}
const toShop = () => {
xma.navigateTo({
url: `/pages/shop/shop?shopId=${shopId.value}`,
});
};
</script>
<style scoped lang="scss">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment