Sanakey
2020-10-20 0da8db73585b015a7bbaf3500b77142d41b7c2ff
pages/cart/cart.js
@@ -461,6 +461,19 @@
  //   })
  // },
  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) {
@@ -475,7 +488,7 @@
    //       return;
    //   }
    // }
    wx.showLoading();
    // wx.showLoading();
  //   // 重新计算价格,判断库存
  //   var shopList = [];
  //   var cartInfo = wx.getStorageSync('cartData');
@@ -522,32 +535,35 @@
    // 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');
    //   }
    // })
    
  },