shop.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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'&&item.vipPromotion=='0'">
  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&&item.vipPromotion=='0'" 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 class="lable flex justify-center align-center" v-if="item.vipPromotion=='1'" style="border-radius: 8rpx;border: 1rpx solid #F97A7A;background-color: #ffffff;color: #FF0000;box-sizing: border-box;">
  100. <text>会员</text>
  101. <text style="margin-left: 3px;">|</text>
  102. <text style="margin-left: 3px;">{{item.vipPromotionDesc}}</text>
  103. </view>
  104. <!-- <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> -->
  105. </view>
  106. </view>
  107. </view>
  108. <view class="flex margin-top-xs">
  109. <view v-for="(ite,ind) in item.goodsList" :key='ind'
  110. @click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
  111. <image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;" class="radius"
  112. mode=""></image>
  113. <view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
  114. <view class="text-bold margin-top-xs" style="color: #FD6416;">
  115. <text class="text-sm">¥</text> {{ite.goodsMoney}}
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <empty v-if="!shopList.length"></empty>
  124. <!-- 打样提示 -->
  125. <view v-if="hintShow" class="hintPopul" @click.stop="hintShow=false">
  126. <view class="content_">
  127. <image src="../../../static/images/index/shop.png" mode="" style="width: 200rpx;height: 180rpx;">
  128. </image>
  129. <view class="text-xl text-bold">店铺打烊啦</view>
  130. <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
  131. <view class="margin-top-xs text-gray margin-bottom">{{shop.businessHours}}-{{shop.lockHours}}</view>
  132. <view class="skuBtn" @click="hintShow=false">知道了</view>
  133. </view>
  134. </view>
  135. </view>
  136. <view v-else>
  137. <view style="font-size: 28upx;" v-html="content"></view>
  138. </view>
  139. </template>
  140. <script>
  141. import empty from '@/components/empty.vue'
  142. export default {
  143. components: {
  144. empty
  145. },
  146. data() {
  147. return {
  148. currenthd:-1,
  149. hdlist:[],
  150. activityId:'',
  151. isShow: false,
  152. hintShow: false,
  153. shop: {},
  154. page: 1,
  155. limit: 10,
  156. shopList: [],
  157. current: 1,
  158. shopTypeId: '',
  159. userId: '',
  160. lng: '',
  161. lat: '',
  162. value1: 0,
  163. value2: 0,
  164. value3: 0,
  165. value4: 0,
  166. options1: [{
  167. label: '综合排序',
  168. value: 1,
  169. }],
  170. options2: [{
  171. value: '3',
  172. label: "距离优先"
  173. }],
  174. options3: [{
  175. value: '4',
  176. label: "销量优先"
  177. }],
  178. options4: [{
  179. id: '',
  180. select: true,
  181. shopTypeName: "全部"
  182. }],
  183. title: '综合排序',
  184. title1: '距离优先',
  185. title2: '销量优先',
  186. title3: '筛选',
  187. totalCount: 0,
  188. XCXIsSelect: '否',
  189. content:'',
  190. hintShow: false,
  191. city:'',
  192. }
  193. },
  194. onLoad(e) {
  195. // console.log(e,'l')
  196. this.city=e.city
  197. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  198. if (this.XCXIsSelect == '否') {
  199. this.getGuize()
  200. uni.setNavigationBarTitle({
  201. title: '隐私政策'
  202. });
  203. } else {
  204. uni.setNavigationBarTitle({
  205. title: '店铺列表'
  206. });
  207. }
  208. let that = this
  209. uni.showLoading({
  210. title: '加载中',
  211. mask: true, // 是否显示透明蒙层,防止触摸穿透
  212. })
  213. that.shopTypeId = e.value ? e.value : ''
  214. that.value2 = e.value ? e.value : 0
  215. that.userId = uni.getStorageSync('userId')
  216. that.getShopType()
  217. uni.getLocation({
  218. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  219. success: function(res) {
  220. that.lat = res.latitude;
  221. that.lng = res.longitude;
  222. }
  223. });
  224. that.getShopList()
  225. // that.gethdlist();
  226. },
  227. methods: {
  228. //筛选活动
  229. searchhd(index,activityId){
  230. if(index==this.currenthd){
  231. this.currenthd = -1
  232. this.activityId = '';
  233. this.getShopList()
  234. }else{
  235. this.currenthd = index;
  236. this.activityId=activityId;
  237. this.getShopList()
  238. }
  239. },
  240. //获取所有活动
  241. gethdlist(){
  242. this.$Request.get("/app/activityManage/getActivityList").then(res => {
  243. if (res.code == 0) {
  244. res.data.records.map((item,index)=>{
  245. if(item.activityId==14){
  246. res.data.records.splice(index, 1)
  247. }
  248. })
  249. this.hdlist = res.data.records
  250. }
  251. });
  252. },
  253. // 跳转商品详情
  254. goDet(goodsId, shopId) {
  255. let userId = this.$queue.getData('userId');
  256. // if (!userId) {
  257. // uni.navigateTo({
  258. // url: '/pages/public/login'
  259. // })
  260. // return
  261. // }
  262. uni.navigateTo({
  263. url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
  264. })
  265. },
  266. getGuize() {
  267. this.$Request.getT('/app/common/type/237').then(res => {
  268. if (res.code == 0) {
  269. this.content = res.data.value;
  270. // this.tit = res.data.min
  271. }
  272. });
  273. },
  274. goBack() {
  275. uni.navigateBack({
  276. })
  277. },
  278. getSelect(e) {
  279. // console.log(e)
  280. this.options4.forEach(res => {
  281. if (res.id == e.id) {
  282. res.select = true
  283. this.page = 1
  284. this.shopTypeId = e.id
  285. this.getShopList();
  286. this.isShow = false
  287. } else {
  288. res.select = false
  289. }
  290. })
  291. },
  292. confirm(e) {
  293. // console.log(e)
  294. this.page = 1
  295. this.current = e;
  296. this.getShopList();
  297. },
  298. confirm2(e) {
  299. // console.log(e)
  300. this.page = 1
  301. this.current = e;
  302. this.getShopList();
  303. },
  304. confirm3(e) {
  305. // console.log(e)
  306. this.page = 1
  307. this.current = e;
  308. this.getShopList();
  309. },
  310. confirm4(e) {
  311. // console.log(e)
  312. this.page = 1
  313. this.shopTypeId = e
  314. this.getShopList();
  315. },
  316. // 商户列表
  317. getShopList() {
  318. // this.lng = uni.getStorageSync('lng')
  319. // this.lat = uni.getStorageSync('lat')
  320. let data = {
  321. page: this.page,
  322. limit: this.limit,
  323. screen: this.current,
  324. shopTypeId: this.shopTypeId,
  325. lng: uni.getStorageSync('lng'),
  326. lat: uni.getStorageSync('lat'),
  327. vipPromotion:1,
  328. city:this.city
  329. // activityId: this.activityId,
  330. }
  331. console.log(data,'输入数据')
  332. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  333. uni.hideLoading()
  334. if (res.code == 0) {
  335. console.log(res.data.list)
  336. this.totalCount = res.data.totalCount
  337. // 先筛选出 vipPromotion 为 1 的数据
  338. const vipPromotionList = res.data.list//.filter(ret => ret.vipPromotion === '1');
  339. vipPromotionList.forEach(ret => {
  340. if (ret.distance > 1000) {
  341. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  342. } else {
  343. if (ret.distance == 0) {
  344. ret.distance = "0m";
  345. } else {
  346. ret.distance = Number(ret.distance).toFixed(1) + "m";
  347. }
  348. }
  349. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  350. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  351. 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'
  352. ret.errandTime = Math.round(ret.errandTime)
  353. ret.shopScore = ret.shopScore.toFixed(1)
  354. })
  355. if (this.page == 1) {
  356. this.shopList = vipPromotionList
  357. } else {
  358. this.shopList = [...this.shopList, ...vipPromotionList]
  359. }
  360. console.log(this.shopList)
  361. }
  362. })
  363. },
  364. // 商户类型
  365. getShopType() {
  366. this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
  367. if (res.code == 0) {
  368. res.data.forEach(res => {
  369. res.select = false
  370. })
  371. this.options4 = [...this.options4, ...res.data]
  372. }
  373. })
  374. },
  375. goNav(url,e,shuzu) {
  376. this.shop = e
  377. // console.log(e, '当前店铺')
  378. let myDate = new Date();
  379. let hours = myDate.getHours();
  380. let minute = myDate.getMinutes();
  381. let openTime = this.shop.businessHours.split(':')[0] //开始小时
  382. let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
  383. let closeTime = this.shop.lockHours.split(':')[0] //结束小时
  384. let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
  385. // console.log(hours)
  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. onReachBottom: function() {
  454. if (this.shopList.length < this.totalCount) {
  455. this.page = this.page + 1;
  456. this.getShopList()
  457. } else {
  458. uni.showToast({
  459. title: '已经到底了',
  460. icon: 'none'
  461. })
  462. }
  463. },
  464. }
  465. </script>
  466. <style lang="scss">
  467. .hd{
  468. width: 100%;
  469. height: auto;
  470. background-color: rgb(248, 248, 248);
  471. padding: 20rpx 0 20rpx 0;
  472. z-index: 1;
  473. // margin-top: 20rpx;
  474. .hd-box{
  475. width: 686rpx;
  476. height: 100%;
  477. .scroll-view_H{
  478. width: 100%;
  479. white-space: nowrap;
  480. }
  481. .hd-box-item{
  482. display: inline-block;
  483. padding: 10rpx 20rpx 10rpx 20rpx;
  484. background-color: #ffffff;
  485. font-size: 24rpx;
  486. border-radius: 8rpx;
  487. margin-right: 10rpx;
  488. }
  489. }
  490. }
  491. .shopli{
  492. }
  493. .select {
  494. padding-bottom: 5rpx;
  495. border-bottom: 6rpx solid #568D84;
  496. }
  497. .tabs {
  498. margin: 20rpx 0;
  499. display: flex;
  500. justify-content: space-between;
  501. align-items: center;
  502. }
  503. .tabs_name {
  504. flex: 1;
  505. /* display: inline-block; */
  506. text-align: center;
  507. margin-bottom: 30rpx 0;
  508. position: relative;
  509. display: flex;
  510. /* justify-content: space-between; */
  511. align-items: center;
  512. }
  513. .tabs_name view {
  514. margin: 0 auto;
  515. display: flex;
  516. align-items: center;
  517. }
  518. .tabs_2 {
  519. /* width: 30%; */
  520. }
  521. .actives {
  522. color: #007AFF;
  523. }
  524. .tabsicon {
  525. position: absolute;
  526. top: 0;
  527. right: 22rpx;
  528. width: 20rpx;
  529. height: 40rpx;
  530. z-index: 1;
  531. }
  532. .tabs_icon {
  533. width: 12rpx;
  534. height: 8rpx;
  535. z-index: 1;
  536. margin-left: 10rpx;
  537. }
  538. .icon1 {
  539. /* position: absolute; */
  540. /* top: 6rpx; */
  541. }
  542. .icon2 {
  543. position: absolute;
  544. bottom: 6rpx;
  545. }
  546. .hintPopul {
  547. width: 100%;
  548. height: 100vh;
  549. position: fixed;
  550. top: 0;
  551. background: rgba(0, 0, 0, .4);
  552. z-index: 999;
  553. }
  554. .content_ {
  555. position: absolute;
  556. left: 0;
  557. right: 0;
  558. top: 0;
  559. bottom: 0;
  560. margin: auto;
  561. text-align: center;
  562. width: 500rpx;
  563. height: 400rpx;
  564. border-radius: 20rpx;
  565. background-color: #fff;
  566. padding-top: 120rpx;
  567. }
  568. .content_ image {
  569. position: absolute;
  570. top: -50rpx;
  571. left: 0;
  572. right: 0;
  573. margin: auto;
  574. }
  575. .hintText {
  576. font-size: 30rpx;
  577. }
  578. .skuBtn {
  579. width: 460rpx;
  580. height: 60rpx;
  581. line-height: 60rpx;
  582. text-align: center;
  583. background: #FCD202;
  584. font-size: 28rpx;
  585. border: 2rpx solid #FCD202;
  586. color: #333333;
  587. border-radius: 50rpx;
  588. font-weight: 700;
  589. margin: auto;
  590. }
  591. .lable {
  592. border: 1rpx solid #FFE6D9;
  593. height: 40rpx;
  594. padding: 0 14rpx;
  595. background: #FFE6D9;
  596. border-radius: 4rpx;
  597. font-weight: 500;
  598. color: #FD6416;
  599. font-size: 20rpx;
  600. margin-right: 10rpx;
  601. margin-bottom: 10rpx;
  602. }
  603. </style>