index.vue 18 KB

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