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
f41c1d02
Commit
f41c1d02
authored
Aug 01, 2024
by
石建新(贵阳日报)
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.platform.xinhuaapp.com/pengjiani/groupPurchase-miniapp
parents
3cb3ddb0
6f8cab2a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
36 deletions
+128
-36
App.vue
src/App.vue
+2
-0
FoodDetails.vue
src/Components/index/FoodDetails.vue
+11
-7
Position.vue
src/Components/index/Position.vue
+62
-29
index.js
src/api/index.js
+35
-0
index.vue
src/pages/index/index.vue
+0
-0
tool.js
src/utils/tool.js
+18
-0
No files found.
src/App.vue
View file @
f41c1d02
...
@@ -18,7 +18,9 @@ onHide(() => {
...
@@ -18,7 +18,9 @@ onHide(() => {
const
signIn
=
()
=>
{
const
signIn
=
()
=>
{
getTokenUser
(
testJson
).
then
((
res
)
=>
{
getTokenUser
(
testJson
).
then
((
res
)
=>
{
const
token
=
res
.
data
.
access_token
;
const
token
=
res
.
data
.
access_token
;
const
userInfo
=
res
.
data
.
user_info
;
xma
.
setStorageSync
(
'Authorization'
,
token
);
xma
.
setStorageSync
(
'Authorization'
,
token
);
xma
.
setStorageSync
(
'userInfo'
,
userInfo
);
console
.
log
(
'登录...'
);
console
.
log
(
'登录...'
);
});
});
};
};
...
...
src/Components/index/FoodDetails.vue
View file @
f41c1d02
<
template
>
<
template
>
<view
class=
"card"
v-for=
"(item, index) in cardData"
:key=
"index"
>
<view
class=
"card"
v-for=
"(item, index) in cardData"
:key=
"index"
>
<image
class=
"img"
src=
"../../static/index/test1.png"
mode=
"widthFix
"
/>
<image
class=
"img"
:src=
"item.shopLogo"
mode=
"aspectFill
"
/>
<view
class=
"right"
>
<view
class=
"right"
>
<text
class=
"text"
>
王将速食超市(可店内用餐)
</text>
<text
class=
"text"
>
{{
item
.
shopName
}}
</text>
<view
class=
"twoBxo"
>
<view
class=
"twoBxo"
>
<text
class=
"one-text"
>
5.0
推荐
</text>
<text
class=
"one-text"
>
{{
item
.
grade
}}
推荐
</text>
<
text
class=
"two-text"
>
¥30/人
</text
>
<
!--
<text
class=
"two-text"
>
¥30/人
</text>
--
>
<text
class=
"three-text"
>
销量
1265
</text>
<text
class=
"three-text"
>
销量
{{
item
.
monthSoldNum
}}
</text>
<text
class=
"four-text"
>
1.2km
</text>
<text
class=
"four-text"
>
1.2km
</text>
</view>
</view>
<view
class=
"threeBox"
>
<view
class=
"threeBox"
>
<image
class=
"img2"
src=
"../../static/index/test2.png"
mode=
"widthFix
"
/>
<image
class=
"img2"
:src=
"item.evaluationVos[0].avatar"
mode=
"aspectFill
"
/>
<text
class=
"one-text"
>
“
味道浓郁,食材新鲜,童年的老味道
”
</text>
<text
class=
"one-text"
>
“
{{
item
.
evaluationVos
[
0
].
evaluation
}}
”
</text>
</view>
</view>
<view
class=
"labelBox"
>
<view
class=
"labelBox"
>
<view>
卤味爱好者最佳选择
</view>
<view>
卤味爱好者最佳选择
</view>
...
@@ -59,6 +59,8 @@ const props = defineProps({
...
@@ -59,6 +59,8 @@ const props = defineProps({
box-sizing
:
border-box
;
box-sizing
:
border-box
;
.img
{
.img
{
width
:
144rpx
;
width
:
144rpx
;
height
:
144rpx
;
border-radius
:
16rpx
;
}
}
.right
{
.right
{
margin-left
:
20rpx
;
margin-left
:
20rpx
;
...
@@ -102,6 +104,8 @@ const props = defineProps({
...
@@ -102,6 +104,8 @@ const props = defineProps({
align-items
:
center
;
align-items
:
center
;
.img2
{
.img2
{
width
:
40rpx
;
width
:
40rpx
;
height
:
40rpx
;
border-radius
:
50%
;
}
}
.one-text
{
.one-text
{
font-size
:
22rpx
;
font-size
:
22rpx
;
...
...
src/Components/index/Position.vue
View file @
f41c1d02
...
@@ -7,33 +7,34 @@
...
@@ -7,33 +7,34 @@
<view
class=
"right-details"
v-show=
"light2 === 0"
>
<view
class=
"right-details"
v-show=
"light2 === 0"
>
<text
class=
"nearby-title"
>
我的附近
</text>
<text
class=
"nearby-title"
>
我的附近
</text>
<view
class=
"nearby-card"
>
<view
class=
"nearby-card"
>
<view
@
tap=
"choice2(0)"
class=
"label"
:class=
"light3 === 0 ? 'light3' : ''"
>
附近
</view>
<view
@
tap=
"choice2(0
, 0
)"
class=
"label"
:class=
"light3 === 0 ? 'light3' : ''"
>
附近
</view>
<view
@
tap=
"choice2(1)"
class=
"label"
:class=
"light3 === 1 ? 'light3' : ''"
>
500m
</view>
<view
@
tap=
"choice2(1
, 0.5
)"
class=
"label"
:class=
"light3 === 1 ? 'light3' : ''"
>
500m
</view>
<view
@
tap=
"choice2(2)"
class=
"label"
:class=
"light3 === 2 ? 'light3' : ''"
>
1km
</view>
<view
@
tap=
"choice2(2
, 1
)"
class=
"label"
:class=
"light3 === 2 ? 'light3' : ''"
>
1km
</view>
<view
@
tap=
"choice2(3)"
class=
"label"
:class=
"light3 === 3 ? 'light3' : ''"
>
3km
</view>
<view
@
tap=
"choice2(3
, 3
)"
class=
"label"
:class=
"light3 === 3 ? 'light3' : ''"
>
3km
</view>
<view
@
tap=
"choice2(4)"
class=
"label"
:class=
"light3 === 4 ? 'light3' : ''"
>
5km
</view>
<view
@
tap=
"choice2(4
, 5
)"
class=
"label"
:class=
"light3 === 4 ? 'light3' : ''"
>
5km
</view>
<view
@
tap=
"choice2(5)"
class=
"label"
:class=
"light3 === 5 ? 'light3' : ''"
>
10km
</view>
<view
@
tap=
"choice2(5
, 10
)"
class=
"label"
:class=
"light3 === 5 ? 'light3' : ''"
>
10km
</view>
</view>
</view>
<text
class=
"nearby-title margin"
>
热门地点
</text>
<text
class=
"nearby-title margin"
>
热门地点
</text>
<ul
class=
"ul"
>
<ul
class=
"ul"
>
<li>
花果园购物中心
</li>
<li
<li>
世纪金源购物中心
</li>
v-for=
"(item, index) in items"
<li>
鸿通城
</li>
:key=
"index"
<li>
花果园中环广场
</li>
:class=
"
{ active: selectedItem === index }"
<li>
万科大都会
</li>
@tap="selectItem(index, item)"
<li>
喷水池
</li>
>
<li>
喷水池
</li>
{{
item
}}
</li>
</ul>
</ul>
</view>
</view>
<view
class=
"right-details2"
v-show=
"light2 === 1"
>
<view
class=
"right-details2"
v-show=
"light2 === 1"
>
<ul
class=
"ul"
>
<ul
class=
"ul"
>
<li
<li
v-for=
"(item, index) in items"
v-for=
"(item, index) in items
1
"
:key=
"index"
:key=
"index"
:class=
"
{ active: selectedItem === index }"
:class=
"
{ active: selectedItem
1
=== index }"
@tap="selectItem(index)"
@tap="selectItem
1
(index)"
>
>
{{
item
}}
{{
item
.
name
}}
</li>
</li>
</ul>
</ul>
<ul
class=
"ul"
>
<ul
class=
"ul"
>
...
@@ -41,9 +42,9 @@
...
@@ -41,9 +42,9 @@
v-for=
"(item, index) in items2"
v-for=
"(item, index) in items2"
:key=
"index"
:key=
"index"
:class=
"
{ active: selectedItem2 === index }"
:class=
"
{ active: selectedItem2 === index }"
@tap="selectItem2(index)"
@tap="selectItem2(index
, item.name
)"
>
>
{{
item
}}
{{
item
.
name
}}
</li>
</li>
</ul>
</ul>
</view>
</view>
...
@@ -52,16 +53,19 @@
...
@@ -52,16 +53,19 @@
<
script
setup
>
<
script
setup
>
import
{
defineProps
}
from
'vue'
;
import
{
defineProps
}
from
'vue'
;
import
{
getRegion
,
administration
}
from
'@/api/index'
;
const
props
=
defineProps
({
const
props
=
defineProps
({
width
:
{
width
:
{
type
:
String
,
type
:
String
,
default
:
'100%'
,
default
:
'100%'
,
},
},
});
});
const
emit
=
defineEmits
([
'nearby'
,
'popular'
,
'region'
]);
const
light2
=
ref
(
0
);
const
light2
=
ref
(
0
);
const
light3
=
ref
(
0
);
const
light3
=
ref
(
0
);
const
items
=
reactive
([
'云岩区'
,
'白云区'
,
'乌当区'
,
'花溪区'
,
'清镇市'
,
'开阳县'
,
'修文县'
]);
const
items
=
ref
([
'云岩区'
,
'白云区'
,
'乌当区'
,
'花溪区'
,
'清镇市'
,
'开阳县'
,
'修文县'
]);
const
items2
=
reactive
([
const
items1
=
ref
([
'云岩区'
,
'白云区'
,
'乌当区'
,
'花溪区'
,
'清镇市'
,
'开阳县'
,
'修文县'
]);
const
items2
=
ref
([
'全部'
,
'全部'
,
'百花新城'
,
'百花新城'
,
'人民广场'
,
'人民广场'
,
...
@@ -72,19 +76,45 @@ const items2 = reactive([
...
@@ -72,19 +76,45 @@ const items2 = reactive([
]);
]);
const
selectedItem
=
ref
(
null
);
const
selectedItem
=
ref
(
null
);
const
selectedItem1
=
ref
(
0
);
const
selectedItem2
=
ref
(
null
);
const
selectedItem2
=
ref
(
null
);
onMounted
(()
=>
{
getPlace
();
getAdministration
();
});
// 热门地点
const
getPlace
=
()
=>
{
getRegion
({
city
:
'贵阳'
}).
then
((
res
)
=>
{
items
.
value
=
res
.
data
;
});
};
// 行政区
const
getAdministration
=
()
=>
{
administration
({
parentId
:
'52'
}).
then
((
res
)
=>
{
items1
.
value
=
res
.
data
;
items2
.
value
=
items1
.
value
[
0
].
children
;
});
};
const
choice
=
(
index
)
=>
{
const
choice
=
(
index
)
=>
{
light2
.
value
=
index
;
light2
.
value
=
index
;
};
};
const
choice2
=
(
index
)
=>
{
const
choice2
=
(
index
,
distance
)
=>
{
light3
.
value
=
index
;
light3
.
value
=
index
;
emit
(
'nearby'
,
distance
);
};
};
const
selectItem
=
(
index
,
communityName
)
=>
{
const
selectItem
=
(
selectItem
)
=>
{
selectedItem
.
value
=
index
;
selectedItem
.
value
=
selectItem
;
selectedItem2
.
value
=
null
;
emit
(
'popular'
,
communityName
);
};
};
const
selectItem2
=
(
selectItem
)
=>
{
const
selectItem1
=
(
index
)
=>
{
selectedItem2
.
value
=
selectItem
;
selectedItem1
.
value
=
index
;
items2
.
value
=
items1
.
value
[
index
].
children
;
};
const
selectItem2
=
(
index
,
area
)
=>
{
selectedItem2
.
value
=
index
;
selectedItem
.
value
=
null
;
emit
(
'region'
,
area
);
};
};
</
script
>
</
script
>
...
@@ -93,7 +123,7 @@ const selectItem2 = (selectItem) => {
...
@@ -93,7 +123,7 @@ const selectItem2 = (selectItem) => {
position
:
absolute
;
position
:
absolute
;
top
:
100%
;
top
:
100%
;
// width: 710rpx;
// width: 710rpx;
height
:
780rpx
;
min-
height
:
780rpx
;
border-radius
:
0rpx
0rpx
16rpx
16rpx
;
border-radius
:
0rpx
0rpx
16rpx
16rpx
;
background
:
#ffffff
;
background
:
#ffffff
;
box-shadow
:
0rpx
16rpx
16rpx
0rpx
rgba
(
73
,
73
,
73
,
0
.14
);
box-shadow
:
0rpx
16rpx
16rpx
0rpx
rgba
(
73
,
73
,
73
,
0
.14
);
...
@@ -103,7 +133,7 @@ const selectItem2 = (selectItem) => {
...
@@ -103,7 +133,7 @@ const selectItem2 = (selectItem) => {
.left-classification
{
.left-classification
{
width
:
176rpx
;
width
:
176rpx
;
background
:
#f1f1f1
;
background
:
#f1f1f1
;
height
:
100%
;
min-height
:
780rpx
;
.option
{
.option
{
text-align
:
center
;
text-align
:
center
;
width
:
100%
;
width
:
100%
;
...
@@ -164,6 +194,9 @@ const selectItem2 = (selectItem) => {
...
@@ -164,6 +194,9 @@ const selectItem2 = (selectItem) => {
color
:
#3d3d3d
;
color
:
#3d3d3d
;
margin-top
:
20rpx
;
margin-top
:
20rpx
;
}
}
.active
{
color
:
#fa5151
;
}
}
}
}
}
.right-details2
{
.right-details2
{
...
...
src/api/index.js
View file @
f41c1d02
...
@@ -41,3 +41,38 @@ export function popularityPage(data) {
...
@@ -41,3 +41,38 @@ export function popularityPage(data) {
data
,
data
,
});
});
}
}
// 团购主页推荐分类
export
function
getRecommList
()
{
return
request
({
url
:
`/sgyrdd/category/getRecommList`
,
method
:
'GET'
,
});
}
// 附近筛选-热门地点
export
function
getRegion
(
data
)
{
return
request
({
url
:
`/sgyrdd/area/hotArea`
,
method
:
'GET'
,
data
,
});
}
// 附近筛选-行政区
export
function
administration
(
data
)
{
return
request
({
url
:
`/sgyrdd/area/tree`
,
method
:
'GET'
,
data
,
});
}
// 商家列表分页-搜索列表
export
function
merchantList
(
data
)
{
return
request
({
url
:
`/sgyrdd/shop/page`
,
method
:
'POST'
,
data
,
});
}
src/pages/index/index.vue
View file @
f41c1d02
This diff is collapsed.
Click to expand it.
src/utils/tool.js
0 → 100644
View file @
f41c1d02
export
function
timeConversion
(
diffInMilliseconds
)
{
// 计算总秒数
const
totalSeconds
=
Math
.
abs
(
Math
.
floor
(
diffInMilliseconds
/
1000
));
// 计算天数、小时数和分钟数
const
days
=
Math
.
floor
(
totalSeconds
/
(
24
*
60
*
60
));
const
hours
=
Math
.
floor
((
totalSeconds
%
(
24
*
60
*
60
))
/
(
60
*
60
));
const
minutes
=
Math
.
floor
((
totalSeconds
%
(
60
*
60
))
/
60
);
// 返回包含天数、小时数和分钟数的对象
if
(
hours
===
0
)
{
return
`
${
minutes
}
分钟`
;
}
else
if
(
days
===
0
)
{
return
`
${
hours
}
小时
${
minutes
}
分钟`
;
}
else
{
return
`
${
days
}
天
${
hours
}
小时
${
minutes
}
分钟`
;
}
}
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