diff --git a/src/components/LocationCard/index.vue b/src/components/LocationCard/index.vue index 9695135..9c28940 100644 --- a/src/components/LocationCard/index.vue +++ b/src/components/LocationCard/index.vue @@ -1,14 +1,26 @@ @@ -30,21 +42,38 @@ const openMap = () => { const longitude = Number(props.orderData.commodityLongitude); uni.getLocation({ - type: "gcj02", //返回可以用于uni.openLocation的经纬度 - success: (res) => { - console.log("当前经纬度", latitude, longitude); - + type: "gcj02", + success: () => { + uni.openLocation({ + latitude: latitude, + longitude: longitude, + address: address, + }); + }, + fail: () => { uni.openLocation({ latitude: latitude, longitude: longitude, address: address, - success: () => { - console.log("success"); - }, }); }, }); }; + +// 拨打电话 +const getPhoneNumber = () => { + const o = props.orderData || {}; + return o.commodityPhone || o.phone || o.contactPhone || ""; +}; + +const callPhone = () => { + const phone = getPhoneNumber(); + if (!phone) { + uni.showToast({ title: "未提供电话号码", icon: "none" }); + return; + } + uni.makePhoneCall({ phoneNumber: String(phone) }); +};