| | |
| | | // }) |
| | | // }, |
| | | |
| | | getSelectedCartIds(){ |
| | | console.log(this.data.goodsList.list); |
| | | let cartIdList = []; |
| | | this.data.goodsList.list.map((item)=>{ |
| | | if (item.isChecked) { |
| | | cartIdList.push(item.CartId); |
| | | } |
| | | }) |
| | | let allCartId = cartIdList.join(';'); |
| | | console.log(allCartId); |
| | | return allCartId; |
| | | }, |
| | | |
| | | // 提交订单 |
| | | toPayOrder: function (e) { |
| | | if (this.data.goodsList.noSelect) { |
| | |
| | | // return; |
| | | // } |
| | | // } |
| | | wx.showLoading(); |
| | | // wx.showLoading(); |
| | | // // 重新计算价格,判断库存 |
| | | // var shopList = []; |
| | | // var cartInfo = wx.getStorageSync('cartData'); |
| | |
| | | |
| | | // wx.hideLoading(); |
| | | |
| | | |
| | | wx.request({ |
| | | url: utils.getUrl('/shopping/confirm.do?m=isLogin'), |
| | | header: { |
| | | "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
| | | }, |
| | | success: res => { |
| | | wx.hideLoading(); |
| | | if(!utils.requestError(res)){ |
| | | return false; |
| | | } |
| | | if(res.data.isLogin){ |
| | | wx.navigateTo({ |
| | | url: '../order/order' |
| | | }) |
| | | } else { |
| | | wx.navigateTo({ |
| | | url: '../authorize/authorize?fromPage=cart' |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | fail: function (errmsg) { |
| | | utils.requestFail(errmsg,'/shopping/confirm.do'); |
| | | } |
| | | let allCartId = this.getSelectedCartIds(); |
| | | wx.navigateTo({ |
| | | url: '../order/order?selectedCartIds='+allCartId |
| | | }) |
| | | // wx.request({ |
| | | // url: utils.getUrl('/shopping/confirm.do?m=isLogin'), |
| | | // header: { |
| | | // "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
| | | // }, |
| | | // success: res => { |
| | | // wx.hideLoading(); |
| | | // if(!utils.requestError(res)){ |
| | | // return false; |
| | | // } |
| | | // if(res.data.isLogin){ |
| | | // wx.navigateTo({ |
| | | // url: '../order/order?selectedCartIds='+allCartId |
| | | // }) |
| | | // } else { |
| | | // wx.navigateTo({ |
| | | // url: '../authorize/authorize?fromPage=cart' |
| | | // }) |
| | | // } |
| | | |
| | | // }, |
| | | // fail: function (errmsg) { |
| | | // utils.requestFail(errmsg,'/shopping/confirm.do'); |
| | | // } |
| | | // }) |
| | | |
| | | }, |
| | | |