list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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(item.shopId,item,item.shopActivityList)">
  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.enableFullReductionFlag==0&&item.exemptMinMoney">
  78. 满{{item.exemptMinMoney}}免配送费</view>
  79. <!-- <view class="lable flex justify-center align-center" v-if="item.exemptMinMoney">满{{item.exemptMinMoney}}免配送费</view> -->
  80. <view v-for="(ite,ind) in item.shopActivityList" :key='ind' v-if="item.shopActivityList && ite.activityType!='1'">
  81. <view class="lable flex justify-center align-center" style="border-radius: 4rpx;background-color: #ffffff;color: red;box-sizing: border-box;">
  82. <text v-if="ite.activityType=='2'">时段</text>
  83. <text v-if="ite.activityType=='3'">满额</text>
  84. <text v-if="ite.activityType=='4'">全场</text>
  85. <text style="margin-left: 3px;">|</text>
  86. <text style="margin-left: 3px;">{{ite.activityName}}</text>
  87. </view>
  88. <!-- <view class="lable flex justify-center align-center"
  89. style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;"
  90. >{{ite.activityName}}
  91. </view> -->
  92. </view>
  93. <view class="lable flex justify-center align-center" v-for="(ite,ind) in item.shopLable" :key='ind'
  94. v-if="item.shopLable">
  95. {{ite}}
  96. </view>
  97. <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">
  98. <text>优惠券</text>
  99. <text style="margin-left: 3px;">|</text>
  100. <text style="margin-left: 3px;">满{{it.minMoney}}减{{it.money}}</text>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <view class="flex margin-top-xs">
  106. <view v-for="(ite,ind) in item.goodsList" :key='ind'
  107. @click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
  108. <image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;" class="radius"
  109. mode=""></image>
  110. <view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
  111. <view class="text-bold margin-top-xs" style="color: #FD6416;">
  112. <text class="text-sm">¥</text> {{ite.goodsMoney}}
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <empty v-if="!shopList.length"></empty>
  121. <!-- 打样提示 -->
  122. <view v-if="hintShow" class="hintPopul" @click.stop="hintShow=false">
  123. <view class="content_">
  124. <image src="../../../static/images/index/shop.png" mode="" style="width: 200rpx;height: 180rpx;">
  125. </image>
  126. <view class="text-xl text-bold">店铺打烊啦</view>
  127. <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
  128. <view class="margin-top-xs text-gray margin-bottom">{{shop.businessHours}}-{{shop.lockHours}}</view>
  129. <view class="skuBtn" @click="hintShow=false">知道了</view>
  130. </view>
  131. </view>
  132. </view>
  133. <view v-else>
  134. <view style="font-size: 28upx;" v-html="content"></view>
  135. </view>
  136. </template>
  137. <script>
  138. import empty from '@/components/empty.vue'
  139. export default {
  140. components: {
  141. empty
  142. },
  143. data() {
  144. return {
  145. isShow: false,
  146. hintShow: false,
  147. shop: {},
  148. page: 1,
  149. limit: 10,
  150. shopList: [],
  151. current: 1,
  152. shopTypeId: '',
  153. userId: '',
  154. lng: '',
  155. lat: '',
  156. value1: 0,
  157. value2: 0,
  158. value3: 0,
  159. value4: 0,
  160. options1: [{
  161. label: '综合排序',
  162. value: 1,
  163. }],
  164. options2: [{
  165. value: '3',
  166. label: "距离优先"
  167. }],
  168. options3: [{
  169. value: '4',
  170. label: "销量优先"
  171. }],
  172. options4: [{
  173. id: '',
  174. select: true,
  175. shopTypeName: "全部"
  176. }],
  177. title: '综合排序',
  178. title1: '距离优先',
  179. title2: '销量优先',
  180. title3: '筛选',
  181. totalCount: 0,
  182. XCXIsSelect: '否',
  183. content:'',
  184. huodongList:[],
  185. activityTitle:'',
  186. activityId:'',
  187. }
  188. },
  189. onLoad(e) {
  190. console.log(e)
  191. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  192. if (this.XCXIsSelect == '否') {
  193. this.getGuize()
  194. uni.setNavigationBarTitle({
  195. title: '隐私政策'
  196. });
  197. }
  198. let that = this
  199. uni.showLoading({
  200. title: '加载中'
  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. if(e.activityTitle){
  215. that.activityTitle = e.activityTitle
  216. uni.setNavigationBarTitle({
  217. title: e.activityTitle
  218. });
  219. that.getHuoDongList()
  220. }
  221. if(e.activityId){
  222. this.activityId = e.activityId
  223. uni.setNavigationBarTitle({
  224. title: '推荐商家'
  225. });
  226. that.getHuoDongList()
  227. }
  228. },
  229. methods: {
  230. // 跳转商品详情
  231. goDet(goodsId, shopId) {
  232. let userId = this.$queue.getData('userId');
  233. if (!userId) {
  234. uni.navigateTo({
  235. url: '/pages/public/login'
  236. })
  237. return
  238. }
  239. uni.navigateTo({
  240. url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
  241. })
  242. },
  243. //活动列表
  244. getHuoDongList(){
  245. let data = {
  246. activityTitle:this.activityTitle,
  247. activityId:this.activityId?this.activityId:''
  248. }
  249. this.$Request.getT('/app/activityManage/getActivityList',data).then(res => {
  250. if (res.code === 0) {
  251. this.huodongList = res.data.records[0]
  252. this.activityId = this.huodongList.activityId
  253. this.getShopList()
  254. }
  255. });
  256. },
  257. getGuize() {
  258. this.$Request.getT('/app/common/type/237').then(res => {
  259. if (res.code == 0) {
  260. this.content = res.data.value;
  261. // this.tit = res.data.min
  262. }
  263. });
  264. },
  265. goBack() {
  266. uni.navigateBack({
  267. })
  268. },
  269. getSelect(e) {
  270. console.log(e)
  271. this.options4.forEach(res => {
  272. if (res.id == e.id) {
  273. res.select = true
  274. this.page = 1
  275. this.shopTypeId = e.id
  276. this.getShopList();
  277. this.isShow = false
  278. } else {
  279. res.select = false
  280. }
  281. })
  282. },
  283. confirm(e) {
  284. console.log(e)
  285. this.page = 1
  286. this.current = e;
  287. this.getShopList();
  288. },
  289. confirm2(e) {
  290. console.log(e)
  291. this.page = 1
  292. this.current = e;
  293. this.getShopList();
  294. },
  295. confirm3(e) {
  296. console.log(e)
  297. this.page = 1
  298. this.current = e;
  299. this.getShopList();
  300. },
  301. confirm4(e) {
  302. console.log(e)
  303. this.page = 1
  304. this.shopTypeId = e
  305. this.getShopList();
  306. },
  307. // 商户列表
  308. getShopList() {
  309. // this.lng = uni.getStorageSync('lng')
  310. // this.lat = uni.getStorageSync('lat')
  311. let data = {
  312. page: this.page,
  313. limit: this.limit,
  314. screen: this.current,
  315. shopTypeId: this.shopTypeId,
  316. lng: uni.getStorageSync('lng'),
  317. lat: uni.getStorageSync('lat'),
  318. activityId:this.activityId
  319. }
  320. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  321. uni.hideLoading()
  322. if (res.code == 0) {
  323. console.log(res.data.list)
  324. this.totalCount = res.data.totalCount
  325. res.data.list.forEach(ret => {
  326. if (ret.distance > 1000) {
  327. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  328. } else {
  329. if (ret.distance == 0) {
  330. ret.distance = "0m";
  331. } else {
  332. ret.distance = Number(ret.distance).toFixed(1) + "m";
  333. }
  334. }
  335. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  336. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  337. '../../static/logo.png'
  338. ret.errandTime = Math.round(ret.errandTime)
  339. ret.shopScore = ret.shopScore.toFixed(1)
  340. })
  341. if (this.page == 1) {
  342. this.shopList = res.data.list
  343. } else {
  344. this.shopList = [...this.shopList, ...res.data.list]
  345. }
  346. console.log(this.shopList)
  347. }
  348. })
  349. },
  350. // 商户类型
  351. getShopType() {
  352. this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
  353. if (res.code == 0) {
  354. res.data.forEach(res => {
  355. res.select = false
  356. })
  357. this.options4 = [...this.options4, ...res.data]
  358. }
  359. })
  360. },
  361. goNav(url,e,shuzu) {
  362. this.shop = e
  363. // console.log(e, '当前店铺')
  364. let myDate = new Date();
  365. let hours = myDate.getHours();
  366. let minute = myDate.getMinutes();
  367. let openTime = this.shop.businessHours.split(':')[0] //开始小时
  368. let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
  369. let closeTime = this.shop.lockHours.split(':')[0] //结束小时
  370. let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
  371. console.log(hours)
  372. console.log(minute)
  373. console.log(openTime)
  374. console.log(openTime1)
  375. console.log(closeTime)
  376. console.log(closeTime1)
  377. console.log(minute >= closeTime1)
  378. if (hours < openTime) {
  379. this.hintShow = true
  380. return
  381. } else if (hours == openTime && minute < openTime1) {
  382. this.hintShow = true
  383. return
  384. } else if (hours > closeTime) {
  385. this.hintShow = true
  386. return
  387. } else if (hours == closeTime && minute >= closeTime1) {
  388. this.hintShow = true
  389. return
  390. }
  391. console.log(url)
  392. let items = encodeURIComponent(JSON.stringify(shuzu));
  393. if (this.userId) {
  394. uni.navigateTo({
  395. url:'/pages/index/shop/index?shopId='+url+'&huoListss='+items
  396. })
  397. } else {
  398. uni.navigateTo({
  399. url: '/pages/public/login'
  400. })
  401. }
  402. },
  403. goShopDet(url, e) {
  404. this.shop = e
  405. console.log(url)
  406. if (this.userId) {
  407. uni.navigateTo({
  408. url
  409. })
  410. } else {
  411. uni.navigateTo({
  412. url: '/pages/public/login'
  413. })
  414. }
  415. },
  416. },
  417. onReachBottom: function() {
  418. if (this.shopList.length < this.totalCount) {
  419. this.page = this.page + 1;
  420. this.getShopList()
  421. } else {
  422. uni.showToast({
  423. title: '已经到底了',
  424. icon: 'none'
  425. })
  426. }
  427. },
  428. }
  429. </script>
  430. <style lang="scss">
  431. .select {
  432. color: #FCD202;
  433. }
  434. .hdSwiper{
  435. width: 100%;
  436. height: 290rpx;
  437. position: fixed;
  438. top: 0;
  439. z-index: 999;
  440. background-color: #ffffff;
  441. .hdSwiper-box{
  442. width: 686rpx;
  443. height: 100%;
  444. border-radius: 24rpx;
  445. }
  446. }
  447. .tabs {
  448. margin: 20rpx 0;
  449. display: flex;
  450. justify-content: space-between;
  451. align-items: center;
  452. }
  453. .tabs_name {
  454. flex: 1;
  455. /* display: inline-block; */
  456. text-align: center;
  457. margin-bottom: 30rpx 0;
  458. position: relative;
  459. display: flex;
  460. /* justify-content: space-between; */
  461. align-items: center;
  462. }
  463. .tabs_name view {
  464. margin: 0 auto;
  465. display: flex;
  466. align-items: center;
  467. }
  468. .tabs_2 {
  469. /* width: 30%; */
  470. }
  471. .actives {
  472. color: #007AFF;
  473. }
  474. .tabsicon {
  475. position: absolute;
  476. top: 0;
  477. right: 22rpx;
  478. width: 20rpx;
  479. height: 40rpx;
  480. z-index: 1;
  481. }
  482. .tabs_icon {
  483. width: 12rpx;
  484. height: 8rpx;
  485. z-index: 1;
  486. margin-left: 10rpx;
  487. }
  488. .icon1 {
  489. /* position: absolute; */
  490. /* top: 6rpx; */
  491. }
  492. .icon2 {
  493. position: absolute;
  494. bottom: 6rpx;
  495. }
  496. .hintPopul {
  497. width: 100%;
  498. height: 100vh;
  499. position: fixed;
  500. top: 0;
  501. background: rgba(0, 0, 0, .4);
  502. z-index: 999;
  503. }
  504. .content_ {
  505. position: absolute;
  506. left: 0;
  507. right: 0;
  508. top: 0;
  509. bottom: 0;
  510. margin: auto;
  511. text-align: center;
  512. width: 500rpx;
  513. height: 400rpx;
  514. border-radius: 20rpx;
  515. background-color: #fff;
  516. padding-top: 120rpx;
  517. }
  518. .content_ image {
  519. position: absolute;
  520. top: -50rpx;
  521. left: 0;
  522. right: 0;
  523. margin: auto;
  524. }
  525. .hintText {
  526. font-size: 30rpx;
  527. }
  528. .skuBtn {
  529. width: 460rpx;
  530. height: 60rpx;
  531. line-height: 60rpx;
  532. text-align: center;
  533. background: #FCD202;
  534. font-size: 28rpx;
  535. border: 2rpx solid #FCD202;
  536. color: #333333;
  537. border-radius: 50rpx;
  538. font-weight: 700;
  539. margin: auto;
  540. }
  541. .lable {
  542. border: 1rpx solid #FFE6D9;
  543. height: 40rpx;
  544. padding: 0 14rpx;
  545. background: #FFE6D9;
  546. border-radius: 4rpx;
  547. font-weight: 500;
  548. color: #FD6416;
  549. font-size: 20rpx;
  550. margin-right: 10rpx;
  551. margin-bottom: 10rpx;
  552. }
  553. </style>