group-shop.vue 7.9 KB

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