datile.vue 11 KB

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