Commit 7d8de8cecfa5dcab766d87f675352a4abba612c0

Authored by yvan.ni
1 parent 53bd290d

商品活动已经过期,有又用商品做新的优惠活动,此时购物车的bug产生

Showing 1 changed file with 12 additions and 3 deletions
pages/cart/cart/cart.js
@@ -267,13 +267,22 @@ Page({ @@ -267,13 +267,22 @@ Page({
267 var isok = 1; 267 var isok = 1;
268 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { 268 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => {
269 if (res.data.code == 0) { 269 if (res.data.code == 0) {
270 - var r_data = res.data.data; 270 + var r_data = res.data.data;
271 if (!r_data.promGoodsLists) { 271 if (!r_data.promGoodsLists) {
272 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 272 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
273 getApp().request.delete(url, {}); 273 getApp().request.delete(url, {});
274 - //商品已经下架 274 + //商品已经无活动
275 isok = 0; 275 isok = 0;
276 - } 276 + }else{
  277 + //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
  278 + if(item.prom_id!=r_data.promGoodsLists[0].prom_id ){
  279 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  280 + getApp().request.delete(url, {});
  281 + //商品已经下架
  282 + isok = 0;
  283 + }
  284 + }
  285 +
277 } else { 286 } else {
278 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 287 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
279 getApp().request.delete(url, {}); 288 getApp().request.delete(url, {});