Commit 777b3033125d53d0cf314ac5acc9b46b8e64ae72

Authored by yvan.ni
1 parent 36f75443

购物车中赠品的图片没有的情况下的bug优化

pages/cart/cart/cart.js
@@ -5841,5 +5841,17 @@ Page({ @@ -5841,5 +5841,17 @@ Page({
5841 }, 5841 },
5842 5842
5843 5843
  5844 + //-- 图片失败,默认图片,赠品图片的处理 --
  5845 + bind_bnerr_gift: function (e) {
  5846 + var pid = e.target.dataset.pid;
  5847 + var idxx = e.target.dataset.idxx;
  5848 + var cart_zp=this.data.cart_zp;
  5849 + cart_zp[pid].goods[idxx].original_img= oo.imghost + "/miniapp/images/default_g_img.png";
  5850 + this.setData({
  5851 + cart_zp
  5852 + })
  5853 + },
  5854 +
  5855 +
5844 5856
5845 }); 5857 });
5846 \ No newline at end of file 5858 \ No newline at end of file
pages/cart/cart/cart.wxml
@@ -161,23 +161,23 @@ @@ -161,23 +161,23 @@
161 161
162 <!-- 判断有没有赠品2024-2-1 --> 162 <!-- 判断有没有赠品2024-2-1 -->
163 <block wx:if="{{cart_zp[item.pid] && cart_zp[item.pid].goods.length>0 }}"> 163 <block wx:if="{{cart_zp[item.pid] && cart_zp[item.pid].goods.length>0 }}">
164 - <block wx:for="{{cart_zp[item.pid].goods}}" wx:for-item="items" wx:for-index="idx" wx:key="{{idx}}">  
165 - <view class="order-item" data-item="{{idx}}"> 164 + <block wx:for="{{cart_zp[item.pid].goods}}" wx:for-item="itemss" wx:for-index="idxx" wx:key="{{idxx}}">
  165 + <view class="order-item" data-item="{{idxx}}">
166 <view class="order-raido flex-vertical " style="width: 45rpx"></view> 166 <view class="order-raido flex-vertical " style="width: 45rpx"></view>
167 - <navigator class="goods-img rel" bindtap="go_gd" data-item="{{items}}" data-gd="{{items.goods_id}}">  
168 - <image class="wh100" src="{{items.original_img}}" binderror="bind_bnerr2" data-errorimg="requestData[{{pidx}}].goods[{{idx}}].original_img" data-url="{{items.original_img}}"></image>  
169 - <view style="background-color:red" class="abs flex-center fs26" wx:if="{{items.is_gift==1}}">赠品</view> 167 + <navigator class="goods-img rel" bindtap="go_gd" data-item="{{itemss}}" data-gd="{{itemss.goods_id}}">
  168 + <image class="wh100" src="{{itemss.original_img}}" binderror="bind_bnerr_gift" data-pid="{{item.pid}}" data-idxx="{{idxx}}" data-url="{{itemss.original_img}}"></image>
  169 + <view style="background-color:red" class="abs flex-center fs26">赠品</view>
170 </navigator> 170 </navigator>
171 <view class="goods-cont"> 171 <view class="goods-cont">
172 <view class="goods-name"> 172 <view class="goods-name">
173 - <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-item="{{items}}" data-gd="{{items.goods_id}}">{{items.goods_name}}</navigator> 173 + <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-item="{{itemss}}" data-gd="{{itemss.goods_id}}">{{itemss.goods_name}}</navigator>
174 174
175 <view class="specifications ellipsis-1"> 175 <view class="specifications ellipsis-1">
176 - <view wx:if="{{items.goods_color || items.goods_spec}}">  
177 - {{items.goods_color}}{{items.goods_color?"/":''}}{{items.goods_spec}}</view> 176 + <view wx:if="{{itemss.goods_color || itemss.goods_spec}}">
  177 + {{itemss.goods_color}}{{itemss.goods_color?"/":''}}{{itemss.goods_spec}}</view>
178 <view wx:else>规格1</view> 178 <view wx:else>规格1</view>
179 </view> 179 </view>
180 - <view>{{items.goods_num}}件</view> 180 + <view>{{itemss.goods_num}}件</view>
181 </view> 181 </view>
182 </view> 182 </view>
183 </view> 183 </view>