index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <view class="center">
  3. <view class="box-title"><image src="../../static/img/index7.png" mode=""></image></view>
  4. <view class="box-body">
  5. <view class="navBox">
  6. <view class="navBox-left">
  7. <!-- <view class="navBox-item" @click="nav('./node')"><image src="../../static/img/index2.png" style="width: 385rpx; height: 398rpx;" mode=""></image></view> -->
  8. <view class="navBox-item" @click="node()"><image src="../../static/img/index2.png" style="width: 385rpx; height: 398rpx;" mode=""></image></view>
  9. </view>
  10. <view class="navBox-right">
  11. <view class="navBox-item" @click="nav('./convert')"><image src="../../static/img/index3.png" style="width: 385rpx; height: 216rpx; " mode=""></image></view>
  12. <!-- <view class="navBox-item" @click="nav('/pages/index/appointment')">
  13. <image src="../../static/img/index6.png" style="width: 339rpx; height: 170rpx; margin-top: -12rpx;" mode=""></image>
  14. </view> -->
  15. <view class="navBox-item" @click="node()">
  16. <image src="../../static/img/index6.png" style="width: 339rpx; height: 170rpx; margin-top: -12rpx;" mode=""></image>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="shopBox" v-for="(item,index) in list" :key="index">
  21. <view class="shopBox-top">
  22. <view class="left"><image src="../../static/img/index4.png" mode=""></image></view>
  23. <view class="between" style="margin-left: -340rpx;">
  24. <text id="one">{{item.name}}</text>
  25. <text id="two">{{item.lun}}轮</text>
  26. </view>
  27. <text id="three">预约中</text>
  28. </view>
  29. <view class="shopBox-between">
  30. <view class="number">
  31. <text class="number-left">{{1*item.cost}}</text>
  32. <text class="number-right">{{item.cost_money_type}}/份</text>
  33. </view>
  34. <view class="quotient"><text class="quotient-children">每轮限购1组,每组限购一份</text></view>
  35. </view>
  36. <image :src="item.background_image" style="width: 635rpx; height: 170rpx; margin: 40rpx 0;" mode=""></image>
  37. <view class="shopBox-bottom">
  38. <view class="forward">
  39. <view class="forward-left"></view>
  40. <view class="forward-right">每组分数:&nbsp {{item.join_number}}份</view>
  41. </view>
  42. <view class="consume">
  43. GAS消耗:
  44. <text>{{1*item.ticket}}{{item.ticket_money_type}}</text>
  45. </view>
  46. <view class="appointmentTime">
  47. 预约时间:
  48. <text>{{ item.start }}-{{ item.end}}</text>
  49. </view>
  50. <view class="lotteryTime">
  51. 开奖时间:
  52. <text>{{item.jiang}}</text>
  53. </view>
  54. </view>
  55. <view class="btn-box flex">
  56. <view class="submit1" @click="lalaDetial(item.id)">查看更多</view>
  57. <view class="submit" @click="buy(item)">预购</view>
  58. </view>
  59. </view>
  60. </view>
  61. <u-popup v-model="show" mode="bottom" border-radius="40" height="868rpx" :closeable="true">
  62. <view class="yugo">
  63. <view class="zhu">
  64. 注:每轮限购1组,每组限购1份
  65. <span class="zhu-right">
  66. 最多可预约:
  67. <span class="zhu-num">1份</span>
  68. </span>
  69. </view>
  70. <view class="info-main">
  71. <view class="info-box">
  72. <view class="info-left">预约份数:</view>
  73. <view class="info-right"><u-number-box :max="max" v-model="value" @change="valChange"></u-number-box></view>
  74. </view>
  75. <view class="info-box">
  76. <view class="info-left">预约金额:</view>
  77. <view class="info-right">{{money}}</view>
  78. </view>
  79. <view class="info-box">
  80. <view class="info-left">预约手续费:</view>
  81. <view class="info-right">{{souxu}}</view>
  82. </view>
  83. </view>
  84. <view class="btn" @click="submit()">确定</view>
  85. </view>
  86. </u-popup>
  87. <u-popup v-model="show1" mode="center" width="548rpx" border-radius="14">
  88. <view class="psw-wrapper">
  89. <view class="psw-title">请输入支付密码</view>
  90. <input type="password" v-model="password" class="psw-ipt" />
  91. <view class="psw-btn">
  92. <text @click="cancel">取消</text>
  93. <text class="psw-qd" @click="pswQd">确定</text>
  94. </view>
  95. </view>
  96. </u-popup>
  97. </view>
  98. </template>
  99. <script>
  100. import { lala,lalaDetial,buylala } from '@/api/product.js'
  101. import {getTime} from '@/utils/rocessor.js'
  102. export default {
  103. data() {
  104. return {
  105. show: false, //支付数量
  106. show1: false, //支付密码
  107. password: '',
  108. value: 1,
  109. list:[],
  110. money:'',//预约金额
  111. souxu:'',//预约手续费
  112. id:'',//购买产品
  113. max:1
  114. };
  115. },
  116. //页面加载即刻发生
  117. onShow() {
  118. this.loadDate();
  119. },
  120. onLoad() {
  121. this.loadDate();
  122. },
  123. methods: {
  124. async loadDate() {
  125. const obj = this;
  126. lala(
  127. {
  128. page:1,
  129. limit:10,
  130. }).then(({data}) => {
  131. obj.list = data.list.data
  132. obj.list.forEach((e,index) => {
  133. lalaDetial({page:1,limit:1},e.id)
  134. .then(les =>{
  135. console.log(les)
  136. let end = getTime(les.data.next_pink - les.data.close_join*60);
  137. let start = getTime(les.data.next_pink - les.data.close_join*60 - 2*60*60);
  138. let jiang = getTime(les.data.next_pink);
  139. e.end = end;
  140. e.start = start;
  141. e.jiang = jiang;
  142. // les.data.next_pink
  143. if('history_list' in les.data){
  144. e.lun = 1*les.data.history_list[0].group_num+1
  145. }else{
  146. e.lun = 1
  147. }
  148. obj.$set(e,'childList',les.data)
  149. // e.childList = les.data
  150. console.log(obj.list,"1111111")
  151. })
  152. })
  153. })
  154. },
  155. nav(url) {
  156. uni.navigateTo({
  157. url: url
  158. });
  159. },
  160. buy(item) {
  161. this.money = (1*item.cost) + item.cost_money_type;
  162. this.souxu = item.ticket+item.ticket_money_type;
  163. this.id = item.id;
  164. this.show = true;
  165. },
  166. valChange(e) {
  167. console.log(e);
  168. if(this.value > 1){
  169. e.value = 1
  170. this.value = 1;
  171. console.log(this.value)
  172. this.$api.msg("每组限购一份");
  173. }
  174. },
  175. submit() {
  176. if(this.value == 0){
  177. this.$api.msg("预约份数不能为0")
  178. }
  179. else{
  180. this.show = false;
  181. this.show1 = true;
  182. }
  183. },
  184. cancel() {
  185. this.password = '';
  186. this.show1 = false;
  187. },
  188. pswQd() {
  189. buylala({
  190. trade_psw: this.password
  191. },this.id).then(e => {
  192. this.password = ''
  193. this.show1 = false;
  194. console.log(e)
  195. }).catch(e => {
  196. this.password = ''
  197. this.show1 = false;
  198. console.log(e)
  199. })
  200. },
  201. node(){
  202. this.$api.msg("敬请期待")
  203. },
  204. lalaDetial(id) {
  205. uni.navigateTo({
  206. url: '/pages/index/datile?id=' + id
  207. })
  208. }
  209. }
  210. };
  211. </script>
  212. <style lang="scss">
  213. .center {
  214. height: auto;
  215. min-height: 100%;
  216. background-color: #ffffff;
  217. }
  218. .box-title {
  219. position: relative;
  220. z-index: 1;
  221. width: 100%;
  222. height: 436rpx;
  223. image {
  224. width: 100%;
  225. height: 436rpx;
  226. }
  227. }
  228. .box-body {
  229. display: flex;
  230. flex-direction: column;
  231. justify-content: space-around;
  232. width: 100%;
  233. height: 100%;
  234. position: relative;
  235. z-index: 10;
  236. margin-top: -40rpx;
  237. border-top-left-radius: 40rpx;
  238. border-top-right-radius: 40rpx;
  239. background: #f8fbfe;
  240. .navBox {
  241. display: flex;
  242. justify-content: space-around;
  243. .navBox-left {
  244. // margin: 20rpx 5rpx 10rpx 10rpx;
  245. margin: 20rpx -24rpx 0 0;
  246. mar .navBox-item {
  247. image {
  248. width: 100%;
  249. height: 100%;
  250. }
  251. }
  252. }
  253. .navBox-right {
  254. margin: 20rpx 0 0 -24rpx;
  255. // margin: 20rpx 10rpx 5rpx 5rpx;
  256. .navBox-item {
  257. display: flex;
  258. flex-direction: column;
  259. align-items: center;
  260. image {
  261. }
  262. }
  263. }
  264. }
  265. .shopBox {
  266. padding: 0 30rpx;
  267. margin-top: 45rpx;
  268. width: 690rpx;
  269. // height: 770rpx;
  270. background: #ffffff;
  271. box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(0, 0, 0, 0.05);
  272. border-radius: 10px;
  273. margin: 0 auto;
  274. .shopBox-top {
  275. margin-top: 26rpx;
  276. display: flex;
  277. justify-content: space-between;
  278. align-items: center;
  279. image {
  280. height: 46rpx;
  281. width: 48rpx;
  282. }
  283. #one {
  284. font-size: 34rpx;
  285. font-family: PingFang SC;
  286. font-weight: bold;
  287. color: #0f253a;
  288. }
  289. #two {
  290. margin-left: 11rpx;
  291. font-size: 26rpx;
  292. font-family: PingFang SC;
  293. font-weight: 500;
  294. color: #6d7c88;
  295. }
  296. #three {
  297. font-size: 26rpx;
  298. font-family: PingFang SC;
  299. font-weight: 500;
  300. color: #ff4c4c;
  301. }
  302. }
  303. .shopBox-between {
  304. margin-top: 20rpx;
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. .number {
  309. .number-left {
  310. font-size: 40rpx;
  311. font-family: PingFang SC;
  312. font-weight: bold;
  313. color: #44969d;
  314. }
  315. .number-right {
  316. font-size: 24rpx;
  317. font-family: PingFang SC;
  318. font-weight: bold;
  319. color: #44969d;
  320. }
  321. }
  322. .quotient {
  323. .quotient-children {
  324. font-size: 24rpx;
  325. font-family: PingFang SC;
  326. font-weight: 500;
  327. color: #6d7c88;
  328. }
  329. }
  330. }
  331. .forward {
  332. display: flex;
  333. justify-content: space-between;
  334. align-items: center;
  335. .forward-left {
  336. font-size: 26rpx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #44969d;
  340. }
  341. .forward-right {
  342. font-size: 24rpx;
  343. font-family: PingFang SC;
  344. font-weight: 500;
  345. color: #6d7c88;
  346. }
  347. }
  348. .consume,
  349. .appointmentTime,
  350. .lotteryTime {
  351. margin: 12rpx 0;
  352. font-size: 26rpx;
  353. font-family: PingFang SC;
  354. font-weight: 400;
  355. color: #6d7c88;
  356. }
  357. .consume > text,
  358. .appointmentTime > text,
  359. .lotteryTime > text {
  360. font-size: 10rpx;
  361. font-family: PingFang SC;
  362. font-weight: 500;
  363. color: #000000;
  364. }
  365. .submit {
  366. width:295rpx;
  367. height: 70rpx;
  368. background: linear-gradient(90deg, #60bab0, #45969b);
  369. border-radius: 35rpx;
  370. font-size: 32rpx;
  371. font-family: PingFang SC;
  372. font-weight: 500;
  373. color: #ffffff;
  374. text-align: center;
  375. line-height: 70rpx;
  376. margin: 40rpx 10rpx;
  377. }
  378. .submit1 {
  379. width:295rpx;
  380. height: 70rpx;
  381. border: 1px solid #60bab0;
  382. background: #fff;
  383. border-radius: 35rpx;
  384. font-size: 32rpx;
  385. font-family: PingFang SC;
  386. font-weight: 500;
  387. color: #60bab0;
  388. text-align: center;
  389. line-height: 70rpx;
  390. margin: 40rpx 10rpx;
  391. }
  392. }
  393. }
  394. .yugo {
  395. padding-top: 80rpx;
  396. position: relative;
  397. height: 100%;
  398. .zhu {
  399. height: 112rpx;
  400. border-top: 1px #eeeeee solid;
  401. border-bottom: 1px #eeeeee solid;
  402. line-height: 112rpx;
  403. padding: 0 32rpx;
  404. font-size: 28rpx;
  405. font-family: PingFang SC;
  406. font-weight: 500;
  407. color: #6d7c88;
  408. .zhu-right {
  409. display: inline-block;
  410. padding-left: 60rpx;
  411. }
  412. .zhu-num {
  413. color: #000000;
  414. }
  415. }
  416. .info-main {
  417. padding: 0 32rpx;
  418. .info-box {
  419. padding-top: 22rpx;
  420. display: flex;
  421. justify-content: space-between;
  422. align-items: center;
  423. .info-left {
  424. font-size: 28rpx;
  425. font-family: PingFang SC;
  426. font-weight: 500;
  427. color: #6d7c88;
  428. }
  429. .info-right {
  430. font-size: 28rpx;
  431. font-family: PingFang SC;
  432. font-weight: 500;
  433. color: #0f253a;
  434. }
  435. }
  436. }
  437. .btn {
  438. position: absolute;
  439. bottom: 50rpx;
  440. left: 50%;
  441. margin-left: -342rpx;
  442. width: 684rpx;
  443. height: 86rpx;
  444. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  445. border-radius: 10rpx;
  446. text-align: center;
  447. line-height: 86rpx;
  448. font-size: 36rpx;
  449. font-family: PingFang SC;
  450. font-weight: 500;
  451. color: #ffffff;
  452. }
  453. }
  454. .psw-wrapper {
  455. width: 548rpx;
  456. height: 344rpx;
  457. background-color: #FFFFFF;
  458. .psw-title {
  459. width: 100%;
  460. font-size: 35rpx;
  461. padding: 43rpx 0 49rpx;
  462. text-align: center;
  463. font-weight: 800;
  464. }
  465. .psw-ipt {
  466. display: block;
  467. background-color: #dce3ed;
  468. height: 90rpx;
  469. width: 464rpx;
  470. padding-left: 30rpx;
  471. margin: 0 auto;
  472. font-size: 80rpx;
  473. }
  474. .psw-btn text{
  475. display: inline-block;
  476. text-align: center;
  477. width: 50%;
  478. padding-top: 29rpx;
  479. font-size: 35rpx;
  480. }
  481. .psw-qd {
  482. color:#45969B;
  483. }
  484. }
  485. </style>