From cc28ed88565fcd44db56c918584d425e490f7951 Mon Sep 17 00:00:00 2001 From: banche Date: Sat, 19 Mar 2022 15:12:09 +0800 Subject: [PATCH] fix服务卡购物车单条结算问题 --- pages/cart/cart/cart.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 4a13223..3556c82 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -69,6 +69,8 @@ Page({ //每次显示都清空 this.data.in_zhact_gdmap = {}; + this.data.service_data = {}; + if (typeof this.getTabBar === 'function' && this.getTabBar()) { var index = getApp().getPageIndex(this); this.getTabBar().setData({ @@ -1533,7 +1535,8 @@ Page({ var e = this, item = t.currentTarget.dataset.item, pitems = t.currentTarget.dataset.pitems; - a = this.data.service_data[pitems].goods[item]; + a = this.data.service_data[pitems].goods[item]; // 选中的商品 + var isok = 1, fir = 0; var iarr = e.data.service_data[pitems].goods; @@ -1565,6 +1568,7 @@ Page({ e.setData({ [txt]: Number(!a.selected), }); + this.doCheckAll(); }, @@ -2619,15 +2623,13 @@ Page({ for (var i = 0; i < this.data.service_data.length; i++) { var i_arr = this.data.service_data[i].goods; for (var j = 0; j < i_arr.length; j++) { - if (i_arr[j].selected) { - await rq.promisePut("/api/weshop/cartService/update", { - data: { - id: i_arr[j].id, - selected: 1, - store_id: oo.stoid - } - }); - } + await rq.promisePut("/api/weshop/cartService/update", { + data: { + id: i_arr[j].id, + selected: i_arr[j].selected, + store_id: oo.stoid + } + }); } } wx.hideLoading(); -- libgit2 0.21.4