Commit 9bad401f34bea4d5a65f4d0384680e85555ef878

Authored by yvan.ni
1 parent 635754ab

如果商品不存在,就要清理掉

Showing 1 changed file with 9 additions and 0 deletions
pages/cart/cart/cart.js
... ... @@ -159,6 +159,15 @@ Page({
159 159 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + item.goods_id, {}).then(res => {
160 160 good = res.data.data;
161 161 })
  162 + if(!good){
  163 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
  164 + getApp().request.delete(url, {
  165 + success: function (t) {
  166 + }
  167 + });
  168 + continue;
  169 + }
  170 +
162 171 var tt = ut.gettimestamp();
163 172 //如果商品下架了,或者商品是赠品,一开始都要清除
164 173 if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0 || item.is_gift) {
... ...