index.vue 19 KB

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