店铺

parent 81e0eb99
import { request } from '../utils/request';
// 分类
export function getStoreInformation(data) {
return request({
url: `/sgyrdd/shop/getById?shopId=${data}`,
method: 'GET',
});
}
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
<view class="swiper"> <view class="swiper">
<wd-swiper <wd-swiper
customClass="swiper-custom" customClass="swiper-custom"
:list="swiperList" :list="shopSwiperList"
autoplay autoplay
height="536rpx" height="536rpx"
customStyle="border-radius: 0rpx;" customStyle="border-radius: 0rpx;"
:current="current" :current="current"
@click="handleClick" @click="handleClick"
@change="onChange" @change="onChange"
:indicator="{ type: 'dots-bar' }"
></wd-swiper> ></wd-swiper>
</view> </view>
<view class="content"> <view class="content">
...@@ -34,33 +35,24 @@ ...@@ -34,33 +35,24 @@
<view class="shop-info"> <view class="shop-info">
<view class="shop-info-top"> <view class="shop-info-top">
<view class="shop-info-detail"> <view class="shop-info-detail">
<text class="shop-title">川心美蛙鱼头火锅(中环广场店)</text> <text class="shop-title">{{ shopInfo.shopName }}</text>
<view class="shop-tag-list"> <view class="shop-tag-list">
<view class="tag-item"> <view class="tag-item" v-for="(item, index) in shopInfo.tagList" :key="index">
<text>中环广场卤煮 第1名</text> <text>{{ item }}</text>
</view>
<view class="tag-item">
<text>火锅</text>
</view>
<view class="tag-item">
<text>免费wifi</text>
</view>
<view class="tag-item">
<text>朋友聚餐</text>
</view> </view>
</view> </view>
</view> </view>
<view class="shop-info-right"> <view class="shop-info-right">
<view class="shop-info-score"> <view class="shop-info-score">
<view class="score-text"> <view class="score-text">
<text class="score-num">4.5</text> <text class="score-num">{{ shopInfo.grade }}</text>
<text class="tj">推荐</text> <text class="tj">推荐</text>
</view> </view>
<view class="score-icon"> <view class="score-icon">
<wd-rate <wd-rate
color="#fff" color="#fff"
readonly readonly
v-model="value" v-model="shopInfo.grade"
size="22rpx" size="22rpx"
space="8rpx" space="8rpx"
:active-color="['#FA5151']" :active-color="['#FA5151']"
...@@ -74,8 +66,8 @@ ...@@ -74,8 +66,8 @@
</view> </view>
<view class="shop-info-bottom"> <view class="shop-info-bottom">
<view class="shop-address"> <view class="shop-address">
<text class="shop-distance">距您<150米 南明区</text> <text class="shop-distance">距您<150米 {{ shopInfo.area }}</text>
<text class="shop-address-detail">南明区后巢乡花果园中环广场3号(M区3栋)一层104 号</text> <text class="shop-address-detail">{{ shopInfo.shopAddress }}(M区3栋)一层104 号</text>
</view> </view>
<view class="shop-map-phone"> <view class="shop-map-phone">
<image class="img1" src="@/static/shop/map.png"></image> <image class="img1" src="@/static/shop/map.png"></image>
...@@ -249,10 +241,14 @@ ...@@ -249,10 +241,14 @@
</template> </template>
<script setup> <script setup>
import navBar from '@/Components/navBar/navBar.vue'; import { getStoreInformation } from '@/api/shop';
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const current = ref(0); const current = ref(0);
const old = reactive({ scrollTop: 0 }); const old = reactive({ scrollTop: 0 });
const activeId = ref(1); const activeId = ref(1);
// 店铺信息
const shopInfo = ref({});
const shopSwiperList = ref([]);
const tagList = ref([ const tagList = ref([
{ name: '美食', id: 1 }, { name: '美食', id: 1 },
{ name: '休闲娱乐', id: 2 }, { name: '休闲娱乐', id: 2 },
...@@ -265,6 +261,13 @@ const swiperList = ref([ ...@@ -265,6 +261,13 @@ const swiperList = ref([
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg', 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg', 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg',
]); ]);
onLoad((options) => {
getStoreInformationFn('1626126617850544129');
});
onShow(() => {
getLocationFn();
});
const value = ref(5); const value = ref(5);
const handleClick = (e) => { const handleClick = (e) => {
console.log(e); console.log(e);
...@@ -276,6 +279,43 @@ function scroll(e) { ...@@ -276,6 +279,43 @@ function scroll(e) {
console.log(e); console.log(e);
old.scrollTop = e.detail.scrollTop; old.scrollTop = e.detail.scrollTop;
} }
function getLocationFn() {
// xma.getLocation({
// type: 'wgs84',
// success: function (res) {
// console.log('经度:' + res.longitude);
// console.log('纬度:' + res.latitude);
// },
// fail: function (err) {
// console.error('获取位置失败:', err);
// },
// });
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function (position) {
console.log('经度123:' + position.coords.longitude);
console.log('纬度:' + position.coords.latitude);
},
function (error) {
console.error('获取位置失败:', error);
},
);
} else {
console.error('浏览器不支持Geolocation API');
}
}
// 获取店铺信息
const getStoreInformationFn = (id) => {
getStoreInformation(id).then((res) => {
if (res.code === 0) {
shopInfo.value = res.data.shop;
shopSwiperList.value = res.data.imgList.map((item) => imgUrl + item.imgUrl);
shopInfo.value.tagList = res.data.shop.labels.split(',');
}
});
};
function changeActie(id) { function changeActie(id) {
activeId.value = id; activeId.value = id;
} }
...@@ -350,6 +390,9 @@ page { ...@@ -350,6 +390,9 @@ page {
:deep(.wd-swiper__track) { :deep(.wd-swiper__track) {
border-radius: 0; border-radius: 0;
} }
:deep(.wd-swiper-nav--bottom) {
bottom: 100rpx;
}
} }
.content { .content {
......
...@@ -35,7 +35,7 @@ export default defineConfig({ ...@@ -35,7 +35,7 @@ export default defineConfig({
alias: { alias: {
'@': path.resolve(__dirname, './src'), '@': path.resolve(__dirname, './src'),
}, },
}, },
server: { server: {
open: true, open: true,
// 代理配置 // 代理配置
......
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