classify.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="container">
  3. <view class="jg"></view>
  4. <view v-if="list.length != 0" class="good-wrapper flex" :key="ind" v-for="(good, ind) in list"
  5. @click="navTo(good)">
  6. <image :src="good.image" mode="" class="good-img"></image>
  7. <view class="good-info flex">
  8. <view class="tit clamp2">
  9. {{good.store_name }}
  10. </view>
  11. <view class="price-wrap">
  12. <view class="old-price">
  13. <text class="old">¥{{good.ot_price}}</text>
  14. <image src="../../static/icon/down.png" mode=""></image>
  15. <text class="zj">直降{{good.price - good.ot_price}}元</text>
  16. </view>
  17. <view class="integral-wrap">
  18. <text class="price">¥{{good.ot_price}}</text>
  19. </view>
  20. </view>
  21. <view class="btn">
  22. 立即购买
  23. </view>
  24. </view>
  25. </view>
  26. <empty v-if="list.length === 0"></empty>
  27. <view class="jg"></view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import empty from '@/components/empty';
  33. import {
  34. groomList
  35. } from '@/api/product.js';
  36. export default {
  37. data() {
  38. return {
  39. list: [],
  40. bannerImg: []
  41. };
  42. },
  43. components: {
  44. empty
  45. },
  46. onLoad(option) {
  47. // 获取查询对象
  48. this.type = option.type;
  49. if (this.type == 7) {
  50. uni.setNavigationBarTitle({
  51. title: '商家礼包'
  52. });
  53. }
  54. // 加载基础数据
  55. this.loadData();
  56. },
  57. methods: {
  58. navTo: function(ls) {
  59. uni.navigateTo({
  60. url: '/pages/product/product?id=' + ls.id
  61. });
  62. },
  63. // 请求载入数据
  64. async loadData() {
  65. groomList({}, this.type)
  66. .then(({
  67. data
  68. }) => {
  69. // 保存轮播图
  70. this.bannerImg = data.banner;
  71. // 保存商品信息
  72. this.list = data.list;
  73. })
  74. .catch(e => {
  75. console.log(e);
  76. });
  77. },
  78. // 轮播图跳转
  79. bannerNavToUrl(item) {
  80. // #ifdef H5
  81. if (item.wap_link.indexOf('http') > 0) {
  82. window.location.href = item.wap_link;
  83. }
  84. // #endif
  85. if (item.wap_link) {
  86. uni.navigateTo({
  87. url: item.wap_link
  88. });
  89. }
  90. }
  91. }
  92. };
  93. </script>
  94. <style lang="scss">
  95. page {
  96. background: $page-color-base;
  97. }
  98. .good-wrapper {
  99. width: 690rpx;
  100. height: 276rpx;
  101. justify-content: flex-start;
  102. align-items: flex-start;
  103. margin: 0 auto 20rpx;
  104. // &:last-of-type {
  105. // margin-bottom: 0;
  106. // }
  107. background: #FFFFFF;
  108. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  109. border-radius: 10rpx;
  110. padding: 20rpx 25rpx 20rpx 15rpx;
  111. .good-img {
  112. flex-shrink: 0;
  113. background-color: #eee;
  114. width: 236rpx;
  115. height: 236rpx;
  116. border-radius: 10rpx;
  117. margin-right: 20rpx;
  118. }
  119. .good-info {
  120. flex-direction: column;
  121. align-items: flex-start;
  122. width: 100%;
  123. height: 100%;
  124. position: relative;
  125. .tit {
  126. padding-top: 10rpx;
  127. padding-right: 15rpx;
  128. font-size: 32rpx;
  129. font-family: PingFang SC;
  130. font-weight: bold;
  131. }
  132. .btn {
  133. width: 137rpx;
  134. line-height: 52rpx;
  135. background: linear-gradient(0deg, #52C696 0%, #52C696 100%);
  136. border-radius: 26rpx;
  137. font-size: 26rpx;
  138. font-family: PingFang SC;
  139. font-weight: 500;
  140. text-align: center;
  141. color: #FFFFFF;
  142. position: absolute;
  143. bottom: 0;
  144. right: 0;
  145. }
  146. .price-wrap {
  147. .old-price {
  148. .old {
  149. font-size: 26rpx;
  150. font-family: PingFang SC;
  151. font-weight: 500;
  152. text-decoration: line-through;
  153. color: #999999;
  154. }
  155. image {
  156. display: inline-block;
  157. width: 14rpx;
  158. height: 20rpx;
  159. margin: 0 6rpx 0 10rpx;
  160. }
  161. .zj {
  162. font-size: 24rpx;
  163. font-family: PingFang SC;
  164. font-weight: bold;
  165. color: #B59467;
  166. }
  167. }
  168. .integral-wrap {
  169. display: flex;
  170. justify-content: flex-start;
  171. padding-top: 14rpx;
  172. image {
  173. width: 40rpx;
  174. height: 40rpx;
  175. margin-right: 8rpx;
  176. }
  177. .price {
  178. font-size: 36rpx;
  179. font-family: PingFang SC;
  180. font-weight: bold;
  181. color: #FF6F0F;
  182. line-height: 40rpx;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. </style>