group-shop.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box group-shop-box">
  3. <Nav :leftShow='false' :customNav='true' :bgckgroundBox='scrollTopNum>30?"#fff":"transparent"' class="nav-box">
  4. <template>
  5. <view slot="custom" class="align-items-center">
  6. <view class="nav-left-box text-align-center" v-show="scrollTopNum<30" @click="leftClick">
  7. <uni-icons color="#fff" type="left" size="15"></uni-icons>
  8. </view>
  9. <uni-icons @click="leftClick" class="mr-30" color="#000" type="left" size="15"
  10. v-show="scrollTopNum>30"></uni-icons>
  11. <view class="fs-34 fw-600 fc-3" v-show="scrollTopNum>30">
  12. 团购商家
  13. </view>
  14. </view>
  15. </template>
  16. </Nav>
  17. <image :src="shopInfo.shop_logo" mode="scaleToFill" class="nav-img" :class="scrollTopNum>30?'nav-img-false':'nav-img-true'"></image>
  18. <scroll-view :scroll-y="true" class="scroll-view-box" @scroll='scroll' @scrolltolower="scrolltolower">
  19. <view class="shop-box p-24 box-border-box">
  20. <view class="bgc-f top-box box-border-box b-rad-20 mb-24">
  21. <view class="display-flex p-b-20 b-b-eee mb-30">
  22. <image :src="shopInfo.shop_logo" mode="aspectFill" class="shop_logo mr-24"></image>
  23. <view class="flex-1 flex-direction">
  24. <view class="display-flex flex-justify-space mb-30">
  25. <view class="fs-38 fw-b fc-0 letter-spacing-6 ">
  26. {{shopInfo.shop_name || ''}}
  27. </view>
  28. <image src="/pages-buy/static/dh.png" mode="" class="dh-img flex-shrink0"
  29. @click="phoneBut(shopInfo.shop_phone)"></image>
  30. </view>
  31. <view class="align-items-center">
  32. <view class="align-items-center flex-shrink0 fg-class">
  33. <image class="dw-class mr-6" src="@/static/img/index/dw.png" mode=""></image>
  34. <view class="fs-24 fc-0">
  35. 距离{{shopInfo.distance}}Km
  36. </view>
  37. </view>
  38. <view class="fs-24">
  39. 营业时间:{{timeData}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="mb-30">
  45. <!-- <view class="align-items-center mb-30">
  46. <view class="fs-24">
  47. 营业时间:
  48. </view>
  49. <view class="fs-24 time-item" v-for="(item,index) in shopInfo.business_hours">
  50. {{item[0]+'-'+item[1]}}
  51. </view>
  52. </view> -->
  53. <view class="align-items-center flex-justify-space">
  54. <view class="fs-24 fc-a mr-8">
  55. {{shopInfo.city_name || ''}} {{shopInfo.address || ''}}
  56. </view>
  57. <image src="/pages-buy/static/fz.png" mode="" class="fz-icon"
  58. @click="copy(shopInfo.city_name+shopInfo.address)"></image>
  59. </view>
  60. </view>
  61. <scroll-view class="uni-margin-wrap mb-18" scroll-x="true" v-if="shopInfo.shop_album.length>0">
  62. <image v-for="(item,index) in shopInfo.shop_album" :src="item" mode="heightFix"
  63. class="swiper-img mr-10" @click="lookImg(shopInfo.shop_album,index)"></image>
  64. </scroll-view>
  65. </view>
  66. <view class="list-box bgc-f b-rad-16 box-border-box">
  67. <image src="/pages-buy/static/bg.png" mode="" class="list-box-bg"></image>
  68. <view class="align-items-center mb-40">
  69. <view class="tg-box">
  70. <view class=" fs-38 fw-b fc-0 z-2">
  71. 团购
  72. </view>
  73. <view class="title-hr"></view>
  74. </view>
  75. <view class="fc-F75820 fs-38 fw-b mr-20">
  76. 推荐
  77. </view>
  78. <view class="fs-24 fc-a">
  79. 限时团购尽情抢购!
  80. </view>
  81. </view>
  82. <view v-if="shopList.length == 0" class="scroll-view-css">
  83. <EnBlank :customSrc='true'>
  84. <template v-slot:blankImg>
  85. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  86. </template>
  87. </EnBlank>
  88. </view>
  89. <view class="item-box align-items-flex-start z-2" v-for="(item,index) in shopList" :key="index"
  90. @click="goToUrl(item)">
  91. <view class="shop-img-box mr-24">
  92. <image :src="item.cover_img" mode="aspectFill" class="shop-img flex-shrink0"></image>
  93. <view class="zk-box fs-20 fc-f text-align-center">
  94. 6.3折
  95. </view>
  96. </view>
  97. <view class="flex-1">
  98. <view class="fs-28 fw-b fc-0 text-overflow-ellipsis-one w-390 mb-22">
  99. {{item.title}}
  100. </view>
  101. <view class="align-items-center flex-justify-space">
  102. <view class="">
  103. <view class="align-items-center mb-24">
  104. <view class="align-items-center mr-12" v-show="item.usable_time === 1">
  105. <view class="fc-9">
  106. 24小时可用
  107. </view>
  108. <view class="d-calss bgc-9 ml-10"></view>
  109. </view>
  110. <view class="align-items-center mr-12">
  111. <view class="fc-9">
  112. {{item.pre_book === 1?'免预约':'需预约'}}
  113. </view>
  114. </view>
  115. </view>
  116. <view class="align-items-flex-end">
  117. <view class="fs-30 fw-600 fc-F93435 mr-8 flex-shrink0">
  118. <span class="fs-24 fc-F93435 fw-b">¥</span>
  119. {{item.price}}
  120. </view>
  121. <view class="fc-a fs-24 flex-shrink0 line-price">
  122. ¥{{item.line_price}}
  123. </view>
  124. </view>
  125. </view>
  126. <view class="qg-box flex-direction align-items-center" @click.stop="goTOPay(item)">
  127. <view class="align-items-center mb-8">
  128. <image src="/pages-buy/static/qg.png" mode="" class="sd-img mr-6"></image>
  129. <view class="fs-28 fc-f fw-b">
  130. 抢购
  131. </view>
  132. </view>
  133. <view class="fs-20 fc-f">
  134. 销量 {{item.sales}}+
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="align-items-center flex-justify-center">
  143. <view class="bottom-hr"></view>
  144. <view class="fs-24 fc-a plr-12">
  145. 我也是有底线的
  146. </view>
  147. <view class="bottom-hr"></view>
  148. </view>
  149. </scroll-view>
  150. </view>
  151. </template>
  152. <script>
  153. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  154. import {
  155. groupShopInfo,
  156. groupList
  157. } from '@/api/group.js'
  158. import tools from '@/service/tools';
  159. export default {
  160. components: {
  161. EnBlank
  162. },
  163. data() {
  164. return {
  165. scrollTopNum: 0, //当前滚动条高度
  166. fromData: {
  167. operate_id: '',
  168. lat: '',
  169. lon: '',
  170. shop_id: ''
  171. },
  172. shopInfo: {
  173. shop_album: []
  174. },
  175. timeData: '',
  176. array: '',
  177. shopList: []
  178. };
  179. },
  180. onLoad(data) {
  181. if (data) {
  182. this.fromData.shop_id = data.shop_id
  183. this.groupShopInfo()
  184. this.groupList()
  185. }
  186. },
  187. mounted() {},
  188. methods: {
  189. copy(value) {
  190. uni.setClipboardData({
  191. data: value,
  192. success() {
  193. tools.success('复制成功')
  194. },
  195. fail() {
  196. tools.error("复制失败")
  197. }
  198. })
  199. },
  200. lookImg(list, index) {
  201. tools.lookBigImg(index, list)
  202. },
  203. phoneBut(phone) {
  204. uni.makePhoneCall({
  205. phoneNumber: phone, // 电话号码
  206. success: function() {
  207. console.log('拨打电话成功');
  208. },
  209. fail: function() {
  210. console.log('拨打电话失败');
  211. }
  212. });
  213. },
  214. goTOPay(item) {
  215. uni.navigateTo({
  216. url: '/pages-buy/group-pay?shop_id=' + item.shop_id + '&goods_id=' + item.id
  217. });
  218. },
  219. goToUrl(item) {
  220. uni.navigateTo({
  221. url: '/pages-buy/group-goods-info?shop_id=' + item.shop_id + '&goods_id=' + item.id +
  222. '&shop_name=' + this.shopInfo.shop_name
  223. });
  224. },
  225. leftClick() {
  226. tools.leftClick()
  227. },
  228. scroll(e) {
  229. this.scrollTopNum = e.detail.scrollTop
  230. },
  231. scrolltolower() {
  232. console.log('触底');
  233. },
  234. groupList() {
  235. groupList({
  236. shop_id: this.fromData.shop_id
  237. }).then((res) => {
  238. if (res.code === 1) {
  239. this.shopList = res.data
  240. }
  241. })
  242. },
  243. groupShopInfo(fromData) {
  244. this.fromData.operate_id = uni.getStorageSync('operate_id');
  245. this.fromData.lon = uni.getStorageSync('lon');
  246. this.fromData.lat = uni.getStorageSync('lat');
  247. groupShopInfo(this.fromData).then((res) => {
  248. if (res.code === 1) {
  249. this.shopInfo = res.data
  250. res.data.business_hours.forEach((v, k) => {
  251. // let time =
  252. v.forEach((i, j) => {
  253. let time = ''
  254. if (j == 0 || j == 3) {
  255. time = i + '-'
  256. } else {
  257. time = i
  258. }
  259. this.array = this.array + time
  260. })
  261. if (res.data.business_hours.length === k + 1) {
  262. this.timeData = this.timeData + this.array
  263. } else {
  264. this.timeData = this.timeData + this.array + ','
  265. }
  266. this.array = ''
  267. })
  268. }
  269. })
  270. }
  271. },
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. .fg-class{
  276. padding-right: 15rpx;
  277. margin-right: 15rpx;
  278. border-right: .5rpx solid #DEDEDE;
  279. }
  280. .time-item {
  281. margin-right: 15rpx;
  282. padding-right: 15rpx;
  283. border-right: .5rpx solid #EEEEEE;
  284. }
  285. .time-item:last-child {
  286. margin-right: 0;
  287. padding: 0;
  288. border-right: none;
  289. }
  290. .qg-box {
  291. width: 130rpx;
  292. height: 80rpx;
  293. background: linear-gradient(-90deg, #FF7D2D, #F54F1D);
  294. box-shadow: 0rpx 3rpx 8rpx 0rpx rgba(246, 83, 30, 0.32);
  295. border-radius: 20rpx;
  296. padding-top: 14rpx;
  297. }
  298. .tg-box {
  299. position: relative;
  300. }
  301. .title-hr {
  302. width: 72rpx;
  303. height: 10rpx;
  304. border-radius: 5rpx;
  305. background: linear-gradient(to right, #F75820, #FEEEE8);
  306. position: absolute;
  307. bottom: 2rpx;
  308. left: 0;
  309. z-index: 1;
  310. }
  311. .z-2 {
  312. position: relative;
  313. z-index: 2;
  314. }
  315. .list-box {
  316. padding: 36rpx 25rpx 0;
  317. position: relative;
  318. }
  319. .list-box-bg {
  320. width: 633rpx;
  321. height: 189rpx;
  322. position: absolute;
  323. right: 0;
  324. top: 0;
  325. }
  326. .dw-class {
  327. width: 16rpx;
  328. height: 17rpx;
  329. }
  330. .dh-img {
  331. width: 48rpx;
  332. height: 48rpx;
  333. }
  334. .top-box {
  335. padding: 33rpx 20rpx 15rpx;
  336. }
  337. .group-shop-box {
  338. position: relative;
  339. background: transparent;
  340. }
  341. .fz-icon {
  342. width: 20rpx;
  343. height: 20rpx;
  344. }
  345. .shop_logo {
  346. width: 140rpx;
  347. height: 140rpx;
  348. border-radius: 20rpx;
  349. }
  350. .item-box {
  351. padding-bottom: 39rpx;
  352. border-bottom: .5rpx solid #EDEEF2;
  353. margin-bottom: 39rpx;
  354. }
  355. .item-box:last-child {
  356. margin-bottom: 0;
  357. }
  358. .item-but {
  359. background: #57CAFF;
  360. border-radius: 40rpx;
  361. padding: 15rpx 30rpx;
  362. box-sizing: border-box;
  363. }
  364. .line-price {
  365. text-decoration: line-through;
  366. }
  367. .discount-box {
  368. padding: 0rpx 6rpx;
  369. border: 1rpx solid #ff3939;
  370. border-radius: 6rpx;
  371. box-sizing: border-box;
  372. }
  373. .d-calss {
  374. width: 5rpx;
  375. height: 5rpx;
  376. border-radius: 50%;
  377. }
  378. .w-390 {
  379. width: 390rpx;
  380. }
  381. .shop-img-box {
  382. width: 220rpx;
  383. height: 150rpx;
  384. border-radius: 10rpx;
  385. position: relative;
  386. }
  387. .shop-img {
  388. width: 220rpx;
  389. height: 150rpx;
  390. border-radius: 10rpx;
  391. }
  392. .zk-box {
  393. width: 70rpx;
  394. height: 28rpx;
  395. line-height: 28rpx;
  396. background: linear-gradient(-90deg, #FF7D2D, #F54F1D);
  397. position: absolute;
  398. left: -3rpx;
  399. top: -4rpx;
  400. border-radius: 20rpx 0 20rpx 0;
  401. }
  402. .hr {
  403. width: 5rpx;
  404. height: 32rpx;
  405. border-radius: 10rpx;
  406. background: #333;
  407. }
  408. .dw {
  409. width: 20rpx;
  410. height: 20rpx;
  411. }
  412. .phone {
  413. width: 35rpx;
  414. height: 35rpx;
  415. }
  416. .scroll-view-box {
  417. width: 100%;
  418. height: 100vh;
  419. // position: fixed;
  420. overflow: auto;
  421. }
  422. .nav-box {
  423. transition: all 0.3s ease-in-out;
  424. }
  425. .nav-img {
  426. width: 100%;
  427. height: 422rpx;
  428. position: fixed;
  429. left: 0;
  430. top: 0;
  431. border-radius: 0 0 200rpx 200rpx;
  432. transition: all 0.3s ease-in-out;
  433. }
  434. .nav-img-true{
  435. opacity: 1;
  436. }
  437. .nav-img-false{
  438. opacity: 0;
  439. }
  440. .uni-margin-wrap {
  441. width: 100%;
  442. border-radius: 20rpx;
  443. white-space: nowrap;
  444. // position: absolute;
  445. // left: 0;
  446. // top: 0;
  447. }
  448. .swiper {
  449. height: 200rpx;
  450. border-radius: 20rpx;
  451. }
  452. .swiper-img {
  453. width: 25%;
  454. height: 190rpx;
  455. display: inline-block;
  456. }
  457. .swiper-img:first-child {
  458. border-radius: 20rpx 0 0 20rpx;
  459. }
  460. .swiper-img:last-child {
  461. border-radius: 0 20rpx 20rpx 0;
  462. }
  463. .swiper-item {
  464. display: block;
  465. height: 200rpx;
  466. line-height: 200rpx;
  467. text-align: center;
  468. border-radius: 20rpx;
  469. }
  470. .nav-left-box {
  471. width: 50rpx;
  472. height: 50rpx;
  473. line-height: 50rpx;
  474. background: #9A9A9A;
  475. border-radius: 18rpx;
  476. }
  477. .shop-box {
  478. width: 100%;
  479. // height: 100vh;
  480. position: relative;
  481. top: -10rpx;
  482. border-radius: 15rpx 15rpx 0 0;
  483. // background: #F6F6F6;
  484. }
  485. .sd-img {
  486. width: 15rpx;
  487. height: 28rpx;
  488. }
  489. .bottom-hr{
  490. width: 61rpx;
  491. height: 1rpx;
  492. background: #D4D4D4;
  493. }
  494. </style>