vip.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. <uni-load-more :status="loadingType"></uni-load-more>
  21. </view>
  22. </template>
  23. <script>
  24. import { getProducts } from '@/api/product.js';
  25. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  26. import empty from '@/components/empty';
  27. export default {
  28. data() {
  29. return {
  30. list: [],
  31. page: 1,
  32. limit: 10,
  33. loadingType: 'more'
  34. };
  35. },
  36. components: {
  37. empty,
  38. uniLoadMore
  39. },
  40. onLoad(option) {
  41. // 获取查询对象
  42. this.type = option.type;
  43. // 加载基础数据
  44. this.loadData();
  45. },
  46. onReachBottom() {
  47. this.loadData();
  48. },
  49. methods: {
  50. navTo: function(ls) {
  51. uni.navigateTo({
  52. url: '/pages/product/product?id=' + ls.id
  53. });
  54. },
  55. // 请求载入数据
  56. async loadData() {
  57. let obj = this;
  58. if (this.loadingType == 'noMore' || this.loadingType == 'loading') {
  59. return;
  60. }
  61. this.loadingType = 'loading';
  62. getProducts({
  63. page: obj.page,
  64. limit: obj.limit,
  65. cid: 52
  66. })
  67. .then(({ data }) => {
  68. // 保存商品信息
  69. this.list = data;
  70. if (data.limit == obj.limit) {
  71. obj.loadingType = 'more';
  72. obj.page++;
  73. } else {
  74. obj.loadingType = 'noMore';
  75. }
  76. })
  77. .catch(e => {
  78. console.log(e);
  79. });
  80. },
  81. navToDetailPage(item) {
  82. let id = item.id;
  83. uni.navigateTo({
  84. url: '/pages/product/product?id=' + id + '&isVip=1'
  85. });
  86. },
  87. // 轮播图跳转
  88. bannerNavToUrl(item) {
  89. // #ifdef H5
  90. if (item.wap_link.indexOf('http') > 0) {
  91. window.location.href = item.wap_link;
  92. }
  93. // #endif
  94. if (item.wap_link) {
  95. uni.navigateTo({
  96. url: item.wap_link
  97. });
  98. }
  99. }
  100. }
  101. };
  102. </script>
  103. <style lang="scss">
  104. page {
  105. background: #fff;
  106. }
  107. .jx-box-content {
  108. margin: 20rpx auto 0;
  109. display: flex;
  110. width: 710rpx;
  111. background: #ffffff;
  112. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  113. border-radius: 10rpx;
  114. padding: 20rpx 30rpx 20rpx 14rpx;
  115. .content-left {
  116. flex-shrink: 0;
  117. width: 236rpx;
  118. height: 236rpx;
  119. background: #e2e2e2;
  120. border-radius: 10rpx;
  121. image {
  122. width: 100%;
  123. height: 100%;
  124. }
  125. }
  126. .content-right {
  127. width: 100%;
  128. margin-left: 20rpx;
  129. display: flex;
  130. flex-direction: column;
  131. justify-content: space-around;
  132. .shop-name {
  133. width: 382rpx;
  134. font-size: 32rpx;
  135. font-weight: bold;
  136. color: #333333;
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. display: -webkit-box;
  140. -webkit-box-orient: vertical;
  141. -webkit-line-clamp: 2;
  142. }
  143. .shop-content {
  144. display: flex;
  145. justify-content: space-between;
  146. .shop-content-left {
  147. display: flex;
  148. flex-direction: column;
  149. .price-box {
  150. display: flex;
  151. align-items: center;
  152. .yuan-price {
  153. font-size: 26rpx;
  154. font-weight: 500;
  155. text-decoration: line-through;
  156. color: #999999;
  157. }
  158. image {
  159. margin-left: 8rpx;
  160. width: 16rpx;
  161. height: 18rpx;
  162. }
  163. .j-price {
  164. margin-left: 8rpx;
  165. font-size: 24rpx;
  166. font-weight: bold;
  167. color: #b59467;
  168. }
  169. }
  170. .price-x {
  171. font-size: 36rpx;
  172. font-weight: bold;
  173. color: #ff4c4c;
  174. }
  175. }
  176. .shop-content-right {
  177. margin-top: 20rpx;
  178. align-items: center;
  179. text-align: center;
  180. width: 137rpx;
  181. height: 52rpx;
  182. font-size: 26rpx;
  183. font-weight: 500;
  184. color: #ffffff;
  185. background: linear-gradient(90deg, #bb9159, #e6c79d);
  186. border-radius: 26rpx;
  187. line-height: 52rpx;
  188. }
  189. }
  190. }
  191. }
  192. </style>