group-shop.vue 7.2 KB

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