classify.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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="normal" :text="txts" absolute="rightTop">
  8. <u-icon :name="iconCooking" label="自提" labelPos="bottom" size="32" ></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="32" :name="iconPeople"></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="shopping-cart-fill"
  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. import iconCooking from '../../static/cooking.png'
  76. import iconPeople from '../../static/people.png'
  77. export default {
  78. components: {
  79. cartPopupVue,
  80. },
  81. data() {
  82. return {
  83. onIndex: 0,
  84. show: false,
  85. iconCooking: iconCooking,
  86. iconPeople: iconPeople,
  87. tags: 1,
  88. txts: 1,
  89. goods: [ // 购物车数据列表
  90. {
  91. id: 1,
  92. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  93. goods_price: "520.00",
  94. },
  95. {
  96. id: 2,
  97. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  98. goods_price: "520.00",
  99. },
  100. {
  101. id: 3,
  102. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  103. goods_price: "520.00",
  104. },
  105. {
  106. id: 4,
  107. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  108. goods_price: "520.00",
  109. },
  110. {
  111. id: 5,
  112. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  113. goods_price: "520.00",
  114. },
  115. {
  116. id: 6,
  117. goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
  118. goods_price: "520.00",
  119. }
  120. ]
  121. }
  122. },
  123. created() {
  124. },
  125. methods: {
  126. // 加购
  127. goCart() {
  128. },
  129. showCart() {
  130. this.$refs.cartPopup.setShow(true);
  131. },
  132. btnIc() {
  133. uni.navigateTo({
  134. url: `/pages/diningList/diningList`
  135. })
  136. },
  137. toDetial() {
  138. uni.navigateTo({
  139. url: `/pages/goodDetail/goodDetail`
  140. })
  141. }
  142. }
  143. }
  144. </script>
  145. <style scoped lang="scss">
  146. .goods-category {
  147. width: calc(100% - 100rpx);
  148. border-radius: 14rpx;
  149. overflow: hidden;
  150. .category-box {
  151. height: 70rpx;
  152. width: 100%;
  153. display: flex;
  154. align-items: center;
  155. .category-item {
  156. font-size: 14px;
  157. flex-shrink: 0;
  158. height: 100%;
  159. line-height: 70rpx;
  160. }
  161. .on-category {
  162. color: #FFF;
  163. background-color: #000;
  164. }
  165. }
  166. .classify-icon {
  167. width: 100rpx;
  168. display: flex;
  169. align-items: center;
  170. justify-content: flex-end;
  171. }
  172. }
  173. .goods-item {
  174. width: 48%;
  175. overflow: hidden;
  176. box-sizing: border-box;
  177. border: solid 4px #FFF;
  178. border-radius: 5px;
  179. box-shadow: 0px 3px 10px 0px rgba(213, 221, 232, 0.5);
  180. .img {
  181. width: 100%;
  182. height: 350rpx;
  183. overflow: hidden;
  184. background: #EEE;
  185. }
  186. .title {
  187. width: 100%;
  188. overflow: hidden;
  189. white-space: nowrap;
  190. text-overflow: ellipsis;
  191. padding: 10rpx;
  192. }
  193. }
  194. .cart-bottom {
  195. width: 100%;
  196. position: fixed;
  197. left: 0;
  198. bottom: 0;
  199. height: 130rpx;
  200. box-sizing: border-box;
  201. background-color: #FFF;
  202. box-shadow: 0px -4px 16px 0px rgba(0, 0, 0, 0.15);
  203. z-index: 10800;
  204. .cart {
  205. width: calc(100% - 220rpx);
  206. border-radius: 5px;
  207. background-color: #FEEEE4;
  208. display: flex;
  209. align-items: center;
  210. height: 100%;
  211. .cart-total {
  212. padding-left: 40rpx;
  213. font-size: 16px;
  214. font-weight: 700;
  215. }
  216. }
  217. .balance {
  218. width: 200rpx;
  219. height: 100%;
  220. background-color: #FF0000;
  221. font-size: $uni-font-size-lg;
  222. border-radius: 5px;
  223. color: #FFF;
  224. }
  225. }
  226. .classify-popup {
  227. width: 400rpx;
  228. }
  229. .container {
  230. display: flex;
  231. flex-direction: column;
  232. /* 垂直排列子元素 */
  233. align-items: center;
  234. /* 垂直居中子元素 */
  235. justify-content: center;
  236. /* 水平居中子元素 */
  237. }
  238. .icon-container-l {
  239. margin-top: 10px;
  240. margin-left: 15px;
  241. }
  242. .icon-container-r {
  243. margin-left: 20px;
  244. }
  245. </style>