Commit 5ed417589ff783cc95a0134e5b379fef86fb332b
1 parent
1a5487de
取价方式的优化
Showing
2 changed files
with
125 additions
and
86 deletions
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -6811,7 +6811,19 @@ Page({ |
6811 | 6811 | if (fid > -1) return false; |
6812 | 6812 | } |
6813 | 6813 | |
6814 | - ob.price += item.goods_price * item.goods_num; | |
6814 | + //优惠促销取价的优化 | |
6815 | + let f_price=item.goods_price; | |
6816 | + if(ob.discount_field!=undefined){ | |
6817 | + switch (ob.discount_field){ | |
6818 | + case 0: f_price=item.goods_price;break; | |
6819 | + case 1: f_price=item.shop_price;break; | |
6820 | + case 2: f_price=item.market_price;break; | |
6821 | + } | |
6822 | + } | |
6823 | + | |
6824 | + item.goods_price=f_price; | |
6825 | + | |
6826 | + ob.price += f_price * item.goods_num; | |
6815 | 6827 | ob.goods_num += item.goods_num; |
6816 | 6828 | ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); |
6817 | 6829 | |
... | ... | @@ -6858,10 +6870,12 @@ Page({ |
6858 | 6870 | switch (prom.discount_field){ |
6859 | 6871 | case 0: f_price=item.goods_price;break; |
6860 | 6872 | case 1: f_price=item.shop_price;break; |
6861 | - case 2: f_price=item.market_price;break; | |
6873 | + case 2: f_price=item.goods_market_price;break; | |
6862 | 6874 | } |
6863 | 6875 | } |
6864 | 6876 | |
6877 | + item.goods_price=f_price; | |
6878 | + | |
6865 | 6879 | ob.price = f_price * item.goods_num; |
6866 | 6880 | ob.goods_num = item.goods_num; |
6867 | 6881 | ob.is_bz = prom.is_bz; |
... | ... | @@ -6869,6 +6883,7 @@ Page({ |
6869 | 6883 | ob.is_xz_yh = prom.is_xz_yh; |
6870 | 6884 | ob.is_order_yh = prom.is_order_yh; |
6871 | 6885 | ob.is_post_temp = prom.is_post_temp; |
6886 | + ob.discount_field = prom.discount_field; | |
6872 | 6887 | ob.goods = new Array(); |
6873 | 6888 | ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); |
6874 | 6889 | map[pickid][item.prom_id] = ob; |
... | ... | @@ -6911,14 +6926,17 @@ Page({ |
6911 | 6926 | |
6912 | 6927 | //优惠促销取价的优化 |
6913 | 6928 | let f_price=item.goods_price; |
6929 | + | |
6914 | 6930 | if(prom.discount_field!=undefined){ |
6915 | 6931 | switch (prom.discount_field){ |
6916 | 6932 | case 0: f_price=item.goods_price;break; |
6917 | 6933 | case 1: f_price=item.shop_price;break; |
6918 | - case 2: f_price=item.market_price;break; | |
6934 | + case 2: f_price=item.goods_market_price;break; | |
6919 | 6935 | } |
6920 | 6936 | } |
6921 | 6937 | |
6938 | + item.goods_price=f_price; | |
6939 | + | |
6922 | 6940 | ob.prom_id = item.prom_id; |
6923 | 6941 | ob.name = prom.name; |
6924 | 6942 | ob.price = f_price * item.goods_num; |
... | ... | @@ -6927,6 +6945,7 @@ Page({ |
6927 | 6945 | ob.is_xz_yh = prom.is_xz_yh; |
6928 | 6946 | ob.is_order_yh = prom.is_order_yh; |
6929 | 6947 | ob.is_post_temp = prom.is_post_temp; |
6948 | + ob.discount_field = prom.discount_field; | |
6930 | 6949 | ob.goods = new Array(); |
6931 | 6950 | ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); |
6932 | 6951 | var obj = {}; |
... | ... | @@ -8320,6 +8339,11 @@ Page({ |
8320 | 8339 | } |
8321 | 8340 | } |
8322 | 8341 | func({'code': 0, 'msg': '成功'}) |
8342 | + }, | |
8343 | + | |
8344 | + //--- 不参与优惠促销的开关 --- | |
8345 | + no_cj_prom:function (e){ | |
8346 | + let can_cx_idx=e.currentTarget.dataset.can_cx_idx; | |
8323 | 8347 | } |
8324 | 8348 | |
8325 | 8349 | ... | ... |
packageE/pages/cart/cart2/cart2.wxml
... | ... | @@ -118,57 +118,65 @@ |
118 | 118 | |
119 | 119 | <!-- 验证活动是不是多个,要不要显示切换 --> |
120 | 120 | <!-- 新增促销多活动的排版,单商品的时候 --> |
121 | - <block wx:if="{{(util.is_more_act(items,item.show_can_cx) && item.show_can_cx[items.goods_id] && item.show_can_cx[items.goods_id].act_arr.length>1)}}"> | |
122 | - | |
123 | - | |
124 | - <!-- 组合购和阶梯促销要特殊出来 --> | |
125 | - <block wx:if="{{item.show_can_cx[items.goods_id].sele_prom_type==7 || item.show_can_cx[items.goods_id].sele_prom_type==10 }}"> | |
126 | - | |
127 | - <!-- 是不是活动的最后一个商品 --> | |
128 | - <view class="bdb16" wx:if="{{items.is_act_last}}" > | |
129 | - <view bindtap="switch_cx_group" | |
130 | - data-index="{{pidx}}" | |
131 | - data-gd_key="{{items.goods_id}}" | |
132 | - class="cx-frame flex" style="position: relative"> | |
133 | - <view class="cx-sizs fs30">促销</view> | |
134 | - <view class="flex ai_c f1 pdh20"> | |
135 | - <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > | |
136 | - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
137 | - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
138 | - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
139 | - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
121 | + <block wx:if="{{(util.is_more_act(items,item.show_can_cx) && item.show_can_cx[items.goods_id])}}"> | |
122 | + | |
123 | + | |
124 | + <!-- 多个活动的时候 --> | |
125 | + <block wx:if="{{item.show_can_cx[items.goods_id].act_arr.length>1}}"> | |
126 | + <!-- 组合购和阶梯促销要特殊出来 --> | |
127 | + <block wx:if="{{item.show_can_cx[items.goods_id].sele_prom_type==7 || item.show_can_cx[items.goods_id].sele_prom_type==10 }}"> | |
128 | + | |
129 | + <!-- 是不是活动的最后一个商品 --> | |
130 | + <view class="bdb16" wx:if="{{items.is_act_last}}" > | |
131 | + <view bindtap="switch_cx_group" | |
132 | + data-index="{{pidx}}" | |
133 | + data-gd_key="{{items.goods_id}}" | |
134 | + class="cx-frame flex" style="position: relative"> | |
135 | + <view class="cx-sizs fs30">促销</view> | |
136 | + <view class="flex ai_c f1 pdh20"> | |
137 | + <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > | |
138 | + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
139 | + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
140 | + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
141 | + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
142 | + </view> | |
143 | + </view> | |
144 | + <view class="cx-obtain-coupon wsize"> | |
145 | + <text class="bg_jj"></text> | |
146 | + </view> | |
140 | 147 | </view> |
141 | 148 | </view> |
142 | - <view class="cx-obtain-coupon wsize"> | |
143 | - <text class="bg_jj"></text> | |
144 | - </view> | |
145 | - </view> | |
146 | - </view> | |
147 | 149 | |
148 | - </block> | |
149 | - <block wx:else> | |
150 | - <view class="bdb16"> | |
151 | - <view bindtap="switch_cx_group" | |
152 | - data-index="{{pidx}}" | |
153 | - data-gd_key="{{items.goods_id}}" | |
154 | - class="cx-frame flex" style="position: relative"> | |
155 | - <view class="cx-sizs fs30">促销</view> | |
156 | - <view class="flex ai_c f1 pdh20"> | |
157 | - <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > | |
158 | - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
159 | - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
160 | - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
161 | - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
150 | + </block> | |
151 | + <block wx:else> | |
152 | + <view class="bdb16"> | |
153 | + <view bindtap="switch_cx_group" | |
154 | + data-index="{{pidx}}" | |
155 | + data-gd_key="{{items.goods_id}}" | |
156 | + class="cx-frame flex" style="position: relative"> | |
157 | + <view class="cx-sizs fs30">促销</view> | |
158 | + <view class="flex ai_c f1 pdh20"> | |
159 | + <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > | |
160 | + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
161 | + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
162 | + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
163 | + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
164 | + </view> | |
165 | + </view> | |
166 | + <view class="cx-obtain-coupon wsize"> | |
167 | + <text class="bg_jj"></text> | |
168 | + </view> | |
162 | 169 | </view> |
163 | 170 | </view> |
164 | - <view class="cx-obtain-coupon wsize"> | |
165 | - <text class="bg_jj"></text> | |
166 | - </view> | |
167 | - </view> | |
168 | - </view> | |
171 | + </block> | |
169 | 172 | </block> |
170 | 173 | |
171 | - | |
174 | + <view class="set-mes" wx:if="{{items.prom_type==3 || items.cj_prom_type==3}}"> | |
175 | + <view class="use-item" data-pidx="{{pidx}}" data-can_cx_idx="{{items.goods_id}}" bindtap='no_cj_prom'> | |
176 | + <icon color="{{!item.show_can_cx[items.goods_id].no_cj_prom?'red':'gray'}}" size="16" type="success"></icon> | |
177 | + <view class="yu_er">参与优惠活动</view> | |
178 | + </view> | |
179 | + </view> | |
172 | 180 | |
173 | 181 | </block> |
174 | 182 | |
... | ... | @@ -177,54 +185,61 @@ |
177 | 185 | <block wx:if="{{item.show_can_cx}}"> |
178 | 186 | <block wx:for="{{item.show_can_cx}}" wx:for-item="pitem"> |
179 | 187 | |
180 | - <!-- 组合购和阶梯促销要特殊出来 --> | |
181 | - <block wx:if="{{ pitem.sele_prom_type==7 || pitem.sele_prom_type==10 }}"> | |
182 | - <!-- 是不是活动的最后一个商品 --> | |
183 | - <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && items.is_act_last}}" > | |
184 | - | |
185 | - <view bindtap="switch_cx_group" | |
186 | - data-index="{{pidx}}" | |
187 | - data-gd_key="{{index}}" | |
188 | - class="cx-frame flex" style="position: relative"> | |
189 | - <view class="cx-sizs fs30">促销</view> | |
190 | - <view class="flex ai_c f1 pdh20"> | |
191 | - <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" > | |
192 | - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
193 | - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
194 | - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
195 | - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
188 | + <!-- 组合购和阶梯促销要特殊出来 --> | |
189 | + <block wx:if="{{ pitem.sele_prom_type==7 || pitem.sele_prom_type==10 }}"> | |
190 | + <!-- 是不是活动的最后一个商品 --> | |
191 | + <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && items.is_act_last}}" > | |
192 | + | |
193 | + <view bindtap="switch_cx_group" | |
194 | + data-index="{{pidx}}" | |
195 | + data-gd_key="{{index}}" | |
196 | + class="cx-frame flex" style="position: relative"> | |
197 | + <view class="cx-sizs fs30">促销</view> | |
198 | + <view class="flex ai_c f1 pdh20"> | |
199 | + <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" > | |
200 | + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
201 | + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
202 | + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
203 | + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
204 | + </view> | |
205 | + </view> | |
206 | + <view class="cx-obtain-coupon wsize"> | |
207 | + <text class="bg_jj"></text> | |
196 | 208 | </view> |
197 | - </view> | |
198 | - <view class="cx-obtain-coupon wsize"> | |
199 | - <text class="bg_jj"></text> | |
200 | 209 | </view> |
201 | 210 | </view> |
202 | - </view> | |
203 | - </block> | |
204 | - <block wx:else> | |
205 | - <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && util.check_is_last(index,items.goods_id) }}" > | |
206 | - <view bindtap="switch_cx_group" | |
207 | - data-index="{{pidx}}" | |
208 | - data-gd_key="{{index}}" | |
209 | - class="cx-frame flex" style="position: relative"> | |
210 | - <view class="cx-sizs fs30">促销</view> | |
211 | - <view class="flex ai_c f1 pdh20"> | |
212 | - <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" > | |
213 | - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
214 | - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
215 | - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
216 | - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
211 | + </block> | |
212 | + <block wx:else> | |
213 | + <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && util.check_is_last(index,items.goods_id) }}" > | |
214 | + <view bindtap="switch_cx_group" | |
215 | + data-index="{{pidx}}" | |
216 | + data-gd_key="{{index}}" | |
217 | + class="cx-frame flex" style="position: relative"> | |
218 | + <view class="cx-sizs fs30">促销</view> | |
219 | + <view class="flex ai_c f1 pdh20"> | |
220 | + <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" > | |
221 | + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
222 | + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
223 | + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
224 | + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
225 | + </view> | |
226 | + </view> | |
227 | + <view class="cx-obtain-coupon wsize"> | |
228 | + <text class="bg_jj"></text> | |
217 | 229 | </view> |
218 | - </view> | |
219 | - <view class="cx-obtain-coupon wsize"> | |
220 | - <text class="bg_jj"></text> | |
221 | 230 | </view> |
222 | 231 | </view> |
232 | + </block> | |
233 | + | |
234 | + <view class="set-mes" wx:if="{{(items.prom_type==3 || items.cj_prom_type==3) && util.check_is_last(index,items.goods_id) && pitem.is_duo_gd }}"> | |
235 | + <view class="use-item" data-pidx="{{pidx}}" data-can_cx_idx="{{index}}" bindtap='no_cj_prom'> | |
236 | + <icon color="{{!item.show_can_cx[items.goods_id].no_cj_prom?'red':'gray'}}" size="16" type="success"></icon> | |
237 | + <view class="yu_er">参与优惠活动</view> | |
238 | + </view> | |
223 | 239 | </view> |
224 | - </block> | |
225 | 240 | |
226 | 241 | </block> |
227 | - </block> | |
242 | + </block> | |
228 | 243 | |
229 | 244 | </block> |
230 | 245 | ... | ... |