category.wxml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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" 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='pic-box {{selIndex==index?"active":""}}'>
  30. <view wx:if="{{item.children.length == 0}}" class='sell-out-box'>
  31. <view class="sell-out-text">敬请期待</view>
  32. </view>
  33. <image class='icon {{selIndex==index?"active":""}}' src="{{imgUrl+item.icon}}" mode="" />
  34. </view>
  35. <view class='name {{selIndex==index?"active":""}} '>
  36. {{item.categoryName}}
  37. </view>
  38. </view>
  39. <view wx:if="{{5-(categoryList.length%5) >0}}" style="width: 100rpx;height: 100rpx;"></view>
  40. <view wx:if="{{5-(categoryList.length%5) >1}}" style="width: 100rpx;height: 100rpx;"></view>
  41. <view wx:if="{{5-(categoryList.length%5) >2}}" style="width: 100rpx;height: 100rpx;"></view>
  42. <view wx:if="{{5-(categoryList.length%5) >3}}" style="width: 100rpx;height: 100rpx;"></view>
  43. </view>
  44. <view class="close-box" bind:tap="onClose">
  45. 点击收起
  46. <image class="icon" src="../../images/icon/more-icon.png" mode="" />
  47. </view>
  48. </view>
  49. </van-popup>
  50. <!-- 顶部滚动分类 -->
  51. <view class="top-content">
  52. <scroll-view scroll-x="true" class='top-box' scroll-into-view-offset="-150" scroll-with-animation enable-passive scroll-into-view="{{'item'+selCategory}}">
  53. <view wx:for='{{categoryList}}' id="{{'item'+item.categoryId}}" class="type-item" wx:key='{{item.categoryId}}' data-index="{{index}}" data-id="{{item.categoryId}}" bindtap='onMenuTab'>
  54. <view style="display: flex;flex-direction: column;align-items: center;">
  55. <view class='pic-box {{selIndex==index?"active":""}}'>
  56. <view wx:if="{{item.children.length == 0}}" class='sell-out-box'>
  57. <view class="sell-out-text">敬请期待</view>
  58. </view>
  59. <image class='icon {{selIndex==index?"active":""}}' src="{{imgUrl+item.icon}}" mode="" />
  60. </view>
  61. <view class='name {{selIndex==index?"active":""}} '>
  62. {{item.categoryName}}
  63. </view>
  64. </view>
  65. </view>
  66. <view class="type-item" style="width: 100rpx;height: 44rpx"></view>
  67. </scroll-view>
  68. <view wx:if="{{categoryList.length}}" class="all" bind:tap="handleAll">展开
  69. <image class="icon" src="../../images/icon/more-icon.png" mode="" />
  70. </view>
  71. </view>
  72. <!-- 滚动内容区 -->
  73. <view class="main" wx:if="{{categoryList.length>0}}">
  74. <!-- 左侧菜单start -->
  75. <!-- <scroll-view scroll-y="true" class='leftmenu' scroll-into-view="{{'item'+subIndex}}"> -->
  76. <scroll-view scroll-y="true" class='leftmenu' >
  77. <view wx:for='{{subCategoryList}}' id="{{'item'+index}}" wx:key='categoryId'>
  78. <view class='menu-item {{subIndex==index?"active":""}} ' data-index="{{index}}" data-id="{{item.categoryId}}" bindtap='onleftMenuTab'>
  79. <image wx:if="{{item.icon}}" class="icon" src="{{item.icon}}" mode=""/>
  80. <image wx:elif="{{index == 0}}" class="icon" src="../../images/icon/good-icon.png" mode=""/>
  81. <image wx:elif="{{index == 1 || index ==4}}" class="icon" src="../../images/icon/hot-icon.png" mode=""/>
  82. <image wx:elif="{{index == 5}}" class="icon" src="../../images/icon/new-icon.png" mode=""/>
  83. {{item.categoryName}}
  84. </view>
  85. </view>
  86. <view style="height: 200rpx;"></view>
  87. </scroll-view>
  88. <!-- 左侧菜单end -->
  89. <!-- 右侧内容start -->
  90. <!-- scroll-view -->
  91. <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">
  92. <image class="banner" src="../../images/imgs/banner.png" mode="" />
  93. <!-- <text wx:if="{{subCategoryList.length>0}}" class="sub-title" >{{subCategoryList[subIndex].categoryName}}</text> -->
  94. <view class="loading" wx:if="{{showLoading}}">
  95. <image class="icon" src="../../images/imgs/loading-icon.png" mode=""/>
  96. </view>
  97. <view class="right-top-box">
  98. <view class="thrid-type-box" wx:if="{{thridCategoryList.length>0}}">
  99. <view class='thrid-type-item {{thridIndex==-1?"active":""}}' data-index="-1" bind:tap="handleThrid">全部</view>
  100. <view class='thrid-type-item {{thridIndex==index?"active":""}}' data-index="{{index}}" data-categoryId="{{item.categoryId}}" wx:for="{{thridCategoryList}}" bind:tap="handleThrid">{{item.categoryName}}</view>
  101. </view>
  102. <view class="filter-box">
  103. <view class="filter-item {{sort == 1 ?'active':''}}" bind:tap="handleSale">销量</view>
  104. <view class="filter-item" bind:tap="handlePrice">价格
  105. <!-- <view class="icon-box">
  106. <van-icon class="down" size="20rpx" color="{{sort ==2? '#006CE8':'#AAAAAA'}}" name="play" />
  107. <van-icon class="up" size="20rpx" color="{{sort ==3? '#006CE8':'#AAAAAA'}}" name="play" />
  108. </view> -->
  109. <image wx:if="{{sort == 0}}" class="icon" src="../../images/icon/sort1.png" mode=""/>
  110. <image wx:else class="icon" src="{{sort ==2?'../../images/icon/sort2.png':'../../images/icon/sort3.png'}}" mode=""/>
  111. </view>
  112. </view>
  113. </view>
  114. <scroll-view class="right-box" scroll-y="true" enable-passive upper-threshold="10" lower-threshold="10" scroll-top="{{topHeight}}" bindscroll="scroll" bindscrolltoupper="scrollTop" bindscrolltolower="scrollBottom">
  115. <view style="height:20px"></view>
  116. <view class="product-item" id="{{'test'+index}}" data-index="{{index}}" wx:for="{{productList}}" data-prodId="{{item.prodId}}" data-shopId="{{item.shopId}}" bind:tap="toProdPage">
  117. <view class="pic-box">
  118. <image class="pic" src="{{item.pic}}" mode="" />
  119. <view class="sell-out" wx:if="{{item.totalStocks == 0}}">
  120. <view class="sell-out-text">已售罄</view>
  121. </view>
  122. </view>
  123. <view class="info">
  124. <view class="title" data-prodId="{{item.prodId}}" data-shopId="{{item.shopId}}" bind:tap="toProdPage">{{item.prodName}}</view>
  125. <view class="salesVolume">已售{{item.salesVolume||0}}</view>
  126. <view class="price-box">
  127. <view class="price">¥{{item.price}}</view>
  128. <view wx:if="{{item.show}}" class="num-box">
  129. <image class="btn" data-num="-1" data-item="{{item}}" catch:tap="handleNum" src="/images/icon/reduce.png" mode=""/>
  130. <view class="num">{{item.prodCount}}</view>
  131. <image class="btn" data-num="1" data-item="{{item}}" data-type="add" catch:tap="handleNum" src="/images/icon/add.png" mode=""/>
  132. </view>
  133. <image wx:else class="test" style="width:52rpx;height:52rpx;" src="/images/icon/car-btn.png" mode="" data-img="/images/icon/car-btn.png" data-type="add" data-num="1" data-item="{{item}}" data-index="{{index}}" catch:tap="handleNum" />
  134. </view>
  135. </view>
  136. </view>
  137. <view wx:if="{{subCategoryList.length!=0&&productList.length == 0}}">
  138. <van-empty image="error" description="暂无商品" />
  139. </view>
  140. <view class="none" wx:if="{{subCategoryList.length==0&&productList.length == 0}}">
  141. <van-empty image="/images/icon/none.png" description="敬请期待" />
  142. </view>
  143. <view wx:if="{{productList.length}}" id="empty" class="block" style="height: 90vh;">
  144. </view>
  145. <!-- <view class="sub-cate-title not-category-data" wx:if="{{subCategoryList.length==0}}">
  146. <view class="sub-cate-text">无二级分类</view>
  147. </view> -->
  148. </scroll-view>
  149. </view>
  150. <!-- 右侧内容end -->
  151. </view>
  152. <view class="not-data-list" wx:else>
  153. <van-empty image="search" description="附近暂无可配送门店" />
  154. <!-- <view class="reset-localization" bindtap="toLocationPage">定位不准确?<text style="color: rgb(40,120,255);">点击手动定位</text></view> -->
  155. </view>
  156. <!-- 购物车弹窗 -->
  157. <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">
  158. <view class="car-box">
  159. <view wx:if="{{carData.length}}">
  160. <view class="item" wx:for="{{carData}}">
  161. <image class="img" src="{{item.pic}}" mode="" />
  162. <view class="info">
  163. <view class="title">{{item.prodName}}</view>
  164. <view class="desc">规格:{{item.weight}}{{item.weightUnit}}</view>
  165. <view class="price-box">
  166. <view class="price">
  167. <view class="unit">¥</view>
  168. <view class="num">{{item.price}}</view>
  169. </view>
  170. <view class="num-box">
  171. <image class="btn" data-num="-1" data-item="{{item}}" bind:tap="handleNum" src="/images/icon/reduce.png" mode=""/>
  172. <view class="num">{{item.prodCount}}</view>
  173. <image class="btn" data-num="1" data-type="add" data-item="{{item}}" bind:tap="handleNum" src="/images/icon/add.png" mode=""/>
  174. </view>
  175. </view>
  176. </view>
  177. </view>
  178. </view>
  179. <!-- 空 -->
  180. <view class="empty" wx:else="{{!carData.length}}">
  181. <view class="empty-icon">
  182. <image src="../../images/icon/empty-basket.png"></image>
  183. </view>
  184. <view class="empty-text">您还没有添加商品到购物车哦~</view>
  185. </view>
  186. </view>
  187. </van-popup>
  188. <view class="bottom-box">
  189. <view class="left" bindtap="openCar">
  190. <view class="num" wx:if="{{totalInfo.count}}">{{totalInfo.count}}</view>
  191. <image class="icon" src="/images/icon/basket-icon.png" mode="" />
  192. <view class="price-box">
  193. <view class="label">总计:</view>
  194. <!-- <view class="price">¥{{totalInfo.finalMoney}}</view> -->
  195. <view class='price'>
  196. <text class='symbol'>¥</text>
  197. <text class='big-num'>{{wxs.parsePrice(totalInfo.finalMoney)[0]}}</text>
  198. <text class='small-num'>.{{wxs.parsePrice(totalInfo.finalMoney)[1]}}</text>
  199. </view>
  200. </view>
  201. </view>
  202. <view class="btn" bind:tap="handleBuy">结算</view>
  203. </view>
  204. <tabbar active="1" class="my-tabbar"></tabbar>
  205. <!-- 抛物线动画容器(数据驱动渲染) -->
  206. <view class="animation-wrap" id="animationWrap">
  207. <view class="{{move?'move-x':''}}" style="position:absolute;width: 50rpx;height: 50rpx;left:{{animateInfo.startX}}px;top:{{animateInfo.startY}}px;--endX: {{animateInfo.endX-animateInfo.startX}}px;--endY: {{animateInfo.endY-animateInfo.startY}}px;" bind:animationend="endAnimate" >
  208. <image
  209. class="{{move?'move-y':''}}"
  210. src="/images/icon/car-btn.png"
  211. style="width: 40rpx;height: 40rpx;--endX: {{animateInfo.endX-animateInfo.startX}}px; --endY: {{animateInfo.endY-animateInfo.startY}}px;"
  212. bind:animationend="endAnimate"
  213. ></image>
  214. </view>
  215. </view>
  216. </view>
  217. <wxs module="wxs" src="../../wxs/number.wxs" />