index.vue 11 KB

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