Commit 69ddb7ad by 高淑倩

add: cart

parent 36fb13c9
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment