datile.vue 13 KB

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