group-det.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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" @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 + 1);
  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: 20rpx auto 24rpx;
  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. z-index: 2;
  251. image{
  252. position: absolute;
  253. top: 0;
  254. left: 0;
  255. width: 100%;
  256. height: 148rpx;
  257. z-index: 1;
  258. }
  259. .card-money{
  260. position: absolute;
  261. top: 10rpx;
  262. left: 20rpx;
  263. z-index: 10;
  264. }
  265. }
  266. .card-bottom{
  267. padding: 24rpx;
  268. width: 702rpx;
  269. max-height: 234rpx;
  270. border-radius: 20rpx;
  271. background-color: #fff;
  272. // position: absolute;
  273. // top: 145rpx;
  274. // left: 24rpx;
  275. margin: -24rpx 0 0 0;
  276. position: relative;
  277. z-index: 5;
  278. }
  279. }
  280. .jd-f{
  281. position: relative;
  282. width: 654rpx;
  283. height: 18rpx;
  284. .jd-1{
  285. position: absolute;
  286. top: 0;
  287. left: 0;
  288. width: 654rpx;
  289. height: 18rpx;
  290. background: #FEE0E0;
  291. border-radius: 200rpx 200rpx 200rpx 200rpx;
  292. z-index: 10;
  293. }
  294. .jd-2{
  295. position: absolute;
  296. top: 0;
  297. left: 0;
  298. height: 18rpx;
  299. background: linear-gradient( 90deg, #FF545D 0%, #FF4B84 100%);
  300. // background-color: #FF2652;
  301. border-radius: 200rpx 200rpx 200rpx 200rpx;
  302. z-index: 12;
  303. }
  304. }
  305. .info-1-time{
  306. position: absolute;
  307. top: 40rpx;
  308. right: 24rpx;
  309. z-index: 20;
  310. display: flex;
  311. .time-title{
  312. font-size: 26rpx;
  313. font-weight: 400;
  314. color: rgba(255,255,255,0.8);
  315. margin-right: 8rpx;
  316. margin-top: 30rpx;
  317. }
  318. .time-day{
  319. font-size: 40rpx;
  320. color: #fff;
  321. margin-top: 16rpx;
  322. text{
  323. margin-left: 6rpx;
  324. font-size: 24rpx;
  325. font-weight: 400;
  326. color: rgba(255,255,255,0.8);
  327. }
  328. }
  329. .time-hms{
  330. margin-top: 30rpx;
  331. display: flex;
  332. }
  333. .time-dian{
  334. color: #fff;
  335. margin: 0 8rpx;
  336. }
  337. .time-H,.time-M,.time-S{
  338. width: 34rpx;
  339. height: 34rpx;
  340. background-color: #fff;
  341. border-radius: 4rpx;
  342. text-align: center;
  343. line-height: 34rpx;
  344. color: #FF2C35;
  345. }
  346. }
  347. }
  348. </style>