group-det.vue 8.2 KB

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