category.wxml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <!--pages/category/category.wxml-->
  2. <view class="container" style="padding-top: {{pageTopHeight}}px;">
  3. <!-- 头部搜索区 -->
  4. <navbar>
  5. <view class="top-search-input">
  6. <swiper vertical="true" circular="true" autoplay="true" interval="3000" class="top-search-swiper" bindtap="toSearchPage" bindchange="topSwiperChange">
  7. <swiper-item wx:for="{{hotList}}" wx:key="index">{{item.name}}</swiper-item>
  8. </swiper>
  9. <view class="top-search-line">|</view>
  10. <view class="top-search-text" bindtap="topHotSearch">搜索</view>
  11. </view>
  12. </navbar>
  13. <!-- 全部分类弹窗 -->
  14. <van-popup show="{{ show }}" position="top" close-on-click-overlay="{{false}}" z-index="{{99999}}" round bind:close="onClose">
  15. <view class="popup-box" style="padding-top: {{pageTopHeight}}px;">
  16. <!-- 搜索 -->
  17. <navbar>
  18. <view class="top-search-input">
  19. <swiper vertical="true" circular="true" autoplay="true" interval="3000" class="top-search-swiper" bindtap="toSearchPage" bindchange="topSwiperChange">
  20. <swiper-item wx:for="{{hotList}}" wx:key="index">{{item.name}}</swiper-item>
  21. </swiper>
  22. <view class="top-search-line">|</view>
  23. <view class="top-search-text" bindtap="topHotSearch">搜索</view>
  24. </view>
  25. </navbar>
  26. <!-- 分类 -->
  27. <view class="top-box top-all-box">
  28. <view wx:for='{{categoryList}}' class="type-item" wx:key='categoryId' data-index="{{index}}" data-id="{{item.categoryId}}" bindtap='onMenuTab'>
  29. <!-- <view class="icon"></view> -->
  30. <image class="icon" src="{{imgUrl+item.icon}}" mode="" />
  31. <view class='name {{selIndex==index?"active":""}} '>
  32. {{item.categoryName}}
  33. </view>
  34. </view>
  35. <view wx:if="{{5-(categoryList.length%5) >0}}" style="width: 100rpx;height: 100rpx;"></view>
  36. <view wx:if="{{5-(categoryList.length%5) >1}}" style="width: 100rpx;height: 100rpx;"></view>
  37. <view wx:if="{{5-(categoryList.length%5) >2}}" style="width: 100rpx;height: 100rpx;"></view>
  38. <view wx:if="{{5-(categoryList.length%5) >3}}" style="width: 100rpx;height: 100rpx;"></view>
  39. </view>
  40. <view class="close-box" bind:tap="onClose">
  41. 点击收起
  42. <image class="icon" src="../../images/icon/more-icon.png" mode="" />
  43. </view>
  44. </view>
  45. </van-popup>
  46. <!-- 顶部滚动分类 -->
  47. <view class="top-content">
  48. <scroll-view scroll-x="true" class='top-box' scroll-into-view="{{'item'+selCategory}}">
  49. <view wx:for='{{categoryList}}' id="{{'item'+item.categoryId}}" class="type-item" wx:key='{{item.categoryId}}' data-index="{{index}}" data-id="{{item.categoryId}}" bindtap='onMenuTab'>
  50. <image class="icon" src="{{imgUrl+item.icon}}" mode="" />
  51. <view class='name {{selIndex==index?"active":""}} '>
  52. {{item.categoryName}}
  53. </view>
  54. </view>
  55. </scroll-view>
  56. <view wx:if="{{categoryList.length}}" class="all" bind:tap="handleAll">全部
  57. <image class="icon" src="../../images/icon/more-icon.png" mode="" />
  58. </view>
  59. </view>
  60. <!-- 滚动内容区 -->
  61. <view class="main" wx:if="{{categoryList.length>0}}">
  62. <!-- 左侧菜单start -->
  63. <scroll-view scroll-y="true" class='leftmenu' scroll-into-view="{{'item'+subIndex}}">
  64. <view wx:for='{{subCategoryList}}' id="{{'item'+index}}" wx:key='categoryId'>
  65. <view class='menu-item {{subIndex==index?"active":""}} ' data-index="{{index}}" data-id="{{item.categoryId}}" bindtap='onleftMenuTab'>
  66. {{item.categoryName}}
  67. </view>
  68. </view>
  69. <view style="height: 200rpx;"></view>
  70. </scroll-view>
  71. <!-- 左侧菜单end -->
  72. <!-- 右侧内容start -->
  73. <scroll-view scroll-y="true" class='rightcontent' enable-passive scroll-into-view="{{rightView}}" upper-threshold="10" lower-threshold="10" scroll-top="{{topHeight}}" bindscroll="scroll"bindscrolltoupper="scrollTop" bindscrolltolower="scrollBottom">
  74. <!-- <text wx:if="{{subCategoryList.length>0}}" class="sub-title" >{{subCategoryList[subIndex].categoryName}}</text> -->
  75. <view class="loading" wx:if="{{showLoading}}">
  76. <!-- <van-icon class="icon" color="#FF941A" size="50rpx" name="replay" /> -->
  77. <image class="icon" src="../../images/imgs/loading-icon.png" mode=""/>
  78. </view>
  79. <view class="right-top-box">
  80. <view class="thrid-type-box" wx:if="{{thridCategoryList.length>0}}">
  81. <view class='thrid-type-item {{thridIndex==-1?"active":""}}' data-index="-1" bind:tap="handleThrid">全部</view>
  82. <view class='thrid-type-item {{thridIndex==index?"active":""}}' data-index="{{index}}" data-categoryId="{{item.categoryId}}" wx:for="{{thridCategoryList}}" bind:tap="handleThrid">{{item.categoryName}}</view>
  83. </view>
  84. <view class="filter-box">
  85. <view class="filter-item {{sort == 1 ?'active':''}}" bind:tap="handleSale">销量</view>
  86. <view class="filter-item" bind:tap="handlePrice">价格
  87. <view class="icon-box">
  88. <van-icon class="down" size="20rpx" color="{{sort ==2? '#FF941A':'#AAAAAA'}}" name="play" />
  89. <van-icon class="up" size="20rpx" color="{{sort ==3? '#FF941A':'#AAAAAA'}}" name="play" />
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="right-box">
  95. <view class="product-item" id="{{'test'+index}}" wx:for="{{productList}}">
  96. <image class="pic" src="{{item.pic}}" mode="" data-prodId="{{item.prodId}}" bind:tap="toProdPage" />
  97. <view class="info">
  98. <view class="title" data-prodId="{{item.prodId}}" bind:tap="toProdPage">{{item.prodName}}</view>
  99. <view class="salesVolume">已售{{item.salesVolume||0}}</view>
  100. <view class="price-box">
  101. <view class="price">¥{{item.price}}</view>
  102. <view wx:if="{{item.show}}" class="num-box">
  103. <view class="btn" data-num="-1" data-item="{{item}}" bind:tap="handleNum">-</view>
  104. <view class="num">{{item.prodCount}}</view>
  105. <view class="btn" data-num="1" data-item="{{item}}" bind:tap="handleNum">+</view>
  106. </view>
  107. <image wx:else style="width:52rpx;height:52rpx;" src="/images/icon/car-btn.png" mode="" data-num="1" data-item="{{item}}" bind:tap="handleNum" />
  108. </view>
  109. </view>
  110. </view>
  111. <view id="empty" class="block" style="height: 90vh;"></view>
  112. <view class="sub-cate-title not-category-data" wx:if="{{subCategoryList.length==0}}">
  113. <view class="sub-cate-text">无二级分类</view>
  114. </view>
  115. </view>
  116. </scroll-view>
  117. <!-- 右侧内容end -->
  118. </view>
  119. <view class="not-data-list" wx:else>
  120. <van-empty image="search" description="附近暂无可配送门店" />
  121. <view class="reset-localization" bindtap="toLocationPage">定位不准确?<text style="color: rgb(40,120,255);">点击手动定位</text></view>
  122. </view>
  123. <!-- 购物车弹窗 -->
  124. <van-popup show="{{ showCar }}" position="bottom" safe-area-inset-bottom="{{false}}" close-on-click-overlay="{{true}}" z-index="{{99999}}" round bind:close="onCarClose">
  125. <view class="car-box">
  126. <view wx:if="{{carData.length}}">
  127. <view class="item" wx:for="{{carData}}">
  128. <image class="img" src="{{item.pic}}" mode="" />
  129. <view class="info">
  130. <view class="title">{{item.prodName}}</view>
  131. <view class="desc">规格:{{item.weight}}{{item.weightUnit}}</view>
  132. <view class="price-box">
  133. <view class="price">
  134. <view class="unit">¥</view>
  135. <view class="num">{{item.price}}</view>
  136. </view>
  137. <view class="num-box">
  138. <view class="btn" data-num="-1" data-item="{{item}}" bind:tap="handleNum">-</view>
  139. <view class="num">{{item.prodCount}}</view>
  140. <view class="btn" data-num="1" data-item="{{item}}" bind:tap="handleNum">+</view>
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. <!-- 空 -->
  147. <view class="empty" wx:else="{{!carData.length}}">
  148. <view class="empty-icon">
  149. <image src="../../images/icon/empty-basket.png"></image>
  150. </view>
  151. <view class="empty-text">您还没有添加商品到购物车哦~</view>
  152. </view>
  153. </view>
  154. </van-popup>
  155. <view class="bottom-box">
  156. <view class="left" bindtap="openCar">
  157. <view class="num" wx:if="{{totalInfo.count}}">{{totalInfo.count}}</view>
  158. <image class="icon" src="../../images/icon/car-icon.png" mode="" />
  159. <view class="price-box">
  160. <view class="top">
  161. <view class="price">¥{{totalInfo.finalMoney}}</view>
  162. <view class="reduce-price">共减¥{{totalInfo.subtractMoney}}</view>
  163. </view>
  164. <view class="shipping-fee">配送费¥0</view>
  165. </view>
  166. </view>
  167. <view class="btn" bind:tap="handleBuy">去结算</view>
  168. </view>
  169. </view>
  170. <wxs module="wxs" src="../../wxs/number.wxs" />