classify.vue 4.2 KB

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