Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
4e6e0c85
Commit
4e6e0c85
authored
Aug 31, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 商品详情添加购物车
parent
4e7d4871
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
18 deletions
+52
-18
skuPopup.js
src/component/skuPopup/skuPopup.js
+6
-0
productDetail.js
src/pages/productDetail/productDetail.js
+45
-17
project.config.json
src/project.config.json
+1
-1
No files found.
src/component/skuPopup/skuPopup.js
View file @
4e6e0c85
...
...
@@ -171,6 +171,12 @@ Component({
}
}
this
.
triggerEvent
(
'skuselect'
,
{
skuId
:
this
.
data
.
skuId
,
count
:
this
.
data
.
proNum
,
})
// this.triggerEvent('skuselect', {
// selectSku: this.data.curSku,
// counts: this.data.proNum,
...
...
src/pages/productDetail/productDetail.js
View file @
4e6e0c85
...
...
@@ -9,18 +9,18 @@ wxService.page({
* 页面的初始数据
*/
data
:
{
productId
:
''
,
productId
:
''
,
scrollTips
:
'继续拖动,查看图文详情'
,
// 滑动文案
productInfo
:
''
,
productInfo
:
''
,
showHtml
:
false
,
reachBottom
:
false
,
// 标识是否触底
showSkuPopup
:
false
,
btnText
:
'确定'
,
baseImgUrl
:
app
.
globalData
.
imageUrl
,
swiperCurrent
:
0
,
selectSkuName
:
''
,
openPlusStatus
:
false
,
memberLevel
:
false
,
selectSkuName
:
''
,
openPlusStatus
:
false
,
memberLevel
:
false
,
showCardModal
:
false
,
currentShareContent
:
null
},
...
...
@@ -29,7 +29,7 @@ wxService.page({
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
if
(
options
&&
options
.
productId
){
if
(
options
&&
options
.
productId
)
{
this
.
setData
({
productId
:
options
.
productId
})
...
...
@@ -57,7 +57,7 @@ wxService.page({
showSkuPopupType
:
'buy'
})
},
// 分享
onTapShare
()
{
let
content
=
{
...
...
@@ -101,7 +101,7 @@ wxService.page({
},
//获取商品详情
getProInfo
(){
getProInfo
()
{
wx
.
showLoading
({
title
:
'加载中'
})
...
...
@@ -119,7 +119,7 @@ wxService.page({
},
// 获取会员等级开关
getMemberLevel
(){
getMemberLevel
()
{
wxService
.
get
(
`/merchant/brandSwitchSetting/getOpenStatus?businessType=2`
).
then
(
res
=>
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
...
...
@@ -133,12 +133,12 @@ wxService.page({
},
// 获取plus会员开关
getOpenStatus
(){
getOpenStatus
()
{
wxService
.
get
(
`/merchant/brandSwitchSetting/getOpenStatus?businessType=3`
).
then
(
res
=>
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
this
.
setData
({
openPlusStatus
:
data
openPlusStatus
:
data
})
}
}).
finally
(()
=>
{
...
...
@@ -227,10 +227,16 @@ wxService.page({
}).
exec
()
},
confirmClick
(
event
){
console
.
log
(
'confirmClick'
,
event
)
confirmClick
(
event
)
{
const
{
skuId
,
count
}
=
event
.
detail
console
.
log
(
'父组件'
,
skuId
,
count
)
const
trolleySku
=
{
count
,
skuId
}
var
selectSkuName
=
[]
for
(
let
i
in
event
.
detail
.
selectSku
){
for
(
let
i
in
event
.
detail
.
selectSku
)
{
selectSkuName
.
push
(
event
.
detail
.
selectSku
[
i
].
name
)
}
var
selectSkuStr
=
selectSkuName
.
join
(
','
)
...
...
@@ -240,13 +246,35 @@ wxService.page({
if
(
this
.
data
.
showSkuPopupType
==
'cart'
)
{
// 加入购物车
this
.
getPutCart
(
trolleySku
)
}
else
if
(
this
.
data
.
showSkuPopupType
==
'buy'
)
{
// 下单页面
console
.
log
(
'buy'
)
}
},
// put 购物车
getPutCart
(
trolleySku
)
{
wx
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
wxService
.
post
(
'/sale/trolley/put'
,
trolleySku
).
then
(
res
=>
{
if
(
res
)
{
const
{
result
}
=
res
.
data
if
(
result
==
0
)
{
// 关闭弹框
this
.
setData
({
showSkuPopup
:
false
})
wx
.
hideLoading
()
wx
.
showToast
({
title
:
'添加成功,在购物车等亲~'
,
icon
:
'none'
})
}
}
})
},
/**
* 用户点击右上角分享
*/
...
...
src/project.config.json
View file @
4e6e0c85
...
...
@@ -144,7 +144,7 @@
"id"
:
16
,
"name"
:
"商品详情页"
,
"pathName"
:
"pages/productDetail/productDetail"
,
"query"
:
"productId=100
8190
"
,
"query"
:
"productId=100
0704
"
,
"scene"
:
null
},
{
...
...
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