shop-deep.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="shop-deep-container">
  3. <BeeBack style="padding: 20upx 0;">
  4. <view style="display: flex;align-items: center;justify-content: space-between;">
  5. <BeeIcon name="arrowleft" :size="34" color="#222229" style="width: fit-content;"></BeeIcon>
  6. <view style="flex: 1;display: flex;align-items: center;" @click.stop="() => {}">
  7. <text style="font-weight: bold;font-size: 36upx;">{{ title }}</text>
  8. <tui-input
  9. v-model="queryInfo.search" label="" placeholder="社区商圈"
  10. clearable is-fillet padding="6upx 10upx 6upx 26upx"
  11. style="flex: 1;margin-left: 16upx;border: 2upx solid #EF5511;"
  12. >
  13. <template #right>
  14. <tui-button
  15. type="warning" width="120rpx" height="50rpx" shape="circle"
  16. style="background: #ee692f!important;"
  17. @click="queryInfo.search && (queryInfo.page = 1) && getNearByShopList()"
  18. >
  19. 搜索
  20. </tui-button>
  21. </template>
  22. </tui-input>
  23. </view>
  24. </view>
  25. </BeeBack>
  26. <!-- 菜单栏 -->
  27. <view
  28. v-if="menuBarArr && menuBarArr.length"
  29. style="display: flex;align-items: center;flex-wrap: wrap;margin: 14upx 26upx 0;padding: 22upx 22upx 2upx;background-color: #ffffff;border-radius: 20upx;"
  30. >
  31. <view
  32. v-for="item in menuBarArr" :key="item.id" style="width: 20%;margin-bottom: 20upx;text-align: center;"
  33. @click="getNearByShopList(false, item.id)"
  34. >
  35. <view>
  36. <BeeIcon
  37. :size="34"
  38. :src="item.picUrl ? common.seamingImgUrl(item.picUrl) : require('../../../static/images/index/design.png')"
  39. >
  40. </BeeIcon>
  41. </view>
  42. <view style="margin-top: 6upx;font-size: 26upx;white-space: nowrap;">{{ item.storeName }}</view>
  43. </view>
  44. </view>
  45. <view v-if="nearbyShopList.length" style="margin: 14upx 26upx 0;">
  46. <CommonShop
  47. v-for="shop in nearbyShopList" :key="shop.shopId" :shop-info="shop" bottom-type="brief"
  48. margin="22upx 0"
  49. radius="20upx"
  50. ></CommonShop>
  51. </view>
  52. <view style="padding-bottom: 45upx;">
  53. <LoadingMore
  54. :status="!isEmpty && !nearbyShopList.length
  55. ? 'loading' : !isEmpty && nearbyShopList.length && (nearbyShopList.length >= nearbyTotal) ? 'no-more' : ''"
  56. >
  57. </LoadingMore>
  58. <tui-no-data v-if="isEmpty" :fixed="false" style="margin-top: 60upx;">{{ `${title} 类目暂无商家认证` }}</tui-no-data>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import CommonShop from '../../../pages/business-district/components/CommonShop.vue'
  64. import { getShopCategorySonApi, getHomeBrandListApi } from '../../../api/anotherTFInterface'
  65. export default {
  66. name: 'ShopDeep',
  67. components: { CommonShop },
  68. data() {
  69. return {
  70. title: '',
  71. nearbyShopList: [],
  72. nearbyTotal: 0,
  73. isEmpty: false,
  74. queryInfo: {
  75. page: 1,
  76. pageSize: 10,
  77. search: '',
  78. classifyId: ''
  79. },
  80. menuBarArr: []
  81. }
  82. },
  83. async onLoad(options) {
  84. this.title = options.name || ''
  85. this.queryInfo.classifyId = options.id || ''
  86. this.getNearByShopList(true)
  87. const res = await getShopCategorySonApi({ pid: this.queryInfo.classifyId })
  88. this.menuBarArr = res.data || []
  89. },
  90. methods: {
  91. getNearByShopList(isLoadmore, classifyId) {
  92. uni.showLoading()
  93. getHomeBrandListApi({
  94. ...this.queryInfo,
  95. areaId: this.$store.state.location.locationInfo.adcode,
  96. longitude: this.$store.state.location.locationInfo.streetNumber.location.split(',')[0],
  97. latitude: this.$store.state.location.locationInfo.streetNumber.location.split(',')[1],
  98. classifyId: classifyId || this.queryInfo.classifyId
  99. })
  100. .then((res) => {
  101. this.nearbyTotal = res.data.total
  102. if (isLoadmore) {
  103. this.nearbyShopList.push(...res.data.list)
  104. } else {
  105. this.nearbyShopList = res.data.list
  106. }
  107. this.isEmpty = this.nearbyShopList.length === 0
  108. uni.hideLoading()
  109. })
  110. .catch(() => {
  111. uni.hideLoading()
  112. })
  113. }
  114. },
  115. onReachBottom() {
  116. if (this.nearbyShopList.length < this.nearbyTotal) {
  117. ++this.queryInfo.page
  118. this.getNearByShopList(true)
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="less" scoped>
  124. .shop-deep-container{
  125. min-height: 100vh;
  126. background-color: #f6f6f8;
  127. box-sizing: border-box;
  128. }
  129. </style>