integral.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="center">
  3. <view class="titleNview-placing"></view>
  4. <swiper class="banner" autoplay="true" duration="400" interval="5000">
  5. <swiper-item class="banner-item" v-for="(item, index) in carouselList">
  6. <image src="../../static/img/jf_banner.png" />
  7. </swiper-item>
  8. </swiper>
  9. <view class="product-box" v-if="integralList.length != 0">
  10. <view class="product-title">
  11. <view class="pt-title">精选推荐</view>
  12. <view class="pt-bg">
  13. <image src="../../static/img/title.png" mode=""></image>
  14. </view>
  15. </view>
  16. <view class="hotgoods">
  17. <view class="hotgoods-item" v-for="item in integralList" :key="item.id" @click="navToDetailPage(item)">
  18. <view class="image-wrapper">
  19. <!-- <image class="image-bg" src="../../static/img/libao-bg.png" mode=""></image> -->
  20. <image class="image" :src="item.image" mode="scaleToFill"></image>
  21. </view>
  22. <view class="title clamp">{{ item.store_name }}</view>
  23. <view class="hot-price">
  24. <view class="price">
  25. <text class="font-size-sm">¥</text>
  26. {{ item.price * 1 }} + {{ item.max_integral * 1 }}积分
  27. </view>
  28. <!-- <view class="yuanPrice">月销:{{ item.sort }}</view> -->
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. loadIndexs
  38. } from '@/api/index.js';
  39. import {
  40. groomList
  41. } from '@/api/product.js';
  42. export default {
  43. data() {
  44. return {
  45. productname: '',
  46. integralList: [],
  47. carouselList: [''],
  48. page: 1,
  49. limit: 10,
  50. loadType: 'more'
  51. };
  52. },
  53. onShow: function() {
  54. // 判断是否强制登录
  55. // if (!this.hasLogin) {
  56. // // 登录拦截
  57. // interceptor();
  58. // }
  59. this.page = 1;
  60. this.limit = 10;
  61. this.loadType = 'more';
  62. this.integralList = [];
  63. this.loadData();
  64. },
  65. methods: {
  66. navTo(url) {
  67. if (url == '') {
  68. this.$api.msg('暂未开通,敬请期待');
  69. } else {
  70. uni.navigateTo({
  71. url,
  72. fail() {
  73. uni.switchTab({
  74. url
  75. });
  76. }
  77. });
  78. }
  79. },
  80. // 请求载入数据
  81. async loadData() {
  82. const obj = this;
  83. if (obj.loadType == 'loading' || obj.loadType == 'noMore') {
  84. return;
  85. }
  86. obj.loadType = 'loading';
  87. groomList({
  88. pages: obj.page,
  89. limit: obj.limit
  90. }, 5).then(({
  91. data
  92. }) => {
  93. this.integralList = this.integralList.concat(data.list);
  94. console.log(data.list, '123456');
  95. if (data.list.length == obj.limit) {
  96. obj.loadType = 'more';
  97. obj.page++;
  98. } else {
  99. obj.loadType = 'noMore';
  100. }
  101. });
  102. },
  103. //详情页
  104. navToDetailPage(item) {
  105. let id = item.id;
  106. uni.navigateTo({
  107. url: '/pages/product/product?id=' + id + '&isjf=1'
  108. });
  109. }
  110. }
  111. };
  112. </script>
  113. <style lang="scss">
  114. .center,
  115. page {
  116. height: auto;
  117. min-height: 100%;
  118. }
  119. .titleNview-placing {
  120. height: var(--status-bar-height);
  121. box-sizing: content-box;
  122. }
  123. .top-search {
  124. margin-top: 30rpx;
  125. height: 80rpx;
  126. padding: 0 20rpx;
  127. .search-box {
  128. position: relative;
  129. z-index: 2;
  130. justify-content: center;
  131. width: 740rpx;
  132. height: 60rpx;
  133. background: #fff;
  134. border-radius: 30rpx;
  135. .search {
  136. width: 26rpx;
  137. height: 30rpx;
  138. }
  139. .search-font input {
  140. width: 500rpx;
  141. margin-left: 14rpx;
  142. font-size: 28rpx;
  143. font-family: PingFang SC;
  144. font-weight: 500;
  145. color: #aaaaaa;
  146. }
  147. }
  148. }
  149. .banner {
  150. margin: 20rpx auto 0;
  151. width: 690rpx;
  152. height: 350rpx;
  153. .banner-item {
  154. width: 690rpx;
  155. height: 350rpx;
  156. image {
  157. width: 100%;
  158. height: 100%;
  159. }
  160. }
  161. }
  162. .product-box {
  163. margin-top: 20rpx;
  164. background: #ffffff;
  165. padding: 26rpx 30rpx 20rpx;
  166. .product-title {
  167. margin: 0 auto;
  168. position: relative;
  169. width: 352rpx;
  170. display: flex;
  171. align-items: center;
  172. .pt-title {
  173. width: 352rpx;
  174. text-align: center;
  175. font-size: 35rpx;
  176. font-family: Source Han Sans CN;
  177. font-weight: 500;
  178. color: #ff4c4c;
  179. }
  180. .pt-bg {
  181. position: absolute;
  182. top: 0;
  183. left: 0;
  184. right: 0;
  185. width: 352rpx;
  186. height: 9rpx;
  187. image {
  188. width: 100%;
  189. height: 100%;
  190. }
  191. }
  192. }
  193. .hotgoods {
  194. margin-top: 38rpx;
  195. width: 100%;
  196. display: flex;
  197. flex-wrap: wrap;
  198. padding: 0 0 30rpx;
  199. border-radius: 14rpx;
  200. .hotgoods-item {
  201. width: 48%;
  202. background-color: #ffffff;
  203. border-radius: 12rpx;
  204. &:nth-child(2n + 1) {
  205. margin-right: 24rpx;
  206. }
  207. .image-wrapper {
  208. width: 100%;
  209. height: 330rpx;
  210. border-radius: 3px;
  211. overflow: hidden;
  212. position: relative;
  213. .image-bg {
  214. position: absolute;
  215. top: 0;
  216. left: 0;
  217. right: 0;
  218. bottom: 0;
  219. width: 100%;
  220. height: 100%;
  221. opacity: 1;
  222. border-radius: 12rpx 12rpx 0 0;
  223. z-index: 2;
  224. }
  225. .image {
  226. width: 100%;
  227. height: 100%;
  228. opacity: 1;
  229. border-radius: 12rpx 12rpx 0 0;
  230. }
  231. }
  232. .title {
  233. margin-top: 24rpx;
  234. font-size: 34rpx;
  235. font-family: PingFang SC;
  236. font-weight: 500;
  237. color: #333333;
  238. }
  239. .hot-price {
  240. display: flex;
  241. justify-content: space-between;
  242. align-items: center;
  243. padding: 14rpx 0 10rpx;
  244. .price {
  245. margin-left: 10rpx;
  246. font-size: 30rpx;
  247. font-family: PingFang SC;
  248. font-weight: bold;
  249. color: #ff1a1a;
  250. }
  251. .yuanPrice {
  252. font-size: 30rpx;
  253. font-family: PingFang SC;
  254. font-weight: bold;
  255. color: #999999;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. </style>