index.vue 16 KB

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