Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
43fa3a44
Commit
43fa3a44
authored
May 18, 2023
by
hxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
榜单组件开发
parent
9677a34d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
182 additions
and
0 deletions
+182
-0
src/components/basicTool/transverse-label/index.vue
+3
-0
src/components/basicTool/transverse-label/main.json
+1
-0
src/pages/home/index.vue
+3
-0
src/pages/home/main.json
+1
-0
static/nativeComponents/RankingList/index.js
+98
-0
static/nativeComponents/RankingList/index.json
+5
-0
static/nativeComponents/RankingList/index.wxml
+16
-0
static/nativeComponents/RankingList/index.wxss
+55
-0
No files found.
src/components/basicTool/transverse-label/index.vue
View file @
43fa3a44
...
...
@@ -74,6 +74,9 @@
<goods-list
:storageKey=
"'transverseLabel'+componentIndex"
:class=
"['goodsListItemIndex'+index,'transverse-label-goodsListItem']"
:datas=
"item1"
:datasIndex=
"active"
:goodsListIndex=
"index"
></goods-list>
</div>
<div
v-else-if=
"item.componentCode == 'ranking-list' && item.componentInfo.visible == 1"
>
<ranking-list
:datas=
"item"
></ranking-list>
</div>
<div
v-else-if=
"item1.componentCode == 'area-navigation' && item1.componentInfo.visible == 1"
>
<area-navigation
:datas=
"item1"
:changeLocation=
"changeLocation"
></area-navigation>
</div>
...
...
src/components/basicTool/transverse-label/main.json
View file @
43fa3a44
...
...
@@ -4,6 +4,7 @@
"van-tab"
:
"/static/vant/tab/index"
,
"banner"
:
"/static/nativeComponents/Banner/index"
,
"goods-list"
:
"/static/nativeComponents/GoodsList/index"
,
"ranking-list"
:
"/static/nativeComponents/RankingList/index"
,
"time-limited-discount"
:
"/static/nativeComponents/TimeLimitedDiscount/index"
,
"waterfall-flow"
:
"/static/nativeComponents/module/WaterfallFlow/index"
,
"van-button"
:
"/static/vant/button/index"
,
...
...
src/pages/home/index.vue
View file @
43fa3a44
...
...
@@ -17,6 +17,9 @@
-->
<goods-list
:storageKey=
"'home'+index"
:class=
"['goodsListItem' + index,'goodsListItemIndex0']"
:datas=
"item"
:datasIndex=
"0"
:goodsListIndex=
"0"
></goods-list>
</div>
<div
v-else-if=
"item.componentCode == 'ranking-list' && item.componentInfo.visible == 1"
>
<ranking-list
:datas=
"item"
></ranking-list>
</div>
<div
v-else-if=
"item.componentCode == 'area-navigation' && item.componentInfo.visible == 1"
>
<area-navigation
:datas=
"item"
:changeLocation=
"changeLocation"
></area-navigation>
</div>
...
...
src/pages/home/main.json
View file @
43fa3a44
...
...
@@ -6,6 +6,7 @@
"van-loading"
:
"/static/vant/loading/index"
,
"banner"
:
"/static/nativeComponents/Banner/index"
,
"goods-list"
:
"/static/nativeComponents/GoodsList/index"
,
"ranking-list"
:
"/static/nativeComponents/RankingList/index"
,
"custom-tab-bar"
:
"/static/nativeComponents/custom-tab-bar/index"
,
"time-limited-discount"
:
"/static/nativeComponents/TimeLimitedDiscount/index"
,
"waterfall-flow"
:
"/static/nativeComponents/module/WaterfallFlow/index"
,
...
...
static/nativeComponents/RankingList/index.js
0 → 100644
View file @
43fa3a44
const
app
=
getApp
();
const
{
goodsApi
,
$themeToLink
}
=
app
;
Component
({
behaviors
:
[],
properties
:
{
datas
:
{
type
:
Object
}
},
data
:
{
rankingInfoA
:
{},
rankingInfoB
:
{},
rankingList
:
[],
rankingListA
:
[],
rankingListB
:
[]
},
ready
()
{
this
.
setData
({
rankingInfoA
:
this
.
data
.
datas
.
componentData
.
rankingInfoA
});
this
.
setData
({
rankingInfoB
:
this
.
data
.
datas
.
componentData
.
rankingInfoB
});
this
.
getRankingList
();
},
observers
:
{
rankingListA
()
{
this
.
notifyRankingList
()
},
rankingListB
()
{
this
.
notifyRankingList
()
}
},
methods
:
{
handleItemClick
(
e
)
{
const
item
=
e
.
currentTarget
.
dataset
.
item
;
$themeToLink
({
type
:
1
,
link
:
`/goods/
${
item
.
productId
}
?terminalProductId=
${
item
.
terminalProductId
}
`
});
},
notifyRankingList
()
{
const
rankingInfoA
=
this
.
data
.
rankingInfoA
;
const
rankingInfoB
=
this
.
data
.
rankingInfoB
;
if
(
rankingInfoA
.
checked
&&
rankingInfoB
.
checked
)
{
const
listA
=
this
.
data
.
rankingListA
.
slice
(
0
,
2
);
const
listB
=
this
.
data
.
rankingListB
.
slice
(
0
,
2
);
this
.
setData
({
rankingList
:
listA
.
concat
(
listB
)
});
}
else
if
(
rankingInfoA
.
checked
)
{
this
.
setData
({
rankingList
:
this
.
data
.
rankingListA
})
}
else
if
(
rankingInfoB
.
checked
)
{
this
.
setData
({
rankingList
:
this
.
data
.
rankingListB
});
}
},
async
getRankingList
()
{
const
rankingInfoA
=
this
.
data
.
rankingInfoA
;
const
rankingInfoB
=
this
.
data
.
rankingInfoB
;
// 开启两个榜单
if
(
rankingInfoA
.
checked
)
{
this
.
getProductInfo
(
0
,
rankingInfoA
.
filter
);
}
if
(
rankingInfoB
.
checked
)
{
this
.
getProductInfo
(
1
,
rankingInfoB
.
filter
);
}
},
async
getProductInfo
(
type
,
id
)
{
const
data
=
{
categoryIncludeChild
:
true
,
categoryId
:
id
,
page
:
1
,
// 当前页
rows
:
4
,
sortColumn
:
this
.
goodsSort
,
sortType
:
1
,
whetherShowSoldOutGoods
:
false
,
//查询销售数量
whetherQueryCollectCount
:
false
,
//查询收藏数
whetherUseVirtualSalesQty
:
false
,
//是否使用虚拟销售数量
whetherUseVirtualCollectCount
:
false
,
//是否使用虚拟收藏人数
whetherFindDistributionCommission
:
0
,
//是否查询商品佣金(0:不查询,1:展示,为空不查佣金)
whetherFindRecommendedCardFlag
:
0
,
//是否查询会员价 1是 0否
whetherShowGoodsDefaultTagFlag
:
0
,
//是否展示营销标签 1是 0否
whetherFindMultiShopFlag
:
1
,
//是否查询多商户 //商城使用
whetherFindMultiSonShopFlag
:
1
,
//是否查询多商户 //多主题使用
brandIdList
:
[],
categoryIdList
:
[],
whetherQueryGoodsAttributeFlag
:
0
,
whetherToEnableQuickPurchase
:
0
,
}
const
res
=
await
goodsApi
.
queryProductInfo
(
data
);
if
(
res
.
data
.
code
==
200
)
{
if
(
!
type
)
{
this
.
setData
({
rankingListA
:
res
.
data
.
data
.
list
||
[]
});
}
else
{
this
.
setData
({
rankingListB
:
res
.
data
.
data
.
list
||
[]
});
}
}
}
},
});
\ No newline at end of file
static/nativeComponents/RankingList/index.json
0 → 100644
View file @
43fa3a44
{
"component"
:
true
,
"usingComponents"
:
{}
}
\ No newline at end of file
static/nativeComponents/RankingList/index.wxml
0 → 100644
View file @
43fa3a44
<view class="ranking-list__wrapper" style="margin: {{datas.componentData.margin[0]*2}}rpx {{datas.componentData.margin[1]*2}}rpx;border-radius: {{datas.componentData.borderRadius}}rpx;background-color:{{datas.componentData.backgroundColor}}">
<view class="flex ranking-list__title">
<view class="ranking-title__left" wx:if="{{rankingInfoA.checked}}">{{ rankingInfoA.title }}</view>
<view class="ranking-title__right" wx:if="{{rankingInfoB.checked}}">{{ rankingInfoB.title }}</view>
</view>
<view class="ranking-list__content">
<block wx:for="{{rankingList}}">
<view class="flex list-item" bindtap="handleItemClick" data-item="{{item}}">
<image class="image" src="{{item.productImgUrl}}" />
<view class="content line-clamp1">{{ item.productName }}</view>
<view class="price">¥{{ item.minPrice }}</view>
</view>
</block>
</view>
</view>
\ No newline at end of file
static/nativeComponents/RankingList/index.wxss
0 → 100644
View file @
43fa3a44
.flex {
display: flex;
}
.line-clamp1 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.ranking-list__title {
padding: 16rpx 24rpx;
font-size: 28rpx;
font-weight: 500;
}
.ranking-list__title .ranking-title__left {
flex: 1;
}
.ranking-list__title .ranking-title__right {
flex: 1;
}
.ranking-list__content {
padding: 0 24rpx;
display: grid;
grid-template-columns: repeat(4, 25%);
align-items: center;
}
.ranking-list__content .list-item {
align-items: center;
flex-direction: column;
}
.ranking-list__content .image {
width: 148rpx;
height: 148rpx;
}
.ranking-list__content .content {
margin-top: 16rpx;
color: #333333;
font-size: 24rpx;
}
.ranking-list__content .price {
margin: 12rpx 0 24rpx;
color: #C72A30;
font-weight: 600;
font-size: 24rpx;
}
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