group-shop.vue 12 KB

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