Commit e9445e732eb9ff95e538641f8d01d224bc811a33
1 parent
fd26792b
预售组件1
Showing
4 changed files
with
81 additions
and
27 deletions
components/diy_public/diy_public.js
| 1 | 1 | // var e = function(e) { |
| 2 | 2 | // return e && e.__esModule ? e : { |
| 3 | 3 | // default: e |
| 4 | -// }; | |
| 4 | +// }; | |
| 5 | 5 | // }(require("../../utils/LoadMore3.js")), |
| 6 | 6 | // n = new e.default(), |
| 7 | 7 | var t = getApp(), |
| ... | ... | @@ -48,7 +48,8 @@ Component({ |
| 48 | 48 | imgobj:{ |
| 49 | 49 | '1':"/miniapp/images/component/seckill.png", |
| 50 | 50 | '2':"/miniapp/images/component/pingd/pingd.png", |
| 51 | - '6':"/miniapp/images/component/pingd/pingd.png" | |
| 51 | + '6':"/miniapp/images/component/pingd/pingd.png", | |
| 52 | + '8':"/miniapp/images/component/presale.png", | |
| 52 | 53 | }, |
| 53 | 54 | nav1:'/packageA/pages/goodsInfo/goodsInfo?', |
| 54 | 55 | nav2:'/pages/goods/goodsInfo/goodsInfo?', |
| ... | ... | @@ -99,6 +100,13 @@ Component({ |
| 99 | 100 | nav2:'/pages/goods/goodsInfo/goodsInfo?' |
| 100 | 101 | }) |
| 101 | 102 | } |
| 103 | + if (this.data.prom_type==8) { //预售 | |
| 104 | + this.setData({ | |
| 105 | + prom_text:'已售', | |
| 106 | + nav1:'/packageC/pages/presell/goodsInfo/goodsInfo?', | |
| 107 | + nav2:'/packageC/pages/presell/goodsInfo/goodsInfo?' | |
| 108 | + }) | |
| 109 | + } | |
| 102 | 110 | var g_id = this.data.object; |
| 103 | 111 | |
| 104 | 112 | this.init(g_id); |
| ... | ... | @@ -153,12 +161,21 @@ Component({ |
| 153 | 161 | +os.stoid+"&aidlist="+goodsidlist + "&user_id="+user_id; |
| 154 | 162 | } |
| 155 | 163 | |
| 164 | + if (th.data.prom_type==8) { //预售 | |
| 165 | + gUrl="/api/weshop/marketing/marketingPresellList/page?store_id=" | |
| 166 | + +os.stoid+"&goodsidlist="+goodsidlist + "&user_id="+user_id+'&is_end=0&timetype=3&isuse=1'; | |
| 167 | + } | |
| 156 | 168 | |
| 157 | 169 | |
| 158 | - app.request.promiseGet(gUrl, {}).then(res => { | |
| 159 | 170 | |
| 171 | + app.request.promiseGet(gUrl, {}).then(res => { | |
| 172 | + | |
| 160 | 173 | //如果秒杀的数组为空的时候 |
| 161 | 174 | var goodslist = res.data.data; |
| 175 | + if (th.data.prom_type==8) { //预售 | |
| 176 | + goodslist = res.data.data ? res.data.data.pageData : [] | |
| 177 | + } | |
| 178 | + | |
| 162 | 179 | //就算是添加的活动已经过期,就要用最新的进行中活动 |
| 163 | 180 | if (goodslist && goodslist.length > 0) { |
| 164 | 181 | th.set_goods_list(g_id.data, goodslist); |
| ... | ... | @@ -197,6 +214,18 @@ Component({ |
| 197 | 214 | timetype: 2, |
| 198 | 215 | } |
| 199 | 216 | } |
| 217 | + if (this.data.prom_type==8) { //预售 | |
| 218 | + gUrl="/api/weshop/marketing/marketingPresellList/page?page=1&pageSize=9" | |
| 219 | + req={ | |
| 220 | + store_id:os.stoid, | |
| 221 | + is_end:0, | |
| 222 | + timetype:3, | |
| 223 | + isuse:1, | |
| 224 | + page:1, | |
| 225 | + user_id:user_id, | |
| 226 | + pageSize:9 | |
| 227 | + } | |
| 228 | + } | |
| 200 | 229 | |
| 201 | 230 | getApp().request.promiseGet(gUrl, |
| 202 | 231 | { isShowLoading: 1, data:req } |
| ... | ... | @@ -211,6 +240,7 @@ Component({ |
| 211 | 240 | |
| 212 | 241 | //就算是添加的活动已经过期,就要用最新的活动 |
| 213 | 242 | set_goods_list(g_id, goodslist) { |
| 243 | + | |
| 214 | 244 | let prom_type=this.data.prom_type |
| 215 | 245 | goodslist.forEach(function (vy, indy) { |
| 216 | 246 | if(!vy.id) vy.id=vy.prom_id; |
| ... | ... | @@ -240,29 +270,30 @@ Component({ |
| 240 | 270 | let item=all_array[i]; |
| 241 | 271 | if(item.user_price) item.price=item.user_price; |
| 242 | 272 | if(item.start_time > newTime) { |
| 243 | - item.status = 0; | |
| 273 | + item.status = 0; //活动没开始 | |
| 244 | 274 | } else if(item.end_time > newTime) { |
| 245 | - item.status = 1; | |
| 275 | + item.status = 1; // 活动进行中 | |
| 246 | 276 | }; |
| 247 | 277 | |
| 248 | 278 | } |
| 249 | 279 | |
| 250 | 280 | |
| 251 | - var promisies = []; | |
| 252 | - for (const key in all_array) { | |
| 253 | - if (Object.hasOwnProperty.call(all_array, key)) { | |
| 254 | - const val = all_array[key]; | |
| 255 | - | |
| 256 | - promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
| 257 | - os.stoid + "/"+prom_type+"/" + val.id, | |
| 258 | - {} | |
| 259 | - ).then(res => { | |
| 260 | - if (res.data.code == 0) { | |
| 261 | - if (res.data.data <= 0) all_array[key].status = 2; | |
| 262 | - }; | |
| 263 | - }); | |
| 264 | - } | |
| 265 | - } | |
| 281 | + var promisies = []; | |
| 282 | + if (th.data.prom_type !=8) { | |
| 283 | + for (const key in all_array) { | |
| 284 | + if (Object.hasOwnProperty.call(all_array, key)) { | |
| 285 | + const val = all_array[key]; | |
| 286 | + promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
| 287 | + os.stoid + "/"+prom_type+"/" + val.id, | |
| 288 | + {} | |
| 289 | + ).then(res => { | |
| 290 | + if (res.data.code == 0) { | |
| 291 | + if (res.data.data <= 0) all_array[key].status = 2;//已售完 | |
| 292 | + }; | |
| 293 | + }); | |
| 294 | + } | |
| 295 | + } | |
| 296 | + } | |
| 266 | 297 | |
| 267 | 298 | |
| 268 | 299 | Promise.all(promisies).then(() => { |
| ... | ... | @@ -271,10 +302,24 @@ Component({ |
| 271 | 302 | for(let i in all_array){ |
| 272 | 303 | let item=all_array[i]; |
| 273 | 304 | if(newTime > item.end_time) { |
| 274 | - all_array[i].status = 3; | |
| 305 | + all_array[i].status = 3; //活动结束 | |
| 275 | 306 | }; |
| 276 | 307 | // let price=all_array[i].price.toFixed(2) |
| 277 | 308 | let price=all_array[i].price + '' |
| 309 | + if (th.data.prom_type==8) { //预售 | |
| 310 | + price = all_array[i].presell_price + '' | |
| 311 | + if (all_array[i].status ===0) { | |
| 312 | + all_array[i].goods_num=all_array[i].presell_sumqty*1 + all_array[i].virtual_qty*1 | |
| 313 | + all_array[i].buy_num=all_array[i].buy_goodnum | |
| 314 | + }else{ | |
| 315 | + all_array[i].goods_num=all_array[i].presell_sumqty*1 + all_array[i].virtual_qty*1 | |
| 316 | + all_array[i].buy_num=all_array[i].buy_goodnum + all_array[i].virtual_qty*1 | |
| 317 | + } | |
| 318 | + | |
| 319 | + | |
| 320 | + } | |
| 321 | + | |
| 322 | + | |
| 278 | 323 | if (price && price.indexOf('.') > -1) { |
| 279 | 324 | let priceArr = price.split(".") |
| 280 | 325 | all_array[i].price_n = priceArr[0] |
| ... | ... | @@ -416,6 +461,9 @@ Component({ |
| 416 | 461 | if (this.data.prom_type==2) { //团购 |
| 417 | 462 | url="/packageC/pages/group_list/group_list"; |
| 418 | 463 | } |
| 464 | + if (this.data.prom_type==8) { //预售 | |
| 465 | + url="/packageC/pages/presell/list/list"; | |
| 466 | + } | |
| 419 | 467 | |
| 420 | 468 | wx.navigateTo({ |
| 421 | 469 | url | ... | ... |
components/diy_public/diy_public.wxml
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <view style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'}}" class="{{'new_item1_box '+ ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}"> |
| 17 | 17 | <block wx:for="{{goods_array}}"> |
| 18 | 18 | <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') }}" style="{{'margin-bottom:'+object.product_spacing+'px;'}}"> |
| 19 | - <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id)}}" class="s1_gk_a1"> | |
| 19 | + <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 20 | 20 | <view class="topBox"> |
| 21 | 21 | <view class="imgBox"> |
| 22 | 22 | <!-- <image mode="{{object.picture_fill==1 ? 'aspectFill' : 'scaleToFill'}}" class="{{'new_item1_image '+ 'aspect_ratio'+object.picture_scale}}" style="{{'width:'+img_width+';height:'+img_height}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> --> |
| ... | ... | @@ -76,7 +76,7 @@ |
| 76 | 76 | <view style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'}}" class="{{'flex2 new_item1_box '+ ((object.product_style==1 || object.product_style==3 )? ' bgf ':'') }}"> |
| 77 | 77 | <block wx:for="{{goods_array}}"> |
| 78 | 78 | <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'boxpad new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')+ (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'')}}" style="{{'margin-bottom:'+object.product_spacing+'px; '+('width:calc(100%/2 - ' + object.product_spacing/2+'px)')}}"> |
| 79 | - <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id)}}" class="s1_gk_a1"> | |
| 79 | + <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 80 | 80 | <view class="topBox"> |
| 81 | 81 | <view class="imgBox"> |
| 82 | 82 | <!-- <image mode="{{object.picture_fill==1 ? 'aspectFill' : 'scaleToFill'}}" class="{{'new_item1_image '+ 'aspect_ratio'+object.picture_scale}}" style="{{'width:'+img_width+';height:'+img_height}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> --> |
| ... | ... | @@ -130,7 +130,7 @@ |
| 130 | 130 | <view style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'}}" class="{{'flex2 new_item1_box '+ ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}"> |
| 131 | 131 | <block wx:for="{{goods_array}}"> |
| 132 | 132 | <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'boxpad new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') }}" style="{{'margin-bottom:'+object.product_spacing+'px; '+('width:calc(100%/3 - ' + (object.product_spacing*2)/3+'px)')}}"> |
| 133 | - <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id)}}" class="s1_gk_a1"> | |
| 133 | + <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 134 | 134 | <view class="topBox"> |
| 135 | 135 | <view class="imgBox"> |
| 136 | 136 | <!-- <image mode="{{object.picture_fill==1 ? 'aspectFill' : 'scaleToFill'}}" class="{{'new_item1_image '+ 'aspect_ratio'+object.picture_scale}}" style="{{'width:'+img_width+';height:'+img_height}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> --> |
| ... | ... | @@ -178,7 +178,7 @@ |
| 178 | 178 | <view style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'}}" class="{{'flex2 new_item1_box '+ ((object.product_style==1 || object.product_style==3 )? ' bgf ':'') }}"> |
| 179 | 179 | <block wx:for="{{goods_array}}"> |
| 180 | 180 | <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'boxpad new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') }}" style="{{'margin-bottom:'+object.product_spacing+'px;'}}"> |
| 181 | - <navigator style="display: flex;" url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id)}}" class="s1_gk_a1"> | |
| 181 | + <navigator style="display: flex;" url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+prom_type+'&prom_id=' + aitem.id +'&pre_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 182 | 182 | <view style="width: 33%;" class="topBox"> |
| 183 | 183 | <view class="imgBox"> |
| 184 | 184 | <view class="{{'container'+object.picture_scale}}" style="{{object.picture_fill==1 ? 'background-color: #fff;' : ''}}"> |
| ... | ... | @@ -231,7 +231,7 @@ |
| 231 | 231 | <block wx:for="{{goods_array}}"> |
| 232 | 232 | <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind"> |
| 233 | 233 | <view wx:if="{{aind==0}}" class="{{'new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}" style="{{'margin-bottom:'+object.product_spacing+'px;'}}"> |
| 234 | - <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=' + prom_type + '&prom_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+ prom_type +'&prom_id=' + aitem.id)}}" class="s1_gk_a1"> | |
| 234 | + <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=' + prom_type + '&prom_id=' + aitem.id +'&pre_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+ prom_type +'&prom_id=' + aitem.id +'&pre_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 235 | 235 | <view class="topBox"> |
| 236 | 236 | <view class="imgBox"> |
| 237 | 237 | <view class="{{'container'+object.picture_scale}}" style="{{object.picture_fill==1 ? 'background-color: #fff;' : ''}}"> |
| ... | ... | @@ -422,7 +422,7 @@ |
| 422 | 422 | <swiper indicator-dots style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'+(swiperHeight ? ('height:'+swiperHeight+';'):'' )}}" class="{{' new_item1_box '+ ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}"> |
| 423 | 423 | <swiper-item wx:for="{{goods_array}}" class="flex2" style="padding: 5rpx;"> |
| 424 | 424 | <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'boxpad swiper_h new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') }}" style="{{'margin-bottom:'+object.product_spacing+'px; '+('width:calc(100%/3 - ' + (object.product_spacing*2)/3+'px)')}}"> |
| 425 | - <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=' + prom_type + '&prom_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+ prom_type +'&prom_id=' + aitem.id)}}" class="s1_gk_a1"> | |
| 425 | + <navigator url="{{aitem.goods_type == 1 ? ( nav1 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=' + prom_type + '&prom_id=' + aitem.id +'&pre_id=' + aitem.id ) : ( nav2 + 'goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type='+ prom_type +'&prom_id=' + aitem.id +'&pre_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 426 | 426 | <view class="topBox"> |
| 427 | 427 | <view class="imgBox"> |
| 428 | 428 | <view class="{{'container'+object.picture_scale}}" style="{{object.picture_fill==1 ? 'background-color: #fff;' : ''}}"> | ... | ... |
pages/index/index/index.wxml
| ... | ... | @@ -516,6 +516,9 @@ |
| 516 | 516 | <block wx:if="{{item.ename=='presale'}}"> |
| 517 | 517 | <presell object="{{item.content}}"></presell> |
| 518 | 518 | </block> |
| 519 | + <block wx:if="{{item.ename=='presaleNew'}}"> | |
| 520 | + <diy_public object="{{item.content}}" prom_type="8"></diy_public> | |
| 521 | + </block> | |
| 519 | 522 | <!-- 团购 --> |
| 520 | 523 | <block wx:if="{{item.ename=='groupbuy'}}"> |
| 521 | 524 | <groupbuy object="{{item.content}}"></groupbuy> | ... | ... |
pages/template/index.wxml
| ... | ... | @@ -69,6 +69,9 @@ |
| 69 | 69 | <block wx:if="{{item.ename=='presale'}}"> |
| 70 | 70 | <presell object="{{item.content}}"></presell> |
| 71 | 71 | </block> |
| 72 | + <block wx:if="{{item.ename=='presaleNew'}}"> | |
| 73 | + <diy_public object="{{item.content}}" prom_type="8"></diy_public> | |
| 74 | + </block> | |
| 72 | 75 | <!-- 团购 --> |
| 73 | 76 | <block wx:if="{{item.ename=='groupbuy'}}"> |
| 74 | 77 | <groupbuy object="{{item.content}}"></groupbuy> | ... | ... |