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
5cf1f8e1
Commit
5cf1f8e1
authored
Aug 03, 2024
by
陈宗胤(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口提示
parent
5412a409
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
222 additions
and
77 deletions
+222
-77
Classification.vue
src/Components/index/Classification.vue
+11
-6
ShopCard.vue
src/Components/index/ShopCard.vue
+18
-9
Sort.vue
src/Components/index/Sort.vue
+12
-5
index.js
src/api/index.js
+20
-2
Search.vue
src/components/index/Search.vue
+6
-1
index.vue
src/pages/index/index.vue
+72
-33
listFood.vue
src/pages/index/listFood.vue
+74
-20
request.js
src/utils/request.js
+9
-1
No files found.
src/Components/index/Classification.vue
View file @
5cf1f8e1
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
<view
class=
"classification"
:style=
"
{ width: width }">
<view
class=
"classification"
:style=
"
{ width: width }">
<ul
class=
"ul"
>
<ul
class=
"ul"
>
<li
<li
v-for=
"(item, index) in
items
"
v-for=
"(item, index) in
category
"
:key=
"index"
:key=
"index"
:class=
"
{ active: selectedItem === index }"
:class=
"
{ active: selectedItem === index }"
@tap="selectItem(index)"
@tap="selectItem(index
, item.categoryId
)"
>
>
{{
item
}}
{{
item
.
categoryName
}}
</li>
</li>
</ul>
</ul>
</view>
</view>
...
@@ -15,16 +15,21 @@
...
@@ -15,16 +15,21 @@
<
script
setup
>
<
script
setup
>
import
{
defineProps
}
from
'vue'
;
import
{
defineProps
}
from
'vue'
;
const
items
=
reactive
([
'全部烧烤烤肉'
,
'烤肉'
,
'烤鱼'
,
'烤串'
]);
const
selectedItem
=
ref
(
null
);
const
selectedItem
=
ref
(
null
);
const
props
=
defineProps
({
const
props
=
defineProps
({
width
:
{
width
:
{
type
:
String
,
type
:
String
,
default
:
'100%'
,
default
:
'100%'
,
},
},
category
:
{
type
:
Array
,
default
:
()
=>
[],
},
});
});
const
selectItem
=
(
selectItem
)
=>
{
const
emit
=
defineEmits
([
'foodCategory'
]);
selectedItem
.
value
=
selectItem
;
const
selectItem
=
(
index
,
categoryId
)
=>
{
selectedItem
.
value
=
index
;
emit
(
'foodCategory'
,
categoryId
);
};
};
</
script
>
</
script
>
...
...
src/Components/index/ShopCard.vue
View file @
5cf1f8e1
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
<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=
"shopCardData.evaluationVos
?.
[0].avatar"
mode=
"aspectFill"
/>
<image
class=
"img2"
:src=
"shopCardData.evaluationVos[0].avatar"
mode=
"aspectFill"
/>
<text
class=
"one-text"
>
“
{{
shopCardData
.
evaluationVos
?.
[
0
].
evaluation
}}
”
</text>
<text
class=
"one-text"
>
“
{{
shopCardData
.
evaluationVos
[
0
].
evaluation
}}
”
</text>
</view>
</view>
<view
class=
"labelBox"
>
<view
class=
"labelBox"
>
<view
v-for=
"(item, index) in shopCardData.labels"
:key=
"index"
>
{{
item
}}
</view>
<view
v-for=
"(item, index) in shopCardData.labels"
:key=
"index"
>
{{
item
}}
</view>
...
@@ -23,13 +23,13 @@
...
@@ -23,13 +23,13 @@
</view>
</view>
</view>
</view>
<view
class=
"nearby-bootom"
>
<view
class=
"nearby-bootom"
>
<view
class=
"contentBox"
v-for=
"(item, index) in
3
"
:key=
"index"
>
<view
class=
"contentBox"
v-for=
"(item, index) in
shopCardData.simpleProds
"
:key=
"index"
>
<image
class=
"img"
src=
"../../static/index/eatFood.png
"
mode=
"aspectFill"
/>
<image
class=
"img"
:src=
"item.pic
"
mode=
"aspectFill"
/>
<text
class=
"one"
>
生态素食套餐
</text>
<text
class=
"one"
>
{{
item
.
prodName
}}
</text>
<view
class=
"price"
>
<view
class=
"price"
>
<image
class=
"img"
src=
"../../static/index/groupBuying.png"
mode=
"aspectFill"
/>
<image
class=
"img"
src=
"../../static/index/groupBuying.png"
mode=
"aspectFill"
/>
<text
class=
"two"
>
¥
19.9
</text>
<text
class=
"two"
>
¥
{{
item
.
price
}}
</text>
<text
class=
"three"
>
29.8
</text>
<text
class=
"three"
>
{{
item
.
oriPrice
}}
</text>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -41,6 +41,9 @@ import { defineProps } from 'vue';
...
@@ -41,6 +41,9 @@ import { defineProps } from 'vue';
const
props
=
defineProps
({
const
props
=
defineProps
({
shopCardData
:
{
shopCardData
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
({
evaluationVos
:
[],
}),
},
},
});
});
</
script
>
</
script
>
...
@@ -151,21 +154,27 @@ const props = defineProps({
...
@@ -151,21 +154,27 @@ const props = defineProps({
padding
:
0
20rpx
;
padding
:
0
20rpx
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
overflow
:
hidden
;
overflow
:
hidden
;
justify-content
:
space-between
;
//
justify-content: space-between;
.contentBox
{
.contentBox
{
width
:
22
0rpx
;
width
:
18
0rpx
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
flex-start
;
align-items
:
flex-start
;
margin-right
:
40rpx
;
.img
{
.img
{
width
:
180rpx
;
width
:
180rpx
;
height
:
136rpx
;
height
:
136rpx
;
border-radius
:
16rpx
;
}
}
.one
{
.one
{
width
:
100%
;
font-size
:
28rpx
;
font-size
:
28rpx
;
font-weight
:
bold
;
font-weight
:
bold
;
color
:
#3d3d3d
;
color
:
#3d3d3d
;
margin
:
10rpx
0
;
margin
:
10rpx
0
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
}
.price
{
.price
{
display
:
flex
;
display
:
flex
;
...
...
src/Components/index/Sort.vue
View file @
5cf1f8e1
...
@@ -5,9 +5,9 @@
...
@@ -5,9 +5,9 @@
v-for=
"(item, index) in items"
v-for=
"(item, index) in items"
:key=
"index"
:key=
"index"
:class=
"
{ active: selectedItem === index }"
:class=
"
{ active: selectedItem === index }"
@tap="selectItem(index)"
@tap="selectItem(index
, item
)"
>
>
{{
item
}}
{{
item
.
name
}}
</li>
</li>
</ul>
</ul>
</view>
</view>
...
@@ -15,7 +15,13 @@
...
@@ -15,7 +15,13 @@
<
script
setup
>
<
script
setup
>
import
{
defineProps
}
from
'vue'
;
import
{
defineProps
}
from
'vue'
;
const
items
=
reactive
([
'智能排序'
,
'距离优先'
,
'好评优先'
,
'销量优先'
,
'低价优先'
,
'低价优先'
]);
const
items
=
ref
([
{
name
:
'智能排序'
,
sortName
:
'default'
,
sortMode
:
'asc'
},
{
name
:
'距离优先'
,
sortName
:
'distance'
,
sortMode
:
'asc'
},
{
name
:
'好评优先'
,
sortName
:
'grade'
,
sortMode
:
'desc'
},
{
name
:
'销量优先'
,
sortName
:
'monthSoldNum'
,
sortMode
:
'desc'
},
]);
const
emit
=
defineEmits
([
'sortParams'
]);
const
selectedItem
=
ref
(
null
);
const
selectedItem
=
ref
(
null
);
const
props
=
defineProps
({
const
props
=
defineProps
({
width
:
{
width
:
{
...
@@ -23,8 +29,9 @@ const props = defineProps({
...
@@ -23,8 +29,9 @@ const props = defineProps({
default
:
'100%'
,
default
:
'100%'
,
},
},
});
});
const
selectItem
=
(
selectItem
)
=>
{
const
selectItem
=
(
index
,
item
)
=>
{
selectedItem
.
value
=
selectItem
;
selectedItem
.
value
=
index
;
emit
(
'sortParams'
,
item
);
};
};
</
script
>
</
script
>
...
...
src/api/index.js
View file @
5cf1f8e1
...
@@ -18,10 +18,11 @@ export function groupBuyList() {
...
@@ -18,10 +18,11 @@ export function groupBuyList() {
}
}
// 根据父级分类id查询子分类列表
// 根据父级分类id查询子分类列表
export
function
getByParentId
(
id
)
{
export
function
getByParentId
(
data
)
{
return
request
({
return
request
({
url
:
`/sgyrdd/category/getByParentId
?parentId=
${
id
}
`
,
url
:
`/sgyrdd/category/getByParentId`
,
method
:
'GET'
,
method
:
'GET'
,
data
,
});
});
}
}
...
@@ -76,3 +77,20 @@ export function merchantList(data) {
...
@@ -76,3 +77,20 @@ export function merchantList(data) {
data
,
data
,
});
});
}
}
// 团购主页优惠券
export
function
couponMainList
()
{
return
request
({
url
:
`/sgyrdd/coupon/couponMainList`
,
method
:
'GET'
,
});
}
// 领取优惠券
export
function
receiveCoupon
(
data
)
{
return
request
({
url
:
`/sgyrdd/coupon/receiveCoupon`
,
method
:
'POST'
,
data
,
});
}
src/components/index/Search.vue
View file @
5cf1f8e1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
src=
"../../static/index/magnifyingGlass.png"
src=
"../../static/index/magnifyingGlass.png"
mode=
"aspectFit|aspectFill|widthFix"
mode=
"aspectFit|aspectFill|widthFix"
/>
/>
<input
type=
"text"
:value=
"test"
class=
"text"
/>
<input
type=
"text"
:value=
"test"
class=
"text"
@
confirm=
"search"
confirm-type=
"搜索"
/>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -26,6 +26,7 @@ const props = defineProps({
...
@@ -26,6 +26,7 @@ const props = defineProps({
default
:
'white'
,
default
:
'white'
,
},
},
});
});
const
emit
=
defineEmits
([
'toSearch'
]);
const
title
=
ref
(
'小程序平台'
);
const
title
=
ref
(
'小程序平台'
);
const
{
countInfo
,
addCount
}
=
useCountStore
();
const
{
countInfo
,
addCount
}
=
useCountStore
();
const
test
=
ref
(
''
);
const
test
=
ref
(
''
);
...
@@ -39,6 +40,10 @@ onMounted(() => {
...
@@ -39,6 +40,10 @@ onMounted(() => {
});
});
});
});
const
search
=
(
res
)
=>
{
const
keyword
=
res
.
detail
.
value
;
emit
(
'toSearch'
,
keyword
);
};
const
test2
=
()
=>
{
const
test2
=
()
=>
{
xma
.
navigateTo
({
xma
.
navigateTo
({
url
:
'/pages/shop/shop'
,
url
:
'/pages/shop/shop'
,
...
...
src/pages/index/index.vue
View file @
5cf1f8e1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<view
class=
"container"
>
<view
class=
"container"
>
<view
class=
"top"
>
<view
class=
"top"
>
<!-- 搜索 -->
<!-- 搜索 -->
<Search
background=
"rgba(255, 255, 255, 0.8)"
backIcon=
"black"
>
<Search
background=
"rgba(255, 255, 255, 0.8)"
backIcon=
"black"
@
toSearch=
"toSearch"
>
<image
class=
"food"
src=
"../../static/index/food.png"
mode=
"widthFix"
/>
<image
class=
"food"
src=
"../../static/index/food.png"
mode=
"widthFix"
/>
</Search>
</Search>
<!-- 类别选择 -->
<!-- 类别选择 -->
...
@@ -34,14 +34,16 @@
...
@@ -34,14 +34,16 @@
<!-- 红包 -->
<!-- 红包 -->
<view
class=
"redEnvelope"
>
<view
class=
"redEnvelope"
>
<view
class=
"title"
>
今日福利
</view>
<view
class=
"title"
>
今日福利
</view>
<view
class=
"box-red"
>
<scroll-view
class=
"box-red"
scroll-x=
"true"
@
scroll=
"scroll"
>
<view
class=
"redBagBox"
v-for=
"(item, index) in 4"
:key=
"index"
>
<view
class=
"redBagBox"
v-for=
"(item, index) in coupon"
:key=
"index"
>
<text
class=
"textO"
>
无门槛补贴
</text>
<view
class=
"content"
>
<text
class=
"textW"
>
¥10
</text>
<text
class=
"textO"
>
{{
item
.
activityName
}}
</text>
<text
class=
"textT"
>
无门槛
</text>
<text
class=
"textW"
>
¥
{{
item
.
discountValue
}}
</text>
<view
class=
"textF"
>
领取
</view>
</view>
<view
v-if=
"item.numState === 0"
class=
"textF"
@
tap=
"receive(item)"
>
领取
</view>
<view
v-else
class=
"textF"
@
tap=
"toUse"
>
去使用
</view>
</view>
</view>
</view>
</
scroll-
view>
<image
class=
"discount"
src=
"../../static/index/discount.png"
mode=
"widthFix"
/>
<image
class=
"discount"
src=
"../../static/index/discount.png"
mode=
"widthFix"
/>
</view>
</view>
<!-- 贵阳老味道 -->
<!-- 贵阳老味道 -->
...
@@ -143,6 +145,8 @@ import {
...
@@ -143,6 +145,8 @@ import {
popularityPage
,
popularityPage
,
getRecommList
,
getRecommList
,
merchantList
,
merchantList
,
couponMainList
,
receiveCoupon
,
}
from
'../../api/index'
;
}
from
'../../api/index'
;
import
{
timeConversion
}
from
'../../utils/tool'
;
import
{
timeConversion
}
from
'../../utils/tool'
;
const
nowTime
=
ref
(
new
Date
().
getTime
());
const
nowTime
=
ref
(
new
Date
().
getTime
());
...
@@ -181,6 +185,7 @@ const listParams = {
...
@@ -181,6 +185,7 @@ const listParams = {
lon
:
106.68650025025502
,
lon
:
106.68650025025502
,
lat
:
26.567192352601154
,
lat
:
26.567192352601154
,
};
};
const
coupon
=
ref
([]);
// 轮播图数据
// 轮播图数据
let
lunboData
;
let
lunboData
;
onMounted
(()
=>
{
onMounted
(()
=>
{
...
@@ -189,10 +194,7 @@ onMounted(() => {
...
@@ -189,10 +194,7 @@ onMounted(() => {
nearbyFood
();
nearbyFood
();
recommendedClassification
();
recommendedClassification
();
getMerchantList
();
getMerchantList
();
// test(testJson).then((res) => {
getCouponMainList
();
// console.log('打印', res);
// });
// console.log('testJson', testJson);
});
});
// 登录
// 登录
// const signIn = () => {
// const signIn = () => {
...
@@ -202,6 +204,25 @@ onMounted(() => {
...
@@ -202,6 +204,25 @@ onMounted(() => {
// console.log('登录...');
// console.log('登录...');
// });
// });
// };
// };
// 搜索
const
toSearch
=
(
keyword
)
=>
{
listParams
.
keyword
=
keyword
;
getMerchantList
();
};
// 获取优惠券
const
getCouponMainList
=
()
=>
{
couponMainList
().
then
((
res
)
=>
{
coupon
.
value
=
res
.
data
.
records
.
slice
(
0
,
10
);
});
};
// 领取优惠券
const
receive
=
(
data
)
=>
{
if
(
data
.
couponType
===
'mch'
&&
data
.
numState
===
0
)
{
receiveCoupon
([
data
.
couponYzfId
]).
then
((
res
)
=>
{
// console.log('打印', res);
});
}
};
// 获取分类
// 获取分类
const
getClassification
=
()
=>
{
const
getClassification
=
()
=>
{
groupBuyList
().
then
((
res
)
=>
{
groupBuyList
().
then
((
res
)
=>
{
...
@@ -248,7 +269,6 @@ const more = () => {
...
@@ -248,7 +269,6 @@ const more = () => {
// 轮播图
// 轮播图
const
rotatingBroadcast
=
()
=>
{
const
rotatingBroadcast
=
()
=>
{
groupImgList
().
then
((
res
)
=>
{
groupImgList
().
then
((
res
)
=>
{
console
.
log
(
'lunbo'
,
res
);
res
.
data
.
forEach
((
item
)
=>
{
res
.
data
.
forEach
((
item
)
=>
{
item
.
imgUrl
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
imgUrl
;
item
.
imgUrl
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
imgUrl
;
});
});
...
@@ -278,8 +298,14 @@ const getMerchantList = () => {
...
@@ -278,8 +298,14 @@ const getMerchantList = () => {
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
;
if
(
item
.
evaluationVos
.
length
>
0
)
{
if
(
item
.
evaluationVos
.
length
>
0
)
{
item
.
evaluationVos
[
0
].
avatar
=
item
.
simpleProds
.
forEach
((
item
)
=>
{
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
evaluationVos
[
0
].
avatar
;
item
.
avatar
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
avatar
;
});
}
if
(
item
.
simpleProds
.
length
>
0
)
{
item
.
simpleProds
.
forEach
((
item
)
=>
{
item
.
pic
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
pic
;
});
}
}
if
(
item
.
labels
)
{
if
(
item
.
labels
)
{
item
.
labels
=
item
.
labels
.
split
(
','
);
item
.
labels
=
item
.
labels
.
split
(
','
);
...
@@ -458,32 +484,43 @@ page {
...
@@ -458,32 +484,43 @@ page {
.box-red
{
.box-red
{
padding
:
10rpx
0
0
20rpx
;
padding
:
10rpx
0
0
20rpx
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
display
:
flex
;
white-space
:
nowrap
;
align-items
:
center
;
width
:
80%
;
.redBagBox
{
.redBagBox
{
margin-right
:
8rpx
;
margin-right
:
8rpx
;
width
:
124rpx
;
width
:
124rpx
;
height
:
104rpx
;
height
:
104rpx
;
background
:
url('../../static/index/redBag.png')
no-repeat
;
background
:
url('../../static/index/redBag.png')
no-repeat
;
background-size
:
100%
100%
;
background-size
:
100%
100%
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
center
;
align-items
:
center
;
display
:
inline-flex
;
position
:
relative
;
box-sizing
:
border-box
;
// overflow: hidden;
// justify-content: space-evenly;
// justify-content: space-evenly;
.textO
{
.content
{
font-size
:
12rpx
;
height
:
70%
;
color
:
#fa5151
;
display
:
flex
;
margin-top
:
5rpx
;
flex-direction
:
column
;
}
align-items
:
center
;
.textW
{
justify-content
:
center
;
font-size
:
24rpx
;
.textO
{
color
:
#fa5151
;
width
:
124rpx
;
font-weight
:
600
;
font-size
:
12rpx
;
font-family
:
Alimama
FangYuanTi
VF
;
color
:
#fa5151
;
}
text-align
:
center
;
.textT
{
white-space
:
nowrap
;
font-size
:
12rpx
;
overflow
:
hidden
;
color
:
#fa5151
;
text-overflow
:
ellipsis
;
}
.textW
{
font-size
:
24rpx
;
color
:
#fa5151
;
font-weight
:
600
;
font-family
:
Alimama
FangYuanTi
VF
;
// margin-top: 5rpx;
}
}
}
.textF
{
.textF
{
width
:
56rpx
;
width
:
56rpx
;
...
@@ -493,7 +530,9 @@ page {
...
@@ -493,7 +530,9 @@ page {
font-size
:
12rpx
;
font-size
:
12rpx
;
color
:
#fa5151
;
color
:
#fa5151
;
text-align
:
center
;
text-align
:
center
;
margin-top
:
10rpx
;
position
:
absolute
;
line-height
:
20rpx
;
bottom
:
8rpx
;
}
}
}
}
}
}
...
...
src/pages/index/listFood.vue
View file @
5cf1f8e1
...
@@ -34,7 +34,8 @@
...
@@ -34,7 +34,8 @@
>
</wd-icon>
>
</wd-icon>
</view>
</view>
</view>
</view>
<view
class=
"bootom-bottom"
>
<!-- 标签 -->
<!--
<view
class=
"bootom-bottom"
>
<view
<view
@
tap=
"choice(index)"
@
tap=
"choice(index)"
class=
"item"
class=
"item"
...
@@ -44,13 +45,13 @@
...
@@ -44,13 +45,13 @@
>
>
{{
item
}}
{{
item
}}
</view>
</view>
</view>
</view>
-->
<!-- 美食类别 -->
<!-- 美食类别 -->
<Classification
v-show=
"rotate"
/>
<Classification
v-show=
"rotate"
:category=
"categoryData"
@
foodCategory=
"foodCategory"
/>
<!-- 附近筛选 -->
<!-- 附近筛选 -->
<Position
v-show=
"rotate2"
/>
<Position
v-show=
"rotate2"
@
nearby=
"nearby"
@
popular=
"popular"
@
region=
"region"
/>
<!-- 排序筛选 -->
<!-- 排序筛选 -->
<Sort
v-show=
"rotate3"
/>
<Sort
v-show=
"rotate3"
@
sortParams=
"sortParams"
/>
</view>
</view>
</view>
</view>
<FoodDetails
:cardData=
"cardData"
/>
<FoodDetails
:cardData=
"cardData"
/>
...
@@ -63,31 +64,90 @@ import FoodDetails from '../../components/index/FoodDetails.vue';
...
@@ -63,31 +64,90 @@ import FoodDetails from '../../components/index/FoodDetails.vue';
import
Classification
from
'../../components/index/Classification.vue'
;
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
}
from
'../../api/index'
;
import
{
merchantList
,
getByParentId
}
from
'../../api/index'
;
const
business
=
reactive
([
'优选商家'
,
'超值半价'
,
'今日可订'
,
'经典单人'
]);
const
active
=
ref
(
null
);
const
rotate
=
ref
(
false
);
const
rotate2
=
ref
(
false
);
const
rotate3
=
ref
(
false
);
const
topBg
=
ref
(
null
);
const
categoryData
=
ref
([]);
const
paramsId
=
{
parentId
:
null
,
};
const
listParams
=
{
current
:
1
,
size
:
10
,
lon
:
106.68650025025502
,
lat
:
26.567192352601154
,
};
onMounted
(()
=>
{
onMounted
(()
=>
{
getMerchantList
();
getMerchantList
();
});
});
onLoad
((
options
)
=>
{
onLoad
((
options
)
=>
{
const
{
type
}
=
options
;
const
{
type
}
=
options
;
console
.
log
(
'打印'
,
type
);
switch
(
type
)
{
switch
(
type
)
{
case
'1'
:
case
'1'
:
topBg
.
value
=
'url(../../static/index/taste.png)'
;
topBg
.
value
=
'url(../../static/index/taste.png)'
;
paramsId
.
parentId
=
'3262'
;
getByParentIdData
();
break
;
break
;
case
'2'
:
case
'2'
:
topBg
.
value
=
'url(../../static/index/foodBg.png)'
;
topBg
.
value
=
'url(../../static/index/foodBg.png)'
;
paramsId
.
parentId
=
'3263'
;
getByParentIdData
();
break
;
break
;
}
}
});
});
const
business
=
reactive
([
'优选商家'
,
'超值半价'
,
'今日可订'
,
'经典单人'
]);
// distance参数来源
const
nearby
=
(
distance
)
=>
{
console
.
log
(
'distance'
,
distance
);
if
(
distance
===
0
)
{
delete
listParams
.
distance
;
}
else
{
listParams
.
distance
=
distance
;
}
getMerchantList
();
};
// communityName参数来源
const
popular
=
(
communityName
)
=>
{
console
.
log
(
'communityName'
,
communityName
);
listParams
.
communityName
=
communityName
;
if
(
listParams
.
area
)
{
delete
listParams
.
area
;
}
getMerchantList
();
};
// area参数来源
const
region
=
(
area
)
=>
{
console
.
log
(
'area'
,
area
);
listParams
.
area
=
area
;
if
(
listParams
.
communityName
)
{
delete
listParams
.
communityName
;
}
getMerchantList
();
};
// categoryId参数来源
const
foodCategory
=
(
categoryId
)
=>
{
listParams
.
categoryIds
=
[
categoryId
];
getMerchantList
();
};
// 排序参数来源
const
sortParams
=
(
params
)
=>
{
const
{
sortName
,
sortMode
}
=
params
;
listParams
.
sortName
=
sortName
;
listParams
.
sortMode
=
sortMode
;
getMerchantList
();
};
// 根据父级分类id查询子分类列表
const
getByParentIdData
=
()
=>
{
getByParentId
(
paramsId
).
then
((
res
)
=>
{
categoryData
.
value
=
res
.
data
;
});
};
const
active
=
ref
(
null
);
const
rotate
=
ref
(
false
);
const
rotate2
=
ref
(
false
);
const
rotate3
=
ref
(
false
);
const
topBg
=
ref
(
null
);
const
back
=
()
=>
{
const
back
=
()
=>
{
xma
.
navigateBack
({
xma
.
navigateBack
({
delta
:
1
,
delta
:
1
,
...
@@ -95,13 +155,7 @@ const back = () => {
...
@@ -95,13 +155,7 @@ const back = () => {
};
};
// 商家列表分页-搜索列表
// 商家列表分页-搜索列表
const
getMerchantList
=
()
=>
{
const
getMerchantList
=
()
=>
{
const
data
=
{
merchantList
(
listParams
).
then
((
res
)
=>
{
current
:
1
,
size
:
10
,
lon
:
106.68650025025502
,
lat
:
26.567192352601154
,
};
merchantList
(
data
).
then
((
res
)
=>
{
console
.
log
(
'商家列表'
,
res
);
console
.
log
(
'商家列表'
,
res
);
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
;
...
...
src/utils/request.js
View file @
5cf1f8e1
...
@@ -20,10 +20,18 @@ export const request = ({ url, data = {}, header, method = 'GET' }) => {
...
@@ -20,10 +20,18 @@ export const request = ({ url, data = {}, header, method = 'GET' }) => {
header
,
header
,
method
,
method
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
if
(
res
.
data
.
code
!==
0
)
{
xma
.
showToast
({
title
:
res
.
data
.
msg
,
duration
:
1000
,
icon
:
'none'
,
});
}
resolve
(
res
.
data
);
resolve
(
res
.
data
);
},
},
fail
:
(
e
)
=>
{
fail
:
(
e
)
=>
{
console
.
log
(
'e'
,
e
);
console
.
log
(
'eee'
,
e
);
reject
(
e
);
},
},
});
});
});
});
...
...
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