food-nearby.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="food-nearby-page-container">
  3. <view class="fixed-container">
  4. <view class="search-container">
  5. <view class="search-header">
  6. <BeeBack>
  7. <view class="header-title">
  8. <BeeIcon :size="24" color="#000" name="arrowleft"></BeeIcon>
  9. <h1>{{ title }}</h1>
  10. </view>
  11. </BeeBack>
  12. <SearchBar
  13. prevent background="#fff" style="flex: 1;margin-right: 15upx;"
  14. @click="$jump('/pages_category_page1/search/index/index')"
  15. ></SearchBar>
  16. <view class="control">
  17. <view class="item">
  18. <BeeIcon
  19. :size="24" :src="require('../../../../static/images/icon/location2.png')"
  20. ></BeeIcon>
  21. <text>位置</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view v-if="list && list.length" class="menus-wrapper">
  27. <view
  28. v-for="item in list" :key="item.text" class="item" :class="{ active: queryParam.dressing === item.id }"
  29. @click="handleChooseMenu(item)"
  30. >
  31. <text>{{ item.storeName }}</text>
  32. </view>
  33. </view>
  34. <BeeStoreFilter
  35. :is-show-filter="false" style="margin: 0;padding: 24upx 28upx 20upx;"
  36. @select-distance="handleSelectDistance"
  37. ></BeeStoreFilter>
  38. </view>
  39. <view class="brand-list">
  40. <view v-if="$data._list && $data._list.length">
  41. <BeeBrandPane v-for="item in $data._list" :key="item.id" :is-positioning="false" :brand-info="item"></BeeBrandPane>
  42. </view>
  43. <view style="padding-bottom: 45upx;">
  44. <LoadMore
  45. :status="!$data._isEmpty && !$data._list.length
  46. ? 'loading' : !$data._isEmpty && $data._list.length && ($data._list.length >= $data._listTotal) ? 'no-more' : ''"
  47. >
  48. </LoadMore>
  49. <tui-no-data v-if="$data._isEmpty" :fixed="false" style="margin-top: 60upx;">暂无商家~</tui-no-data>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import loadData from '../../../../mixins/loadData'
  56. import { getSubMenuByPidApi, getHomeBrandListApi } from '../../../../api/user'
  57. export default {
  58. name: 'FoodNearby',
  59. mixins: [
  60. loadData({
  61. api: getHomeBrandListApi,
  62. mapKey: {
  63. list: 'list',
  64. listTotal: 'total',
  65. pageSize: 'pageSize'
  66. },
  67. dataFn(data) {
  68. const ignoreBrandList = ['佛山市顺德区修江缘美食餐饮店', '测试门店呀']
  69. return data.filter((item) => !ignoreBrandList.includes(item.name))
  70. }
  71. })
  72. ],
  73. data() {
  74. return {
  75. list: [],
  76. title: '',
  77. id: '',
  78. queryParam: {
  79. dressing: '',
  80. distance: ''
  81. }
  82. }
  83. },
  84. onLoad(options) {
  85. this.title = options.name
  86. this.id = options.id
  87. this.getMenus()
  88. },
  89. methods: {
  90. getBrandList() {
  91. this.$data._query = {
  92. ...this.$data._query,
  93. ...this.queryParam,
  94. areaId: this.$store.state.location.locationInfo.adcode,
  95. longitude: this.$store.state.location.locationInfo.streetNumber.location.split(',')[0],
  96. latitude: this.$store.state.location.locationInfo.streetNumber.location.split(',')[1]
  97. }
  98. this._loadData()
  99. },
  100. handleChooseMenu(item) {
  101. this.queryParam.dressing = item.id
  102. this.getBrandList()
  103. },
  104. // 获取当前页面的分类
  105. async getMenus() {
  106. const { data } = await getSubMenuByPidApi({
  107. dressing: this.id
  108. })
  109. this.list = data
  110. data && data.length ? this.queryParam.dressing = data[0].id : this.queryParam.dressing = this.id
  111. this.getBrandList()
  112. },
  113. handleSelectDistance(e) {
  114. this.queryParam.distance = e
  115. this.getBrandList()
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .food-nearby-page-container {
  122. width: 100vw;
  123. min-height: 100vh;
  124. background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, #f6f6f6 0%);
  125. .fixed-container {
  126. .search-header {
  127. display: flex;
  128. align-items: center;
  129. justify-content: space-between;
  130. padding: 44upx 22upx 0;
  131. box-sizing: border-box;
  132. .header-title {
  133. display: flex;
  134. align-items: center;
  135. }
  136. h1 {
  137. font-size: 28upx;
  138. color: #000;
  139. font-weight: normal;
  140. margin-right: 10upx;
  141. }
  142. .control {
  143. display: flex;
  144. align-items: center;
  145. .item {
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. flex-direction: column;
  150. color: #000;
  151. font-size: 24upx;
  152. margin-left: 8upx;
  153. &:nth-child(1) {
  154. margin-left: 0;
  155. }
  156. }
  157. }
  158. }
  159. .menus-wrapper {
  160. white-space: nowrap;
  161. display: flex;
  162. align-items: center;
  163. overflow: scroll;
  164. padding: 20upx 20upx 0 20upx;
  165. .item {
  166. height: 48upx;
  167. position: relative;
  168. font-size: 24upx;
  169. box-sizing: border-box;
  170. margin-right: 48upx;
  171. border-radius: 10upx;
  172. flex-shrink: 0;
  173. &::after {
  174. content: '';
  175. position: absolute;
  176. left: 50%;
  177. transform: translateX(-50%);
  178. bottom: 0;
  179. width: 0;
  180. height: 4upx;
  181. border-radius: 10upx;
  182. background-color: #FB5D5D;
  183. transition: all 350ms ease-in;
  184. }
  185. &.active {
  186. font-size: 28upx;
  187. font-weight: 500;
  188. &::after {
  189. width: 48upx;
  190. }
  191. }
  192. }
  193. }
  194. }
  195. .brand-list {
  196. padding: 0 20upx;
  197. box-sizing: border-box;
  198. }
  199. .no-data {
  200. text-align: center;
  201. color: #747474;
  202. height: 200upx;
  203. line-height: 200upx;
  204. }
  205. }
  206. </style>