|
@@ -134,6 +134,8 @@ Page({
|
|
|
cartNum: 0,//footer购物车显示的数量
|
|
|
minNumber: 0,//购买数量
|
|
|
commodityChannelPrice:null, //渠道价格
|
|
|
+ channelName:null,
|
|
|
+ _carTotal:null,// 购物车全部数量
|
|
|
|
|
|
},
|
|
|
|
|
@@ -873,6 +875,10 @@ Page({
|
|
|
|
|
|
}
|
|
|
})
|
|
|
+ that.getCarNum(that)
|
|
|
+ that.setData({
|
|
|
+ channelName: wx.getStorageSync('channelName')
|
|
|
+ })
|
|
|
that.loadFun();
|
|
|
if (wx.getStorageSync('channelIdObj').channelId) {
|
|
|
that.setData({
|
|
@@ -880,8 +886,35 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
+ // 获取购物车数量
|
|
|
+ getCarNum(that){
|
|
|
+ console.log("开始执行")
|
|
|
+ let un_id = getApp().globalData.un_id,
|
|
|
+ host = getApp().globalData.servsers,
|
|
|
+ data = {
|
|
|
+ user_id: un_id,
|
|
|
+ channel_account_id: wx.getStorageSync('channelIdObj').channelAccountId ? wx.getStorageSync('channelIdObj').channelAccountId : "",
|
|
|
+ channel_id: wx.getStorageSync('channelIdObj').channelId ? wx.getStorageSync('channelIdObj').channelId : ""
|
|
|
+ }
|
|
|
+ wx.request({
|
|
|
+ url: host + "/shoppingcartapi/shoppingcartview",
|
|
|
+ data: data,
|
|
|
+ method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
|
|
|
+ header: {
|
|
|
+ 'Accept': 'application/json'
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ if (res == null || res.data == null) {
|
|
|
+ console.error('网络请求失败');
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ _carTotal: res.data.total
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//获得对象的key
|
|
|
getObjKeys: function (obj) {
|
|
|
var that = this;
|
|
@@ -2225,6 +2258,8 @@ Page({
|
|
|
if (res == null || res.data == null) {
|
|
|
console.error('网络请求失败');
|
|
|
return;
|
|
|
+ } else {
|
|
|
+ that.getCarNum(that)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -2525,6 +2560,7 @@ Page({
|
|
|
animationDataSer: animation.export()
|
|
|
})
|
|
|
}.bind(this), 200)
|
|
|
+
|
|
|
|
|
|
},
|
|
|
|