feat: 商品详情的调整

This commit is contained in:
2025-09-06 16:24:44 +08:00
parent 7973743644
commit f6821ade2d
6 changed files with 136 additions and 32 deletions

View File

@@ -0,0 +1,45 @@
<template>
<view class="store-address" @click="openMap">
<text class="location-label">位于 [{{ orderData.commodityAddress }}]</text>
<text class="address-text">{{ orderData.commodityAddress }}</text>
</view>
</template>
<script setup>
import { defineProps } from "vue";
const props = 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,49 @@
.store-address {
display: flex;
align-items: start;
flex-direction: column;
padding: 16px 12px;
background-color: #f0f0f0;
background-image: url(""); // 预留背景图片位置,用户手动导入
background-size: cover;
background-position: center;
border-radius: 12px;
font-size: 14px;
color: #333;
position: relative;
overflow: hidden;
// 添加半透明遮罩层确保文字可读性
&::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.8);
z-index: 1;
}
// 确保内容在遮罩层之上
.location-label,
.address-text {
position: relative;
z-index: 2;
}
.location-label {
color: #333;
font-size: 14px;
margin-right: 4px;
font-weight: 500;
}
.address-text {
margin-top: 4px;
flex: 1;
color: #666;
font-size: 12px;
font-weight: 400;
}
}