Commit 9582b6a26ac8822b02258ea0ad0fd0c25a57ca3f
1 parent
1d80bc8e
自定义组件优化
Showing
4 changed files
with
32 additions
and
13 deletions
components/diy_public/diy_public.js
| ... | ... | @@ -54,6 +54,7 @@ Component({ |
| 54 | 54 | }, |
| 55 | 55 | nav1:'/packageA/pages/goodsInfo/goodsInfo?', |
| 56 | 56 | nav2:'/pages/goods/goodsInfo/goodsInfo?', |
| 57 | + | |
| 57 | 58 | }, |
| 58 | 59 | |
| 59 | 60 | pageLifetimes: { |
| ... | ... | @@ -345,7 +346,8 @@ Component({ |
| 345 | 346 | } |
| 346 | 347 | if (th.data.prom_type==9) { //幸运购 |
| 347 | 348 | price = (all_array[i].group_price / 100) + '' |
| 348 | - all_array[i].buy_num = all_array[i].group_joined | |
| 349 | + // all_array[i].buy_num = all_array[i].group_joined | |
| 350 | + all_array[i].buy_num = all_array[i].goods_num*1 - all_array[i].actLen*1 | |
| 349 | 351 | all_array[i].goods_name = all_array[i].title |
| 350 | 352 | } |
| 351 | 353 | |
| ... | ... | @@ -360,7 +362,11 @@ Component({ |
| 360 | 362 | |
| 361 | 363 | all_array[i].residue=all_array[i].goods_num*1 - all_array[i].buy_num*1 |
| 362 | 364 | all_array[i].residue = (all_array[i].residue >= 0) ? all_array[i].residue : 0 |
| 363 | - console.error(all_array[i].residue); | |
| 365 | + if (th.data.prom_type==9) { //幸运购 | |
| 366 | + all_array[i].residue= all_array[i].actLen | |
| 367 | + } | |
| 368 | + | |
| 369 | + // console.error(all_array[i].residue); | |
| 364 | 370 | if (all_array[i].residue && all_array[i].residue > 0 && all_array[i].status !=2) { |
| 365 | 371 | empty.push(all_array[i]) |
| 366 | 372 | } |
| ... | ... | @@ -470,7 +476,14 @@ Component({ |
| 470 | 476 | sec: '00' |
| 471 | 477 | } |
| 472 | 478 | } |
| 473 | - var txt = "goods_array[" + j + "][" + i + "].djs"; | |
| 479 | + let txt = "goods_array[" + j + "][" + i + "].djs"; | |
| 480 | + | |
| 481 | + if (!o.status && obj.day=='00' && obj.hou=='00' && obj.min=='00' && obj.sec=='01') { | |
| 482 | + let t1="goods_array[" + j + "][" + i + "].status"; | |
| 483 | + ee.setData({ | |
| 484 | + [t1]:1 | |
| 485 | + }) | |
| 486 | + } | |
| 474 | 487 | ee.setData({ |
| 475 | 488 | [txt]: obj |
| 476 | 489 | }); | ... | ... |
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 +'&pre_id=' + aitem.id + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 19 | + <navigator url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_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 +'&pre_id=' + aitem.id + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 79 | + <navigator url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_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 +'&pre_id=' + aitem.id + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 133 | + <navigator url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_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 +'&pre_id=' + aitem.id + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 181 | + <navigator style="display: flex;" url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_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 +'&pre_id=' + aitem.id + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 234 | + <navigator url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_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;' : ''}}"> |
| ... | ... | @@ -281,7 +281,7 @@ |
| 281 | 281 | </navigator> |
| 282 | 282 | </view> |
| 283 | 283 | <view wx:if="{{aind==1}}" 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)')}}"> |
| 284 | - <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 + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 284 | + <navigator url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_id=' + aitem.id ))}}" class="s1_gk_a1"> | |
| 285 | 285 | <view class="topBox"> |
| 286 | 286 | <view class="imgBox"> |
| 287 | 287 | <view class="{{'container'+object.picture_scale}}" style="{{object.picture_fill==1 ? 'background-color: #fff;' : ''}}"> |
| ... | ... | @@ -323,7 +323,7 @@ |
| 323 | 323 | </navigator> |
| 324 | 324 | </view> |
| 325 | 325 | <view wx:if="{{aind==2}}" 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)')}}"> |
| 326 | - <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 + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 326 | + <navigator url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_id=' + aitem.id ))}}" class="s1_gk_a1"> | |
| 327 | 327 | <view class="topBox"> |
| 328 | 328 | <view class="imgBox"> |
| 329 | 329 | <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 +'&pre_id=' + aitem.id + '&group_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 + '&group_id=' + aitem.id )}}" class="s1_gk_a1"> | |
| 425 | + <navigator url="{{(prom_type==9 && aitem.residue==0) ? '' : (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 + '&group_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 + '&group_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
| ... | ... | @@ -484,9 +484,12 @@ |
| 484 | 484 | <diy_public object="{{item.content}}" prom_type="6"></diy_public> |
| 485 | 485 | </block> |
| 486 | 486 | <!--秒杀--> |
| 487 | - <block wx:if="{{item.ename=='seckill' || item.ename=='seckillNew'}}"> | |
| 487 | + <block wx:if="{{item.ename=='seckill'}}"> | |
| 488 | 488 | <seckill object="{{item.content}}"></seckill> |
| 489 | 489 | </block> |
| 490 | + <block wx:if="{{item.ename=='seckillNew'}}"> | |
| 491 | + <diy_public object="{{item.content}}" prom_type="1"></diy_public> | |
| 492 | + </block> | |
| 490 | 493 | <!--标题--> |
| 491 | 494 | <block wx:if="{{item.ename=='title'}}"> |
| 492 | 495 | <title object="{{item.content}}"></title> | ... | ... |
pages/template/index.wxml
| ... | ... | @@ -41,9 +41,12 @@ |
| 41 | 41 | <diy_public object="{{item.content}}" prom_type="6"></diy_public> |
| 42 | 42 | </block> |
| 43 | 43 | <!--秒杀--> |
| 44 | - <block wx:if="{{item.ename=='seckill' || item.ename=='seckillNew'}}"> | |
| 44 | + <block wx:if="{{item.ename=='seckill'}}"> | |
| 45 | 45 | <seckill object="{{item.content}}"></seckill> |
| 46 | 46 | </block> |
| 47 | + <block wx:if="{{item.ename=='seckillNew'}}"> | |
| 48 | + <diy_public object="{{item.content}}" prom_type="1"></diy_public> | |
| 49 | + </block> | |
| 47 | 50 | <!--标题--> |
| 48 | 51 | <block wx:if="{{item.ename=='title'}}"> |
| 49 | 52 | <title object="{{item.content}}"></title> | ... | ... |