category.wxml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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 {{selIndex==index?"active":""}}' 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-offset="-150" scroll-with-animation enable-passive 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 {{selIndex==index?"active":""}}' src="{{imgUrl+item.icon}}" mode="" />
  51. <view class='name {{selIndex==index?"active":""}} '>
  52. {{item.categoryName}}
  53. </view>
  54. </view>
  55. <view class="type-item" style="width: 100rpx;height: 44rpx"></view>
  56. </scroll-view>
  57. <view wx:if="{{categoryList.length}}" class="all" bind:tap="handleAll">展开
  58. <image class="icon" src="../../images/icon/more-icon.png" mode="" />
  59. </view>
  60. </view>
  61. <!-- 滚动内容区 -->
  62. <view class="main" wx:if="{{categoryList.length>0}}">
  63. <!-- 左侧菜单start -->
  64. <!-- <scroll-view scroll-y="true" class='leftmenu' scroll-into-view="{{'item'+subIndex}}"> -->
  65. <scroll-view scroll-y="true" class='leftmenu' >
  66. <view wx:for='{{subCategoryList}}' id="{{'item'+index}}" wx:key='categoryId'>
  67. <view class='menu-item {{subIndex==index?"active":""}} ' data-index="{{index}}" data-id="{{item.categoryId}}" bindtap='onleftMenuTab'>
  68. <image wx:if="{{index == 0}}" class="icon" src="../../images/icon/good-icon.png" mode=""/>
  69. <image wx:if="{{index == 1 || index ==4}}" class="icon" src="../../images/icon/hot-icon.png" mode=""/>
  70. <image wx:if="{{index == 5}}" class="icon" src="../../images/icon/new-icon.png" mode=""/>
  71. {{item.categoryName}}
  72. </view>
  73. </view>
  74. <view style="height: 200rpx;"></view>
  75. </scroll-view>
  76. <!-- 左侧菜单end -->
  77. <!-- 右侧内容start -->
  78. <!-- scroll-view -->
  79. <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">
  80. <image class="banner" src="../../images/imgs/banner.png" mode="" />
  81. <!-- <text wx:if="{{subCategoryList.length>0}}" class="sub-title" >{{subCategoryList[subIndex].categoryName}}</text> -->
  82. <view class="loading" wx:if="{{showLoading}}">
  83. <!-- <van-icon class="icon" color="#006CE8" size="50rpx" name="replay" /> -->
  84. <image class="icon" src="../../images/imgs/loading-icon.png" mode=""/>
  85. </view>
  86. <view class="right-top-box">
  87. <view class="thrid-type-box" wx:if="{{thridCategoryList.length>0}}">
  88. <view class='thrid-type-item {{thridIndex==-1?"active":""}}' data-index="-1" bind:tap="handleThrid">全部</view>
  89. <view class='thrid-type-item {{thridIndex==index?"active":""}}' data-index="{{index}}" data-categoryId="{{item.categoryId}}" wx:for="{{thridCategoryList}}" bind:tap="handleThrid">{{item.categoryName}}</view>
  90. </view>
  91. <view class="filter-box">
  92. <view class="filter-item {{sort == 1 ?'active':''}}" bind:tap="handleSale">销量</view>
  93. <view class="filter-item" bind:tap="handlePrice">价格
  94. <!-- <view class="icon-box">
  95. <van-icon class="down" size="20rpx" color="{{sort ==2? '#006CE8':'#AAAAAA'}}" name="play" />
  96. <van-icon class="up" size="20rpx" color="{{sort ==3? '#006CE8':'#AAAAAA'}}" name="play" />
  97. </view> -->
  98. <image wx:if="{{sort == 0}}" class="icon" src="../../images/icon/sort1.png" mode=""/>
  99. <image wx:else class="icon" src="{{sort ==2?'../../images/icon/sort2.png':'../../images/icon/sort3.png'}}" mode=""/>
  100. </view>
  101. </view>
  102. </view>
  103. <scroll-view class="right-box" scroll-y="true" enable-passive scroll-into-view="{{rightView}}" upper-threshold="10" lower-threshold="10" scroll-top="{{topHeight}}" bindscroll="scroll"bindscrolltoupper="scrollTop" bindscrolltolower="scrollBottom">
  104. <view class="product-item" id="{{'test'+index}}" wx:for="{{productList}}">
  105. <image class="pic" src="{{item.pic}}" mode="" data-prodId="{{item.prodId}}" bind:tap="toProdPage" />
  106. <view class="info">
  107. <view class="title" data-prodId="{{item.prodId}}" bind:tap="toProdPage">{{item.prodName}}</view>
  108. <view class="salesVolume">已售{{item.salesVolume||0}}</view>
  109. <view class="price-box">
  110. <view class="price">¥{{item.price}}</view>
  111. <view wx:if="{{item.show}}" class="num-box">
  112. <image class="btn" data-num="-1" data-item="{{item}}" bind:tap="handleNum" src="/images/icon/reduce.png" mode=""/>
  113. <view class="num">{{item.prodCount}}</view>
  114. <image class="btn" data-num="1" data-item="{{item}}" bind:tap="handleNum" src="/images/icon/add.png" mode=""/>
  115. </view>
  116. <image wx:else style="width:52rpx;height:52rpx;" src="/images/icon/car-btn.png" mode="" data-num="1" data-item="{{item}}" bind:tap="handleNum" />
  117. </view>
  118. </view>
  119. </view>
  120. <view wx:if="{{subCategoryList.length!=0&&productList.length == 0}}">
  121. <van-empty image="error" description="暂无商品" />
  122. </view>
  123. <view id="empty" class="block" style="height: 90vh;">
  124. </view>
  125. <view class="sub-cate-title not-category-data" wx:if="{{subCategoryList.length==0}}">
  126. <view class="sub-cate-text">无二级分类</view>
  127. </view>
  128. </scroll-view>
  129. </view>
  130. <!-- 右侧内容end -->
  131. </view>
  132. <view class="not-data-list" wx:else>
  133. <van-empty image="search" description="附近暂无可配送门店" />
  134. <!-- <view class="reset-localization" bindtap="toLocationPage">定位不准确?<text style="color: rgb(40,120,255);">点击手动定位</text></view> -->
  135. </view>
  136. <!-- 购物车弹窗 -->
  137. <van-popup show="{{ showCar }}" position="bottom" safe-area-tab-bar safe-area-inset-bottom close-on-click-overlay="{{true}}" z-index="{{99999}}" round bind:close="onCarClose">
  138. <view class="car-box">
  139. <view wx:if="{{carData.length}}">
  140. <view class="item" wx:for="{{carData}}">
  141. <image class="img" src="{{item.pic}}" mode="" />
  142. <view class="info">
  143. <view class="title">{{item.prodName}}</view>
  144. <view class="desc">规格:{{item.weight}}{{item.weightUnit}}</view>
  145. <view class="price-box">
  146. <view class="price">
  147. <view class="unit">¥</view>
  148. <view class="num">{{item.price}}</view>
  149. </view>
  150. <view class="num-box">
  151. <view class="btn" data-num="-1" data-item="{{item}}" bind:tap="handleNum">-</view>
  152. <view class="num">{{item.prodCount}}</view>
  153. <view class="btn" data-num="1" data-item="{{item}}" bind:tap="handleNum">+</view>
  154. </view>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <!-- 空 -->
  160. <view class="empty" wx:else="{{!carData.length}}">
  161. <view class="empty-icon">
  162. <image src="../../images/icon/empty-basket.png"></image>
  163. </view>
  164. <view class="empty-text">您还没有添加商品到购物车哦~</view>
  165. </view>
  166. </view>
  167. </van-popup>
  168. <view class="bottom-box">
  169. <view class="left" bindtap="openCar">
  170. <view class="num" wx:if="{{totalInfo.count}}">{{totalInfo.count}}</view>
  171. <image class="icon" src="../../images/icon/car-icon.png" mode="" />
  172. <view class="price-box">
  173. <view class="top">
  174. <view class="price">¥{{totalInfo.finalMoney}}</view>
  175. <view class="reduce-price">共减¥{{totalInfo.subtractMoney}}</view>
  176. </view>
  177. <view class="shipping-fee">配送费¥0</view>
  178. </view>
  179. </view>
  180. <view class="btn" bind:tap="handleBuy">去结算</view>
  181. </view>
  182. <tabbar active="1"></tabbar>
  183. </view>
  184. <wxs module="wxs" src="../../wxs/number.wxs" />