Commit 21f10250c5164dbad7755097f4d62b98d50ff142
1 parent
2946048f
商品详情页面点击跳转
Showing
4 changed files
with
68 additions
and
30 deletions
packageE/pages/cart/cart2/cart2.wxml
... | ... | @@ -119,26 +119,55 @@ |
119 | 119 | <!-- 验证活动是不是多个,要不要显示切换 --> |
120 | 120 | <!-- 新增促销多活动的排版,单商品的时候 --> |
121 | 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 | - <view class="bdb16" wx:if="{{util.check_show(items,item.show_can_cx[items.goods_id].cur_act.prom_type)}}"> | |
123 | - | |
124 | - <view bindtap="switch_cx_group" | |
125 | - data-index="{{pidx}}" | |
126 | - data-gd_key="{{items.goods_id}}" | |
127 | - class="cx-frame flex" style="position: relative"> | |
128 | - <view class="cx-sizs fs30">促销</view> | |
129 | - <view class="flex ai_c f1 pdh20"> | |
130 | - <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > | |
131 | - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
132 | - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
133 | - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
134 | - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
122 | + | |
123 | + <!-- 组合购和阶梯促销要特殊出来 --> | |
124 | + <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 }}"> | |
125 | + <!-- 是不是活动的最后一个商品 --> | |
126 | + <view class="bdb16" wx:if="{{items.is_act_last}}" > | |
127 | + <view bindtap="switch_cx_group" | |
128 | + data-index="{{pidx}}" | |
129 | + data-gd_key="{{items.goods_id}}" | |
130 | + class="cx-frame flex" style="position: relative"> | |
131 | + <view class="cx-sizs fs30">促销</view> | |
132 | + <view class="flex ai_c f1 pdh20"> | |
133 | + <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > | |
134 | + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
135 | + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
136 | + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
137 | + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
138 | + </view> | |
139 | + </view> | |
140 | + <view class="cx-obtain-coupon wsize"> | |
141 | + <text class="bg_jj"></text> | |
135 | 142 | </view> |
136 | 143 | </view> |
137 | - <view class="cx-obtain-coupon wsize"> | |
138 | - <text class="bg_jj"></text> | |
144 | + </view> | |
145 | + | |
146 | + </block> | |
147 | + <block wx:else> | |
148 | + <view class="bdb16"> | |
149 | + <view bindtap="switch_cx_group" | |
150 | + data-index="{{pidx}}" | |
151 | + data-gd_key="{{items.goods_id}}" | |
152 | + class="cx-frame flex" style="position: relative"> | |
153 | + <view class="cx-sizs fs30">促销</view> | |
154 | + <view class="flex ai_c f1 pdh20"> | |
155 | + <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > | |
156 | + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view> | |
157 | + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view> | |
158 | + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view> | |
159 | + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view> | |
160 | + </view> | |
161 | + </view> | |
162 | + <view class="cx-obtain-coupon wsize"> | |
163 | + <text class="bg_jj"></text> | |
164 | + </view> | |
139 | 165 | </view> |
140 | 166 | </view> |
141 | - </view> | |
167 | + </block> | |
168 | + | |
169 | + | |
170 | + | |
142 | 171 | </block> |
143 | 172 | |
144 | 173 | <!--此时是多个商品参与活动的切换 验证活动是不是多个,要不要显示切换,同时要最后一个商品显示 --> |
... | ... | @@ -146,9 +175,9 @@ |
146 | 175 | <block wx:if="{{item.show_can_cx}}"> |
147 | 176 | <block wx:for="{{item.show_can_cx}}" wx:for-item="pitem"> |
148 | 177 | |
178 | + <!-- 组合购和阶梯促销要特殊出来 --> | |
149 | 179 | <block wx:if="{{ pitem.sele_prom_type==7 || pitem.sele_prom_type==10 }}"> |
150 | - | |
151 | - | |
180 | + <!-- 是不是活动的最后一个商品 --> | |
152 | 181 | <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && items.is_act_last}}" > |
153 | 182 | |
154 | 183 | <view bindtap="switch_cx_group" |
... | ... | @@ -171,7 +200,7 @@ |
171 | 200 | </view> |
172 | 201 | </block> |
173 | 202 | <block wx:else> |
174 | - <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && util.check_is_last(index,items.goods_id,items.is_act_last) }}" > | |
203 | + <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && util.check_is_last(index,items.goods_id) }}" > | |
175 | 204 | <view bindtap="switch_cx_group" |
176 | 205 | data-index="{{pidx}}" |
177 | 206 | data-gd_key="{{index}}" | ... | ... |
packageE/pages/cart/cart2/filter.wxs
... | ... | @@ -26,7 +26,7 @@ function check_show(items,sele_prom_type){ |
26 | 26 | //index多活动的索引 |
27 | 27 | //is_act_last 是不是最后一个 |
28 | 28 | |
29 | -function check_is_last(index,goods_id,is_act_last){ | |
29 | +function check_is_last(index,goods_id){ | |
30 | 30 | var gd_arr=index.split(','); |
31 | 31 | var idx=-1; |
32 | 32 | //-- 判断有没有包含商品 -- | ... | ... |
packageE/pages/cart/cart2/ladder_calculate.js
... | ... | @@ -101,6 +101,9 @@ module.exports = { |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | + | |
105 | + //-- 暂存的数组 -- | |
106 | + var temp_arr=[]; | |
104 | 107 | if (Object.keys(goods_map).length) { |
105 | 108 | //这里就开始拆分提交订单时的列表 |
106 | 109 | for (let j in goods_map) { |
... | ... | @@ -116,8 +119,8 @@ module.exports = { |
116 | 119 | new_g.prom_type = 0; |
117 | 120 | new_g.prom_id = 0; |
118 | 121 | new_g.is_ld_split=1; |
119 | - goods.push(new_g); | |
120 | - //goods.splice(idx, 1); | |
122 | + temp_arr.push(new_g); | |
123 | + | |
121 | 124 | } |
122 | 125 | } |
123 | 126 | |
... | ... | @@ -130,20 +133,28 @@ module.exports = { |
130 | 133 | goods.splice(idx, 1); |
131 | 134 | } |
132 | 135 | |
133 | - | |
134 | - | |
136 | + var ls=-1; | |
135 | 137 | //-- 只统计是参与活动的商品 -- |
136 | 138 | for (var ij in goods) { |
137 | - goods[ij].is_act_last=0; | |
138 | - | |
139 | 139 | var iter = goods[ij]; |
140 | 140 | if (iter.prom_type != 10 || iter.prom_id != act_item.id) { |
141 | 141 | continue; |
142 | 142 | } |
143 | + goods[ij].is_act_last=0; | |
143 | 144 | all_price0 += iter.goods_num * iter.goods_price; |
145 | + ls= parseInt(ij); | |
146 | + } | |
147 | + | |
148 | + //-- 要在特定的位置插入商品 -- | |
149 | + if(temp_arr){ | |
150 | + for(var gh=0;gh<temp_arr.length;gh++){ | |
151 | + var idx=gh+ls+1; | |
152 | + goods.splice(idx, 0,temp_arr[gh]); | |
153 | + } | |
154 | + ls+=temp_arr.length; | |
144 | 155 | } |
156 | + goods[ls].is_act_last=1; | |
145 | 157 | |
146 | - goods[goods.length-1].is_act_last=1; | |
147 | 158 | |
148 | 159 | if(!c_item.ladder_prom_goods) c_item.ladder_prom_goods={}; |
149 | 160 | if(!c_item.ladder_prom_goods[act_item.id]) c_item.ladder_prom_goods[act_item.id]={}; | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -2066,8 +2066,6 @@ Page({ |
2066 | 2066 | }); |
2067 | 2067 | |
2068 | 2068 | } else { |
2069 | - newd.prom_type = 0; | |
2070 | - newd.id = 0; | |
2071 | 2069 | |
2072 | 2070 | newd['pick_name'] = th.data.sto_sele_name; |
2073 | 2071 | newd['pick_dis'] = th.data.sto_sele_distr; |
... | ... | @@ -2138,7 +2136,7 @@ Page({ |
2138 | 2136 | s.set_b_now(e); |
2139 | 2137 | getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id) |
2140 | 2138 | } else { |
2141 | - | |
2139 | + | |
2142 | 2140 | //----其他就按照公众号的购物车立即购买形式来修改,先看会员在购物车中是否加入了该商品,立即购买的----- |
2143 | 2141 | getApp().request.get("/api/weshop/cart/page", { |
2144 | 2142 | data: { | ... | ... |