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
264705b2
Commit
264705b2
authored
Aug 26, 2019
by
赵雅纹
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_7.1.0' into feature-zyw-sc
parents
c0ff0dc5
67347fe4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
16 deletions
+46
-16
cart.js
src/pages/cart/cart.js
+21
-10
confirmOrder.js
src/pages/confirmOrder/confirmOrder.js
+25
-6
No files found.
src/pages/cart/cart.js
View file @
264705b2
...
...
@@ -56,7 +56,7 @@ wxService.page({
const
trolleySku
=
{
count
:
1
,
skuId
:
'155610880731600
1
'
skuId
:
'155610880731600
0
'
}
// 加入购物车
wxService
.
post
(
'/sale/trolley/put'
,
trolleySku
).
then
(
res
=>
{
...
...
@@ -205,6 +205,7 @@ wxService.page({
},
goBuy
()
{
let
skuIds
=
[]
let
trolleySku2Buy
=
[]
let
specIds
=
[]
let
quantitys
=
[]
let
redemptionSpecIds
=
[]
...
...
@@ -214,24 +215,34 @@ wxService.page({
cartListData
.
filter
(
item
=>
{
// 选中的商品信息
return
item
.
checked
}).
map
(
item
=>
{
skuIds
.
push
(
item
.
skuId
-
0
)
if
(
!
item
.
skuId
)
return
false
let
trolleySku2BuyObj
=
{
count
:
0
,
skuId
:
0
}
trolleySku2BuyObj
.
count
=
item
.
count
-
0
trolleySku2BuyObj
.
skuId
=
item
.
skuId
-
0
// skuIds.push(item.skuId)
trolleySku2Buy
.
push
(
trolleySku2BuyObj
)
})
if
(
skuIds
.
length
==
0
)
{
if
(
trolleySku2Buy
.
length
==
0
)
{
wx
.
showToast
({
title
:
'请选择商品'
,
icon
:
'none'
})
return
false
}
console
.
log
(
'trolleySku2Buy'
,
trolleySku2Buy
)
// 去下单页 && 参数
//
let parmas = {
// specId: skuIds.join(','
)
//
}
//
wxService
//
.router('/pages/confirmOrder/confirmOrder')
//
.search(parmas)
let
parmas
=
{
trolleySku2Buy
:
JSON
.
stringify
(
trolleySku2Buy
)
}
wxService
.
router
(
'/pages/confirmOrder/confirmOrder'
)
.
search
(
parmas
)
// 直接调支付
this
.
handleGoBuy
(
skuIds
)
//
this.handleGoBuy(skuIds)
},
handleGoBuy
(
parmas
)
{
// 下单
...
...
src/pages/confirmOrder/confirmOrder.js
View file @
264705b2
...
...
@@ -21,16 +21,35 @@ wxService.page({
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
let
skuIds
=
[]
skuIds
.
push
(
this
.
options
.
specId
)
// 计算优惠价
if
(
skuIds
){
this
.
calPreferentialPrice
(
skuIds
)}
let
trolleySku2Buy
=
this
.
options
.
trolleySku2Buy
console
.
log
(
'thtrolleySku2Bu'
,
JSON
.
parse
(
trolleySku2Buy
))
// 下单 && 计算优惠价
if
(
trolleySku2Buy
.
length
){
this
.
getBill
(
trolleySku2Buy
)
// 下单
// this.calPreferentialPrice(trolleySku2Buy) // 计算优惠价
}
},
calPreferentialPrice
(
skuIds
)
{
// 下单
getBill
(
trolleySku2Buy
)
{
wx
.
showLoading
({
title
:
'加载中'
})
wxService
.
post
(
`/sale/trade/buyer/bill`
,
trolleySku2Buy
).
then
(
res
=>
{
if
(
res
)
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
wx
.
hideLoading
()
console
.
log
(
'data'
,
data
)
}
}
})
},
// 计算优惠价
calPreferentialPrice
(
trolleySku2Buy
)
{
wx
.
showLoading
({
title
:
'加载中'
})
wxService
.
post
(
`/sale/trade/buyer/preview`
,
skuIds
).
then
(
res
=>
{
wxService
.
post
(
`/sale/trade/buyer/preview`
,
trolleySku2Buy
).
then
(
res
=>
{
if
(
res
)
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
...
...
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