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
03634695
Commit
03634695
authored
Jan 28, 2021
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表点击事件
parent
61e3b697
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
146 additions
and
26 deletions
+146
-26
src/pages/index/index.vue
+3
-0
src/utils/mayi.js
+2
-2
static/nativeComponents/GoodsList/GoodsItem/index.js
+46
-2
static/nativeComponents/GoodsList/GoodsItem/index.wxml
+16
-4
static/nativeComponents/GoodsList/heapItem/index.wxml
+4
-5
static/nativeComponents/GoodsList/index.js
+55
-10
static/nativeComponents/GoodsList/index.wxml
+13
-2
static/nativeComponents/GoodsList/index.wxss
+7
-1
No files found.
src/pages/index/index.vue
View file @
03634695
...
@@ -153,6 +153,9 @@ export default {
...
@@ -153,6 +153,9 @@ export default {
}
else
if
(
options
.
from
&&
(
options
.
from
==
"home"
||
options
.
from
==
"livedToIndex"
))
{
}
else
if
(
options
.
from
&&
(
options
.
from
==
"home"
||
options
.
from
==
"livedToIndex"
))
{
//来自直播详情
//来自直播详情
this
.
page
=
decodeURIComponent
(
options
.
backpath
);
this
.
page
=
decodeURIComponent
(
options
.
backpath
);
if
(
this
.
page
.
includes
(
"?"
)){
this
.
params
=
"&mixid="
+
this
.
shopId
;
}
options
.
params
&&
(
this
.
params
+=
"&"
+
serialize
(
options
.
params
));
options
.
params
&&
(
this
.
params
+=
"&"
+
serialize
(
options
.
params
));
}
else
if
(
options
.
from
&&
options
.
from
==
"livedBackShop"
)
{
}
else
if
(
options
.
from
&&
options
.
from
==
"livedBackShop"
)
{
//直播页back到商城
//直播页back到商城
...
...
src/utils/mayi.js
View file @
03634695
...
@@ -77,9 +77,9 @@ export function $themeToLink(data) {
...
@@ -77,9 +77,9 @@ export function $themeToLink(data) {
}
}
}
}
function
toPage
(
backPath
,
backParams
)
{
function
toPage
(
backPath
,
backParams
=
""
)
{
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
`../index/main?from=home&backpath=
${
backPath
}
¶ms=
${
encodeURIComponent
(
backParams
)}
`
url
:
`../index/main?from=home&backpath=
${
encodeURIComponent
(
backPath
)
}
¶ms=
${
encodeURIComponent
(
backParams
)}
`
});
});
}
}
...
...
static/nativeComponents/GoodsList/GoodsItem/index.js
View file @
03634695
const
app
=
getApp
();
const
{
goodsApi
,
DFSImg
,
$themeToLink
}
=
app
;
const
componentOptions
=
{
const
componentOptions
=
{
// 组件选项
// 组件选项
options
:
{
options
:
{
...
@@ -18,7 +20,7 @@ const componentOptions = {
...
@@ -18,7 +20,7 @@ const componentOptions = {
// 组件数据
// 组件数据
data
:
{
data
:
{
isPageHidden
:
false
,
// 页面是否处于隐藏状态
isPageHidden
:
false
,
// 页面是否处于隐藏状态
timeData
:
{}
,
timeData
:
{}
},
},
// 数据监听器
// 数据监听器
observers
:
{},
observers
:
{},
...
@@ -54,7 +56,49 @@ const componentOptions = {
...
@@ -54,7 +56,49 @@ const componentOptions = {
},
},
onChange
(
e
)
{
onChange
(
e
)
{
this
.
setData
({
timeData
:
e
.
detail
});
this
.
setData
({
timeData
:
e
.
detail
});
}
},
onclickProduct
()
{
let
{
goodsType
}
=
this
.
data
.
datas
.
componentData
;
let
{
productId
,
terminalProductId
,
terminalGoodsMixId
}
=
this
.
data
.
items
;
let
linkVal
=
""
;
if
(
goodsType
==
0
)
{
linkVal
=
`/goods/
${
productId
}
?terminalProductId=
${
terminalProductId
}
`
;
}
else
if
(
goodsType
==
1
)
{
linkVal
=
`/pointShop/goodsDetail?productId
${
productId
}
&terminalProductId=
${
terminalProductId
}
&terminalGoodsMixId=
${
terminalGoodsMixId
}
`
;
}
$themeToLink
({
type
:
1
,
link
:
linkVal
});
},
onclickBuynow
()
{
let
{
btnType
}
=
this
.
data
.
datas
.
componentData
;
let
{
minProductGoodsMixid
,
minProductGoodsId
,
minGoodsId
}
=
this
.
data
.
items
;
let
linkVal
=
""
;
if
(
btnType
<
6
)
{
// 加入购物车
console
.
log
(
"加入购物车"
);
// this.$themeAddToCard(item);
}
else
{
// 进入确认订单
linkVal
=
`/order/orderConfirm?productGoodsMixId=
${
minProductGoodsMixid
}
&productGoodsId=
${
minProductGoodsId
}
&goodsId=
${
minGoodsId
}
&qty=1&goodsString=null&source=3`
;
}
console
.
log
(
linkVal
,
"-------90"
);
$themeToLink
({
type
:
1
,
link
:
linkVal
});
},
toMerchants
()
{
let
{
orgId
}
=
this
.
data
.
items
;
$themeToLink
({
type
:
1
,
link
:
`/merchantsDetail/
${
orgId
}
`
});
},
},
},
// 组件生命周期
// 组件生命周期
lifetimes
:
{
lifetimes
:
{
...
...
static/nativeComponents/GoodsList/GoodsItem/index.wxml
View file @
03634695
<!-- 商品列表item -->
<!-- 商品列表item -->
<view class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}" style="--proGap2:{{datas.componentData.proGap*2}}rpx;">
<view
class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}"
style="--proGap2:{{datas.componentData.proGap*2}}rpx;"
bindtap="onclickProduct"
>
<view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius}}em;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};">
<view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius}}em;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};">
<!-- 商户入口-顶部 -->
<!-- 商户入口-顶部 -->
<view class="merchantsEntrance flex" wx:if="{{datas.componentData['merchantsEntrance'] && datas.componentData['merchantsEntranceType'] == 0 && datas.componentData.style!='heap'}}">
<view
class="merchantsEntrance flex"
bindtoMerchants="toMerchants"
wx:if="{{datas.componentData['merchantsEntrance'] && datas.componentData['merchantsEntranceType'] == 0 && datas.componentData.style!='heap'}}"
>
<view class="left flex" wx:if="{{items != null}}">
<view class="left flex" wx:if="{{items != null}}">
<view class="logo">
<view class="logo">
<image mode='widthFix' src="{{items.shopLogoUrl}}" />
<image mode='widthFix' src="{{items.shopLogoUrl}}" />
...
@@ -152,7 +160,7 @@
...
@@ -152,7 +160,7 @@
>
>
已售罄
已售罄
</view>
</view>
<view wx:if="{{(items&&items.totalQty-0>0||items&&items.oversoldFlag==1)&& datas.componentData['paynow']}}">
<view wx:if="{{(items&&items.totalQty-0>0||items&&items.oversoldFlag==1)&& datas.componentData['paynow']}}"
catchtap="onclickBuynow"
>
<text wx:if="{{datas.componentData.btnType<6}}" style="color:{{datas.componentData.btnColor}}" class="buy-now-icon iconfont-common {{datas.componentData.btnIcon}}"></text>
<text wx:if="{{datas.componentData.btnType<6}}" style="color:{{datas.componentData.btnColor}}" class="buy-now-icon iconfont-common {{datas.componentData.btnIcon}}"></text>
<view
<view
wx:else
wx:else
...
@@ -191,7 +199,11 @@
...
@@ -191,7 +199,11 @@
</block>
</block>
</view>
</view>
<!-- 商户入口二 -->
<!-- 商户入口二 -->
<view class="merchantsEntrance flex" wx:if="{{datas.componentData.merchantsEntrance&&datas.componentData.merchantsEntranceType==1 && datas.componentData.style!='heap'}}">
<view
class="merchantsEntrance flex"
bindtoMerchants="toMerchants"
wx:if="{{datas.componentData.merchantsEntrance&&datas.componentData.merchantsEntranceType==1 && datas.componentData.style!='heap'}}"
>
<view class="left flex" wx:if="{{items!=null}}">
<view class="left flex" wx:if="{{items!=null}}">
<view class="logo">
<view class="logo">
<image mode='widthFix' src="http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/ppefWK8BS6.png?x-oss-process=image/resize,limit_1,w_150,h_150" />
<image mode='widthFix' src="http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/ppefWK8BS6.png?x-oss-process=image/resize,limit_1,w_150,h_150" />
...
...
static/nativeComponents/GoodsList/heapItem/index.wxml
View file @
03634695
...
@@ -5,11 +5,10 @@
...
@@ -5,11 +5,10 @@
wx:key="index"
wx:key="index"
data-index="{{index}}"
data-index="{{index}}"
class="{{'card-swiper-item curdistance' + (swiperCurIndex + index) + (!!item.slideClass? item.slideClass: '')}}"
class="{{'card-swiper-item curdistance' + (swiperCurIndex + index) + (!!item.slideClass? item.slideClass: '')}}"
bindtap="next"
bindtouchstart="touchCard.start"
catchtouchstart="touchCard.start"
bindtouchmove="touchCard.move"
catchtouchmove="touchCard.move"
bindtouchend="touchCard.end"
catchtouchend="touchCard.end"
bindtouchcancel="touchCard.cancel"
catchtouchcancel="touchCard.cancel"
>
>
<goods-item
<goods-item
style="width:100%"
style="width:100%"
...
...
static/nativeComponents/GoodsList/index.js
View file @
03634695
const
app
=
getApp
();
const
app
=
getApp
();
const
{
goodsApi
,
DFSImg
}
=
app
;
const
{
goodsApi
,
DFSImg
,
$themeToLink
}
=
app
;
const
componentOptions
=
{
const
componentOptions
=
{
// 组件选项
// 组件选项
options
:
{
options
:
{
...
@@ -96,7 +96,12 @@ const componentOptions = {
...
@@ -96,7 +96,12 @@ const componentOptions = {
},
},
getProductList
(
code
,
type
)
{
getProductList
(
code
,
type
)
{
let
{
goodsList
,
goodsSort
}
=
this
.
data
.
datas
.
componentData
;
let
{
goodsList
,
goodsSort
}
=
this
.
data
.
datas
.
componentData
;
let
{
classificationLoadPage
,
loading
,
finished
,
queryProductInfoLoading
}
=
this
.
data
;
let
{
classificationLoadPage
,
loading
,
finished
,
queryProductInfoLoading
}
=
this
.
data
;
if
(
queryProductInfoLoading
==
true
)
{
if
(
queryProductInfoLoading
==
true
)
{
return
;
return
;
}
}
...
@@ -111,9 +116,32 @@ const componentOptions = {
...
@@ -111,9 +116,32 @@ const componentOptions = {
loading
=
true
;
loading
=
true
;
}
}
this
.
setData
({
classificationLoadPage
,
loading
});
this
.
setData
({
classificationLoadPage
,
loading
});
let
query
=
{
categoryId
:
this
.
data
.
datas
.
componentData
.
categoryId
,
page
:
this
.
showRowNum
()
?
classificationLoadPage
:
1
,
rows
:
this
.
showRowNum
()
?
this
.
data
.
classificationLoadNum
:
this
.
getItemNum
(),
sortColumn
:
goodsSort
,
sortType
:
goodsSort
!=
2
?
1
:
0
,
whetherShowSoldOutGoods
:
this
.
data
.
datas
.
componentData
.
whetherShowSoldOutGoods
,
whetherQueryCollectCount
:
true
,
whetherUseVirtualSalesQty
:
true
,
whetherUseVirtualCollectCount
:
true
,
whetherFindDistributionCommission
:
this
.
whetherFindDistributionCommission
,
whetherFindRecommendedCardFlag
:
this
.
data
.
datas
.
componentData
.
vipPrice
?
1
:
0
,
whetherShowGoodsDefaultTagFlag
:
this
.
data
.
datas
.
componentData
.
marketingTag
?
1
:
0
,
whetherFindMultiShopFlag
:
1
};
// 当前页 // 一页多少条 //查询销售数量 //查询收藏数 //是否使用虚拟销售数量 //是否使用虚拟收藏人数 //是否查询商品佣金(0:不查询,1:展示,为空不查佣金) //是否查询会员价 1是 0否 //是否展示营销标签 1是 0否 //是否查询多商户 //商城使用
let
query
=
{
categoryId
:
this
.
data
.
datas
.
componentData
.
categoryId
,
page
:
this
.
showRowNum
()
?
classificationLoadPage
:
1
,
rows
:
this
.
showRowNum
()
?
this
.
data
.
classificationLoadNum
:
this
.
getItemNum
(),
sortColumn
:
goodsSort
,
sortType
:
goodsSort
!=
2
?
1
:
0
,
whetherShowSoldOutGoods
:
this
.
data
.
datas
.
componentData
.
whetherShowSoldOutGoods
,
whetherQueryCollectCount
:
true
,
whetherUseVirtualSalesQty
:
true
,
whetherUseVirtualCollectCount
:
true
,
whetherFindDistributionCommission
:
this
.
whetherFindDistributionCommission
,
whetherFindRecommendedCardFlag
:
this
.
data
.
datas
.
componentData
.
vipPrice
?
1
:
0
,
whetherShowGoodsDefaultTagFlag
:
this
.
data
.
datas
.
componentData
.
marketingTag
?
1
:
0
,
whetherFindMultiShopFlag
:
1
};
// 当前页 // 一页多少条 //查询销售数量 //查询收藏数 //是否使用虚拟销售数量 //是否使用虚拟收藏人数 //是否查询商品佣金(0:不查询,1:展示,为空不查佣金) //是否查询会员价 1是 0否 //是否展示营销标签 1是 0否 //是否查询多商户 //商城使用
goodsApi
.
queryProductInfo
(
query
).
then
(
res
=>
{
goodsApi
.
queryProductInfo
(
query
).
then
(
res
=>
{
this
.
setData
({
loading
:
false
,
queryProductInfoLoading
:
false
});
this
.
setData
({
loading
:
false
,
queryProductInfoLoading
:
false
});
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
let
goodsLists
=
res
.
data
.
data
.
list
;
let
goodsLists
=
res
.
data
.
data
.
list
;
if
(
type
==
1
)
{
if
(
type
==
1
)
{
...
@@ -122,9 +150,9 @@ const componentOptions = {
...
@@ -122,9 +150,9 @@ const componentOptions = {
goodsList
=
[...
goodsList
,
...
goodsLists
];
goodsList
=
[...
goodsList
,
...
goodsLists
];
}
}
if
(
goodsLists
&&
goodsLists
.
length
<
10
)
{
if
(
goodsLists
&&
goodsLists
.
length
<
10
)
{
this
.
setData
({
finished
:
true
});
this
.
setData
({
finished
:
true
});
}
}
this
.
goodsListVal
(
goodsList
,
type
);
this
.
goodsListVal
(
goodsList
,
type
);
}
}
});
});
}
else
{
}
else
{
...
@@ -178,11 +206,11 @@ const componentOptions = {
...
@@ -178,11 +206,11 @@ const componentOptions = {
goodsApi
.
queryMoreProductInfo
(
moreQuery
).
then
(
res
=>
{
goodsApi
.
queryMoreProductInfo
(
moreQuery
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
goodsList
=
res
.
data
.
data
;
goodsList
=
res
.
data
.
data
;
this
.
goodsListVal
(
goodsList
,
1
);
this
.
goodsListVal
(
goodsList
,
1
);
}
}
});
});
},
},
goodsListVal
(
goodsList
,
type
)
{
goodsListVal
(
goodsList
,
type
)
{
console
.
log
(
goodsList
,
"------------goodsListVal"
);
console
.
log
(
goodsList
,
"------------goodsListVal"
);
goodsList
.
forEach
((
item
,
index
)
=>
{
goodsList
.
forEach
((
item
,
index
)
=>
{
item
.
marketingTag
=
item
.
defaultTags
item
.
marketingTag
=
item
.
defaultTags
...
@@ -192,7 +220,7 @@ const componentOptions = {
...
@@ -192,7 +220,7 @@ const componentOptions = {
)
)
:
[];
:
[];
item
.
shopLogoUrl
=
DFSImg
(
item
.
shopLogoUrl
);
item
.
shopLogoUrl
=
DFSImg
(
item
.
shopLogoUrl
);
item
.
coverImage
=
DFSImg
(
item
.
coverImage
,
100
,
100
,
0
);
item
.
coverImage
=
DFSImg
(
item
.
coverImage
,
100
,
100
,
0
);
item
.
productImgUrl
=
DFSImg
(
item
.
productImgUrl
,
100
,
100
,
0
);
item
.
productImgUrl
=
DFSImg
(
item
.
productImgUrl
,
100
,
100
,
0
);
item
.
minPrice
=
Number
(
item
.
minPrice
).
toFixed
(
2
);
item
.
minPrice
=
Number
(
item
.
minPrice
).
toFixed
(
2
);
item
.
qty
=
Number
(
item
.
qty
);
item
.
qty
=
Number
(
item
.
qty
);
...
@@ -311,7 +339,24 @@ const componentOptions = {
...
@@ -311,7 +339,24 @@ const componentOptions = {
// 分页加载
// 分页加载
onLoad
()
{
onLoad
()
{
console
.
log
(
"---触发分页加载"
);
console
.
log
(
"---触发分页加载"
);
this
.
getProductList
(
1
,
2
);
this
.
getProductList
(
1
,
2
);
},
viewMore
()
{
let
{
goodsType
,
style
,
categoryName
,
categoryId
}
=
this
.
data
.
datas
.
componentData
;
let
linkVal
=
""
;
if
(
goodsType
!=
1
)
{
if
(
style
==
"list"
)
{
linkVal
=
`/goods/commodityMenu?categoryName=
${
categoryName
}
&categoryId=
${
categoryId
}
`
;
}
else
{
linkVal
=
`/goods/commodityMenu`
;
}
}
else
{
linkVal
=
`/pointShop/productList?categoryName=
${
categoryName
}
&categoryId=
${
categoryId
}
`
;
}
$themeToLink
({
type
:
1
,
link
:
linkVal
,
});
}
}
}
}
};
};
...
...
static/nativeComponents/GoodsList/index.wxml
View file @
03634695
...
@@ -9,7 +9,11 @@
...
@@ -9,7 +9,11 @@
</view>
</view>
<view class="title">{{datas.componentData['titles']}}</view>
<view class="title">{{datas.componentData['titles']}}</view>
</view>
</view>
<view class="moreTop" wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='top' && datas.componentData['goodsSource']!='assign'}}">
<view
class="moreTop"
bindtap="viewMore"
wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='top' && datas.componentData['goodsSource']!='assign'}}"
>
查看更多
查看更多
<text class="jt"></text>
<text class="jt"></text>
</view>
</view>
...
@@ -91,7 +95,14 @@
...
@@ -91,7 +95,14 @@
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
<heap-item datas="{{datas}}"></heap-item>
<heap-item datas="{{datas}}"></heap-item>
</view>
</view>
<view
class="moreBottom"
bindtap="viewMore"
wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='bottom' && datas.componentData['goodsSource']!='assign'}}"
>
查看更多
<text class="jt"></text>
</view>
</view>
</view>
</view>
</view>
static/nativeComponents/GoodsList/index.wxss
View file @
03634695
...
@@ -40,7 +40,7 @@ image{
...
@@ -40,7 +40,7 @@ image{
font-size: 13px;
font-size: 13px;
color: #6b6b6b;
color: #6b6b6b;
}
}
.moreTop .jt
{
.moreTop .jt
,.moreBottom .jt
{
display: inline-block;
display: inline-block;
border-top: 1px solid;
border-top: 1px solid;
border-right: 1px solid;
border-right: 1px solid;
...
@@ -50,6 +50,12 @@ image{
...
@@ -50,6 +50,12 @@ image{
transform: rotate(405deg);
transform: rotate(405deg);
margin-left: 0px;
margin-left: 0px;
}
}
.moreBottom {
font-size: 13px;
text-align: center;
padding-top: 0.54em;
color: #6b6b6b;
}
.goodsItem-list{
.goodsItem-list{
flex-wrap: wrap;
flex-wrap: wrap;
}
}
...
...
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