classify.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="w-full">
  3. <view>
  4. <u-row justify="space-between" customStyle="margin-bottom: 10px">
  5. <u-col span="3">
  6. <view class="icon-container-l">
  7. <uni-badge size="small" :text="100" absolute="rightTop">
  8. <u-icon label="自提" labelPos="bottom" size="38" name="order"></u-icon>
  9. </uni-badge>
  10. </view>
  11. </u-col>
  12. <view class="container">
  13. <u-tag plain :text="tags ? '营业中' : '离线'" :type="tags ? 'success' : 'error'" size="mini"></u-tag>
  14. <view @click="btnIc">
  15. <u-icon label="当前餐车名称" labelPos="left" size="16" name="arrow-down"></u-icon>
  16. </view>
  17. </view>
  18. <u-col span="3">
  19. <view class="icon-container-r">
  20. <u-icon label="我的" labelPos="bottom" size="38" name="account"></u-icon>
  21. </view>
  22. </u-col>
  23. </u-row>
  24. </view>
  25. <!-- <top-search :isSearch="false" @searchClick="searchClick"></top-search>
  26. <view class="w-full padding-lr-sm box-sizing-b dflex-b">
  27. <scroll-view class="goods-category" scroll-x>
  28. <view class="category-box">
  29. <view class="category-item padding-lr-lg" v-for="item in 8" :key="item" :class="{'on-category':onIndex === item}">分类{{item+1}}</view>
  30. </view>
  31. </scroll-view>
  32. <view class="classify-icon">
  33. <u-icon name="grid-fill" size="30" @click="show = true" />
  34. </view>
  35. </view>
  36. <u-popup :show="show" mode="left" @close="show = false">
  37. <view class="classify-popup padding-lr-lg padding-tb box-sizing-b">
  38. <view class="padding-tb-sm">全部</view>
  39. <view class="padding-tb-sm" v-for="index in 8">分类{{index+1}}</view>
  40. </view>
  41. </u-popup> -->
  42. <view class="w-full dflex-b padding-sm box-sizing-b dflex-wrap-w">
  43. <view class="goods-item margin-bottom-sm" v-for="(item, index) in goods" :key="index">
  44. <view class="img dflex-c" @click="toDetial">
  45. <image mode="aspectFit" :src="'../../static/x'+ index%2 +'.jpg'"></image>
  46. </view>
  47. <view class="title">{{item.goods_name}}</view>
  48. <view class="dflex padding-bottom-xs">
  49. <u-tag plain text="销量: 199" borderColor="#FF6D20" color="#FF6D20" size="mini"></u-tag>
  50. </view>
  51. <view class="w-full dflex-b">
  52. <view class="price">{{item.goods_price}}</view>
  53. <view>
  54. <u-button type="primary" shape="circle" size="small" icon="map"
  55. color="linear-gradient(to right, #F54319, #FF6D20)" @click="goCart"></u-button>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <my-gap :height="130" />
  61. <view class="cart-bottom padding-sm dflex-b">
  62. <view class="cart padding-lr">
  63. <uni-badge size="small" :text="100" absolute="rightTop">
  64. <u-icon name="shopping-cart-fill" size="28" color="#FF873D" @click="showCart"></u-icon>
  65. </uni-badge>
  66. <text class="cart-total">¥35.60</text>
  67. </view>
  68. <view class="balance dflex-c background-gradient">去结算</view>
  69. </view>
  70. <cartPopupVue ref="cartPopup" />
  71. </view>
  72. </template>
  73. <script>
  74. import cartPopupVue from '../../components/cartPopup.vue'
  75. export default {
  76. components: {
  77. cartPopupVue
  78. },
  79. data() {
  80. return {
  81. onIndex: 0,
  82. show: false,
  83. tags: 1,
  84. goods: [ // 购物车数据列表
  85. {
  86. id: 1,
  87. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  88. goods_price: "520.00",
  89. },
  90. {
  91. id: 2,
  92. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  93. goods_price: "520.00",
  94. },
  95. {
  96. id: 3,
  97. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  98. goods_price: "520.00",
  99. },
  100. {
  101. id: 4,
  102. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  103. goods_price: "520.00",
  104. },
  105. {
  106. id: 5,
  107. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  108. goods_price: "520.00",
  109. },
  110. {
  111. id: 6,
  112. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  113. goods_price: "520.00",
  114. }
  115. ]
  116. }
  117. },
  118. created() {
  119. },
  120. methods: {
  121. // 加购
  122. goCart() {
  123. },
  124. showCart() {
  125. this.$refs.cartPopup.setShow(true);
  126. },
  127. btnIc() {
  128. uni.navigateTo({
  129. url: `/pages/diningList/diningList`
  130. })
  131. },
  132. toDetial() {
  133. uni.navigateTo({
  134. url: `/pages/classify/detail`
  135. })
  136. }
  137. }
  138. }
  139. </script>
  140. <style scoped lang="scss">
  141. .goods-category {
  142. width: calc(100% - 100rpx);
  143. border-radius: 14rpx;
  144. overflow: hidden;
  145. .category-box {
  146. height: 70rpx;
  147. width: 100%;
  148. display: flex;
  149. align-items: center;
  150. .category-item {
  151. font-size: 14px;
  152. flex-shrink: 0;
  153. height: 100%;
  154. line-height: 70rpx;
  155. }
  156. .on-category {
  157. color: #FFF;
  158. background-color: #000;
  159. }
  160. }
  161. .classify-icon {
  162. width: 100rpx;
  163. display: flex;
  164. align-items: center;
  165. justify-content: flex-end;
  166. }
  167. }
  168. .goods-item {
  169. width: 48%;
  170. overflow: hidden;
  171. box-sizing: border-box;
  172. border: solid 4px #FFF;
  173. border-radius: 5px;
  174. box-shadow: 0px 3px 10px 0px rgba(213, 221, 232, 0.5);
  175. .img {
  176. width: 100%;
  177. height: 350rpx;
  178. overflow: hidden;
  179. background: #EEE;
  180. }
  181. .title {
  182. width: 100%;
  183. overflow: hidden;
  184. white-space: nowrap;
  185. text-overflow: ellipsis;
  186. padding: 10rpx;
  187. }
  188. }
  189. .cart-bottom {
  190. width: 100%;
  191. position: fixed;
  192. left: 0;
  193. bottom: 0;
  194. height: 130rpx;
  195. box-sizing: border-box;
  196. background-color: #FFF;
  197. box-shadow: 0px -4px 16px 0px rgba(0, 0, 0, 0.15);
  198. z-index: 10800;
  199. .cart {
  200. width: calc(100% - 220rpx);
  201. border-radius: 5px;
  202. background-color: #FEEEE4;
  203. display: flex;
  204. align-items: center;
  205. height: 100%;
  206. .cart-total {
  207. padding-left: 40rpx;
  208. font-size: 16px;
  209. font-weight: 700;
  210. }
  211. }
  212. .balance {
  213. width: 200rpx;
  214. height: 100%;
  215. background-color: #FF0000;
  216. font-size: $uni-font-size-lg;
  217. border-radius: 5px;
  218. color: #FFF;
  219. }
  220. }
  221. .classify-popup {
  222. width: 400rpx;
  223. }
  224. .container {
  225. display: flex;
  226. flex-direction: column;
  227. /* 垂直排列子元素 */
  228. align-items: center;
  229. /* 垂直居中子元素 */
  230. justify-content: center;
  231. /* 水平居中子元素 */
  232. }
  233. .icon-container-l {
  234. margin-top: 10px;
  235. margin-left: 15px;
  236. }
  237. .icon-container-r {
  238. margin-left: 20px;
  239. }
  240. </style>