index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  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. methods: {
  121. async loadDate() {
  122. const obj = this;
  123. lala(
  124. {
  125. page:1,
  126. limit:10,
  127. }).then(({data}) => {
  128. obj.list = data.list.data
  129. obj.list.forEach((e,index) => {
  130. lalaDetial({page:1,limit:1},e.id)
  131. .then(les =>{
  132. console.log(les)
  133. let end = getTime(les.data.next_pink - les.data.close_join*60);
  134. let start = getTime(les.data.next_pink - les.data.close_join*60 - 2*60*60);
  135. let jiang = getTime(les.data.next_pink);
  136. e.end = end;
  137. e.start = start;
  138. e.jiang = jiang;
  139. // les.data.next_pink
  140. if('history_list' in les.data){
  141. e.lun = 1*les.data.history_list[0].group_num+1
  142. }else{
  143. e.lun = 1
  144. }
  145. obj.$set(e,'childList',les.data)
  146. // e.childList = les.data
  147. console.log(obj.list,"1111111")
  148. })
  149. })
  150. })
  151. },
  152. nav(url) {
  153. uni.navigateTo({
  154. url: url
  155. });
  156. },
  157. buy(item) {
  158. this.money = (1*item.cost) + item.cost_money_type;
  159. this.souxu = item.ticket+item.ticket_money_type;
  160. this.id = item.id;
  161. this.show = true;
  162. },
  163. valChange(e) {
  164. console.log(e);
  165. if(this.value > 1){
  166. e.value = 1
  167. this.value = 1;
  168. console.log(this.value)
  169. this.$api.msg("每组限购一份");
  170. }
  171. },
  172. submit() {
  173. if(this.value == 0){
  174. this.$api.msg("预约份数不能为0")
  175. }
  176. else{
  177. this.show = false;
  178. this.show1 = true;
  179. }
  180. },
  181. cancel() {
  182. this.password = '';
  183. this.show1 = false;
  184. },
  185. pswQd() {
  186. buylala({
  187. trade_psw: this.password
  188. },this.id).then(e => {
  189. this.password = ''
  190. this.show1 = false;
  191. obj.$api.msg(data.msg);
  192. }).catch(e => {
  193. this.password = ''
  194. this.show1 = false;
  195. console.log(e)
  196. })
  197. },
  198. node(){
  199. this.$api.msg("敬请期待")
  200. },
  201. lalaDetial(id) {
  202. uni.navigateTo({
  203. url: '/pages/index/datile?id=' + id
  204. })
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="scss">
  210. .center {
  211. height: auto;
  212. min-height: 100%;
  213. background-color: #ffffff;
  214. }
  215. .box-title {
  216. position: relative;
  217. z-index: 1;
  218. width: 100%;
  219. height: 436rpx;
  220. image {
  221. width: 100%;
  222. height: 436rpx;
  223. }
  224. }
  225. .box-body {
  226. display: flex;
  227. flex-direction: column;
  228. justify-content: space-around;
  229. width: 100%;
  230. height: 100%;
  231. position: relative;
  232. z-index: 10;
  233. margin-top: -40rpx;
  234. border-top-left-radius: 40rpx;
  235. border-top-right-radius: 40rpx;
  236. background: #f8fbfe;
  237. .navBox {
  238. display: flex;
  239. justify-content: space-around;
  240. .navBox-left {
  241. // margin: 20rpx 5rpx 10rpx 10rpx;
  242. margin: 20rpx -24rpx 0 0;
  243. mar .navBox-item {
  244. image {
  245. width: 100%;
  246. height: 100%;
  247. }
  248. }
  249. }
  250. .navBox-right {
  251. margin: 20rpx 0 0 -24rpx;
  252. // margin: 20rpx 10rpx 5rpx 5rpx;
  253. .navBox-item {
  254. display: flex;
  255. flex-direction: column;
  256. align-items: center;
  257. image {
  258. }
  259. }
  260. }
  261. }
  262. .shopBox {
  263. padding: 0 30rpx;
  264. margin-top: 45rpx;
  265. width: 690rpx;
  266. // height: 770rpx;
  267. background: #ffffff;
  268. box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(0, 0, 0, 0.05);
  269. border-radius: 10px;
  270. margin: 0 auto;
  271. .shopBox-top {
  272. margin-top: 26rpx;
  273. display: flex;
  274. justify-content: space-between;
  275. align-items: center;
  276. image {
  277. height: 46rpx;
  278. width: 48rpx;
  279. }
  280. #one {
  281. font-size: 34rpx;
  282. font-family: PingFang SC;
  283. font-weight: bold;
  284. color: #0f253a;
  285. }
  286. #two {
  287. margin-left: 11rpx;
  288. font-size: 26rpx;
  289. font-family: PingFang SC;
  290. font-weight: 500;
  291. color: #6d7c88;
  292. }
  293. #three {
  294. font-size: 26rpx;
  295. font-family: PingFang SC;
  296. font-weight: 500;
  297. color: #ff4c4c;
  298. }
  299. }
  300. .shopBox-between {
  301. margin-top: 20rpx;
  302. display: flex;
  303. justify-content: space-between;
  304. align-items: center;
  305. .number {
  306. .number-left {
  307. font-size: 40rpx;
  308. font-family: PingFang SC;
  309. font-weight: bold;
  310. color: #44969d;
  311. }
  312. .number-right {
  313. font-size: 24rpx;
  314. font-family: PingFang SC;
  315. font-weight: bold;
  316. color: #44969d;
  317. }
  318. }
  319. .quotient {
  320. .quotient-children {
  321. font-size: 24rpx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #6d7c88;
  325. }
  326. }
  327. }
  328. .forward {
  329. display: flex;
  330. justify-content: space-between;
  331. align-items: center;
  332. .forward-left {
  333. font-size: 26rpx;
  334. font-family: PingFang SC;
  335. font-weight: 500;
  336. color: #44969d;
  337. }
  338. .forward-right {
  339. font-size: 24rpx;
  340. font-family: PingFang SC;
  341. font-weight: 500;
  342. color: #6d7c88;
  343. }
  344. }
  345. .consume,
  346. .appointmentTime,
  347. .lotteryTime {
  348. margin: 12rpx 0;
  349. font-size: 26rpx;
  350. font-family: PingFang SC;
  351. font-weight: 400;
  352. color: #6d7c88;
  353. }
  354. .consume > text,
  355. .appointmentTime > text,
  356. .lotteryTime > text {
  357. font-size: 10rpx;
  358. font-family: PingFang SC;
  359. font-weight: 500;
  360. color: #000000;
  361. }
  362. .submit {
  363. width:295rpx;
  364. height: 70rpx;
  365. background: linear-gradient(90deg, #60bab0, #45969b);
  366. border-radius: 35rpx;
  367. font-size: 32rpx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #ffffff;
  371. text-align: center;
  372. line-height: 70rpx;
  373. margin: 40rpx 10rpx;
  374. }
  375. .submit1 {
  376. width:295rpx;
  377. height: 70rpx;
  378. border: 1px solid #60bab0;
  379. background: #fff;
  380. border-radius: 35rpx;
  381. font-size: 32rpx;
  382. font-family: PingFang SC;
  383. font-weight: 500;
  384. color: #60bab0;
  385. text-align: center;
  386. line-height: 70rpx;
  387. margin: 40rpx 10rpx;
  388. }
  389. }
  390. }
  391. .yugo {
  392. padding-top: 80rpx;
  393. position: relative;
  394. height: 100%;
  395. .zhu {
  396. height: 112rpx;
  397. border-top: 1px #eeeeee solid;
  398. border-bottom: 1px #eeeeee solid;
  399. line-height: 112rpx;
  400. padding: 0 32rpx;
  401. font-size: 28rpx;
  402. font-family: PingFang SC;
  403. font-weight: 500;
  404. color: #6d7c88;
  405. .zhu-right {
  406. display: inline-block;
  407. padding-left: 60rpx;
  408. }
  409. .zhu-num {
  410. color: #000000;
  411. }
  412. }
  413. .info-main {
  414. padding: 0 32rpx;
  415. .info-box {
  416. padding-top: 22rpx;
  417. display: flex;
  418. justify-content: space-between;
  419. align-items: center;
  420. .info-left {
  421. font-size: 28rpx;
  422. font-family: PingFang SC;
  423. font-weight: 500;
  424. color: #6d7c88;
  425. }
  426. .info-right {
  427. font-size: 28rpx;
  428. font-family: PingFang SC;
  429. font-weight: 500;
  430. color: #0f253a;
  431. }
  432. }
  433. }
  434. .btn {
  435. position: absolute;
  436. bottom: 50rpx;
  437. left: 50%;
  438. margin-left: -342rpx;
  439. width: 684rpx;
  440. height: 86rpx;
  441. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  442. border-radius: 10rpx;
  443. text-align: center;
  444. line-height: 86rpx;
  445. font-size: 36rpx;
  446. font-family: PingFang SC;
  447. font-weight: 500;
  448. color: #ffffff;
  449. }
  450. }
  451. .psw-wrapper {
  452. width: 548rpx;
  453. height: 344rpx;
  454. background-color: #FFFFFF;
  455. .psw-title {
  456. width: 100%;
  457. font-size: 35rpx;
  458. padding: 43rpx 0 49rpx;
  459. text-align: center;
  460. font-weight: 800;
  461. }
  462. .psw-ipt {
  463. display: block;
  464. background-color: #dce3ed;
  465. height: 90rpx;
  466. width: 464rpx;
  467. padding-left: 30rpx;
  468. margin: 0 auto;
  469. font-size: 80rpx;
  470. }
  471. .psw-btn text{
  472. display: inline-block;
  473. text-align: center;
  474. width: 50%;
  475. padding-top: 29rpx;
  476. font-size: 35rpx;
  477. }
  478. .psw-qd {
  479. color:#45969B;
  480. }
  481. }
  482. </style>