construction.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="store-list">
  3. <scroll-view scroll-y="true" class="list" @scrolltolower="loadData()" :style="{'height': height}">
  4. <empty v-if="loaded && list.length == 0"></empty>
  5. <view class="store flex" v-for="item in list" @click="navTo('/pages/product/product?id=' + item.id)">
  6. <image :src="item.image" mode="" class="store-img"></image>
  7. <view class="store-info">
  8. <view class="store-name clamp2">{{item.store_name}}</view>
  9. <!-- <view class="store-detail">台州市椒江区市府大道120号</view> -->
  10. <!-- <view class="info clamp">鑫旺零售台州店鑫旺零售台州店</view> -->
  11. <view class="price-box">
  12. <view class="new-price">
  13. {{item.price}}
  14. <!-- <text class="old-price"> ¥220.00</text> -->
  15. </view>
  16. </view>
  17. <view class="qb-btn">立即购买</view>
  18. </view>
  19. </view>
  20. <uni-load-more :status="loadingType" v-if="list != 0"></uni-load-more>
  21. </scroll-view>
  22. </view>
  23. </template>
  24. <script>
  25. import empty from '@/components/empty';
  26. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  27. import {getProducts} from '@/api/product.js'
  28. export default {
  29. components: {
  30. uniLoadMore,
  31. empty
  32. },
  33. data() {
  34. return {
  35. list: [],
  36. storeList: [],
  37. loadingType: 'more',
  38. page: 1,
  39. limit: 10,
  40. height: '', //滚动区域高度
  41. loaded: false
  42. };
  43. },
  44. onReady(res) {
  45. var _this = this;
  46. uni.getSystemInfo({
  47. success: resu => {
  48. const query = uni.createSelectorQuery();
  49. query.select('.list').boundingClientRect();
  50. query.exec(function(res) {
  51. console.log(res, 'ddddddddddddd');
  52. _this.height = resu.windowHeight - res[0].top + 'px';
  53. console.log('打印页面的剩余高度', _this.height);
  54. });
  55. },
  56. fail: res => {}
  57. });
  58. },
  59. onLoad() {
  60. this.loadData();
  61. },
  62. methods: {
  63. navTo(url) {
  64. uni.navigateTo({
  65. url: url
  66. })
  67. },
  68. //获取施工产品信息
  69. loadData() {
  70. let obj = this;
  71. if (obj.loadingType == 'loading') {
  72. return;
  73. }
  74. if (obj.loadingType == 'noMore') {
  75. return;
  76. }
  77. getProducts({
  78. page: obj.page,
  79. limit: obj.limit,
  80. is_drop: 1
  81. }).then(({data}) => {
  82. console.log(data,'is_drop++++++++++++++++')
  83. let list = data.map(item => {
  84. return item
  85. })
  86. obj.list = obj.list.concat(list)
  87. obj.page++
  88. if (obj.limit == data.length) {
  89. //判断是否还有数据, 有改为 more, 没有改为noMore
  90. obj.loadingType = 'more';
  91. return;
  92. } else {
  93. //判断是否还有数据, 有改为 more, 没有改为noMore
  94. obj.loadingType = 'noMore';
  95. }
  96. // uni.hideLoading();
  97. this.$set(obj, 'loaded', true);
  98. })
  99. }
  100. }
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. .store-list {
  105. padding-top: 20rpx;
  106. }
  107. .store {
  108. margin: 0 auto 20rpx;
  109. // width: 710rpx;
  110. // height: 210rpx;
  111. // background: #ffffff;
  112. // box-shadow: 0px 0px 10rpx 0px rgba(0, 0, 0, 0.1);
  113. // border-radius: 10rpx;
  114. padding: 40rpx 20rpx;
  115. justify-content: flex-start;
  116. width: 710rpx;
  117. height: 280rpx;
  118. background: #ffffff;
  119. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  120. border-radius: 8rpx;
  121. .store-img {
  122. flex-shrink: 0;
  123. // background-color: red;
  124. width: 190rpx;
  125. height: 200rpx;
  126. border-radius: 10rpx;
  127. }
  128. .store-info {
  129. width: 481rpx;
  130. height: 100%;
  131. padding-left: 19rpx;
  132. position: relative;
  133. .store-name {
  134. width: 461rpx;
  135. padding-top: 10rpx;
  136. font-size: 30rpx;
  137. font-family: PingFang SC;
  138. font-weight: bold;
  139. color: #333333;
  140. }
  141. .store-detail {
  142. padding-top: 10rpx;
  143. font-size: 22rpx;
  144. font-family: PingFang SC;
  145. font-weight: 500;
  146. color: #666666;
  147. }
  148. .info {
  149. padding-top: 20rpx;
  150. font-size: 24rpx;
  151. font-family: PingFang SC;
  152. font-weight: 500;
  153. color: #FE6A42;
  154. }
  155. .qb-btn {
  156. width: 160rpx;
  157. height: 60rpx;
  158. line-height: 60rpx;
  159. line-height: 60rpx;
  160. text-align: center;
  161. background: linear-gradient(180deg, #fd4646, #ff3535);
  162. box-shadow: 0px 2rpx 20rpx 0px rgba(253, 67, 67, 0.5);
  163. border-radius: 30rpx;
  164. position: absolute;
  165. right: 0;
  166. bottom: 0;
  167. font-size: 28rpx;
  168. font-family: PingFang SC;
  169. font-weight: 500;
  170. color: #ffffff;
  171. text-align: center;
  172. }
  173. .price-box {
  174. padding-left: 20rpx;
  175. display: flex;
  176. align-items: flex-end;
  177. height: 42rpx;
  178. position: absolute;
  179. left: 0;
  180. bottom: 0;
  181. .new-price {
  182. font-size: 32rpx;
  183. font-family: PingFang SC;
  184. font-weight: bold;
  185. color: #ff0000;
  186. .old-price {
  187. display: inline-block;
  188. padding-left: 8rpx;
  189. font-size: 20rpx;
  190. font-family: PingFang SC;
  191. font-weight: 500;
  192. text-decoration: line-through;
  193. color: #999999;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. </style>