datile.vue 10.0 KB

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