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
d4403f15
Commit
d4403f15
authored
Jan 11, 2023
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表收藏
parent
e5434229
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletions
+39
-1
src/api/goods.js
+8
-0
static/nativeComponents/GoodsList/GoodsItem/index.js
+30
-0
static/nativeComponents/GoodsList/GoodsItem/index.wxml
+1
-1
No files found.
src/api/goods.js
View file @
d4403f15
...
...
@@ -34,4 +34,12 @@ export default {
batch_query_collect_count
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/batch_query_collect_count`
,
data
)
},
// 收藏
collect_goods
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/collect_goods?productId=
${
data
.
productId
}
&terminalProductId=
${
data
.
terminalProductId
}
`
)
},
// 取消收藏
uncollect_goods
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/product/uncollect_goods?productId=
${
data
.
productId
}
&terminalProductId=
${
data
.
terminalProductId
}
`
,
data
)
},
};
static/nativeComponents/GoodsList/GoodsItem/index.js
View file @
d4403f15
...
...
@@ -101,6 +101,36 @@ const componentOptions = {
link
:
linkVal
});
},
// 收藏
toStart
(
e
)
{
let
{
items
}
=
this
.
data
;
console
.
log
(
this
.
data
.
items
,
e
,
'----items'
)
let
query
=
{
productId
:
items
.
productId
,
terminalProductId
:
items
.
terminalProductId
,
}
if
(
!
items
.
collectFlag
)
{
// 收藏
goodsApi
.
collect_goods
(
query
).
then
(
res1
=>
{
let
res
=
res1
.
data
;
if
(
res
.
code
==
200
&&
res
.
data
)
{
this
.
setData
({
"items.collectFlag"
:
!
items
.
collectFlag
})
}
})
}
else
{
// 取消收藏
goodsApi
.
uncollect_goods
(
query
).
then
(
res1
=>
{
let
res
=
res1
.
data
;
if
(
res
.
code
==
200
&&
res
.
data
)
{
this
.
setData
({
"items.collectFlag"
:
!
items
.
collectFlag
})
}
})
}
},
onclickBuynow
(
e
)
{
let
{
btnType
}
=
this
.
data
.
datas
.
componentData
;
let
_this
=
this
;
...
...
static/nativeComponents/GoodsList/GoodsItem/index.wxml
View file @
d4403f15
...
...
@@ -185,7 +185,7 @@
{{datas.componentData.btnTest}}
</view>
</view>
<view class="start" wx:if="{{datas.componentData['collectFlag']}}">
<view class="start" wx:if="{{datas.componentData['collectFlag']}}"
catchtap="toStart"
>
<text style="color:{{datas.componentData.btnColor}}" class="buy-now-icon iconfont-common {{items.collectFlag?'common-iconaixin':'common-iconaixin1'}}"></text>
</view>
<!-- 底部展示标签列表 -->
...
...
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