list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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 >
  12. <!-- v-for="(item,index) in huodongList.activityImage.split(',')" :key="index" -->
  13. <image :src="imageUrl" style="width: 100%;height: 100%;border-radius: 24rpx;" mode="aspectFill"></image>
  14. </swiper-item>
  15. </swiper>
  16. </view>
  17. </view>
  18. <!-- #ifdef H5 -->
  19. <view style="position: fixed;top: 360rpx;width: 100%;z-index: 999;">
  20. <!-- #endif -->
  21. <!-- #ifndef H5 -->
  22. <view style="position: fixed;top: 290rpx;width: 100%;z-index: 999;">
  23. <!-- #endif -->
  24. <view class="flex justify-between align-center bg-white padding-tb padding-lr-sm">
  25. <view class="flex-sub text-center" :class="current==1?'select':''" @click="confirm(1)">综合排序</view>
  26. <view class="flex-sub text-center" :class="current==3?'select':''" @click="confirm(3)">距离优先</view>
  27. <view class="flex-sub text-center" :class="current==4?'select':''" @click="confirm(4)">销量优先</view>
  28. <view class="flex-sub text-center flex" @click="isShow = !isShow">
  29. <view class="flex align-center" style="margin: 0 auto;">
  30. <view :class="isShow?'select':''">筛选</view>
  31. <u-icon v-if="!isShow" name="arrow-down" size="28"></u-icon>
  32. <u-icon v-if="isShow" name="arrow-up" color="#FCD202" size="28"></u-icon>
  33. </view>
  34. </view>
  35. </view>
  36. <view v-if="isShow"
  37. style="position: absolute;top: 90rpx;width: 100%;z-index: 1000;background: rgba(0,0,0,.5);height: 100vh;"
  38. @click="isShow =false">
  39. <view class="padding-lr bg-white">
  40. <view class="flex justify-between align-center padding-tb-sm u-border-bottom"
  41. v-for="(item,index) in options4" :key='index' @click.stop="getSelect(item)">
  42. <view class="text-df" :class="item.select?'select':''">{{item.shopTypeName}}</view>
  43. <u-icon v-if="item.select" name="checkmark" color="#FCD202" size="28"></u-icon>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- #ifdef H5 -->
  49. <view class="padding-lr-sm" style="margin-top: 140px;">
  50. <!-- #endif -->
  51. <!-- #ifndef H5 -->
  52. <view class="padding-lr-sm" style="margin-top: 400rpx;min-height: 100vh; /* 设置最小高度为视口高度 */">
  53. <!-- #endif -->
  54. <view class="shopli" v-for="(item,index) in shopList" :key='index'>
  55. <view class="margin-tb-sm flex justify-between bg-white padding"
  56. @click="goNav(item.shopId,item,item.shopActivityList)">
  57. <image :src="item.shopCover" class="radius" style="width: 160rpx;height: 160rpx;"></image>
  58. <view class=" margin-left-sm" style="width: 450rpx;">
  59. <view class=" flex flex-direction justify-between">
  60. <view class="text-lg text-bold text-black">{{item.shopName}}</view>
  61. <view class="flex align-center margin-top-xs" style="width: 100%;">
  62. <u-icon name="star-fill" color="#FD6416" size="28"></u-icon>
  63. <text class="text-lg" style=""> {{item.shopScore?item.shopScore:0}}</text>
  64. <text
  65. class="text-gray flex-sub margin-left-xs">销量{{item.shopSales?item.shopSales:0}}</text>
  66. <text class="text-gray margin-left-xs">{{item.errandTime}}分钟</text>
  67. <text class="text-gray margin-left-xs">{{item.distance}}</text>
  68. </view>
  69. <view class="text-gray margin-top-xs flex justify-between">
  70. <view>起送 ¥{{item.minimumDelivery}} 配送 ¥{{item.errandMoney?item.errandMoney:0}}
  71. </view>
  72. <!-- <view style="color: #FCD202;">{{item.autoSendOrder==1?'商家配送':'平台配送'}}</view> -->
  73. </view>
  74. <view class="text-gray margin-top-xs" v-if="item.businessHours&&item.lockHours">
  75. 营业时间:{{item.businessHours}}-{{item.lockHours}}</view>
  76. <view class="flex margin-top-xs justify-between align-start" style="width: 100%;">
  77. <view class="flex flex-wrap align-center" style="width: 100%;height: 100%;overflow: hidden;">
  78. <view class="lable flex justify-center align-center" v-if="item.enableFullReductionFlag==0&&item.exemptMinMoney">
  79. 满{{item.exemptMinMoney}}免配送费</view>
  80. <!-- <view class="lable flex justify-center align-center" v-if="item.exemptMinMoney">满{{item.exemptMinMoney}}免配送费</view> -->
  81. <view v-for="(ite,ind) in item.shopActivityList" :key='ind' v-if="item.shopActivityList && ite.activityType!='1'">
  82. <view class="lable flex justify-center align-center" style="border-radius: 4rpx;background-color: #ffffff;color: red;box-sizing: border-box;">
  83. <text v-if="ite.activityType=='2'">时段</text>
  84. <text v-if="ite.activityType=='3'">满额</text>
  85. <text v-if="ite.activityType=='4'">全场</text>
  86. <text style="margin-left: 3px;">|</text>
  87. <text style="margin-left: 3px;">{{ite.activityName}}</text>
  88. </view>
  89. <!-- <view class="lable flex justify-center align-center"
  90. style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;"
  91. >{{ite.activityName}}
  92. </view> -->
  93. </view>
  94. <view class="lable flex justify-center align-center" v-for="(ite,ind) in item.shopLable" :key='ind'
  95. v-if="item.shopLable">
  96. {{ite}}
  97. </view>
  98. <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">
  99. <text>优惠券</text>
  100. <text style="margin-left: 3px;">|</text>
  101. <text style="margin-left: 3px;">满{{it.minMoney}}减{{it.money}}</text>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="flex margin-top-xs">
  107. <view v-for="(ite,ind) in item.goodsList" :key='ind'
  108. @click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
  109. <image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;" class="radius"
  110. mode=""></image>
  111. <view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
  112. <view class="text-bold margin-top-xs" style="color: #FD6416;">
  113. <text class="text-sm">¥</text> {{ite.goodsMoney}}
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <empty v-if="!shopList.length"></empty>
  122. <!-- 打样提示 -->
  123. <view v-if="hintShow" class="hintPopul" @click.stop="hintShow=false">
  124. <view class="content_">
  125. <image src="../../../static/images/index/shop.png" mode="" style="width: 200rpx;height: 180rpx;">
  126. </image>
  127. <view class="text-xl text-bold">店铺打烊啦</view>
  128. <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
  129. <view class="margin-top-xs text-gray margin-bottom">{{shop.businessHours}}-{{shop.lockHours}}</view>
  130. <view class="skuBtn" @click="hintShow=false">知道了</view>
  131. </view>
  132. </view>
  133. </view>
  134. <view v-else>
  135. <view style="font-size: 28upx;" v-html="content"></view>
  136. </view>
  137. </template>
  138. <script>
  139. import empty from '@/components/empty.vue'
  140. export default {
  141. components: {
  142. empty
  143. },
  144. data() {
  145. return {
  146. isShow: false,
  147. hintShow: false,
  148. shop: {},
  149. page: 1,
  150. limit: 10,
  151. shopList: [],
  152. current: 1,
  153. shopTypeId: '',
  154. userId: '',
  155. lng: '',
  156. lat: '',
  157. value1: 0,
  158. value2: 0,
  159. value3: 0,
  160. value4: 0,
  161. options1: [{
  162. label: '综合排序',
  163. value: 1,
  164. }],
  165. options2: [{
  166. value: '3',
  167. label: "距离优先"
  168. }],
  169. options3: [{
  170. value: '4',
  171. label: "销量优先"
  172. }],
  173. options4: [{
  174. id: '',
  175. select: true,
  176. shopTypeName: "全部"
  177. }],
  178. title: '综合排序',
  179. title1: '距离优先',
  180. title2: '销量优先',
  181. title3: '筛选',
  182. totalCount: 0,
  183. XCXIsSelect: '否',
  184. content:'',
  185. huodongList:[],
  186. activityTitle:'',
  187. activityId:'',
  188. imageUrl:'',
  189. }
  190. },
  191. onLoad(e) {
  192. console.log(e,'ll')
  193. this.imageUrl=e.imageUrl
  194. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  195. if (this.XCXIsSelect == '否') {
  196. this.getGuize()
  197. uni.setNavigationBarTitle({
  198. title: '隐私政策'
  199. });
  200. }
  201. let that = this
  202. uni.showLoading({
  203. title: '加载中',
  204. mask: true, // 是否显示透明蒙层,防止触摸穿透
  205. })
  206. that.shopTypeId = e.value ? e.value : ''
  207. that.value2 = e.value ? e.value : 0
  208. that.userId = uni.getStorageSync('userId')
  209. that.getShopType()
  210. uni.getLocation({
  211. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  212. success: function(res) {
  213. that.lat = res.latitude;
  214. that.lng = res.longitude;
  215. }
  216. });
  217. // that.getShopList()
  218. if(e.activityTitle){
  219. that.activityTitle = e.activityTitle
  220. uni.setNavigationBarTitle({
  221. title: e.activityTitle
  222. });
  223. // that.getHuoDongList()
  224. this.getShopList()
  225. }
  226. if(e.activityId){
  227. this.activityId = e.activityId
  228. uni.setNavigationBarTitle({
  229. title: '推荐商家'
  230. });
  231. this.getShopList()
  232. // that.getHuoDongList()
  233. }
  234. },
  235. methods: {
  236. // 跳转商品详情
  237. goDet(goodsId, shopId) {
  238. let userId = this.$queue.getData('userId');
  239. if (!userId) {
  240. uni.navigateTo({
  241. url: '/pages/public/login'
  242. })
  243. return
  244. }
  245. uni.navigateTo({
  246. url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
  247. })
  248. },
  249. //活动列表
  250. getHuoDongList(){
  251. let data = {
  252. activityTitle:this.activityTitle,
  253. activityId:this.activityId?this.activityId:''
  254. }
  255. this.$Request.getT('/app/activityManage/getActivityList',data).then(res => {
  256. if (res.code === 0) {
  257. this.huodongList = res.data.records[0]
  258. this.activityId = this.huodongList.activityId
  259. this.getShopList()
  260. }
  261. });
  262. },
  263. getGuize() {
  264. this.$Request.getT('/app/common/type/237').then(res => {
  265. if (res.code == 0) {
  266. this.content = res.data.value;
  267. // this.tit = res.data.min
  268. }
  269. });
  270. },
  271. goBack() {
  272. uni.navigateBack({
  273. })
  274. },
  275. getSelect(e) {
  276. console.log(e)
  277. this.options4.forEach(res => {
  278. if (res.id == e.id) {
  279. res.select = true
  280. this.page = 1
  281. this.shopTypeId = e.id
  282. this.getShopList();
  283. this.isShow = false
  284. } else {
  285. res.select = false
  286. }
  287. })
  288. },
  289. confirm(e) {
  290. console.log(e)
  291. this.page = 1
  292. this.current = e;
  293. this.getShopList();
  294. },
  295. confirm2(e) {
  296. console.log(e)
  297. this.page = 1
  298. this.current = e;
  299. this.getShopList();
  300. },
  301. confirm3(e) {
  302. console.log(e)
  303. this.page = 1
  304. this.current = e;
  305. this.getShopList();
  306. },
  307. confirm4(e) {
  308. console.log(e)
  309. this.page = 1
  310. this.shopTypeId = e
  311. this.getShopList();
  312. },
  313. // 商户列表
  314. getShopList() {
  315. let data = {
  316. page: this.page,
  317. limit: this.limit,
  318. screen: this.current,
  319. shopTypeId: this.shopTypeId,
  320. lng: uni.getStorageSync('lng'),
  321. lat: uni.getStorageSync('lat'),
  322. city:this.city
  323. }
  324. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  325. if (res.code == 0) {
  326. var totalCount=res.data.totalCount
  327. let data = {
  328. page: this.page,
  329. limit: totalCount,
  330. }
  331. this.$Request.getT(`/app/activity-shop/activity-shop-page/${this.activityId}`, data).then(res => {
  332. console.log(res,'hhhhhh2h')
  333. if (res.code == 0) {
  334. var huodongList=[]
  335. huodongList=res.data.list
  336. let data = {
  337. page: this.page,
  338. limit: totalCount,
  339. screen: this.current,
  340. shopTypeId: this.shopTypeId,
  341. lng: uni.getStorageSync('lng'),
  342. lat: uni.getStorageSync('lat'),
  343. city:this.city
  344. }
  345. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  346. if (res.code == 0) {
  347. this.totalCount = res.data.totalCount
  348. res.data.list.forEach(ret => {
  349. if (ret.distance > 1000) {
  350. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  351. } else {
  352. if (ret.distance == 0) {
  353. ret.distance = "0m";
  354. } else {
  355. ret.distance = Number(ret.distance).toFixed(1) + "m";
  356. }
  357. }
  358. ret.shopScore = ret.shopScore.toFixed(1)
  359. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  360. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  361. 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'
  362. ret.errandTime = Math.round(ret.errandTime)
  363. })
  364. var shopList=[]
  365. shopList=res.data.list
  366. for (let i = 0; i < shopList.length; i++) {
  367. let item1 = shopList[i];
  368. // 内层循环遍历array2
  369. for (let j = 0; j < huodongList.length; j++) {
  370. let item2 = huodongList[j];
  371. // 检查id是否相等
  372. if (item1.shopId === item2.shopId) {
  373. // 如果相等,将对象添加到matchedArray
  374. this.shopList.push(item1);
  375. // 如果只需要添加一次,则可以在这里退出内层循环
  376. // break;
  377. }
  378. }
  379. }
  380. }
  381. uni.stopPullDownRefresh();
  382. uni.hideLoading()
  383. })
  384. }
  385. })
  386. }
  387. uni.stopPullDownRefresh();
  388. uni.hideLoading()
  389. })
  390. },
  391. // 商户类型
  392. getShopType() {
  393. this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
  394. if (res.code == 0) {
  395. res.data.forEach(res => {
  396. res.select = false
  397. })
  398. this.options4 = [...this.options4, ...res.data]
  399. }
  400. })
  401. },
  402. goNav(url,e,shuzu) {
  403. this.shop = e
  404. // console.log(e, '当前店铺')
  405. let myDate = new Date();
  406. let hours = myDate.getHours();
  407. let minute = myDate.getMinutes();
  408. let openTime = this.shop.businessHours.split(':')[0] //开始小时
  409. let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
  410. let closeTime = this.shop.lockHours.split(':')[0] //结束小时
  411. let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
  412. console.log(hours)
  413. console.log(minute)
  414. console.log(openTime)
  415. console.log(openTime1)
  416. console.log(closeTime)
  417. console.log(closeTime1)
  418. console.log(minute >= closeTime1)
  419. if (hours < openTime) {
  420. this.hintShow = true
  421. return
  422. } else if (hours == openTime && minute < openTime1) {
  423. this.hintShow = true
  424. return
  425. } else if (hours > closeTime) {
  426. this.hintShow = true
  427. return
  428. } else if (hours == closeTime && minute >= closeTime1) {
  429. this.hintShow = true
  430. return
  431. }
  432. console.log(url)
  433. let items = encodeURIComponent(JSON.stringify(shuzu));
  434. if (this.userId) {
  435. uni.navigateTo({
  436. url:'/pages/index/shop/index?shopId='+url+'&huoListss='+items+'&shopTypeId='+e.shopTypeId
  437. })
  438. } else {
  439. uni.navigateTo({
  440. url: '/pages/public/login'
  441. })
  442. }
  443. },
  444. goShopDet(url, e) {
  445. this.shop = e
  446. console.log(url)
  447. if (this.userId) {
  448. uni.navigateTo({
  449. url
  450. })
  451. } else {
  452. uni.navigateTo({
  453. url: '/pages/public/login'
  454. })
  455. }
  456. },
  457. },
  458. onReachBottom: function() {
  459. if (this.shopList.length < this.totalCount) {
  460. this.page = this.page + 1;
  461. this.getShopList()
  462. } else {
  463. uni.showToast({
  464. title: '已经到底了',
  465. icon: 'none'
  466. })
  467. }
  468. },
  469. }
  470. </script>
  471. <style lang="scss">
  472. .select {
  473. color: #FCD202;
  474. }
  475. .shopli{
  476. }
  477. .hdSwiper{
  478. width: 100%;
  479. height: 290rpx;
  480. position: fixed;
  481. top: 0;
  482. z-index: 999;
  483. background-color: #ffffff;
  484. .hdSwiper-box{
  485. width: 686rpx;
  486. height: 100%;
  487. border-radius: 24rpx;
  488. }
  489. }
  490. .tabs {
  491. margin: 20rpx 0;
  492. display: flex;
  493. justify-content: space-between;
  494. align-items: center;
  495. }
  496. .tabs_name {
  497. flex: 1;
  498. /* display: inline-block; */
  499. text-align: center;
  500. margin-bottom: 30rpx 0;
  501. position: relative;
  502. display: flex;
  503. /* justify-content: space-between; */
  504. align-items: center;
  505. }
  506. .tabs_name view {
  507. margin: 0 auto;
  508. display: flex;
  509. align-items: center;
  510. }
  511. .tabs_2 {
  512. /* width: 30%; */
  513. }
  514. .actives {
  515. color: #007AFF;
  516. }
  517. .tabsicon {
  518. position: absolute;
  519. top: 0;
  520. right: 22rpx;
  521. width: 20rpx;
  522. height: 40rpx;
  523. z-index: 1;
  524. }
  525. .tabs_icon {
  526. width: 12rpx;
  527. height: 8rpx;
  528. z-index: 1;
  529. margin-left: 10rpx;
  530. }
  531. .icon1 {
  532. /* position: absolute; */
  533. /* top: 6rpx; */
  534. }
  535. .icon2 {
  536. position: absolute;
  537. bottom: 6rpx;
  538. }
  539. .hintPopul {
  540. width: 100%;
  541. height: 100vh;
  542. position: fixed;
  543. top: 0;
  544. background: rgba(0, 0, 0, .4);
  545. z-index: 999;
  546. }
  547. .content_ {
  548. position: absolute;
  549. left: 0;
  550. right: 0;
  551. top: 0;
  552. bottom: 0;
  553. margin: auto;
  554. text-align: center;
  555. width: 500rpx;
  556. height: 400rpx;
  557. border-radius: 20rpx;
  558. background-color: #fff;
  559. padding-top: 120rpx;
  560. }
  561. .content_ image {
  562. position: absolute;
  563. top: -50rpx;
  564. left: 0;
  565. right: 0;
  566. margin: auto;
  567. }
  568. .hintText {
  569. font-size: 30rpx;
  570. }
  571. .skuBtn {
  572. width: 460rpx;
  573. height: 60rpx;
  574. line-height: 60rpx;
  575. text-align: center;
  576. background: #FCD202;
  577. font-size: 28rpx;
  578. border: 2rpx solid #FCD202;
  579. color: #333333;
  580. border-radius: 50rpx;
  581. font-weight: 700;
  582. margin: auto;
  583. }
  584. .lable {
  585. border: 1rpx solid #FFE6D9;
  586. height: 40rpx;
  587. padding: 0 14rpx;
  588. background: #FFE6D9;
  589. border-radius: 4rpx;
  590. font-weight: 500;
  591. color: #FD6416;
  592. font-size: 20rpx;
  593. margin-right: 10rpx;
  594. margin-bottom: 10rpx;
  595. }
  596. </style>