index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view :data-theme="theme">
  3. <tui-skeleton v-if="skeletonShow"></tui-skeleton>
  4. <view class="street-box">
  5. <view style="position: relative;" class="pad-30">
  6. <merchant-list :merchantList="merchantList" :isStreet="true"></merchant-list>
  7. </view>
  8. <view class='loadingicon acea-row row-center-wrapper'>
  9. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  10. </view>
  11. <view class='no-shop' v-if="!merchantList.length && !loading">
  12. <view class='pictrue' style="margin: 0 auto;">
  13. <!-- <image src='/static/images/no-shop.png'></image> -->
  14. <text>暂无店铺,快去搜索其他店铺吧</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view v-if="bottomNavigationIsCustom" class="footerBottom"></view>
  19. <pageFooter></pageFooter>
  20. </view>
  21. </template>
  22. <script>
  23. // +----------------------------------------------------------------------
  24. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  25. // +----------------------------------------------------------------------
  26. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  27. // +----------------------------------------------------------------------
  28. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  29. // +----------------------------------------------------------------------
  30. // | Author: CRMEB Team <admin@crmeb.com>
  31. // +----------------------------------------------------------------------
  32. import {
  33. getMerStreetApi
  34. } from '@/api/merchant.js';
  35. import merchantList from '@/components/merchantList/index.vue'
  36. import tuiSkeleton from '@/components/base/tui-skeleton.vue';
  37. import pageFooter from "@/components/pageFooter/index.vue";
  38. import {
  39. mapGetters
  40. } from "vuex";
  41. let app = getApp();
  42. export default {
  43. data() {
  44. return {
  45. theme: app.globalData.theme,
  46. where: {
  47. page: 1,
  48. limit: 20,
  49. },
  50. merchantList: [],
  51. skeletonShow: false,
  52. loadTitle: '',
  53. loading: false,
  54. loadend: false
  55. }
  56. },
  57. components: {
  58. merchantList,
  59. tuiSkeleton,
  60. pageFooter
  61. },
  62. computed: mapGetters(['bottomNavigationIsCustom']),
  63. onLoad: function(options) {
  64. uni.setNavigationBarTitle({
  65. title: '店铺街'
  66. })
  67. this.skeletonShow = true
  68. this.getMerStreet();
  69. },
  70. // 滚动监听
  71. onPageScroll(e) {
  72. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  73. uni.$emit('scroll');
  74. },
  75. methods:{
  76. goback() {
  77. uni.navigateBack()
  78. },
  79. getMerStreet: function(isPage) {
  80. let that = this;
  81. if (that.loadend) return;
  82. if (that.loading) return;
  83. if (isPage === true) that.$set(that, 'merchantList', []);
  84. that.loading = true;
  85. that.loadTitle = '';
  86. getMerStreetApi(that.where).then(res => {
  87. this.skeletonShow = false
  88. let list = res.data.list;
  89. let merchantList = that.$util.SplitArray(list, that.merchantList);
  90. let loadend = list.length < that.where.limit;
  91. that.loadend = loadend;
  92. that.loadTitle = loadend ? '没有了' : '加载更多';
  93. that.$set(that, 'merchantList', merchantList);
  94. that.$set(that.where, 'page', that.where.page + 1);
  95. that.loading = false;
  96. }).catch(err => {
  97. that.loading = false;
  98. that.loadTitle = '加载更多';
  99. });
  100. },
  101. },
  102. onReachBottom() {
  103. if (this.merchantList.length > 0) {
  104. this.getMerStreet();
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. page {
  111. height: auto;
  112. display: flex;
  113. flex-direction: column;
  114. height: 100%;
  115. /* #ifdef H5 */
  116. background-color: #fff;
  117. /* #endif */
  118. }
  119. </style>
  120. <style scoped lang="scss">
  121. .street-box{
  122. /deep/.mer_name {
  123. color: #fff;
  124. }
  125. }
  126. .pad-30{
  127. padding: 30rpx 30rpx 0 30rpx;
  128. /deep/.street-pad20{
  129. padding: 0;
  130. }
  131. }
  132. .bg_color {
  133. @include main_bg_color(theme);
  134. }
  135. .mp-bg {
  136. position: absolute;
  137. left: 0;
  138. top: 88rpx;
  139. width: 100%;
  140. height: 140rpx;
  141. @include index-gradient(theme);
  142. }
  143. .productList .search {
  144. width: 100%;
  145. height: 86rpx;
  146. padding-left: 30rpx;
  147. box-sizing: border-box;
  148. position: fixed;
  149. top: 88rpx;
  150. left: 0;
  151. z-index: 9;
  152. }
  153. .productList .search .input {
  154. width: 630rpx;
  155. height: 60rpx;
  156. background-color: #fff;
  157. border-radius: 50rpx;
  158. padding: 0 20rpx;
  159. box-sizing: border-box;
  160. }
  161. .productList .search .input input {
  162. width: 528rpx;
  163. height: 100%;
  164. font-size: 26rpx;
  165. }
  166. .productList .search .input .placeholder {
  167. color: #999;
  168. }
  169. .productList .search .input .iconfont {
  170. font-size: 35rpx;
  171. color: #555;
  172. }
  173. .productList .search .icon-yangshi1 {
  174. color: #fff;
  175. width: 62rpx;
  176. font-size: 40rpx;
  177. height: 86rpx;
  178. line-height: 86rpx;
  179. }
  180. </style>