Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
groupPurchase-miniapp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭佳妮(贵阳日报)
groupPurchase-miniapp
Commits
530749b0
Commit
530749b0
authored
Aug 07, 2024
by
陈宗胤(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
0b6b47f8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
29 deletions
+69
-29
FoodDetails.vue
src/Components/index/FoodDetails.vue
+12
-1
ShopCard.vue
src/Components/index/ShopCard.vue
+27
-3
coupon.vue
src/pages/index/coupon.vue
+5
-3
index.vue
src/pages/index/index.vue
+18
-19
listFood.vue
src/pages/index/listFood.vue
+6
-2
common.js
src/utils/common.js
+1
-1
No files found.
src/Components/index/FoodDetails.vue
View file @
530749b0
...
...
@@ -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
,
...
...
src/Components/index/ShopCard.vue
View file @
530749b0
...
...
@@ -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
{
...
...
src/pages/index/coupon.vue
View file @
530749b0
...
...
@@ -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
;
...
...
src/pages/index/index.vue
View file @
530749b0
...
...
@@ -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
;
...
...
src/pages/index/listFood.vue
View file @
530749b0
...
...
@@ -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
);
...
...
src/utils/common.js
View file @
530749b0
...
...
@@ -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'
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment