Commit cc28ed88565fcd44db56c918584d425e490f7951

Authored by 泉州测试
1 parent 9c32a022

fix服务卡购物车单条结算问题

Showing 1 changed file with 12 additions and 10 deletions
pages/cart/cart/cart.js
... ... @@ -69,6 +69,8 @@ Page({
69 69 //每次显示都清空
70 70 this.data.in_zhact_gdmap = {};
71 71  
  72 + this.data.service_data = {};
  73 +
72 74 if (typeof this.getTabBar === 'function' && this.getTabBar()) {
73 75 var index = getApp().getPageIndex(this);
74 76 this.getTabBar().setData({
... ... @@ -1533,7 +1535,8 @@ Page({
1533 1535 var e = this,
1534 1536 item = t.currentTarget.dataset.item,
1535 1537 pitems = t.currentTarget.dataset.pitems;
1536   - a = this.data.service_data[pitems].goods[item];
  1538 + a = this.data.service_data[pitems].goods[item]; // 选中的商品
  1539 +
1537 1540 var isok = 1,
1538 1541 fir = 0;
1539 1542 var iarr = e.data.service_data[pitems].goods;
... ... @@ -1565,6 +1568,7 @@ Page({
1565 1568 e.setData({
1566 1569 [txt]: Number(!a.selected),
1567 1570 });
  1571 +
1568 1572 this.doCheckAll();
1569 1573 },
1570 1574  
... ... @@ -2619,15 +2623,13 @@ Page({
2619 2623 for (var i = 0; i < this.data.service_data.length; i++) {
2620 2624 var i_arr = this.data.service_data[i].goods;
2621 2625 for (var j = 0; j < i_arr.length; j++) {
2622   - if (i_arr[j].selected) {
2623   - await rq.promisePut("/api/weshop/cartService/update", {
2624   - data: {
2625   - id: i_arr[j].id,
2626   - selected: 1,
2627   - store_id: oo.stoid
2628   - }
2629   - });
2630   - }
  2626 + await rq.promisePut("/api/weshop/cartService/update", {
  2627 + data: {
  2628 + id: i_arr[j].id,
  2629 + selected: i_arr[j].selected,
  2630 + store_id: oo.stoid
  2631 + }
  2632 + });
2631 2633 }
2632 2634 }
2633 2635 wx.hideLoading();
... ...