group-shop.vue 11 KB

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