datile.vue 10 KB

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