group-det.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="ticket-det-box iPhone-bottom flex-common-css box-border-box">
  3. <view class="nav-box">
  4. <Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
  5. <template>
  6. <view slot="custom" class="align-items-center">
  7. <view class="yuan-bg">
  8. <uni-icons type="left" size="20" @click="toBack()" color="#000"></uni-icons>
  9. </view>
  10. </view>
  11. </template>
  12. </Nav>
  13. </view>
  14. <view class="scroll-view-css">
  15. <swiper class="swiper " circular :autoplay="true" :interval="3000" :duration="500" :current='BanenerCurrent' @change="onSwiperChange">
  16. <swiper-item v-for="(item,i) in obj.image" :key="i">
  17. <image class="swiper-item" :src="item" mode="aspectFill" @click="lookImg(obj.image,i)"></image>
  18. <view class="swiper-num fc-f">{{BanenerCurrent}}/{{obj.image.length}}</view>
  19. </swiper-item>
  20. </swiper>
  21. <view class="box-border-box p-24 card-f">
  22. <view class="card-top">
  23. <image src="@/static/img/buy/tg-det-bg.png" mode="scaleToFill"></image>
  24. <view class="card-money">
  25. <view class="mb-4">
  26. <span class="fs-28 fc-f fw-600">¥</span><span class="fs-48 fc-f fw-600">{{obj.price||''}}</span>
  27. </view>
  28. <view class="fs-24 fw-400 fc-f text-line-through">原价{{obj.line_price||''}}</view>
  29. </view>
  30. <view class="info-1-time">
  31. <view class="time-title">倒计时</view>
  32. <view class="time-day" v-if="showTime">{{time.day}}<text>天</text></view>
  33. <view class="time-hms" v-else>
  34. <view class="time-H">{{time.h}}</view>
  35. <view class="time-dian">:</view>
  36. <view class="time-M">{{time.m}}</view>
  37. <view class="time-dian">:</view>
  38. <view class="time-S">{{time.s}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="card-bottom box-border-box">
  43. <view class="fs-36 fc-3 fw-600 text-overflow-ellipsis mb-24">{{obj.title||''}}</view>
  44. <view class="jd-f mb-24">
  45. <view class="jd-1"></view>
  46. <view class="jd-2" :style="{width:setWidth(obj.number,obj.sales)+'rpx'}"></view>
  47. </view>
  48. <view class="flex-justify-space align-items-center">
  49. <view class="">
  50. <span class="fs-24 fc-9">已团</span>
  51. <span class="fs-24 fc-3">{{obj.sales||''}}</span>
  52. </view>
  53. <view class="">
  54. <span class="fs-24 fc-9">剩余</span>
  55. <span class="fs-24 fc-3">{{obj.number - obj.sales||''}}</span>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <image class="pwxq" src="@/static/img/buy/tgxq.png" mode="scaleToFill"></image>
  61. <view class="box-border-box plr-24">
  62. <view class="box-card box-border-box p-24 fs-30 fc-0" v-html="obj.content"></view>
  63. </view>
  64. </view>
  65. <view class="bottom-box box-border-box p-24">
  66. <view class="flex-justify-space">
  67. <view class="align-items-flex-end box-1">
  68. <span class="fs-28 fc-FB3D03 fw-600">¥</span>
  69. <span class="fs-44 fc-FB3D03 fw-600">{{obj.deposit||''}}</span>
  70. </view>
  71. <view class="text-align-center box-2 fs-32 fc-f fw-600" @click="toSave()">{{bText}}</view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import {groupInfo} from '@/api/groupOrder.js';
  78. import tools from "@/service/tools";
  79. export default {
  80. data(){
  81. return{
  82. id:"",
  83. BanenerCurrent:1,
  84. showTime:false,
  85. isTimeEnd:false,
  86. bText:'立即抢购',
  87. time:{
  88. day:'',
  89. h:"",
  90. m:'',
  91. s:'',
  92. },
  93. obj:{
  94. image:[],
  95. },
  96. }
  97. },
  98. onLoad(e) {
  99. if(e.id){
  100. this.id = e.id;
  101. this.getInfo();
  102. }
  103. },
  104. onShow() {
  105. },
  106. methods:{
  107. getInfo(){
  108. let school_id = uni.getStorageSync('school_id');
  109. groupInfo({school_id:school_id,id:this.id}).then((res)=>{
  110. if(res.code === 1){
  111. this.obj = res.data;
  112. this.setCountDown(this.obj.end_time);
  113. }
  114. })
  115. },
  116. lookImg(list,i){
  117. tools.lookBigImg(i,list);
  118. },
  119. toBack(){
  120. tools.leftClick()
  121. },
  122. onSwiperChange(e){
  123. this.BanenerCurrent = e.detail.current;
  124. },
  125. setWidth(total,num){
  126. let w = 0
  127. let tH = 654;
  128. w = (tH/total * num).toFixed(0)
  129. return w
  130. },
  131. setCountDown(sTime){
  132. let end = new Date(sTime.replace(/-/g, "/")).getTime();
  133. let now = new Date().getTime();
  134. let msec = end - now;
  135. this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
  136. let h = parseInt(msec / 1000 / 60 / 60 % 24);
  137. let m = parseInt(msec / 1000 / 60 % 60);
  138. let s = parseInt(msec / 1000 % 60);
  139. this.time.h = h > 9 ? h : '0' + h;
  140. this.time.m = m > 9 ? m : '0' + m;
  141. this.time.s = s > 9 ? s : '0' + s;
  142. msec -= 1000;
  143. if(this.time.day >= 1){
  144. this.showTime = true;
  145. }else{
  146. this.showTime = false;
  147. };
  148. if(msec>=0){
  149. setTimeout(()=>{
  150. this.setCountDown(sTime);
  151. }, 1000);
  152. }else{
  153. this.isTimeEnd = true;
  154. this.bText = '活动结束';
  155. this.time.h = '--';
  156. this.time.m = '--';
  157. this.time.s = '--';
  158. };
  159. },
  160. toSave(){
  161. if(!this.isTimeEnd){
  162. let goodsData = {
  163. title:this.obj.title,
  164. cover_img:this.obj.cover_img,
  165. deposit:this.obj.deposit,
  166. id:this.obj.id,
  167. }
  168. uni.navigateTo({
  169. url:'/pages-buy/save-order?goodsData=' + encodeURIComponent(JSON.stringify(goodsData))
  170. })
  171. }
  172. },
  173. },
  174. }
  175. </script>
  176. <style scoped lang="scss">
  177. .ticket-det-box{
  178. position: relative;
  179. .nav-box{
  180. position: absolute;
  181. .yuan-bg{
  182. width: 60rpx;
  183. height: 60rpx;
  184. background-color: #B3B3B4;
  185. border-radius: 50%;
  186. text-align: center;
  187. line-height: 62rpx;
  188. }
  189. }
  190. .bottom-box{
  191. .box-1{
  192. flex: 1;
  193. height: 100rpx;
  194. background: #FDE9E8;
  195. border-radius: 200rpx 0rpx 0rpx 200rpx;
  196. box-sizing: border-box;
  197. padding-left: 32rpx;
  198. padding-bottom: 20rpx;
  199. }
  200. .box-2{
  201. width: 200rpx;
  202. height: 100rpx;
  203. line-height: 100rpx;
  204. background: #FD2E42;
  205. border-radius: 0rpx 200rpx 200rpx 0rpx;
  206. text-align: center;
  207. }
  208. }
  209. .swiper{
  210. width: 100%;
  211. height: 750rpx;
  212. position: relative;
  213. .swiper-item{
  214. width: 100%;
  215. height: 750rpx;
  216. }
  217. .swiper-num{
  218. position: absolute;
  219. right: 24rpx;
  220. bottom: 24rpx;
  221. width: 120rpx;
  222. height: 48rpx;
  223. background: rgba(51,51,51,0.6);
  224. border-radius: 200rpx;
  225. text-align: center;
  226. line-height: 48rpx;
  227. }
  228. }
  229. .box-card{
  230. width: 100%;
  231. min-height: 100rpx;
  232. background: #FFFFFF;
  233. border-radius: 20rpx;
  234. }
  235. .pwxq{
  236. width: 146rpx;
  237. height: 46rpx;
  238. margin: 38rpx auto 24rpx auto;
  239. }
  240. .card-f{
  241. width: 100%;
  242. position: relative;
  243. height: 386rpx;
  244. .card-top{
  245. width: 100%;
  246. height: 148rpx;
  247. position: relative;
  248. image{
  249. position: absolute;
  250. top: 0;
  251. left: 0;
  252. width: 100%;
  253. height: 148rpx;
  254. z-index: 1;
  255. }
  256. .card-money{
  257. position: absolute;
  258. top: 10rpx;
  259. left: 20rpx;
  260. z-index: 10;
  261. }
  262. }
  263. .card-bottom{
  264. padding: 24rpx;
  265. width: 702rpx;
  266. max-height: 234rpx;
  267. border-radius: 20rpx;
  268. background-color: #fff;
  269. position: absolute;
  270. top: 145rpx;
  271. left: 24rpx;
  272. z-index: 2;
  273. }
  274. }
  275. .jd-f{
  276. position: relative;
  277. width: 654rpx;
  278. height: 18rpx;
  279. .jd-1{
  280. position: absolute;
  281. top: 0;
  282. left: 0;
  283. width: 654rpx;
  284. height: 18rpx;
  285. background: #FEE0E0;
  286. border-radius: 200rpx 200rpx 200rpx 200rpx;
  287. z-index: 10;
  288. }
  289. .jd-2{
  290. position: absolute;
  291. top: 0;
  292. left: 0;
  293. height: 18rpx;
  294. background: linear-gradient( 90deg, #FF545D 0%, #FF4B84 100%);
  295. // background-color: #FF2652;
  296. border-radius: 200rpx 200rpx 200rpx 200rpx;
  297. z-index: 12;
  298. }
  299. }
  300. .info-1-time{
  301. position: absolute;
  302. top: 40rpx;
  303. right: 24rpx;
  304. z-index: 20;
  305. display: flex;
  306. .time-title{
  307. font-size: 26rpx;
  308. font-weight: 400;
  309. color: rgba(255,255,255,0.8);
  310. margin-right: 8rpx;
  311. margin-top: 30rpx;
  312. }
  313. .time-day{
  314. font-size: 40rpx;
  315. color: #fff;
  316. margin-top: 16rpx;
  317. text{
  318. margin-left: 6rpx;
  319. font-size: 24rpx;
  320. font-weight: 400;
  321. color: rgba(255,255,255,0.8);
  322. }
  323. }
  324. .time-hms{
  325. margin-top: 30rpx;
  326. display: flex;
  327. }
  328. .time-dian{
  329. color: #fff;
  330. margin: 0 8rpx;
  331. }
  332. .time-H,.time-M,.time-S{
  333. width: 34rpx;
  334. height: 34rpx;
  335. background-color: #fff;
  336. border-radius: 4rpx;
  337. text-align: center;
  338. line-height: 34rpx;
  339. color: #FF2C35;
  340. }
  341. }
  342. }
  343. </style>