list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <template>
  2. <view v-if="XCXIsSelect=='是'">
  3. <!-- #ifdef H5 -->
  4. <view class="hdSwiper flex justify-center" style="top: 80rpx;">
  5. <!-- #endif -->
  6. <!-- #ifndef H5 -->
  7. <view class="hdSwiper flex justify-center">
  8. <!-- #endif -->
  9. <view class="hdSwiper-box">
  10. <swiper :circular="true" :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000">
  11. <swiper-item v-for="(item,index) in huodongList.activityImage.split(',')" :key="index">
  12. <image :src="item" style="width: 100%;height: 100%;border-radius: 24rpx;" mode="aspectFill"></image>
  13. </swiper-item>
  14. </swiper>
  15. </view>
  16. </view>
  17. <!-- #ifdef H5 -->
  18. <view style="position: fixed;top: 360rpx;width: 100%;z-index: 999;">
  19. <!-- #endif -->
  20. <!-- #ifndef H5 -->
  21. <view style="position: fixed;top: 290rpx;width: 100%;z-index: 999;">
  22. <!-- #endif -->
  23. <view class="flex justify-between align-center bg-white padding-tb padding-lr-sm">
  24. <view class="flex-sub text-center" :class="current==1?'select':''" @click="confirm(1)">综合排序</view>
  25. <view class="flex-sub text-center" :class="current==3?'select':''" @click="confirm(3)">距离优先</view>
  26. <view class="flex-sub text-center" :class="current==4?'select':''" @click="confirm(4)">销量优先</view>
  27. <view class="flex-sub text-center flex" @click="isShow = !isShow">
  28. <view class="flex align-center" style="margin: 0 auto;">
  29. <view :class="isShow?'select':''">筛选</view>
  30. <u-icon v-if="!isShow" name="arrow-down" size="28"></u-icon>
  31. <u-icon v-if="isShow" name="arrow-up" color="#FCD202" size="28"></u-icon>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="isShow"
  36. style="position: absolute;top: 90rpx;width: 100%;z-index: 1000;background: rgba(0,0,0,.5);height: 100vh;"
  37. @click="isShow =false">
  38. <view class="padding-lr bg-white">
  39. <view class="flex justify-between align-center padding-tb-sm u-border-bottom"
  40. v-for="(item,index) in options4" :key='index' @click.stop="getSelect(item)">
  41. <view class="text-df" :class="item.select?'select':''">{{item.shopTypeName}}</view>
  42. <u-icon v-if="item.select" name="checkmark" color="#FCD202" size="28"></u-icon>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- #ifdef H5 -->
  48. <view class="padding-lr-sm" style="margin-top: 390rpx;">
  49. <!-- #endif -->
  50. <!-- #ifndef H5 -->
  51. <view class="padding-lr-sm" style="margin-top: 400rpx;">
  52. <!-- #endif -->
  53. <view class="" v-for="(item,index) in shopList" :key='index'>
  54. <view class="margin-tb-sm flex justify-between bg-white padding"
  55. @click="goNav('/pages/index/shop/index?shopId='+item.shopId)">
  56. <image :src="item.shopCover" class="radius" style="width: 160rpx;height: 160rpx;"></image>
  57. <view class=" margin-left-sm" style="width: 450rpx;">
  58. <view class=" flex flex-direction justify-between">
  59. <view class="text-lg text-bold text-black">{{item.shopName}}</view>
  60. <view class="flex align-center margin-top-xs" style="width: 100%;">
  61. <u-icon name="star-fill" color="#FD6416" size="28"></u-icon>
  62. <text class="text-lg" style=""> {{item.shopScore?item.shopScore:0}}</text>
  63. <text
  64. class="text-gray flex-sub margin-left-xs">销量{{item.shopSales?item.shopSales:0}}</text>
  65. <text class="text-gray margin-left-xs">{{item.errandTime}}分钟</text>
  66. <text class="text-gray margin-left-xs">{{item.distance}}</text>
  67. </view>
  68. <view class="text-gray margin-top-xs flex justify-between">
  69. <view>起送 ¥{{item.minimumDelivery}} 配送 ¥{{item.errandMoney?item.errandMoney:0}}
  70. </view>
  71. <view style="color: #FCD202;">{{item.autoSendOrder==1?'商家配送':'平台配送'}}</view>
  72. </view>
  73. <view class="text-gray margin-top-xs" v-if="item.businessHours&&item.lockHours">
  74. 营业时间:{{item.businessHours}}-{{item.lockHours}}</view>
  75. <view class="flex margin-top-xs justify-between align-start" style="width: 100%;">
  76. <view class="flex flex-wrap align-center" style="width: 100%;height: 100%;overflow: hidden;">
  77. <view class="lable flex justify-center align-center" v-if="item.exemptMinMoney">满{{item.exemptMinMoney}}免配送费</view>
  78. <view class="lable flex justify-center align-center" v-for="(ite,ind) in item.shopLable" :key='ind'
  79. v-if="item.shopLable">
  80. {{ite}}
  81. </view>
  82. <view class="lable flex justify-center align-center" v-if="item.couponList" style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;" v-for="(it,ide) in item.couponList" :key="ide">满{{it.minMoney}}减{{it.money}}</view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="flex margin-top-xs">
  87. <view v-for="(ite,ind) in item.goodsList" :key='ind'
  88. @click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
  89. <image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;" class="radius"
  90. mode=""></image>
  91. <view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
  92. <view class="text-bold margin-top-xs" style="color: #FD6416;">
  93. <text class="text-sm">¥</text> {{ite.goodsMoney}}
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <empty v-if="!shopList.length"></empty>
  102. </view>
  103. <view v-else>
  104. <view style="font-size: 28upx;" v-html="content"></view>
  105. </view>
  106. </template>
  107. <script>
  108. import empty from '@/components/empty.vue'
  109. export default {
  110. components: {
  111. empty
  112. },
  113. data() {
  114. return {
  115. isShow: false,
  116. hintShow: false,
  117. shop: {},
  118. page: 1,
  119. limit: 10,
  120. shopList: [],
  121. current: 1,
  122. shopTypeId: '',
  123. userId: '',
  124. lng: '',
  125. lat: '',
  126. value1: 0,
  127. value2: 0,
  128. value3: 0,
  129. value4: 0,
  130. options1: [{
  131. label: '综合排序',
  132. value: 1,
  133. }],
  134. options2: [{
  135. value: '3',
  136. label: "距离优先"
  137. }],
  138. options3: [{
  139. value: '4',
  140. label: "销量优先"
  141. }],
  142. options4: [{
  143. id: '',
  144. select: true,
  145. shopTypeName: "全部"
  146. }],
  147. title: '综合排序',
  148. title1: '距离优先',
  149. title2: '销量优先',
  150. title3: '筛选',
  151. totalCount: 0,
  152. XCXIsSelect: '否',
  153. content:'',
  154. huodongList:[],
  155. activityTitle:'',
  156. activityId:'',
  157. }
  158. },
  159. onLoad(e) {
  160. console.log(e)
  161. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  162. if (this.XCXIsSelect == '否') {
  163. this.getGuize()
  164. uni.setNavigationBarTitle({
  165. title: '隐私政策'
  166. });
  167. }
  168. let that = this
  169. uni.showLoading({
  170. title: '加载中'
  171. })
  172. that.shopTypeId = e.value ? e.value : ''
  173. that.value2 = e.value ? e.value : 0
  174. that.userId = uni.getStorageSync('userId')
  175. that.getShopType()
  176. uni.getLocation({
  177. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  178. success: function(res) {
  179. that.lat = res.latitude;
  180. that.lng = res.longitude;
  181. }
  182. });
  183. // that.getShopList()
  184. if(e.activityTitle){
  185. that.activityTitle = e.activityTitle
  186. uni.setNavigationBarTitle({
  187. title: e.activityTitle
  188. });
  189. that.getHuoDongList()
  190. }
  191. if(e.activityId){
  192. this.activityId = e.activityId
  193. uni.setNavigationBarTitle({
  194. title: '推荐商家'
  195. });
  196. that.getHuoDongList()
  197. }
  198. },
  199. methods: {
  200. // 跳转商品详情
  201. goDet(goodsId, shopId) {
  202. let userId = this.$queue.getData('userId');
  203. if (!userId) {
  204. uni.navigateTo({
  205. url: '/pages/public/login'
  206. })
  207. return
  208. }
  209. uni.navigateTo({
  210. url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
  211. })
  212. },
  213. //活动列表
  214. getHuoDongList(){
  215. let data = {
  216. activityTitle:this.activityTitle,
  217. activityId:this.activityId?this.activityId:''
  218. }
  219. this.$Request.getT('/app/activityManage/getActivityList',data).then(res => {
  220. if (res.code === 0) {
  221. this.huodongList = res.data.records[0]
  222. this.activityId = this.huodongList.activityId
  223. this.getShopList()
  224. }
  225. });
  226. },
  227. getGuize() {
  228. this.$Request.getT('/app/common/type/237').then(res => {
  229. if (res.code == 0) {
  230. this.content = res.data.value;
  231. // this.tit = res.data.min
  232. }
  233. });
  234. },
  235. goBack() {
  236. uni.navigateBack({
  237. })
  238. },
  239. getSelect(e) {
  240. console.log(e)
  241. this.options4.forEach(res => {
  242. if (res.id == e.id) {
  243. res.select = true
  244. this.page = 1
  245. this.shopTypeId = e.id
  246. this.getShopList();
  247. this.isShow = false
  248. } else {
  249. res.select = false
  250. }
  251. })
  252. },
  253. confirm(e) {
  254. console.log(e)
  255. this.page = 1
  256. this.current = e;
  257. this.getShopList();
  258. },
  259. confirm2(e) {
  260. console.log(e)
  261. this.page = 1
  262. this.current = e;
  263. this.getShopList();
  264. },
  265. confirm3(e) {
  266. console.log(e)
  267. this.page = 1
  268. this.current = e;
  269. this.getShopList();
  270. },
  271. confirm4(e) {
  272. console.log(e)
  273. this.page = 1
  274. this.shopTypeId = e
  275. this.getShopList();
  276. },
  277. // 商户列表
  278. getShopList() {
  279. // this.lng = uni.getStorageSync('lng')
  280. // this.lat = uni.getStorageSync('lat')
  281. let data = {
  282. page: this.page,
  283. limit: this.limit,
  284. screen: this.current,
  285. shopTypeId: this.shopTypeId,
  286. lng: uni.getStorageSync('lng'),
  287. lat: uni.getStorageSync('lat'),
  288. activityId:this.activityId
  289. }
  290. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  291. uni.hideLoading()
  292. if (res.code == 0) {
  293. console.log(res.data.list)
  294. this.totalCount = res.data.totalCount
  295. res.data.list.forEach(ret => {
  296. if (ret.distance > 1000) {
  297. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  298. } else {
  299. if (ret.distance == 0) {
  300. ret.distance = "0m";
  301. } else {
  302. ret.distance = Number(ret.distance).toFixed(1) + "m";
  303. }
  304. }
  305. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  306. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  307. '../../static/logo.png'
  308. ret.errandTime = Math.round(ret.errandTime)
  309. ret.shopScore = ret.shopScore.toFixed(1)
  310. })
  311. if (this.page == 1) {
  312. this.shopList = res.data.list
  313. } else {
  314. this.shopList = [...this.shopList, ...res.data.list]
  315. }
  316. console.log(this.shopList)
  317. }
  318. })
  319. },
  320. // 商户类型
  321. getShopType() {
  322. this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
  323. if (res.code == 0) {
  324. res.data.forEach(res => {
  325. res.select = false
  326. })
  327. this.options4 = [...this.options4, ...res.data]
  328. }
  329. })
  330. },
  331. goNav(url) {
  332. console.log(url)
  333. if (this.userId) {
  334. uni.navigateTo({
  335. url
  336. })
  337. } else {
  338. uni.navigateTo({
  339. url: '/pages/public/login'
  340. })
  341. }
  342. },
  343. goShopDet(url, e) {
  344. this.shop = e
  345. console.log(url)
  346. if (this.userId) {
  347. uni.navigateTo({
  348. url
  349. })
  350. } else {
  351. uni.navigateTo({
  352. url: '/pages/public/login'
  353. })
  354. }
  355. },
  356. },
  357. onReachBottom: function() {
  358. if (this.shopList.length < this.totalCount) {
  359. this.page = this.page + 1;
  360. this.getShopList()
  361. } else {
  362. uni.showToast({
  363. title: '已经到底了',
  364. icon: 'none'
  365. })
  366. }
  367. },
  368. }
  369. </script>
  370. <style lang="scss">
  371. .select {
  372. color: #FCD202;
  373. }
  374. .hdSwiper{
  375. width: 100%;
  376. height: 290rpx;
  377. position: fixed;
  378. top: 0;
  379. z-index: 999;
  380. background-color: #ffffff;
  381. .hdSwiper-box{
  382. width: 686rpx;
  383. height: 100%;
  384. border-radius: 24rpx;
  385. }
  386. }
  387. .tabs {
  388. margin: 20rpx 0;
  389. display: flex;
  390. justify-content: space-between;
  391. align-items: center;
  392. }
  393. .tabs_name {
  394. flex: 1;
  395. /* display: inline-block; */
  396. text-align: center;
  397. margin-bottom: 30rpx 0;
  398. position: relative;
  399. display: flex;
  400. /* justify-content: space-between; */
  401. align-items: center;
  402. }
  403. .tabs_name view {
  404. margin: 0 auto;
  405. display: flex;
  406. align-items: center;
  407. }
  408. .tabs_2 {
  409. /* width: 30%; */
  410. }
  411. .actives {
  412. color: #007AFF;
  413. }
  414. .tabsicon {
  415. position: absolute;
  416. top: 0;
  417. right: 22rpx;
  418. width: 20rpx;
  419. height: 40rpx;
  420. z-index: 1;
  421. }
  422. .tabs_icon {
  423. width: 12rpx;
  424. height: 8rpx;
  425. z-index: 1;
  426. margin-left: 10rpx;
  427. }
  428. .icon1 {
  429. /* position: absolute; */
  430. /* top: 6rpx; */
  431. }
  432. .icon2 {
  433. position: absolute;
  434. bottom: 6rpx;
  435. }
  436. .hintPopul {
  437. width: 100%;
  438. height: 100vh;
  439. position: fixed;
  440. top: 0;
  441. background: rgba(0, 0, 0, .4);
  442. z-index: 999;
  443. }
  444. .content_ {
  445. position: absolute;
  446. left: 0;
  447. right: 0;
  448. top: 0;
  449. bottom: 0;
  450. margin: auto;
  451. text-align: center;
  452. width: 500rpx;
  453. height: 400rpx;
  454. border-radius: 20rpx;
  455. background-color: #fff;
  456. padding-top: 120rpx;
  457. }
  458. .content_ image {
  459. position: absolute;
  460. top: -50rpx;
  461. left: 0;
  462. right: 0;
  463. margin: auto;
  464. }
  465. .hintText {
  466. font-size: 30rpx;
  467. }
  468. .skuBtn {
  469. width: 460rpx;
  470. height: 60rpx;
  471. line-height: 60rpx;
  472. text-align: center;
  473. background: #FCD202;
  474. font-size: 28rpx;
  475. border: 2rpx solid #FCD202;
  476. color: #333333;
  477. border-radius: 50rpx;
  478. font-weight: 700;
  479. margin: auto;
  480. }
  481. .lable {
  482. border: 1rpx solid #FFE6D9;
  483. height: 40rpx;
  484. padding: 0 14rpx;
  485. background: #FFE6D9;
  486. border-radius: 4rpx;
  487. font-weight: 500;
  488. color: #FD6416;
  489. font-size: 20rpx;
  490. margin-right: 10rpx;
  491. margin-bottom: 10rpx;
  492. }
  493. </style>