storeList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <view class="container" @click="filterShow = false">
  3. <view class="top-box">
  4. <view class="search-box">
  5. <view class="search-left">
  6. <u-search placeholder="请输入搜索内容" :showAction="false" v-model="sellerListParams.keyword" />
  7. </view>
  8. <view class="search-right" @click='handlerSearch'>搜索</view>
  9. </view>
  10. <view class="filter-box">
  11. <view class="filter-item">
  12. <!-- <view class="fiter1">
  13. <u-icon name="map"></u-icon>
  14. <span class="filter-l">贵阳市青少年人才社区</span>
  15. <u-icon name="arrow-down-fill"></u-icon>
  16. </view> -->
  17. <view class="fiter2" @tap.stop="handlerSelectAllFilter(2)">
  18. <span>{{ sortCondition }}</span>
  19. <u-icon name="arrow-down-fill"></u-icon>
  20. </view>
  21. <view class="fiter1" @tap.stop="handlerSelectMenu(1)">
  22. <span>筛选</span>
  23. <u-icon name="arrow-down-fill"></u-icon>
  24. </view>
  25. </view>
  26. <view class="filter-drapdown" v-show="filterShow">
  27. <view class="filter1" v-show="filterType == 1">
  28. <view class="scroll-box">
  29. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="filter-menu-left scroll-Y"
  30. @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
  31. <view id="demo1" class="scroll-view-item uni-bg-red menu-item"
  32. :class="current == index ? 'act-left-menu' : ''" v-for="(item, index) of menuList" :key="index"
  33. @click.stop="handlerSelectLMenu(item, index)">{{ item.name }}
  34. </view>
  35. </scroll-view>
  36. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="filter-menu-right scroll-Y"
  37. @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
  38. <view id="demo1" class="scroll-view-item uni-bg-red" v-for="item of 15" :key="item">
  39. <view class="menu-right-title">洗车</view>
  40. <view class="menu-right-contentbox">
  41. <span class="menu-item" v-for="item of 7" :key="item">测试</span>
  42. </view>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </view>
  47. <view class="filter2" v-show="filterType == 2">
  48. <view @tap="sellerListFillter(1)">离我最近</view>
  49. <view @tap="sellerListFillter(2)">好评优先</view>
  50. <view @tap="sellerListFillter(3)">销量优先</view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="content-box">
  56. <view class="content-item" v-for="(item, index) in sellerList" :key="index" @tap="goSellerDetail(item.id)">
  57. <view class="item-left">
  58. <image class="img" :src="item.logo" mode="aspectFit"></image>
  59. <!-- <image class="img" :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo"
  60. mode="scaleToFill"></image> -->
  61. </view>
  62. <view class="item-right">
  63. <view>
  64. <view class="item-title">
  65. <view class="tag">常去</view>
  66. <view class="title">{{ `${item.name}(${item.address})` }}</view>
  67. </view>
  68. <view class="str-box">
  69. <view class="srt-left">
  70. <u-rate activeColor="#fc8400" :value="item.score" readonly></u-rate>
  71. <text>{{ item.score }}</text>
  72. </view>
  73. <view class="border"></view>
  74. <!-- <view class="srt-right">{{ item.sale }}单</view> -->
  75. <view class="srt-right"></view>
  76. </view>
  77. </view>
  78. <view class="bottom-textbox">
  79. <view class="bottom-left">宝安中心区美容洗车</view>
  80. <view class="bottom-right">{{ (item.distance / 1000).toFixed(2) }}KM</view>
  81. </view>
  82. </view>
  83. </view>
  84. <u-empty v-if="sellerList.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import { getSellerList } from '@/api/client/business.js';
  90. import { getCurrentLocation } from '@/api/client/home.js';
  91. import { mapGetters } from 'vuex';
  92. export default {
  93. data() {
  94. return {
  95. filterShow: false,
  96. filterType: 0,
  97. sortCondition: '综合排序',
  98. current: 0,
  99. menuList: [{
  100. name: '汽车',
  101. },
  102. {
  103. name: '汽车2',
  104. },
  105. {
  106. name: '汽车3',
  107. },
  108. {
  109. name: '汽车4',
  110. },
  111. ],
  112. sellerList: [],
  113. sellerListParams: {
  114. longitude: '',
  115. latitude: '',
  116. sort: 'SYNTHESE',
  117. size: 10,
  118. region: '', //地区编码
  119. keyword: '', //关键字
  120. categoryId: '', //分类ID
  121. },
  122. };
  123. },
  124. onLoad(option) {
  125. if(option.id){
  126. this.sellerListParams.categoryId = option.id;
  127. }
  128. if(option.keyword){
  129. this.sellerListParams.keyword = option.keyword;
  130. }
  131. },
  132. mounted() {
  133. let { latitude , longitude , region } = this.location
  134. this.sellerListParams.latitude = latitude
  135. this.sellerListParams.longitude = longitude
  136. this.sellerListParams.region = region
  137. this.getData();
  138. },
  139. computed:{
  140. ...mapGetters(['location'])
  141. },
  142. methods: {
  143. // 点击综合排序
  144. handlerSelectAllFilter(e) {
  145. this.filterShow = true;
  146. this.filterType = 2;
  147. },
  148. // 排序条件
  149. sellerListFillter(e) {
  150. switch (e) {
  151. case 1:
  152. this.sortCondition = '离我最近';
  153. this.sellerListParams.sort = 'NEAREST';
  154. break;
  155. case 2:
  156. this.sortCondition = '好评优先';
  157. this.sellerListParams.sort = 'FAVORITE';
  158. break;
  159. case 3:
  160. this.sortCondition = '销量优先';
  161. this.sellerListParams.sort = 'BESTSELLING';
  162. break;
  163. default:
  164. break;
  165. }
  166. this.getData();
  167. },
  168. // 获取初始化列表
  169. getData() {
  170. getSellerList(this.sellerListParams)
  171. .then(res => {
  172. this.sellerList = res.data;
  173. })
  174. .catch(err => {});
  175. },
  176. // 点击进入详情
  177. goSellerDetail(id) {
  178. uni.navigateTo({
  179. url: `/pages/client/clientPackage/storeDetail?id=${id}`,
  180. });
  181. },
  182. //
  183. handlerSelectMenu(e) {
  184. this.filterShow = true;
  185. this.filterType = 1;
  186. },
  187. // 选择左侧菜单
  188. handlerSelectLMenu(item, index) {
  189. this.current = index;
  190. },
  191. scroll() {},
  192. lower() {},
  193. upper() {},
  194. // 搜索
  195. handlerSearch(){
  196. this.getData()
  197. }
  198. },
  199. };
  200. </script>
  201. <style lang="scss" scoped>
  202. .container {
  203. min-height: 100vh;
  204. background-color: #efefef;
  205. .top-box {
  206. width: 100%;
  207. background-color: #fff;
  208. padding: 10rpx 20rpx;
  209. box-sizing: border-box;
  210. .search-box {
  211. display: flex;
  212. justify-content: space-around;
  213. align-items: center;
  214. .search-left {
  215. width: 80%;
  216. }
  217. .search-right {
  218. text-align: center;
  219. }
  220. }
  221. .filter-box {
  222. margin-top: 20rpx;
  223. .filter-item {
  224. display: flex;
  225. justify-content: space-between;
  226. .fiter1,
  227. .fiter2 {
  228. display: flex;
  229. align-items: center;
  230. }
  231. .filter-l {
  232. width: 200rpx;
  233. overflow: hidden;
  234. text-overflow: ellipsis;
  235. white-space: nowrap;
  236. }
  237. .fiter1 {
  238. color: #808080;
  239. font-size: 24rpx;
  240. }
  241. .fiter2 {}
  242. }
  243. .filter-drapdown {
  244. position: fixed;
  245. left: 0;
  246. width: 100%;
  247. background-color: #fff;
  248. // height: 300rpx;
  249. z-index: 999;
  250. box-shadow: 0 10rpx 20rpx -5rpx rgba(0, 0, 0, 0.2);
  251. .filter1 {
  252. .scroll-box {
  253. display: flex;
  254. max-height: 1200rpx;
  255. .filter-menu-left {
  256. width: 30%;
  257. background-color: #ebebeb;
  258. overflow-y: scroll;
  259. .menu-item {
  260. width: 100%;
  261. height: 100rpx;
  262. text-align: center;
  263. line-height: 100rpx;
  264. font-size: 30rpx;
  265. background-color: #ebebeb;
  266. color: #5a5a5a;
  267. }
  268. .act-left-menu {
  269. background-color: #fff;
  270. color: #5992bb;
  271. border-right: 8rpx solid #5992bb !important;
  272. }
  273. }
  274. .filter-menu-right {
  275. background-color: #fff;
  276. padding: 10rpx 20rpx;
  277. box-sizing: border-box;
  278. width: 70%;
  279. overflow-y: scroll;
  280. .menu-right-title {
  281. font-size: 30rpx;
  282. color: #000;
  283. margin-bottom: 10rpx;
  284. }
  285. .menu-right-contentbox {
  286. padding: 0 0 0 30rpx;
  287. display: flex;
  288. justify-content: left;
  289. flex-wrap: wrap;
  290. .menu-item {
  291. // width: 100rpx;
  292. padding: 0 20rpx;
  293. height: 40rpx;
  294. background-color: #cccccc;
  295. color: #000;
  296. text-align: center;
  297. line-height: 40rpx;
  298. margin: 10rpx 20rpx;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. .filter2 {
  305. padding: 20rpx 50rpx;
  306. box-sizing: border-box;
  307. view {
  308. margin: 30rpx 0;
  309. }
  310. }
  311. }
  312. }
  313. }
  314. .content-box {
  315. width: 100%;
  316. .content-item {
  317. background-color: #fff;
  318. padding: 10rpx 20rpx;
  319. box-sizing: border-box;
  320. margin: 10rpx 0;
  321. display: flex;
  322. .item-left {
  323. margin-right: 10rpx;
  324. .img {
  325. width: 200rpx;
  326. height: 200rpx;
  327. border-radius: 10rpx;
  328. }
  329. }
  330. .item-right {
  331. height: 200rpx;
  332. align-content: space-between;
  333. .item-title {
  334. display: flex;
  335. align-items: center;
  336. .tag {
  337. width: 80rpx;
  338. height: 46rpx;
  339. line-height: 35rpx;
  340. padding: 4rpx;
  341. font-size: 22rpx;
  342. box-sizing: border-box;
  343. background-color: #f6e7d4;
  344. color: #f99a47;
  345. border: 2rpx solid #f99a47;
  346. text-align: center;
  347. // align-items: center;
  348. margin-right: 10rpx;
  349. }
  350. .title {
  351. width: 85%;
  352. font-size: 30rpx;
  353. color: #000;
  354. font-weight: bold;
  355. overflow: hidden;
  356. text-overflow: ellipsis;
  357. display: -webkit-box;
  358. -webkit-line-clamp: 2;
  359. -webkit-box-orient: vertical;
  360. }
  361. }
  362. .str-box {
  363. display: flex;
  364. margin-top: 10rpx;
  365. .srt-left {
  366. display: flex;
  367. color: #fc8400;
  368. }
  369. .border {
  370. border-left: 2rpx solid #cfcfcf;
  371. margin: 0 20rpx;
  372. }
  373. .srt-right {}
  374. }
  375. .bottom-textbox {
  376. display: flex;
  377. justify-content: space-between;
  378. font-size: 26rpx;
  379. margin-top: 40rpx;
  380. .bottom-left {
  381. color: #c7c7c7;
  382. }
  383. .bottom-right {
  384. color: #000;
  385. }
  386. }
  387. }
  388. }
  389. }
  390. }
  391. </style>