classify.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="container">
  3. <view class="goodsList-box">
  4. <view class="goodsList-item flex" :key="ind" v-for="(ls, ind) in firstList" @click="navTo(ls)">
  5. <image :src="ls.image" mode=" scaleToFill"></image>
  6. <view class="goodsList-content">
  7. <view class="title clamp2">
  8. <text>{{ ls.store_name }}</text>
  9. </view>
  10. <view class="goods-money flex">
  11. <view class="money-box">
  12. <view class="old-price" v-if="ls.ot_price * 1 > ls.price * 1">
  13. <text class="old-left">¥{{ ls.ot_price }}</text>
  14. <image src="../../static/icon/down.png" mode="widthFix"></image>
  15. <text class="old-right">直降{{ ls.ot_price * 1 - ls.price * 1 }}元</text>
  16. </view>
  17. <view class="otMoney-box flex">
  18. <view class="otMoney">¥{{ ls.price }}</view>
  19. <view class="goodsList-btn">
  20. 立即购买
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. groomList
  33. } from '@/api/product.js';
  34. export default {
  35. data() {
  36. return {
  37. list: [],
  38. bannerImg: []
  39. };
  40. },
  41. onLoad(option) {
  42. // 获取查询对象
  43. this.type = option.type;
  44. // 加载基础数据
  45. this.loadData();
  46. },
  47. methods: {
  48. navTo: function(ls) {
  49. uni.navigateTo({
  50. url: '/pages/product/product?id=' + ls.id + '&isvip=1'
  51. });
  52. },
  53. // 请求载入数据
  54. async loadData() {
  55. groomList({}, this.type)
  56. .then(({
  57. data
  58. }) => {
  59. // 保存轮播图
  60. this.bannerImg = data.banner;
  61. // 保存商品信息
  62. this.list = data.list;
  63. })
  64. .catch(e => {
  65. console.log(e);
  66. });
  67. },
  68. // 轮播图跳转
  69. bannerNavToUrl(item) {
  70. // #ifdef H5
  71. if (item.wap_link.indexOf('http') > 0) {
  72. window.location.href = item.wap_link;
  73. }
  74. // #endif
  75. if (item.wap_link) {
  76. uni.navigateTo({
  77. url: item.wap_link
  78. });
  79. }
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss">
  85. page {
  86. background: $page-color-base;
  87. }
  88. .carousel-section {
  89. padding: 0;
  90. .titleNview-placing {
  91. padding-top: 0;
  92. height: 0;
  93. }
  94. .swiper-dots {
  95. left: 45rpx;
  96. bottom: 40rpx;
  97. }
  98. .carousel {
  99. width: 100%;
  100. height: 360rpx;
  101. .carousel-item {
  102. width: 100%;
  103. height: 100%;
  104. overflow: hidden;
  105. }
  106. image {
  107. width: 100%;
  108. height: 100%;
  109. }
  110. }
  111. }
  112. // 中间标题样式
  113. .type-title-box {
  114. padding: 40rpx;
  115. .title-content {
  116. height: 100%;
  117. width: 200rpx;
  118. text-align: center;
  119. font-size: $font-lg;
  120. font-weight: 500;
  121. color: $font-color-dark;
  122. }
  123. .title-border {
  124. width: 250rpx;
  125. height: 2rpx;
  126. background-color: #e9e9e9;
  127. }
  128. }
  129. // 商品列表
  130. .goodsList-box {
  131. .goodsList-item {
  132. margin-bottom: 40rpx;
  133. background-color: #ffffff;
  134. padding: 30rpx;
  135. image {
  136. flex-shrink: 0;
  137. border-radius: $border-radius-sm;
  138. height: 180rpx;
  139. width: 180rpx;
  140. }
  141. .goodsList-content {
  142. margin-left: 20rpx;
  143. flex-grow: 1;
  144. height: 180rpx;
  145. position: relative;
  146. .title {
  147. font-size: $font-base;
  148. color: $font-color-dark;
  149. font-weight: 500;
  150. }
  151. .goods-money {
  152. position: absolute;
  153. left: 0;
  154. bottom: 0;
  155. width: 100%;
  156. .money-box {
  157. image {
  158. width: 14rpx;
  159. margin: 0 6rpx 0 10rpx;
  160. }
  161. .old-price {
  162. .old-left {
  163. font-size: 26rpx;
  164. font-weight: 500;
  165. text-decoration: line-through;
  166. color: #999999;
  167. }
  168. .old-right {
  169. font-size: 24rpx;
  170. font-weight: bold;
  171. color: #b59467;
  172. }
  173. }
  174. .otMoney-box {
  175. display: flex;
  176. align-items: center;
  177. .otMoney {
  178. font-size: 36rpx;
  179. color: $color-red;
  180. padding-right: 20rpx;
  181. }
  182. }
  183. }
  184. .goodsList-btn {
  185. position: absolute;
  186. bottom: 0;
  187. right: 0;
  188. width: 137rpx;
  189. height: 52rpx;
  190. background: #9c0b18;
  191. border-radius: 26rpx;
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. font-size: 26rpx;
  196. font-family: PingFang SC;
  197. font-weight: 500;
  198. color: #FFFFFF;
  199. }
  200. }
  201. }
  202. }
  203. }
  204. </style>