group-shop.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <view class="flex-common-css iPhone-bottom">
  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. <scroll-view :scroll-y="true" class="scroll-view-box" @scroll='scroll' @scrolltolower="scrolltolower">
  18. <image src="@/static/img/my/bg.png" mode="scaleToFill" class="nav-img"></image>
  19. <view class="shop-box p-24 box-border-box">
  20. <view class="align-items-center mb-18">
  21. <image :src="shopInfo.shop_logo" mode="aspectFill" class="shop_logo mr-10"></image>
  22. <view class="flex-1">
  23. <view class="fs-38 fw-600 fc-3 letter-spacing-6 mb-18">
  24. {{shopInfo.shop_name || ''}}
  25. </view>
  26. <view class="align-items-center flex-justify-space b-b-F9F9F9">
  27. <view class="">
  28. 营业时间:{{timeData}}
  29. </view>
  30. <image src="@/static/img/takeout/info-phone.png" mode="" class="phone"
  31. @click="phoneBut(shopInfo.shop_phone)"></image>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="p-b-20 b-b-F9F9F9">
  36. <view class="align-items-center mb-10">
  37. <view class="fs-26 fc-3 mr-8">
  38. {{shopInfo.city_name || ''}} {{shopInfo.address || ''}}
  39. </view>
  40. <image src="@/static/img/order/fz.png" mode="" class="fz-icon"
  41. @click="copy(shopInfo.city_name+shopInfo.address)"></image>
  42. </view>
  43. <view class="align-items-center">
  44. <image class="dw mr-4" src="@/static/img/my/wz-two.png" mode=""></image>
  45. <view class="fs-24 fc-9">
  46. 距离{{shopInfo.distance || ''}}Km
  47. </view>
  48. </view>
  49. </view>
  50. <scroll-view class="uni-margin-wrap mb-18" scroll-x="true" v-if="shopInfo.shop_album.length>0">
  51. <image v-for="(item,index) in shopInfo.shop_album" :src="item" mode="heightFix"
  52. class="swiper-img mr-6" @click="lookImg(shopInfo.shop_album,index)"></image>
  53. </scroll-view>
  54. <!-- <view class="uni-margin-wrap mb-18" v-if="shopInfo.shop_album.length>0">
  55. <swiper class="swiper" :circular='true' :autoplay="true" :interval="3000" :duration="500">
  56. <swiper-item v-for="(item,index) in shopInfo.shop_album">
  57. <image :src="item" mode="aspectFit" class="swiper-img"></image>
  58. </swiper-item>
  59. </swiper>
  60. </view> -->
  61. <view class="align-items-center mb-18">
  62. <view class="hr mr-8"></view>
  63. <view class="fs-32 fw-600 fc-3 letter-spacing-6">
  64. 团购
  65. </view>
  66. </view>
  67. <view class="list-box bgc-f b-rad-16 p-24 box-border-box">
  68. <view class="item-box align-items-flex-start" v-for="(item,index) in shopList" :key="index"
  69. @click="goToUrl(item)">
  70. <image :src="item.cover_img" mode="aspectFit" class="shop-img mr-16 flex-shrink0"></image>
  71. <view class="flex-1">
  72. <view class="align-items-center mb-10">
  73. <view class="fs-32 fs-32 flex-1 mr-16 text-overflow-ellipsis-one w-380">
  74. {{item.title}}
  75. </view>
  76. <uni-icons type="right" size="16"></uni-icons>
  77. </view>
  78. <view class="align-items-center mb-18">
  79. <view class="align-items-center mr-12" v-show="item.usable_time === 1">
  80. <view class="fc-9">
  81. 24小时可用
  82. </view>
  83. <view class="d-calss bgc-9 ml-10"></view>
  84. </view>
  85. <view class="align-items-center mr-12">
  86. <view class="fc-9">
  87. {{item.pre_book === 1?'免预约':'需预约'}}
  88. </view>
  89. <view class="d-calss bgc-9 ml-10"></view>
  90. </view>
  91. <view class="fc-9" v-show="item.is_quota == 1">
  92. 限购{{item.quota_num}}份
  93. </view>
  94. </view>
  95. <view class="align-items-center flex-justify-space">
  96. <view class="align-items-center">
  97. <view class="fs-30 fw-600 fc-ff3939 mr-8 flex-shrink0">
  98. <span class="fs-24 fc-ff3939">¥</span>
  99. {{item.price}}
  100. </view>
  101. <view class="mr-8 fs-20 fc-ff3939 discount-box flex-shrink0">
  102. 6.3折
  103. </view>
  104. <view class="mr-8 fc-9 fs-24 flex-shrink0 line-price">
  105. ¥{{item.line_price}}
  106. </view>
  107. </view>
  108. <view class="">
  109. <view class="fs-26 fc-9 mb-8 text-align-right">
  110. 销量 {{item.sales}}+
  111. </view>
  112. <view class="item-but fc-f fs-32" @click.stop="goTOPay(item)">
  113. 抢购
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </scroll-view>
  122. </view>
  123. </template>
  124. <script>
  125. import {
  126. groupShopInfo,
  127. groupList
  128. } from '@/api/group.js'
  129. import tools from '@/service/tools';
  130. export default {
  131. components: {},
  132. data() {
  133. return {
  134. scrollTopNum: 0, //当前滚动条高度
  135. fromData: {
  136. operate_id: '',
  137. lat: '',
  138. lon: '',
  139. shop_id: ''
  140. },
  141. shopInfo: {
  142. shop_album: []
  143. },
  144. timeData: '',
  145. array: '',
  146. shopList: []
  147. };
  148. },
  149. onLoad(data) {
  150. if (data) {
  151. this.fromData.shop_id = data.shop_id
  152. this.groupShopInfo()
  153. this.groupList()
  154. }
  155. },
  156. mounted() {},
  157. methods: {
  158. copy(value) {
  159. uni.setClipboardData({
  160. data: value,
  161. success() {
  162. tools.success('复制成功')
  163. },
  164. fail() {
  165. tools.error("复制失败")
  166. }
  167. })
  168. },
  169. lookImg(list, index) {
  170. tools.lookBigImg(index, list)
  171. },
  172. phoneBut(phone) {
  173. uni.makePhoneCall({
  174. phoneNumber: phone, // 电话号码
  175. success: function() {
  176. console.log('拨打电话成功');
  177. },
  178. fail: function() {
  179. console.log('拨打电话失败');
  180. }
  181. });
  182. },
  183. goTOPay(item) {
  184. uni.navigateTo({
  185. url: '/pages-buy/group-pay?shop_id=' + item.shop_id + '&goods_id=' + item.id
  186. });
  187. },
  188. goToUrl(item) {
  189. uni.navigateTo({
  190. url: '/pages-buy/group-goods-info?shop_id=' + item.shop_id + '&goods_id=' + item.id +
  191. '&shop_name=' + this.shopInfo.shop_name
  192. });
  193. },
  194. leftClick() {
  195. tools.leftClick()
  196. },
  197. scroll(e) {
  198. this.scrollTopNum = e.detail.scrollTop
  199. },
  200. scrolltolower() {
  201. console.log('触底');
  202. },
  203. groupList() {
  204. groupList({
  205. shop_id: this.fromData.shop_id
  206. }).then((res) => {
  207. if (res.code === 1) {
  208. this.shopList = res.data
  209. }
  210. })
  211. },
  212. groupShopInfo(fromData) {
  213. this.fromData.operate_id = uni.getStorageSync('operate_id');
  214. this.fromData.lon = uni.getStorageSync('lon');
  215. this.fromData.lat = uni.getStorageSync('lat');
  216. groupShopInfo(this.fromData).then((res) => {
  217. if (res.code === 1) {
  218. this.shopInfo = res.data
  219. res.data.business_hours.forEach((v, k) => {
  220. // let time =
  221. v.forEach((i, j) => {
  222. let time = ''
  223. if (j == 0 || j == 3) {
  224. time = i + '-'
  225. } else {
  226. time = i
  227. }
  228. this.array = this.array + time
  229. })
  230. if (res.data.business_hours.length === k + 1) {
  231. this.timeData = this.timeData + this.array
  232. } else {
  233. this.timeData = this.timeData + this.array + ','
  234. }
  235. this.array = ''
  236. })
  237. }
  238. })
  239. }
  240. },
  241. }
  242. </script>
  243. <style lang="scss" scoped>
  244. .fz-icon {
  245. width: 30rpx;
  246. height: 30rpx;
  247. }
  248. .shop_logo {
  249. width: 100rpx;
  250. height: 100rpx;
  251. border-radius: 20rpx;
  252. }
  253. .item-box {
  254. margin-bottom: 20rpx;
  255. }
  256. .item-box:last-child {
  257. margin-bottom: 0;
  258. }
  259. .item-but {
  260. background: #57CAFF;
  261. border-radius: 40rpx;
  262. padding: 15rpx 30rpx;
  263. box-sizing: border-box;
  264. }
  265. .line-price {
  266. text-decoration: line-through;
  267. }
  268. .discount-box {
  269. padding: 0rpx 6rpx;
  270. border: 1rpx solid #ff3939;
  271. border-radius: 6rpx;
  272. box-sizing: border-box;
  273. }
  274. .d-calss {
  275. width: 5rpx;
  276. height: 5rpx;
  277. border-radius: 50%;
  278. }
  279. .w-380 {
  280. width: 380rpx;
  281. }
  282. .shop-img {
  283. width: 180rpx;
  284. height: 180rpx;
  285. border-radius: 15rpx;
  286. }
  287. .hr {
  288. width: 5rpx;
  289. height: 32rpx;
  290. border-radius: 10rpx;
  291. background: #333;
  292. }
  293. .dw {
  294. width: 20rpx;
  295. height: 20rpx;
  296. }
  297. .phone {
  298. width: 35rpx;
  299. height: 35rpx;
  300. }
  301. .scroll-view-box {
  302. width: 100%;
  303. height: 100vh;
  304. position: fixed;
  305. overflow: auto;
  306. }
  307. .nav-box {
  308. transition: all 0.3s ease-in-out;
  309. }
  310. .nav-img {
  311. width: 100%;
  312. height: 200rpx;
  313. }
  314. .uni-margin-wrap {
  315. width: 100%;
  316. border-radius: 20rpx;
  317. white-space: nowrap;
  318. // position: absolute;
  319. // left: 0;
  320. // top: 0;
  321. }
  322. .swiper {
  323. height: 200rpx;
  324. border-radius: 20rpx;
  325. }
  326. .swiper-img {
  327. width: 25%;
  328. height: 230rpx;
  329. display: inline-block;
  330. }
  331. .swiper-img:first-child {
  332. border-radius: 20rpx 0 0 20rpx;
  333. }
  334. .swiper-img:last-child {
  335. border-radius: 0 20rpx 20rpx 0;
  336. }
  337. .swiper-item {
  338. display: block;
  339. height: 200rpx;
  340. line-height: 200rpx;
  341. text-align: center;
  342. border-radius: 20rpx;
  343. }
  344. .nav-left-box {
  345. width: 50rpx;
  346. height: 50rpx;
  347. line-height: 50rpx;
  348. background: #9A9A9A;
  349. border-radius: 18rpx;
  350. }
  351. .shop-box {
  352. width: 100%;
  353. // height: 100vh;
  354. position: relative;
  355. top: -10rpx;
  356. border-radius: 15rpx 15rpx 0 0;
  357. background: #F6F6F6;
  358. }
  359. </style>