|
@@ -201,11 +201,16 @@ Page({
|
|
|
},
|
|
|
checkedItem: function(event) {
|
|
|
let itemIndex = event.target.dataset.itemIndex;
|
|
|
+ let goodsBizType = event.target.dataset.goodsBizType;
|
|
|
+ let goodsId = event.target.dataset.goodsId;
|
|
|
+ let checked = event.target.dataset.checked;
|
|
|
let that = this;
|
|
|
-
|
|
|
+ // console.log(goodsBizType);
|
|
|
+ // console.log(goodsId);
|
|
|
+ // console.log(that.data.cartGoods[itemIndex].checked);
|
|
|
util.request(api.CartChecked, {
|
|
|
- productIds: that.data.cartGoods[itemIndex].product_id,
|
|
|
- isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1,
|
|
|
+ goodsIds: goodsId,
|
|
|
+ isChecked: checked ? 0 : 1,
|
|
|
checkCart: that.data.checkCart
|
|
|
}, 'POST').then(function(res) {
|
|
|
if (res.errno === 0) {
|
|
@@ -222,16 +227,15 @@ Page({
|
|
|
checkedGoodsCount += v.number;
|
|
|
}
|
|
|
});
|
|
|
- console.log(checkedGoodsCount);
|
|
|
return checkedGoodsCount;
|
|
|
},
|
|
|
checkedAll: function() {
|
|
|
let that = this;
|
|
|
- var productIds = this.data.cartGoods.map(function(v) {
|
|
|
- return v.product_id;
|
|
|
+ var goodsIds = this.data.cartGoods.map(function(v) {
|
|
|
+ return v.goodsIds;
|
|
|
});
|
|
|
util.request(api.CartChecked, {
|
|
|
- productIds: productIds.join(','),
|
|
|
+ goodsIds: goodsIds.join(','),
|
|
|
isChecked: that.isCheckedAll() ? 0 : 1
|
|
|
}, 'POST').then(function(res) {
|
|
|
if (res.errno === 0) {
|
|
@@ -244,26 +248,52 @@ Page({
|
|
|
let that = this;
|
|
|
let goodsBizType = e.target.dataset.goodsBizType;
|
|
|
let isCheckedTypeStatu;
|
|
|
+ let checkCart;
|
|
|
if (goodsBizType == '00') {
|
|
|
isCheckedTypeStatu = that.isCheckedTypeStatus00();
|
|
|
+ checkCart = '00';
|
|
|
}
|
|
|
if (goodsBizType == '02') {
|
|
|
isCheckedTypeStatu = that.isCheckedTypeStatus02();
|
|
|
+ checkCart = '00';
|
|
|
}
|
|
|
if (goodsBizType == '10') {
|
|
|
isCheckedTypeStatu = that.isCheckedTypeStatus10();
|
|
|
+ checkCart = '00';
|
|
|
}
|
|
|
if (goodsBizType == '11') {
|
|
|
isCheckedTypeStatu = that.isCheckedTypeStatus11();
|
|
|
+ checkCart = '11';
|
|
|
}
|
|
|
util.request(api.CartChecked, {
|
|
|
isChecked: isCheckedTypeStatu ? 0 : 1,
|
|
|
- goodsBizType: goodsBizType
|
|
|
+ goodsBizType: goodsBizType,
|
|
|
+ checkCart: checkCart
|
|
|
}, 'POST').then(function(res) {
|
|
|
if (res.errno === 0) {
|
|
|
- that.setCommonData(res);
|
|
|
+ // that.setCommonData(res);
|
|
|
+ that.setData({
|
|
|
+ validCartList: res.data.validCartList,
|
|
|
+ couponInfoList: res.data.couponInfoList,
|
|
|
+ });
|
|
|
+ if (goodsBizType == '11') {
|
|
|
+ that.setData({
|
|
|
+ cartGoods: res.data.cartList,
|
|
|
+ cartTotal: res.data.cartTotal,
|
|
|
+ cartGoods11: res.data.cart11List,
|
|
|
+ total11: res.data.total11
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ cartGoods: res.data.cartList,
|
|
|
+ cartTotal: res.data.cartTotal,
|
|
|
+ cartGoods00: res.data.cart00List,
|
|
|
+ cartGoods02: res.data.cart02List,
|
|
|
+ cartGoods10: res.data.cart10List,
|
|
|
+ total00: res.data.total00
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
if (goodsBizType == '00') {
|
|
|
that.setData({
|
|
|
checkedTypeStatus00: that.isCheckedTypeStatus00()
|