datile.vue 13 KB

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