feat: 商品详情页面交互

This commit is contained in:
duanshuwen
2025-08-02 17:35:57 +08:00
parent 9d6abe3e2a
commit ea5841d594
28 changed files with 1967 additions and 268 deletions

View File

@@ -0,0 +1,46 @@
<template>
<view class="store-address" @click="openMap">
<uni-icons type="location" size="18" color="#999" />
<text>{{ orderData.commodityAddress }}</text>
<uni-icons type="right" size="14" color="#999" />
</view>
</template>
<script setup>
import { defineProps } from "vue";
defineProps({
orderData: {
type: Object,
required: true,
default: () => ({}),
},
});
// 打开地图
const openMap = () => {
const address = props.orderData.commodityAddress;
const latitude = Number(props.orderData.commodityLatitude);
const longitude = Number(props.orderData.commodityLongitude);
uni.getLocation({
type: "gcj02", //返回可以用于uni.openLocation的经纬度
success: (res) => {
console.log("当前经纬度", latitude, longitude);
uni.openLocation({
latitude: latitude,
longitude: longitude,
address: address,
success: () => {
console.log("success");
},
});
},
});
};
</script>
<style scoped lang="scss">
@import "./styles/index.scss";
</style>

View File

@@ -0,0 +1,14 @@
.store-address {
display: flex;
align-items: center;
font-size: 14px;
color: #333;
text {
flex: 1;
padding: 0 6px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}