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
69ddb7ad
Commit
69ddb7ad
authored
Aug 19, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: cart
parent
36fb13c9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
33 deletions
+32
-33
cart.js
src/pages/cart/cart.js
+32
-33
No files found.
src/pages/cart/cart.js
View file @
69ddb7ad
...
...
@@ -213,13 +213,12 @@ wxService.page({
let
cartListData
=
this
.
data
.
cartList
||
[]
if
(
!
cartListData
)
return
false
// cartListData.filter(item => { // 选中的商品信息
// return item.checked
// }).map(function (item) {
// goodsIds.push(item.promotionId)
// specIds.push(item.selectSku.id)
// quantitys.push(item.quantity)
// })
cartListData
.
filter
(
item
=>
{
// 选中的商品信息
return
item
.
checked
}).
map
(
function
(
item
)
{
goodsIds
.
push
(
item
.
skuId
)
quantitys
.
push
(
item
.
count
)
})
if
(
goodsIds
.
length
==
0
)
{
wx
.
showToast
({
title
:
'请选择商品'
,
...
...
@@ -228,38 +227,38 @@ wxService.page({
return
false
}
// 去下单页
//
this.handleGoBuy()
this
.
handleGoBuy
()
},
handleGoBuy
()
{
// 下单
wx
.
showLoading
({
title
:
'加载中'
})
wxService
.
post
(
`/sale/trade/buyer/create`
).
then
(
res
=>
{
if
(
!
res
)
return
false
;
const
{
result
,
data
}
=
res
&&
res
.
data
||
res
&&
res
.
result
if
(
result
==
0
)
{
delete
data
.
appId
wx
.
requestPayment
(
Object
.
assign
({
success
(
res
)
{
wx
.
hideLoading
()
wx
.
showToast
({
title
:
'支付成功'
,
icon
:
'none'
,
mask
:
true
})
},
fail
(
res
)
{
wx
.
hideLoading
()
wx
.
showToast
({
title
:
'支付失败'
,
icon
:
'none'
,
mask
:
true
})
}
},
data
))
}
})
//
wxService.post(`/sale/trade/buyer/create`).then(res => {
//
if (!res) return false;
//
const { result, data } = res && res.data || res && res.result
//
if (result == 0) {
//
delete data.appId
//
wx.requestPayment(Object.assign({
//
success(res) {
//
wx.hideLoading()
//
wx.showToast({
//
title: '支付成功',
//
icon: 'none',
//
mask: true
//
})
//
},
//
fail(res) {
//
wx.hideLoading()
//
wx.showToast({
//
title: '支付失败',
//
icon: 'none',
//
mask: true
//
})
//
}
//
}, data))
//
}
//
})
},
// 调整商品 /trolley/add
editOk
()
{
...
...
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