bug

parent 0b6b47f8
......@@ -7,7 +7,9 @@
<text class="one-text">{{ item.grade }}推荐</text>
<!-- <text class="two-text">¥30/人</text> -->
<text class="three-text">销量{{ item.monthSoldNum }}</text>
<text class="four-text">1.2km</text>
<text class="four-text">
{{ getDistance(item.shopLat, item.shopLng, latF, lonF) }}
</text>
</view>
<view class="threeBox" v-if="item.evaluationVos.length === 0">
<image class="img2" :src="item.evaluationVos[0].avatar" mode="aspectFill" />
......@@ -36,6 +38,15 @@
<script setup>
import { defineProps } from 'vue';
import { getLocation } from '../../utils/tool';
import { getDistance } from '../../utils/common';
const lonF = ref(0);
const latF = ref(0);
onMounted(async () => {
const { lon, lat } = await getLocation();
lonF.value = lon;
latF.value = lat;
});
const props = defineProps({
cardData: {
type: Array,
......
......@@ -10,7 +10,9 @@
<text class="one-text">{{ shopCardData.grade }}推荐</text>
<!-- <text class="two-text">¥30/人</text> -->
<text class="three-text">销量{{ shopCardData.monthSoldNum }}</text>
<text class="four-text">1.2km</text>
<text class="four-text">
{{ getDistance(shopCardData.shopLat, shopCardData.shopLng, latF, lonF) }}
</text>
</view>
<view class="threeBox">
<image class="img2" :src="shopCardData.evaluationVos[0].avatar" mode="aspectFill" />
......@@ -23,7 +25,12 @@
</view>
</view>
<view class="nearby-bootom">
<view class="contentBox" v-for="(item, index) in shopCardData.simpleProds" :key="index">
<view
class="contentBox"
@tap="topFoodDetails(item.prodId)"
v-for="(item, index) in shopCardData.simpleProds"
:key="index"
>
<image class="img" :src="item.pic" mode="aspectFill" />
<text class="one">{{ item.prodName }}</text>
<view class="price">
......@@ -38,6 +45,10 @@
<script setup>
import { defineProps } from 'vue';
import { getDistance } from '../../utils/common';
import { getLocation } from '../../utils/tool';
const lonF = ref(0);
const latF = ref(0);
const props = defineProps({
shopCardData: {
type: Object,
......@@ -46,6 +57,16 @@ const props = defineProps({
}),
},
});
onMounted(async () => {
const { lon, lat } = await getLocation();
lonF.value = lon;
latF.value = lat;
});
const topFoodDetails = (id) => {
xma.navigateTo({
url: `/pages/packageDetails/packageDetails?prodId=${id}`,
});
};
</script>
<style lang="scss" scoped>
......@@ -90,6 +111,8 @@ const props = defineProps({
display: flex;
align-items: center;
margin-top: 10rpx;
position: relative;
width: 510rpx;
.one-text {
font-size: 22rpx;
font-weight: bold;
......@@ -111,7 +134,8 @@ const props = defineProps({
font-size: 20rpx;
color: #ffffff;
font-weight: 500;
margin-left: 182rpx;
position: absolute;
right: 20rpx;
}
}
.threeBox {
......
......@@ -53,12 +53,11 @@
<script setup>
import {} from 'vue';
import { getCoupon, getShopAndProdPage } from '../../api/index';
import { getLocation } from '../../utils/tool';
const tabs = ref(['推荐', '附近美食', '果蔬生鲜', '数码商城', '小吃快餐', '数码商城', '餐饮券']);
const params = {
current: 1,
size: 6,
lng: 106.68650025025502,
lat: 26.567192352601154,
};
let total;
const active = ref(0);
......@@ -107,10 +106,13 @@ const getCoupons = () => {
};
// 领券中心-店铺商品列表分页
const getShop = () => {
const getShop = async () => {
xma.showLoading({
title: '加载中',
});
const { lon, lat } = await getLocation();
params.lng = lon;
params.lat = lat;
getShopAndProdPage(params).then((res) => {
xma.hideLoading();
total = res.data.total;
......
......@@ -60,7 +60,7 @@
@click="handleClick"
@change="onChange"
customClass="guiyang"
height="68"
height="120"
imageMode="aspectFill"
></wd-swiper>
<!-- 附近人气美食 -->
......@@ -120,10 +120,10 @@
:class="{ rotate: rotate }"
></wd-icon>
</view>
<view class="box">
<!-- <view class="box">
<text class="text2">排序筛选</text>
<wd-icon name="fill-arrow-down" size="22rpx" class="icon2"></wd-icon>
</view>
</view> -->
</view>
<!-- 位置定位 -->
<Position v-show="rotate" @nearby="nearby" @popular="popular" @region="region" />
......@@ -175,6 +175,7 @@ import ShopCard from '../../components/index/ShopCard.vue';
import Marketing from '../../components/index/Marketing.vue';
import Position from '../../components/index/Position.vue';
import { orderStatus } from '../../utils/signIn';
import { getLocation, timeConversion } from '../../utils/tool';
import {
getTokenUser,
groupBuyList,
......@@ -185,7 +186,7 @@ import {
couponMainList,
receiveCoupon,
} from '../../api/index';
import { timeConversion } from '../../utils/tool';
// import testJson from '../../static/json/test.json';
const nowTime = ref(new Date().getTime());
const title = ref('小程序平台');
......@@ -285,24 +286,19 @@ const getClassification = () => {
});
};
// 附近人气美食分页
const nearbyFood = () => {
// xma.getLocation({
// isHighAccuracy: true,
// success: function (res) {
// console.log('经度', res.longitude);
// console.log('维度', res.latitude);
// },
// fail: function (err) {
// console.log('获取位置失败:', err);
// },
// });
const nearbyFood = async () => {
xma.showLoading({
title: '加载中',
});
const data = {
current: 1,
size: 3,
lon: 106.68650025025502,
lat: 26.567192352601154,
};
const { lon, lat } = await getLocation();
data.lon = lon;
data.lat = lat;
popularityPage(data).then((res) => {
xma.hideLoading();
res.data.content.forEach((item) => {
item.shopLogo = import.meta.env.VITE_APP_IMG_URL + item.shopLogo;
item.lastBuyTime = new Date().getTime() - new Date(item.lastBuyTime).getTime();
......@@ -313,7 +309,7 @@ const nearbyFood = () => {
// 附近美食查看更多
const more = () => {
xma.navigateTo({
url: '/pages/index/listFood?type=2',
url: '/pages/index/listFood?categoryId=&place=rqms',
});
};
// 轮播图
......@@ -351,10 +347,13 @@ const toUse = () => {
});
};
// 商家列表分页-搜索列表
const getMerchantList = () => {
const getMerchantList = async () => {
xma.showLoading({
title: '加载中',
});
const { lon, lat } = await getLocation();
listParams.lon = lon;
listParams.lat = lat;
merchantList(listParams).then((res) => {
xma.hideLoading();
total = res.data.totalElements;
......
......@@ -72,7 +72,7 @@ import Classification from '../../components/index/Classification.vue';
import Position from '../../components/index/Position.vue';
import Sort from '../../components/index/Sort.vue';
import { merchantList, getByParentId, getByType } from '../../api/index';
import { getLocation } from '../../utils/tool';
const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']);
const active = ref(null);
const rotate = ref(false);
......@@ -169,11 +169,15 @@ const back = () => {
});
};
// 商家列表分页-搜索列表
const getMerchantList = () => {
const getMerchantList = async () => {
xma.showLoading({
title: '加载中',
});
const { lon, lat } = await getLocation();
listParams.lon = lon;
listParams.lat = lat;
merchantList(listParams).then((res) => {
xma.hideLoading();
total = res.data.totalElements;
xma.hideLoading();
console.log('商家列表', res);
......
......@@ -21,7 +21,7 @@ export function getDistance(lat1, lng1, lat2, lng2, type = 1) {
? type === 0
? distance.toFixed(2) + '千米'
: distance.toFixed(2) + 'km'
: type === 1
: type === 0
? (distance * 1000).toFixed(2) + '米'
: (distance * 1000).toFixed(2) + 'm';
}
......
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