classify.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="container">
  3. <view class="jx-box-content" v-for="(item, index) in list">
  4. <view class="content-left"><image :src="item.image" mode=""></image></view>
  5. <view class="content-right">
  6. <view class="shop-name">{{ item.store_name }}</view>
  7. <view class="shop-content">
  8. <view class="shop-content-left">
  9. <view class="price-box">
  10. <view class="yuan-price">¥{{ item.ot_price * 1 }}</view>
  11. <image src="../../static/sy/sy06.png" mode=""></image>
  12. <view class="j-price">直降{{ (item.ot_price - item.price).toFixed(2) * 1 }}元</view>
  13. </view>
  14. <view class="price-x">¥{{ item.price * 1 }}</view>
  15. </view>
  16. <view class="shop-content-right" @click="navToDetailPage(item)">购买</view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import { groomList } from '@/api/product.js';
  24. export default {
  25. data() {
  26. return {
  27. list: [],
  28. bannerImg: []
  29. };
  30. },
  31. onLoad(option) {
  32. // 获取查询对象
  33. this.type = option.type;
  34. // 加载基础数据
  35. this.loadData();
  36. },
  37. methods: {
  38. navTo: function(ls) {
  39. uni.navigateTo({
  40. url: '/pages/product/product?id=' + ls.id
  41. });
  42. },
  43. // 请求载入数据
  44. async loadData() {
  45. groomList(
  46. {
  47. page: 1,
  48. limit: 1000
  49. },
  50. 1
  51. )
  52. .then(({ data }) => {
  53. // 保存轮播图
  54. this.bannerImg = data.banner;
  55. // 保存商品信息
  56. this.list = data.list;
  57. })
  58. .catch(e => {
  59. console.log(e);
  60. });
  61. },
  62. // 轮播图跳转
  63. bannerNavToUrl(item) {
  64. // #ifdef H5
  65. if (item.wap_link.indexOf('http') > 0) {
  66. window.location.href = item.wap_link;
  67. }
  68. // #endif
  69. if (item.wap_link) {
  70. uni.navigateTo({
  71. url: item.wap_link
  72. });
  73. }
  74. }
  75. }
  76. };
  77. </script>
  78. <style lang="scss">
  79. page {
  80. background: #fff;
  81. }
  82. .jx-box-content {
  83. margin: 20rpx auto 0;
  84. display: flex;
  85. width: 710rpx;
  86. background: #ffffff;
  87. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  88. border-radius: 10rpx;
  89. padding: 20rpx 30rpx 20rpx 14rpx;
  90. .content-left {
  91. flex-shrink: 0;
  92. width: 236rpx;
  93. height: 236rpx;
  94. background: #e2e2e2;
  95. border-radius: 10rpx;
  96. image {
  97. width: 100%;
  98. height: 100%;
  99. }
  100. }
  101. .content-right {
  102. width: 100%;
  103. margin-left: 20rpx;
  104. display: flex;
  105. flex-direction: column;
  106. justify-content: space-around;
  107. .shop-name {
  108. width: 382rpx;
  109. font-size: 32rpx;
  110. font-weight: bold;
  111. color: #333333;
  112. overflow: hidden;
  113. text-overflow: ellipsis;
  114. display: -webkit-box;
  115. -webkit-box-orient: vertical;
  116. -webkit-line-clamp: 2;
  117. }
  118. .shop-content {
  119. display: flex;
  120. justify-content: space-between;
  121. .shop-content-left {
  122. display: flex;
  123. flex-direction: column;
  124. .price-box {
  125. display: flex;
  126. align-items: center;
  127. .yuan-price {
  128. font-size: 26rpx;
  129. font-weight: 500;
  130. text-decoration: line-through;
  131. color: #999999;
  132. }
  133. image {
  134. margin-left: 8rpx;
  135. width: 16rpx;
  136. height: 18rpx;
  137. }
  138. .j-price {
  139. margin-left: 8rpx;
  140. font-size: 24rpx;
  141. font-weight: bold;
  142. color: #b59467;
  143. }
  144. }
  145. .price-x {
  146. font-size: 36rpx;
  147. font-weight: bold;
  148. color: #ff4c4c;
  149. }
  150. }
  151. .shop-content-right {
  152. margin-top: 20rpx;
  153. align-items: center;
  154. text-align: center;
  155. width: 137rpx;
  156. height: 52rpx;
  157. font-size: 26rpx;
  158. font-weight: 500;
  159. color: #ffffff;
  160. background: linear-gradient(90deg, #bb9159, #e6c79d);
  161. border-radius: 26rpx;
  162. line-height: 52rpx;
  163. }
  164. }
  165. }
  166. }
  167. </style>