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
571bbf6c
Commit
571bbf6c
authored
Jul 30, 2024
by
石建新(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店铺
parent
81e0eb99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
19 deletions
+71
-19
shop.js
src/api/shop.js
+9
-0
shop.vue
src/pages/shop/shop.vue
+61
-18
vite.config.ts
vite.config.ts
+1
-1
No files found.
src/api/shop.js
0 → 100644
View file @
571bbf6c
import
{
request
}
from
'../utils/request'
;
// 分类
export
function
getStoreInformation
(
data
)
{
return
request
({
url
:
`/sgyrdd/shop/getById?shopId=
${
data
}
`
,
method
:
'GET'
,
});
}
src/pages/shop/shop.vue
View file @
571bbf6c
...
...
@@ -20,13 +20,14 @@
<view
class=
"swiper"
>
<wd-swiper
customClass=
"swiper-custom"
:list=
"swiperList"
:list=
"s
hopS
wiperList"
autoplay
height=
"536rpx"
customStyle=
"border-radius: 0rpx;"
:current=
"current"
@
click=
"handleClick"
@
change=
"onChange"
:indicator=
"
{ type: 'dots-bar' }"
>
</wd-swiper>
</view>
<view
class=
"content"
>
...
...
@@ -34,33 +35,24 @@
<view
class=
"shop-info"
>
<view
class=
"shop-info-top"
>
<view
class=
"shop-info-detail"
>
<text
class=
"shop-title"
>
川心美蛙鱼头火锅(中环广场店)
</text>
<text
class=
"shop-title"
>
{{
shopInfo
.
shopName
}}
</text>
<view
class=
"shop-tag-list"
>
<view
class=
"tag-item"
>
<text>
中环广场卤煮 第1名
</text>
</view>
<view
class=
"tag-item"
>
<text>
火锅
</text>
</view>
<view
class=
"tag-item"
>
<text>
免费wifi
</text>
</view>
<view
class=
"tag-item"
>
<text>
朋友聚餐
</text>
<view
class=
"tag-item"
v-for=
"(item, index) in shopInfo.tagList"
:key=
"index"
>
<text>
{{
item
}}
</text>
</view>
</view>
</view>
<view
class=
"shop-info-right"
>
<view
class=
"shop-info-score"
>
<view
class=
"score-text"
>
<text
class=
"score-num"
>
4.5
</text>
<text
class=
"score-num"
>
{{
shopInfo
.
grade
}}
</text>
<text
class=
"tj"
>
推荐
</text>
</view>
<view
class=
"score-icon"
>
<wd-rate
color=
"#fff"
readonly
v-model=
"
valu
e"
v-model=
"
shopInfo.grad
e"
size=
"22rpx"
space=
"8rpx"
:active-color=
"['#FA5151']"
...
...
@@ -74,8 +66,8 @@
</view>
<view
class=
"shop-info-bottom"
>
<view
class=
"shop-address"
>
<text
class=
"shop-distance"
>
距您<150米
南明区
</text>
<text
class=
"shop-address-detail"
>
南明区后巢乡花果园中环广场3号
(M区3栋)一层104 号
</text>
<text
class=
"shop-distance"
>
距您<150米
{{
shopInfo
.
area
}}
</text>
<text
class=
"shop-address-detail"
>
{{
shopInfo
.
shopAddress
}}
(M区3栋)一层104 号
</text>
</view>
<view
class=
"shop-map-phone"
>
<image
class=
"img1"
src=
"@/static/shop/map.png"
></image>
...
...
@@ -249,10 +241,14 @@
</
template
>
<
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
old
=
reactive
({
scrollTop
:
0
});
const
activeId
=
ref
(
1
);
// 店铺信息
const
shopInfo
=
ref
({});
const
shopSwiperList
=
ref
([]);
const
tagList
=
ref
([
{
name
:
'美食'
,
id
:
1
},
{
name
:
'休闲娱乐'
,
id
:
2
},
...
...
@@ -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/panda.jpg'
,
]);
onLoad
((
options
)
=>
{
getStoreInformationFn
(
'1626126617850544129'
);
});
onShow
(()
=>
{
getLocationFn
();
});
const
value
=
ref
(
5
);
const
handleClick
=
(
e
)
=>
{
console
.
log
(
e
);
...
...
@@ -276,6 +279,43 @@ function scroll(e) {
console
.
log
(
e
);
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
)
{
activeId
.
value
=
id
;
}
...
...
@@ -350,6 +390,9 @@ page {
:deep
(
.wd-swiper__track
)
{
border-radius
:
0
;
}
:deep
(
.wd-swiper-nav--bottom
)
{
bottom
:
100rpx
;
}
}
.content
{
...
...
vite.config.ts
View file @
571bbf6c
...
...
@@ -35,7 +35,7 @@ export default defineConfig({
alias
:
{
'@'
:
path
.
resolve
(
__dirname
,
'./src'
),
},
},
},
server
:
{
open
:
true
,
// 代理配置
...
...
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