group-shop.vue 7.6 KB

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