index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. <template>
  2. <view class="center">
  3. <view class="status_bar"><!-- 这里是状态栏 --></view>
  4. <view class="carousel">
  5. <swiper autoplay="true" duration="400" interval="5000" @change="swiperChange" class="bor">
  6. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"><image :src="item.pic" /></swiper-item>
  7. </swiper>
  8. </view>
  9. <view class="swiper-dot">
  10. <template v-for="item in swiperLength">
  11. <view class="swiper-dots-item" :key="item" :class="{ action: swiperCurrent + 1 === item }"></view>
  12. </template>
  13. </view>
  14. <!-- 通知栏 -->
  15. <view class="tongz flex">
  16. <view>
  17. <view class="tongz-bg"><image src="../../static/img/tongz-bg.png" mode=""></image></view>
  18. <view class="tongz-left flex">
  19. <image class="image-left" src="../../static/img/ling.png" mode=""></image>
  20. <u-notice-bar
  21. style="width: 100%;"
  22. mode="vertical"
  23. type="none"
  24. :volume-icon="false"
  25. :more-icon="true"
  26. :list="showList.infoList"
  27. @click="goDetails"
  28. @getMore="nav('/pages/index/nodeList')"
  29. ></u-notice-bar>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="box-body">
  34. <view class="navBox">
  35. <view class="navBox-left">
  36. <view class="navBox-item" @click="nav('./node')"><image src="../../static/img/index2.png" style="width: 385rpx; height: 398rpx;" mode=""></image></view>
  37. </view>
  38. <view class="navBox-right">
  39. <view class="navBox-item" @click="nav('./convert')"><image src="../../static/img/index3.png" style="width: 385rpx; height: 216rpx; " mode=""></image></view>
  40. <view class="navBox-item" @click="nav('/pages/index/appointment')">
  41. <image src="../../static/img/index6.png" style="width: 339rpx; height: 170rpx; margin-top: -12rpx;" mode=""></image>
  42. </view>
  43. <!-- <view class="navBox-item" @click="node()">
  44. <image src="../../static/img/index6.png" style="width: 339rpx; height: 170rpx; margin-top: -12rpx;" mode=""></image>
  45. </view> -->
  46. </view>
  47. </view>
  48. <view class="shopBox" v-for="(item, index) in list" :key="index">
  49. <view class="shopBox-top">
  50. <view class="left"><image src="../../static/img/index4.png" mode=""></image></view>
  51. <view class="between" style="margin-left: -340rpx;">
  52. <text id="one">{{ item.name }}</text>
  53. <text id="two">{{ item.lun }}轮</text>
  54. </view>
  55. <view v-if="'childList' in item && item.type == 1">
  56. <text id="three" v-if="item.childList.next_pink_status">待开团</text>
  57. <text id="three" v-else>预约中</text>
  58. </view>
  59. <view v-if="item.type == 2"><text id="three" v-if="item.childList.next_pink_status">未开始</text></view>
  60. </view>
  61. <view class="shopBox-between">
  62. <view class="number">
  63. <text class="number-left">{{ 1 * item.cost }}</text>
  64. <text class="number-right">{{ item.cost_money_type }}/份</text>
  65. </view>
  66. <view class="quotient"><text class="quotient-children">每轮限购1组,每组限购一份</text></view>
  67. </view>
  68. <image :src="item.background_image" style="width: 635rpx; height: 170rpx; margin: 40rpx 0;" mode=""></image>
  69. <view class="shopBox-bottom">
  70. <view class="forward">
  71. <view class="forward-left"></view>
  72. <view class="forward-right">每组分数:&nbsp {{ item.join_number }}份</view>
  73. </view>
  74. <view class="consume">
  75. GAS消耗:
  76. <text>{{ 1 * item.ticket }}{{ item.ticket_money_type }}</text>
  77. </view>
  78. <view class="appointmentTime">
  79. 预约开始时间:
  80. <text>{{ item.start }}</text>
  81. </view>
  82. <view class="appointmentTime">
  83. 预约结束时间:
  84. <text>{{ item.end }}</text>
  85. </view>
  86. <view class="lotteryTime">
  87. 开奖时间:
  88. <text>{{ item.childList ? item.childList.next_pink.name : '' }}</text>
  89. </view>
  90. </view>
  91. <view class="btn-box flex">
  92. <view class="submit1" @click="lalaDetial(item.id)">当天预约</view>
  93. <view v-if="'childList' in item && item.type == 1">
  94. <view class="submit" v-if="item.childList.next_pink_status">待开团</view>
  95. <view class="submit" @click="buy(item)" v-else>预约</view>
  96. </view>
  97. <view v-if="item.type == 2"><view class="submit">未开始</view></view>
  98. </view>
  99. </view>
  100. </view>
  101. <u-popup v-model="show" mode="bottom" border-radius="40" height="868rpx" :closeable="true">
  102. <view class="yugo">
  103. <view class="zhu">
  104. 注:每轮限购1组,每组限购1份
  105. <span class="zhu-right">
  106. 最多可预约:
  107. <span class="zhu-num">1份</span>
  108. </span>
  109. </view>
  110. <view class="info-main">
  111. <view class="info-box">
  112. <view class="info-left">预约份数:</view>
  113. <view class="info-right"><u-number-box :max="max" v-model="value" @change="valChange"></u-number-box></view>
  114. </view>
  115. <view class="info-box">
  116. <view class="info-left">预约金额:</view>
  117. <view class="info-right">{{ money }}</view>
  118. </view>
  119. <view class="info-box">
  120. <view class="info-left">预约门票:</view>
  121. <view class="info-right">{{ souxu }}</view>
  122. </view>
  123. </view>
  124. <view class="btn" @click="submit()">确定</view>
  125. </view>
  126. </u-popup>
  127. <u-popup v-model="show1" mode="center" width="548rpx" border-radius="14">
  128. <view class="psw-wrapper">
  129. <view class="psw-title">请输入支付密码</view>
  130. <input type="password" v-model="password" class="psw-ipt" />
  131. <view class="psw-btn">
  132. <text @click="cancel">取消</text>
  133. <text class="psw-qd" @click="pswQd">确定</text>
  134. </view>
  135. </view>
  136. </u-popup>
  137. <view class="tishi" v-if="tishi">
  138. <view class="closeBox" @click="closetishi()">
  139. <view class="close">
  140. <image src="../../static/img/indexClose.png" mode=""></image>
  141. </view>
  142. </view>
  143. <view class="main" @click="nav('/pages/index/teachList')">
  144. <image src="../../static/img/teach.png" mode=""></image>
  145. </view>
  146. </view>
  147. </view>
  148. </template>
  149. <script>
  150. import { lala, lalaDetial, buylala } from '@/api/product.js';
  151. import { getTime } from '@/utils/rocessor.js';
  152. import { loadIndexs } from '@/api/user.js';
  153. export default {
  154. data() {
  155. return {
  156. tishi:true,//是否显示教程框
  157. show: false, //支付数量
  158. show1: false, //支付密码
  159. password: '',
  160. value: 1,
  161. list: [],
  162. money: '', //预约金额
  163. souxu: '', //预约手续费
  164. id: '', //购买产品
  165. max: 1,
  166. carouselList: [],
  167. swiperLength: 0,
  168. swiperCurrent: 0,
  169. showList: [],
  170. start: '' //平团开始时间
  171. };
  172. },
  173. //页面加载即刻发生
  174. onShow() {
  175. this.tishi = true,
  176. this.loadDate();
  177. },
  178. methods: {
  179. async loadDate() {
  180. const obj = this;
  181. uni.showLoading({
  182. title: '加载中',
  183. // mask: true
  184. });
  185. loadIndexs({})
  186. .then(({ data }) => {
  187. console.log(data);
  188. obj.carouselList = data.banner;
  189. obj.swiperLength = data.banner.length;
  190. let arr = data.roll;
  191. let ar = [];
  192. arr.forEach(e => {
  193. ar.push(e.info);
  194. });
  195. arr.infoList = ar;
  196. obj.showList = arr;
  197. lala({
  198. page: 1,
  199. limit: 10
  200. }).then(({ data }) => {
  201. data.list.data.forEach((e, index) => {
  202. lalaDetial({ page: 1, limit: 1 }, e.id).then(les => {
  203. // e.childList = les.data
  204. //开团时间
  205. let date = les.data.open_times[0].name.split(' ');
  206. let start = date[0] + ' ' + les.data.lala_pink_open + ':00';
  207. start = new Date(start);
  208. start = start.getTime();
  209. obj.start = start;
  210. //当前时间
  211. let dateTime = new Date().valueOf();
  212. //结束时间
  213. let endTime = les.data.open_times[5].value * 1000;
  214. //如果当前时间在开团时间之前或在结束时间之后,显示未开始
  215. if (dateTime > start || dataTime < endTime) {
  216. e.type = 1;
  217. } else {
  218. e.type = 2;
  219. }
  220. //拼团结束时间
  221. e.end = getTime(les.data.next_pink.value - les.data.close_join * 60);
  222. for (let i = 0; i < les.data.open_times.length; i++) {
  223. if (les.data.open_times[i].value == les.data.next_pink.value) {
  224. //拼团的轮数
  225. e.lun = i + 1;
  226. //拼团开始时间
  227. if (i != 0) {
  228. let j = i - 1;
  229. e.start = getTime(les.data.open_times[j].value);
  230. } else {
  231. e.start = getTime(obj.start);
  232. }
  233. }
  234. }
  235. obj.$set(e, 'childList', les.data);
  236. });
  237. });
  238. obj.list = data.list.data;
  239. console.log(obj.list, '1111111');
  240. uni.stopPullDownRefresh();
  241. uni.hideLoading();
  242. });
  243. })
  244. .catch(e => {
  245. uni.stopPullDownRefresh();
  246. });
  247. },
  248. closetishi() {
  249. this.tishi = false
  250. },
  251. nav(url) {
  252. console.log(url);
  253. uni.navigateTo({
  254. url: url
  255. });
  256. },
  257. buy(item) {
  258. this.money = 1 * item.cost + item.cost_money_type;
  259. this.souxu = 1 * item.ticket + item.ticket_money_type;
  260. this.id = item.id;
  261. this.show = true;
  262. },
  263. valChange(e) {
  264. console.log(e);
  265. if (this.value > 1) {
  266. e.value = 1;
  267. this.value = 1;
  268. console.log(this.value);
  269. this.$api.msg('每组限购一份');
  270. }
  271. },
  272. submit() {
  273. if (this.value == 0) {
  274. this.$api.msg('预约份数不能为0');
  275. } else {
  276. this.show = false;
  277. this.show1 = true;
  278. }
  279. },
  280. cancel() {
  281. this.password = '';
  282. this.show1 = false;
  283. },
  284. pswQd() {
  285. const obj = this;
  286. buylala(
  287. {
  288. trade_psw: this.password
  289. },
  290. this.id
  291. )
  292. .then(e => {
  293. this.password = '';
  294. this.show1 = false;
  295. this.$api.msg('参与拼购成功');
  296. })
  297. .catch(e => {
  298. this.password = '';
  299. this.show1 = false;
  300. console.log(e);
  301. });
  302. },
  303. node() {
  304. this.$api.msg('敬请期待');
  305. },
  306. lalaDetial(id) {
  307. uni.navigateTo({
  308. url: '/pages/index/datile?id=' + id
  309. });
  310. },
  311. //轮播图切换修改背景色
  312. swiperChange(e) {
  313. const index = e.detail.current;
  314. this.swiperCurrent = index;
  315. this.titleNViewBackground = this.carouselList[index].background;
  316. },
  317. goDetails(e) {
  318. uni.navigateTo({
  319. url: this.showList[e].url
  320. });
  321. }
  322. }
  323. };
  324. </script>
  325. <style lang="scss">
  326. .center {
  327. height: auto;
  328. min-height: 100%;
  329. background-color: #ffffff;
  330. }
  331. .status_bar {
  332. height: var(--status-bar-height);
  333. width: 100%;
  334. }
  335. .carousel {
  336. width: 690rpx;
  337. height: 300rpx;
  338. border-radius: 10rpx;
  339. margin: 26rpx auto 0;
  340. .bor {
  341. border-radius: 10rpx;
  342. .carousel-item {
  343. image {
  344. width: 100%;
  345. height: 100%;
  346. border-radius: 10rpx;
  347. }
  348. }
  349. }
  350. }
  351. .swiper-dot {
  352. position: relative;
  353. z-index: 10;
  354. margin-top: -40rpx;
  355. display: flex;
  356. justify-content: center;
  357. .swiper-dots-item {
  358. width: 14rpx;
  359. height: 14rpx;
  360. background: #aaaaaa;
  361. border-radius: 50%;
  362. margin: 0 16rpx;
  363. // z-index: 999;
  364. }
  365. .action {
  366. background-color: #ffffff;
  367. }
  368. }
  369. .tongz {
  370. width: 690rpx;
  371. height: 70rpx;
  372. margin: 48rpx auto 0;
  373. padding: 18rpx 30rpx 18rpx 24rpx;
  374. align-items: center;
  375. position: relative;
  376. .tongz-bg {
  377. position: absolute;
  378. top: 0;
  379. right: 0;
  380. left: 0;
  381. width: 690rpx;
  382. height: 70rpx;
  383. image {
  384. width: 100%;
  385. height: 100%;
  386. }
  387. }
  388. .tongz-left {
  389. width: 640rpx;
  390. .image-left {
  391. width: 28rpx;
  392. height: 34rpx;
  393. }
  394. .tongz-font {
  395. margin-left: 22rpx;
  396. font-size: 28rpx;
  397. font-family: Source Han Sans CN;
  398. font-weight: 400;
  399. color: #0f253a;
  400. }
  401. }
  402. .tongz-right {
  403. position: relative;
  404. z-index: 11;
  405. width: 12rpx;
  406. height: 26rpx;
  407. image {
  408. width: 100%;
  409. height: 100%;
  410. }
  411. }
  412. }
  413. .box-title {
  414. position: relative;
  415. z-index: 1;
  416. width: 100%;
  417. height: 436rpx;
  418. image {
  419. width: 100%;
  420. height: 436rpx;
  421. }
  422. }
  423. .box-body {
  424. display: flex;
  425. flex-direction: column;
  426. justify-content: space-around;
  427. width: 100%;
  428. height: 100%;
  429. position: relative;
  430. z-index: 10;
  431. margin-top: 20rpx;
  432. background: #f8fbfe;
  433. .navBox {
  434. display: flex;
  435. justify-content: space-around;
  436. .navBox-left {
  437. // margin: 20rpx 5rpx 10rpx 10rpx;
  438. margin: 20rpx -24rpx 0 0;
  439. mar .navBox-item {
  440. image {
  441. width: 100%;
  442. height: 100%;
  443. }
  444. }
  445. }
  446. .navBox-right {
  447. margin: 20rpx 0 0 -24rpx;
  448. // margin: 20rpx 10rpx 5rpx 5rpx;
  449. .navBox-item {
  450. display: flex;
  451. flex-direction: column;
  452. align-items: center;
  453. image {
  454. }
  455. }
  456. }
  457. }
  458. .shopBox {
  459. padding: 0 30rpx;
  460. width: 690rpx;
  461. // height: 770rpx;
  462. background: #ffffff;
  463. box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(0, 0, 0, 0.05);
  464. border-radius: 10px;
  465. margin: 45rpx auto 0;
  466. .shopBox-top {
  467. margin-top: 26rpx;
  468. display: flex;
  469. justify-content: space-between;
  470. align-items: center;
  471. image {
  472. height: 46rpx;
  473. width: 48rpx;
  474. }
  475. #one {
  476. font-size: 34rpx;
  477. font-family: PingFang SC;
  478. font-weight: bold;
  479. color: #0f253a;
  480. }
  481. #two {
  482. margin-left: 11rpx;
  483. font-size: 26rpx;
  484. font-family: PingFang SC;
  485. font-weight: 500;
  486. color: #6d7c88;
  487. }
  488. #three {
  489. font-size: 26rpx;
  490. font-family: PingFang SC;
  491. font-weight: 500;
  492. color: #ff4c4c;
  493. }
  494. }
  495. .shopBox-between {
  496. margin-top: 20rpx;
  497. display: flex;
  498. justify-content: space-between;
  499. align-items: center;
  500. .number {
  501. .number-left {
  502. font-size: 40rpx;
  503. font-family: PingFang SC;
  504. font-weight: bold;
  505. color: #44969d;
  506. }
  507. .number-right {
  508. font-size: 24rpx;
  509. font-family: PingFang SC;
  510. font-weight: bold;
  511. color: #44969d;
  512. }
  513. }
  514. .quotient {
  515. .quotient-children {
  516. font-size: 24rpx;
  517. font-family: PingFang SC;
  518. font-weight: 500;
  519. color: #6d7c88;
  520. }
  521. }
  522. }
  523. .forward {
  524. display: flex;
  525. justify-content: space-between;
  526. align-items: center;
  527. .forward-left {
  528. font-size: 26rpx;
  529. font-family: PingFang SC;
  530. font-weight: 500;
  531. color: #44969d;
  532. }
  533. .forward-right {
  534. font-size: 24rpx;
  535. font-family: PingFang SC;
  536. font-weight: 500;
  537. color: #6d7c88;
  538. }
  539. }
  540. .consume,
  541. .appointmentTime,
  542. .lotteryTime {
  543. margin: 12rpx 0;
  544. font-size: 26rpx;
  545. font-family: PingFang SC;
  546. font-weight: 400;
  547. color: #6d7c88;
  548. }
  549. .consume > text,
  550. .appointmentTime > text,
  551. .lotteryTime > text {
  552. font-size: 24rpx;
  553. font-family: PingFang SC;
  554. font-weight: 500;
  555. color: #000000;
  556. }
  557. .submit {
  558. width: 280rpx;
  559. height: 70rpx;
  560. background: linear-gradient(90deg, #60bab0, #45969b);
  561. border-radius: 35rpx;
  562. font-size: 32rpx;
  563. font-family: PingFang SC;
  564. font-weight: 500;
  565. color: #ffffff;
  566. text-align: center;
  567. line-height: 70rpx;
  568. margin: 40rpx 10rpx;
  569. }
  570. .submit1 {
  571. width: 280rpx;
  572. height: 70rpx;
  573. background: #ffffff;
  574. border: 1px solid #60bab0;
  575. border-radius: 35rpx;
  576. font-size: 32rpx;
  577. font-family: PingFang SC;
  578. font-weight: 500;
  579. color: #60bab0;
  580. text-align: center;
  581. line-height: 70rpx;
  582. margin: 40rpx 10rpx;
  583. }
  584. }
  585. }
  586. .yugo {
  587. padding-top: 80rpx;
  588. position: relative;
  589. height: 100%;
  590. .zhu {
  591. height: 112rpx;
  592. border-top: 1px #eeeeee solid;
  593. border-bottom: 1px #eeeeee solid;
  594. line-height: 112rpx;
  595. padding: 0 32rpx;
  596. font-size: 28rpx;
  597. font-family: PingFang SC;
  598. font-weight: 500;
  599. color: #6d7c88;
  600. .zhu-right {
  601. display: inline-block;
  602. padding-left: 60rpx;
  603. }
  604. .zhu-num {
  605. color: #000000;
  606. }
  607. }
  608. .info-main {
  609. padding: 0 32rpx;
  610. .info-box {
  611. padding-top: 22rpx;
  612. display: flex;
  613. justify-content: space-between;
  614. align-items: center;
  615. .info-left {
  616. font-size: 28rpx;
  617. font-family: PingFang SC;
  618. font-weight: 500;
  619. color: #6d7c88;
  620. }
  621. .info-right {
  622. font-size: 28rpx;
  623. font-family: PingFang SC;
  624. font-weight: 500;
  625. color: #0f253a;
  626. }
  627. }
  628. }
  629. .btn {
  630. position: absolute;
  631. bottom: 50rpx;
  632. left: 50%;
  633. margin-left: -342rpx;
  634. width: 684rpx;
  635. height: 86rpx;
  636. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  637. border-radius: 10rpx;
  638. text-align: center;
  639. line-height: 86rpx;
  640. font-size: 36rpx;
  641. font-family: PingFang SC;
  642. font-weight: 500;
  643. color: #ffffff;
  644. }
  645. }
  646. .psw-wrapper {
  647. width: 548rpx;
  648. height: 344rpx;
  649. background-color: #ffffff;
  650. .psw-title {
  651. width: 100%;
  652. font-size: 35rpx;
  653. padding: 43rpx 0 49rpx;
  654. text-align: center;
  655. font-weight: 800;
  656. }
  657. .psw-ipt {
  658. display: block;
  659. background-color: #dce3ed;
  660. height: 90rpx;
  661. width: 464rpx;
  662. padding-left: 30rpx;
  663. margin: 0 auto;
  664. font-size: 80rpx;
  665. }
  666. .psw-btn text {
  667. display: inline-block;
  668. text-align: center;
  669. width: 50%;
  670. padding-top: 29rpx;
  671. font-size: 35rpx;
  672. }
  673. .psw-qd {
  674. color: #45969b;
  675. }
  676. }
  677. .tishi {
  678. position: fixed;
  679. bottom: 400rpx;
  680. right: 20rpx;
  681. z-index: 100;
  682. image {
  683. width: 100%;
  684. height: 100%;
  685. }
  686. .closeBox {
  687. position: absolute;
  688. top: 0;
  689. right: 0;
  690. width: 50rpx;
  691. height: 50rpx;
  692. padding-top: 10rpx;
  693. .close {
  694. width: 30rpx;
  695. height: 30rpx;
  696. margin:auto ;
  697. }
  698. }
  699. .main {
  700. top: 40rpx;
  701. right: 20rpx;
  702. position: absolute;
  703. width: 100rpx;
  704. height: 100rpx;
  705. }
  706. }
  707. </style>