category.wxml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <van-search value="{{ name }}" placeholder="请输入搜索关键词" shape="round" bind:search="bindconfirm" use-right-icon-slot>
  2. <van-icon slot="right-icon" name="scan" bind:click="searchscan" />
  3. </van-search>
  4. <view class="main">
  5. <scroll-view class="category-container" scroll-y="true" scroll-with-animation="true" scroll-into-view="{{ aaa }}">
  6. <van-sidebar custom-class="sidebar-l" active-key="{{ activeCategory }}">
  7. <van-sidebar-item wx:if="{{item.level == 1}}" id="category{{item.id}}" wx:for="{{firstCategories}}" wx:key="id" data-idx="{{index}}" bindtap="onCategoryClick" title="{{ item.name }}" />
  8. </van-sidebar>
  9. </scroll-view>
  10. <scroll-view class="goods-container" scroll-y="true" scroll-top="{{scrolltop}}" wx:if='{{onLoadStatus}}' bindscrolltolower="goodsGoBottom">
  11. <van-tabs wx:if="{{ categoryMod != 2 && categorySelected.childs && categorySelected.childs.length > 0 }}" custom-class="llargada" bind:change="onSecondCategoryClick" ellipsis="{{ false }}">
  12. <van-tab title="全部"></van-tab>
  13. <van-tab wx:for="{{categorySelected.childs}}" wx:key="id" title="{{ item.name }}"></van-tab>
  14. </van-tabs>
  15. <van-empty wx:if="{{categoryMod != 2 && !currentGoods}}" description="暂无商品" />
  16. <block wx:if="{{ categoryMod == 2 }}">
  17. <van-cell title="{{ categorySelected.name }}" is-link url="/pages/goods/list?categoryId={{ categorySelected.id }}" />
  18. <image wx:if="{{ adPosition }}" class="adPosition" mode="aspectFill" src="{{adPosition.val}}" mode="widthFix" data-url="{{adPosition.url}}" bindtap="adPositionClick"></image>
  19. <view class="small-category-box">
  20. <navigator wx:for="{{categorySelected.childs}}" wx:key="id" url="/pages/goods/list?categoryId={{item.id}}">
  21. <view class="small-category">
  22. <image mode="aspectFill" src="{{item.icon}}" mode="aspectFill"></image>
  23. <view>{{item.name}}</view>
  24. </view>
  25. </navigator>
  26. </view>
  27. </block>
  28. <!-- 三级级分类展示 -->
  29. <!-- <view wx:for="{{categories}}" wx:key="id" wx:if="{{item.pid == categorySelected.id}}">
  30. <navigator url="/pages/goods/list?categoryId={{item.id}}">
  31. <view class="no-data medium-category">
  32. <view class="line"></view>
  33. <view class="txt">{{item.name}}</view>
  34. <view class="line"></view>
  35. </view>
  36. </navigator>
  37. <view class="small-category-box">
  38. <navigator wx:for="{{categories}}" wx:for-item="small" wx:key="id" wx:if="{{small.pid == item.id}}" url="/pages/goods/list?categoryId={{small.id}}">
  39. <view class="small-category">
  40. <image mode="aspectFill" src="{{small.icon}}"></image>
  41. <view>{{small.name}}</view>
  42. </view>
  43. </navigator>
  44. </view>
  45. </view> -->
  46. <!-- 显示右侧商品 -->
  47. <wxs module="goodsDetailPage">
  48. module.exports = {
  49. url : function(item) {
  50. if (item.supplyType == 'cps_jd') {
  51. return '/packageCps/pages/goods-details/cps-jd?id=' + item.id
  52. } else if (item.supplyType == 'vop_jd') {
  53. return '/pages/goods-details/vop?id=' + item.yyId + '&goodsId=' + item.id
  54. } else if (item.supplyType == 'cps_pdd') {
  55. return '/packageCps/pages/goods-details/cps-pdd?id=' + item.id
  56. } else if (item.supplyType == 'cps_taobao') {
  57. return '/packageCps/pages/goods-details/cps-taobao?id=' + item.id
  58. } else {
  59. return '/pages/goods-details/index?id=' + item.id
  60. }
  61. }
  62. }
  63. </wxs>
  64. <van-card
  65. wx:for="{{currentGoods}}" wx:key="id"
  66. price="{{item.minPrice}}"
  67. desc="{{item.numberSells ? '已售' + item.numberSells : ''}}"
  68. tag="{{item.gotScore ? item.gotScore + '积分' : ''}}"
  69. title="{{item.name}}"
  70. thumb="{{item.pic}}"
  71. thumb-link="{{ goodsDetailPage.url(item) }}"
  72. >
  73. <view class="goods-btn" slot="footer">
  74. <van-icon wx:if="{{ item.propertyIds || item.hasAddition }}" name="add" color="#e64340" size="48rpx" data-id="{{item.id}}" bind:click="addShopCar" />
  75. <van-icon wx:else name="shopping-cart-o" color="#e64340" size="48rpx" data-id="{{item.id}}" bind:click="addShopCar" />
  76. </view>
  77. </van-card>
  78. </scroll-view>
  79. </view>
  80. <van-popup
  81. show="{{ skuCurGoodsShow }}"
  82. position="bottom"
  83. round
  84. custom-style="padding-top:32rpx;max-height: 80%;"
  85. bind:close="closeSku"
  86. >
  87. <van-card
  88. centered
  89. price="{{ selectSizePrice }}"
  90. origin-price="{{ selectSizePrice != selectSizePrice ? selectSizeOPrice : '' }}"
  91. title="{{ skuCurGoods.basicInfo.name }}"
  92. thumb="{{ skuGoodsPic }}"
  93. />
  94. <view class="sku-container">
  95. <view class="sku" wx:for="{{skuCurGoods.properties}}" wx:key="id">
  96. <view class="t">{{item.name}}</view>
  97. <view class="items">
  98. <text class="{{small.active? 'active' : ''}}" wx:for="{{item.childsCurGoods}}" wx:for-item="small" wx:key="id" data-pid="{{small.propertyId}}" data-id="{{small.id}}" bindtap="skuSelect">{{small.name}}</text>
  99. </view>
  100. </view>
  101. <view class="num">
  102. <view class="t">购买数量</view>
  103. <van-stepper value="{{ skuCurGoods.basicInfo.storesBuy }}" bind:plus="storesJia" bind:minus="storesJian" />
  104. </view>
  105. </view>
  106. <van-button type="danger" block bind:click="addCarSku">加入购物车</van-button>
  107. </van-popup>