jfgood.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="main">
  3. <view class="top-search">
  4. <input type="text" class="search-key" placeholder="请输入关键字" v-model="keyword" />
  5. <image src="../../static/icon/search.png" mode="" class="search-logo"></image>
  6. <view class="search-btn" @click.stop="search">搜索</view>
  7. </view>
  8. <scroll-view scroll-y="true" :style="{'height': height}" class="scoll-wrap" @scrolltolower="getArticleList()">
  9. <view class="list-box-h">
  10. <view v-for="(item, index) in list" :key="index" class="guess-item" @click="navToDetailPage(item)">
  11. <image :src="item.image"></image>
  12. <view class="guess-box">
  13. <view class="title clamp2">{{ item.goods_name }}</view>
  14. <view class="flex itemContent">
  15. <view>
  16. <view class="price-box flex">
  17. <!-- <view class="yuanprice">{{ item.ot_price }}</view> -->
  18. <!-- <image src="../../static/img/jiantou.png" mode=""></image> -->
  19. <!-- <view class="jiang">直降{{ (item.ot_price - item.price).toFixed(2) }}元</view> -->
  20. </view>
  21. <view class="price" >{{ ((item.price)*(three_integral)).toFixed(2) }}积分</view>
  22. </view>
  23. <view class="btn">立即购买</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <uni-load-more :status="loadingType"></uni-load-more>
  29. </scroll-view>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. getJfList,getBl
  35. } from '@/api/product.js';
  36. export default {
  37. data() {
  38. return {
  39. height: '',
  40. list: [],
  41. page: 1,
  42. limit: 10,
  43. loadingType: 'more',
  44. total_pages: 0,
  45. keyword: '',
  46. three_integral: 1,
  47. }
  48. },
  49. onLoad(opt) {
  50. this.getArticleList()
  51. },
  52. // onReachBottom() {
  53. // this.getArticleList()
  54. // },
  55. onReady(res) {
  56. var obj = this;
  57. uni.getSystemInfo({
  58. success: resu => {
  59. const query = uni.createSelectorQuery();
  60. query.select('.scoll-wrap').boundingClientRect();
  61. query.exec(function(res) {
  62. console.log(res, 'ddddddddddddd');
  63. obj.height = resu.windowHeight - res[0].top + 'px';
  64. console.log('打印页面的剩余高度', obj.height);
  65. });
  66. },
  67. fail: res => {}
  68. });
  69. },
  70. methods: {
  71. navToDetailPage(item) {
  72. uni.navigateTo({
  73. url: '/pages/product/jfproduct?id=' + item.id
  74. });
  75. },
  76. getArticleList() {
  77. let obj = this
  78. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  79. return
  80. }
  81. obj.loadingType = 'loading'
  82. getJfList({
  83. page: obj.page,
  84. // limit: obj.limit,
  85. keyword: obj.keyword //商品关键字
  86. // is_gp:1 //设置是否vip商品
  87. }).then(({
  88. data
  89. }) => {
  90. obj.list = obj.list.concat(data.data)
  91. obj.total_pages = data.meta.pagination.total_pages
  92. obj.page++
  93. if(obj.page <= obj.total_pages) {
  94. obj.loadingType = 'more'
  95. }else {
  96. obj.loadingType = 'noMore'
  97. }
  98. // if (data.length == obj.limit) {
  99. // obj.loadingType = 'more'
  100. // } else {
  101. // obj.loadingType = 'noMore'
  102. // }
  103. })
  104. },
  105. search() {
  106. let obj = this
  107. obj.page = 1
  108. obj.list = []
  109. obj.loadingType = 'more'
  110. obj.getArticleList()
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. page {
  117. background-color: #fff;
  118. min-height: 100%;
  119. }
  120. .list-box-h {
  121. padding: 20rpx;
  122. }
  123. .guess-item {
  124. padding: 10rpx;
  125. display: flex;
  126. min-width: 100%;
  127. width: 0;
  128. margin-bottom: 20rpx;
  129. background: #ffffff;
  130. border-radius: 10rpx;
  131. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  132. image {
  133. width: 200rpx;
  134. height: 200rpx;
  135. border-radius: 10rpx;
  136. flex-shrink: 0;
  137. }
  138. .guess-box {
  139. width: 100%;
  140. padding: 5px;
  141. position: relative;
  142. .itemContent {
  143. position: absolute ;
  144. width: 100%;
  145. padding: 20rpx 10rpx;
  146. bottom: 0;
  147. right: 0;
  148. }
  149. .title {
  150. font-size: 30rpx;
  151. font-weight: bold;
  152. color: #333333;
  153. height: 2.5em;
  154. line-height: 1.25em;
  155. }
  156. .price-box {
  157. justify-content: flex-start;
  158. .yuanprice {
  159. font-size: 26rpx;
  160. font-family: PingFang SC;
  161. font-weight: 500;
  162. text-decoration: line-through;
  163. color: #999999;
  164. padding-right: 6rpx;
  165. }
  166. image {
  167. width: 14rpx;
  168. height: 16rpx;
  169. }
  170. .jiang {
  171. padding-left: 2rpx;
  172. font-size: 24rpx;
  173. font-family: PingFang SC;
  174. font-weight: bold;
  175. color: #b59467;
  176. }
  177. }
  178. .price {
  179. font-size: 36rpx;
  180. font-family: PingFang SC;
  181. font-weight: bold;
  182. color: #FF6F0F;
  183. }
  184. .btn {
  185. background: #16cc9f;
  186. border-radius: 28rpx;
  187. font-size: 28rpx;
  188. font-weight: 500;
  189. color: #ffffff;
  190. float: right;
  191. padding: 10rpx 20rpx;
  192. }
  193. }
  194. }
  195. .top-search {
  196. width: 750rpx;
  197. height: 100rpx;
  198. // padding-top: 20rpx;
  199. display: flex;
  200. justify-content: center;
  201. align-items: center;
  202. position: relative;
  203. .search-key {
  204. width: 700rpx;
  205. height: 70rpx;
  206. padding-left: 100rpx;
  207. background: #FFFFFF;
  208. box-shadow: 0px 1rpx 5rpx #16cc9f;
  209. border-radius: 35rpx;
  210. position: relative;
  211. }
  212. .search-logo {
  213. width: 36rpx;
  214. height: 36rpx;
  215. position: absolute;
  216. top: 0;
  217. bottom: 0;
  218. left: 50rpx;
  219. margin: auto;
  220. }
  221. .search-btn {
  222. width: 150rpx;
  223. height: 70rpx;
  224. border-radius: 30rpx;
  225. color: #16cc9f;
  226. text-align: center;
  227. line-height: 70rpx;
  228. position: absolute;
  229. top: 0;
  230. bottom: 0;
  231. right: 10rpx;
  232. margin: auto;
  233. // background-color: red;
  234. z-index: 9;
  235. }
  236. }
  237. </style>