bug

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