index.vue 15 KB

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