Commit 264705b2 by 赵雅纹

Merge branch 'dev_7.1.0' into feature-zyw-sc

parents c0ff0dc5 67347fe4
......@@ -56,7 +56,7 @@ wxService.page({
const trolleySku = {
count: 1,
skuId: '1556108807316001'
skuId: '1556108807316000'
}
// 加入购物车
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) {
// 下单
......
......@@ -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) {
......
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