index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  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. <<<<<<< HEAD
  176. =======
  177. this.tishi = true,
  178. >>>>>>> 52a7e9ac801e5bdec57490748e56d954e229ebe5
  179. this.loadDate();
  180. },
  181. methods: {
  182. async loadDate() {
  183. const obj = this;
  184. uni.showLoading({
  185. title: '加载中',
  186. // mask: true
  187. });
  188. loadIndexs({})
  189. .then(({ data }) => {
  190. console.log(data);
  191. obj.carouselList = data.banner;
  192. obj.swiperLength = data.banner.length;
  193. let arr = data.roll;
  194. let ar = [];
  195. arr.forEach(e => {
  196. ar.push(e.info);
  197. });
  198. arr.infoList = ar;
  199. obj.showList = arr;
  200. lala({
  201. page: 1,
  202. limit: 10
  203. }).then(({ data }) => {
  204. data.list.data.forEach((e, index) => {
  205. lalaDetial({ page: 1, limit: 1 }, e.id).then(les => {
  206. // e.childList = les.data
  207. //开团时间
  208. let date = les.data.open_times[0].name.split(' ');
  209. let start = date[0] + ' ' + les.data.lala_pink_open + ':00';
  210. start = new Date(start);
  211. start = start.getTime();
  212. obj.start = start;
  213. //当前时间
  214. let dateTime = new Date().valueOf();
  215. //结束时间
  216. let endTime = les.data.open_times[5].value * 1000;
  217. //如果当前时间在开团时间之前或在结束时间之后,显示未开始
  218. if (dateTime > start || dataTime < endTime) {
  219. e.type = 1;
  220. } else {
  221. e.type = 2;
  222. }
  223. //拼团结束时间
  224. e.end = getTime(les.data.next_pink.value - les.data.close_join * 60);
  225. for (let i = 0; i < les.data.open_times.length; i++) {
  226. if (les.data.open_times[i].value == les.data.next_pink.value) {
  227. //拼团的轮数
  228. e.lun = i + 1;
  229. //拼团开始时间
  230. if (i != 0) {
  231. let j = i - 1;
  232. e.start = getTime(les.data.open_times[j].value);
  233. } else {
  234. e.start = getTime(obj.start);
  235. }
  236. }
  237. }
  238. obj.$set(e, 'childList', les.data);
  239. });
  240. });
  241. obj.list = data.list.data;
  242. console.log(obj.list, '1111111');
  243. uni.stopPullDownRefresh();
  244. uni.hideLoading();
  245. });
  246. })
  247. .catch(e => {
  248. uni.stopPullDownRefresh();
  249. });
  250. },
  251. closetishi() {
  252. this.tishi = false
  253. },
  254. nav(url) {
  255. console.log(url);
  256. uni.navigateTo({
  257. url: url
  258. });
  259. },
  260. buy(item) {
  261. this.money = 1 * item.cost + item.cost_money_type;
  262. this.souxu = 1 * item.ticket + item.ticket_money_type;
  263. this.id = item.id;
  264. this.show = true;
  265. },
  266. valChange(e) {
  267. console.log(e);
  268. if (this.value > 1) {
  269. e.value = 1;
  270. this.value = 1;
  271. console.log(this.value);
  272. this.$api.msg('每组限购一份');
  273. }
  274. },
  275. submit() {
  276. if (this.value == 0) {
  277. this.$api.msg('预约份数不能为0');
  278. } else {
  279. this.show = false;
  280. this.show1 = true;
  281. }
  282. },
  283. cancel() {
  284. this.password = '';
  285. this.show1 = false;
  286. },
  287. pswQd() {
  288. const obj = this;
  289. buylala(
  290. {
  291. trade_psw: this.password
  292. },
  293. this.id
  294. )
  295. .then(e => {
  296. this.password = '';
  297. this.show1 = false;
  298. this.$api.msg('参与拼购成功');
  299. })
  300. .catch(e => {
  301. this.password = '';
  302. this.show1 = false;
  303. console.log(e);
  304. });
  305. },
  306. node() {
  307. this.$api.msg('敬请期待');
  308. },
  309. lalaDetial(id) {
  310. uni.navigateTo({
  311. url: '/pages/index/datile?id=' + id
  312. });
  313. },
  314. //轮播图切换修改背景色
  315. swiperChange(e) {
  316. const index = e.detail.current;
  317. this.swiperCurrent = index;
  318. this.titleNViewBackground = this.carouselList[index].background;
  319. },
  320. goDetails(e) {
  321. uni.navigateTo({
  322. url: this.showList[e].url
  323. });
  324. }
  325. }
  326. };
  327. </script>
  328. <style lang="scss">
  329. .center {
  330. height: auto;
  331. min-height: 100%;
  332. background-color: #ffffff;
  333. }
  334. .status_bar {
  335. height: var(--status-bar-height);
  336. width: 100%;
  337. }
  338. .carousel {
  339. width: 690rpx;
  340. height: 300rpx;
  341. border-radius: 10rpx;
  342. margin: 26rpx auto 0;
  343. .bor {
  344. border-radius: 10rpx;
  345. .carousel-item {
  346. image {
  347. width: 100%;
  348. height: 100%;
  349. border-radius: 10rpx;
  350. }
  351. }
  352. }
  353. }
  354. .swiper-dot {
  355. position: relative;
  356. z-index: 10;
  357. margin-top: -40rpx;
  358. display: flex;
  359. justify-content: center;
  360. .swiper-dots-item {
  361. width: 14rpx;
  362. height: 14rpx;
  363. background: #aaaaaa;
  364. border-radius: 50%;
  365. margin: 0 16rpx;
  366. // z-index: 999;
  367. }
  368. .action {
  369. background-color: #ffffff;
  370. }
  371. }
  372. .tongz {
  373. width: 690rpx;
  374. height: 70rpx;
  375. margin: 48rpx auto 0;
  376. padding: 18rpx 30rpx 18rpx 24rpx;
  377. align-items: center;
  378. position: relative;
  379. .tongz-bg {
  380. position: absolute;
  381. top: 0;
  382. right: 0;
  383. left: 0;
  384. width: 690rpx;
  385. height: 70rpx;
  386. image {
  387. width: 100%;
  388. height: 100%;
  389. }
  390. }
  391. .tongz-left {
  392. width: 640rpx;
  393. .image-left {
  394. width: 28rpx;
  395. height: 34rpx;
  396. }
  397. .tongz-font {
  398. margin-left: 22rpx;
  399. font-size: 28rpx;
  400. font-family: Source Han Sans CN;
  401. font-weight: 400;
  402. color: #0f253a;
  403. }
  404. }
  405. .tongz-right {
  406. position: relative;
  407. z-index: 11;
  408. width: 12rpx;
  409. height: 26rpx;
  410. image {
  411. width: 100%;
  412. height: 100%;
  413. }
  414. }
  415. }
  416. .box-title {
  417. position: relative;
  418. z-index: 1;
  419. width: 100%;
  420. height: 436rpx;
  421. image {
  422. width: 100%;
  423. height: 436rpx;
  424. }
  425. }
  426. .box-body {
  427. display: flex;
  428. flex-direction: column;
  429. justify-content: space-around;
  430. width: 100%;
  431. height: 100%;
  432. position: relative;
  433. z-index: 10;
  434. margin-top: 20rpx;
  435. background: #f8fbfe;
  436. .navBox {
  437. display: flex;
  438. justify-content: space-around;
  439. .navBox-left {
  440. // margin: 20rpx 5rpx 10rpx 10rpx;
  441. margin: 20rpx -24rpx 0 0;
  442. mar .navBox-item {
  443. image {
  444. width: 100%;
  445. height: 100%;
  446. }
  447. }
  448. }
  449. .navBox-right {
  450. margin: 20rpx 0 0 -24rpx;
  451. // margin: 20rpx 10rpx 5rpx 5rpx;
  452. .navBox-item {
  453. display: flex;
  454. flex-direction: column;
  455. align-items: center;
  456. image {
  457. }
  458. }
  459. }
  460. }
  461. .shopBox {
  462. padding: 0 30rpx;
  463. width: 690rpx;
  464. // height: 770rpx;
  465. background: #ffffff;
  466. box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(0, 0, 0, 0.05);
  467. border-radius: 10px;
  468. margin: 45rpx auto 0;
  469. .shopBox-top {
  470. margin-top: 26rpx;
  471. display: flex;
  472. justify-content: space-between;
  473. align-items: center;
  474. image {
  475. height: 46rpx;
  476. width: 48rpx;
  477. }
  478. #one {
  479. font-size: 34rpx;
  480. font-family: PingFang SC;
  481. font-weight: bold;
  482. color: #0f253a;
  483. }
  484. #two {
  485. margin-left: 11rpx;
  486. font-size: 26rpx;
  487. font-family: PingFang SC;
  488. font-weight: 500;
  489. color: #6d7c88;
  490. }
  491. #three {
  492. font-size: 26rpx;
  493. font-family: PingFang SC;
  494. font-weight: 500;
  495. color: #ff4c4c;
  496. }
  497. }
  498. .shopBox-between {
  499. margin-top: 20rpx;
  500. display: flex;
  501. justify-content: space-between;
  502. align-items: center;
  503. .number {
  504. .number-left {
  505. font-size: 40rpx;
  506. font-family: PingFang SC;
  507. font-weight: bold;
  508. color: #44969d;
  509. }
  510. .number-right {
  511. font-size: 24rpx;
  512. font-family: PingFang SC;
  513. font-weight: bold;
  514. color: #44969d;
  515. }
  516. }
  517. .quotient {
  518. .quotient-children {
  519. font-size: 24rpx;
  520. font-family: PingFang SC;
  521. font-weight: 500;
  522. color: #6d7c88;
  523. }
  524. }
  525. }
  526. .forward {
  527. display: flex;
  528. justify-content: space-between;
  529. align-items: center;
  530. .forward-left {
  531. font-size: 26rpx;
  532. font-family: PingFang SC;
  533. font-weight: 500;
  534. color: #44969d;
  535. }
  536. .forward-right {
  537. font-size: 24rpx;
  538. font-family: PingFang SC;
  539. font-weight: 500;
  540. color: #6d7c88;
  541. }
  542. }
  543. .consume,
  544. .appointmentTime,
  545. .lotteryTime {
  546. margin: 12rpx 0;
  547. font-size: 26rpx;
  548. font-family: PingFang SC;
  549. font-weight: 400;
  550. color: #6d7c88;
  551. }
  552. .consume > text,
  553. .appointmentTime > text,
  554. .lotteryTime > text {
  555. font-size: 24rpx;
  556. font-family: PingFang SC;
  557. font-weight: 500;
  558. color: #000000;
  559. }
  560. .submit {
  561. width: 280rpx;
  562. height: 70rpx;
  563. background: linear-gradient(90deg, #60bab0, #45969b);
  564. border-radius: 35rpx;
  565. font-size: 32rpx;
  566. font-family: PingFang SC;
  567. font-weight: 500;
  568. color: #ffffff;
  569. text-align: center;
  570. line-height: 70rpx;
  571. margin: 40rpx 10rpx;
  572. }
  573. .submit1 {
  574. width: 280rpx;
  575. height: 70rpx;
  576. background: #ffffff;
  577. border: 1px solid #60bab0;
  578. border-radius: 35rpx;
  579. font-size: 32rpx;
  580. font-family: PingFang SC;
  581. font-weight: 500;
  582. color: #60bab0;
  583. text-align: center;
  584. line-height: 70rpx;
  585. margin: 40rpx 10rpx;
  586. }
  587. }
  588. }
  589. .yugo {
  590. padding-top: 80rpx;
  591. position: relative;
  592. height: 100%;
  593. .zhu {
  594. height: 112rpx;
  595. border-top: 1px #eeeeee solid;
  596. border-bottom: 1px #eeeeee solid;
  597. line-height: 112rpx;
  598. padding: 0 32rpx;
  599. font-size: 28rpx;
  600. font-family: PingFang SC;
  601. font-weight: 500;
  602. color: #6d7c88;
  603. .zhu-right {
  604. display: inline-block;
  605. padding-left: 60rpx;
  606. }
  607. .zhu-num {
  608. color: #000000;
  609. }
  610. }
  611. .info-main {
  612. padding: 0 32rpx;
  613. .info-box {
  614. padding-top: 22rpx;
  615. display: flex;
  616. justify-content: space-between;
  617. align-items: center;
  618. .info-left {
  619. font-size: 28rpx;
  620. font-family: PingFang SC;
  621. font-weight: 500;
  622. color: #6d7c88;
  623. }
  624. .info-right {
  625. font-size: 28rpx;
  626. font-family: PingFang SC;
  627. font-weight: 500;
  628. color: #0f253a;
  629. }
  630. }
  631. }
  632. .btn {
  633. position: absolute;
  634. bottom: 50rpx;
  635. left: 50%;
  636. margin-left: -342rpx;
  637. width: 684rpx;
  638. height: 86rpx;
  639. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  640. border-radius: 10rpx;
  641. text-align: center;
  642. line-height: 86rpx;
  643. font-size: 36rpx;
  644. font-family: PingFang SC;
  645. font-weight: 500;
  646. color: #ffffff;
  647. }
  648. }
  649. .psw-wrapper {
  650. width: 548rpx;
  651. height: 344rpx;
  652. background-color: #ffffff;
  653. .psw-title {
  654. width: 100%;
  655. font-size: 35rpx;
  656. padding: 43rpx 0 49rpx;
  657. text-align: center;
  658. font-weight: 800;
  659. }
  660. .psw-ipt {
  661. display: block;
  662. background-color: #dce3ed;
  663. height: 90rpx;
  664. width: 464rpx;
  665. padding-left: 30rpx;
  666. margin: 0 auto;
  667. font-size: 80rpx;
  668. }
  669. .psw-btn text {
  670. display: inline-block;
  671. text-align: center;
  672. width: 50%;
  673. padding-top: 29rpx;
  674. font-size: 35rpx;
  675. }
  676. .psw-qd {
  677. color: #45969b;
  678. }
  679. }
  680. .tishi {
  681. position: fixed;
  682. bottom: 400rpx;
  683. right: 20rpx;
  684. z-index: 100;
  685. image {
  686. width: 100%;
  687. height: 100%;
  688. }
  689. .closeBox {
  690. position: absolute;
  691. top: 0;
  692. right: 0;
  693. width: 50rpx;
  694. height: 50rpx;
  695. padding-top: 10rpx;
  696. .close {
  697. width: 30rpx;
  698. height: 30rpx;
  699. margin:auto ;
  700. }
  701. }
  702. .main {
  703. top: 40rpx;
  704. right: 20rpx;
  705. position: absolute;
  706. width: 100rpx;
  707. height: 100rpx;
  708. }
  709. }
  710. </style>