classify.vue 4.5 KB

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