fwbDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <view class="content">
  3. <view class="top-wrap">
  4. <view class="top-bg">
  5. </view>
  6. <view class="user-data flex">
  7. <!-- <view class="data" @click="navto('/pages/vip/contract')">
  8. <view class="data-val">200</view>
  9. <view class="data-tit">合约收益</view>
  10. </view> -->
  11. <view class="data" @click="navto('/pages/vip/extension')">
  12. <view class="data-val">{{(userInfo.brokerage_price*1).toFixed(0)}}</view>
  13. <view class="data-tit">推广收益</view>
  14. </view>
  15. <view class="data" @click="navto('/pages/vip/mytz')">
  16. <view class="data-val">{{(userInfo.now_money*1).toFixed(0)}}</view>
  17. <view class="data-tit">我的通证</view>
  18. </view>
  19. <view class="data" @click="navto('/pages/user/integral')">
  20. <view class="data-val">{{(userInfo.integral*1).toFixed(0)}}</view>
  21. <view class="data-tit">我的积分</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="fwb-logo">
  26. <image src="../../static/img/fwb.png" mode=""></image>
  27. </view>
  28. <scroll-view scroll-y="true" :style="{'height': height}" class="scoll-wrap" @scrolltolower="loadData()">
  29. <view class="buy-item" v-for="item in list" >
  30. <!-- v-if="item.start <= nowTime && item.end > nowTime" -->
  31. <view class="item-top">
  32. <view class="top-left">
  33. <image src="../../static/icon/mrlogo.png" mode=""></image><text class="top-name clamp">{{item.name || ''}}</text>
  34. </view>
  35. <view class="top-right">
  36. {{item.status}}
  37. <!-- {{item.am == 1? '上午场':'下午场'}} -->
  38. </view>
  39. </view>
  40. <view class="item-info">
  41. <view class="info-data">
  42. <view class="info-tit">收益:</view>
  43. <view class="info-val">{{item.day}}天/{{item.proportion}}</view>
  44. </view>
  45. <!-- <view class="info-data">
  46. <view class="info-tit">开始时间:</view>
  47. <view class="info-val">10:20</view>
  48. </view> -->
  49. <view class="info-data">
  50. <view class="info-tit">可获通证:</view>
  51. <view class="info-val">{{item.pass}}</view>
  52. </view>
  53. <!-- <view class="info-data">
  54. <view class="info-tit">终止释放时间:</view>
  55. <view class="info-val">10:20</view>
  56. </view> -->
  57. <view class="info-data" v-if="item.status == '已结束'">
  58. <view class="info-tit">开奖时间:</view>
  59. <!-- <view class="info-val">{{item.cts}}</view> -->
  60. <view class="info-val">{{getNextTime()}}</view>
  61. </view>
  62. <view class="info-data">
  63. <view class="info-tit">价值:</view>
  64. <view class="info-val">{{item.price}}</view>
  65. </view>
  66. </view>
  67. <view class="mc-btn yy " @click="((item.am == 1 && nowTime >= '06:00' && nowTime < '12:00') || (item.am == 0 && nowTime >= '13:00' && nowTime < '17:00')) ? packageReserve(item): ''" :class="{'could':((item.am == 1 && nowTime >= '06:00' && nowTime < '12:00') || (item.am == 0 && nowTime >= '13:00' && nowTime < '17:00'))}">
  68. 立即预约
  69. </view>
  70. <!-- <view class="mc-btn pass could" @click="packageExchange(item,2)">
  71. 合约兑换
  72. </view> -->
  73. <!-- <view class="mc-btn fail" :class="{'could':(item.am == 0 && item.status == '进行中')}" @click="(item.am == 0 && item.status == '进行中')?packageExchange(item,1):''"> -->
  74. <view class="mc-btn fail" :class="{'could':item.am == 0 }" @click="item.am == 0 ?packageExchange(item,1):''">
  75. 推广兑换
  76. </view>
  77. </view>
  78. <uni-load-more :status="loadingType"></uni-load-more>
  79. </scroll-view>
  80. <view class="btm-btn flex">
  81. <view class="btm-left flex" @click="navto('/pages/appointment/appointment')">
  82. <image src="../../static/icon/myyy.png" mode=""></image>
  83. <view class="">
  84. 我的预约
  85. </view>
  86. </view>
  87. <view class="btm-right" style="background-color: #FFB238;" @click="navto('/pages/sellout/sellout')">
  88. 卖出
  89. </view>
  90. <view class="btm-right" style="background-color: #FF4C4C;" @click="navto('/pages/purchase/purchase')">
  91. 买入
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import { orderData, getUserInfo,service } from '@/api/user.js';
  98. import { getPackageList, packageReserve, packageExchange } from '@/api/package.js'
  99. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  100. import { mapState, mapMutations } from 'vuex';
  101. export default {
  102. computed:{
  103. ...mapState('user',['userInfo'])
  104. },
  105. components: {
  106. uniLoadMore,
  107. },
  108. data() {
  109. return {
  110. height: '',
  111. list: [],
  112. loadingType: 'more',
  113. page: 1,
  114. limit: 10,
  115. // loaded: false,
  116. nowTime: '',
  117. timer: ''
  118. }
  119. },
  120. onReady(res) {
  121. var obj = this;
  122. uni.getSystemInfo({
  123. success: resu => {
  124. const query = uni.createSelectorQuery();
  125. query.select('.scoll-wrap').boundingClientRect();
  126. query.exec(function(res) {
  127. console.log(res, 'ddddddddddddd');
  128. obj.height = resu.windowHeight - res[0].top + 'px';
  129. console.log('打印页面的剩余高度', obj.height);
  130. });
  131. },
  132. fail: res => {}
  133. });
  134. },
  135. onShow() {
  136. // this.getPackageList()
  137. console.log(this.userInfo)
  138. this.loadData()
  139. this.getUserInfo()
  140. // this.nowTime = this.getNow()
  141. clearInterval(this.timer)
  142. this.timer = setInterval(()=> {
  143. this.nowTime = this.getNow()
  144. console.log(this.nowTime)
  145. },1000)
  146. // this.nowTime = '10:25'
  147. },
  148. onBackPress() {
  149. console.log('页面隐藏onBackPress')
  150. clearInterval(this.timer)
  151. },
  152. onUnload() {
  153. console.log('页面隐藏onUnload')
  154. clearInterval(this.timer)
  155. },
  156. onHide() {
  157. console.log('页面隐藏')
  158. clearInterval(this.timer)
  159. },
  160. methods: {
  161. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  162. getNow() {
  163. let myDate = new Date();
  164. let h = myDate.getHours() > 9 ? myDate.getHours() : ('0' + myDate.getHours()); //获取当前小时数(0-23)
  165. let m = myDate.getMinutes() > 9 ? myDate.getMinutes() : ('0' + myDate.getMinutes()); //获取当前分钟数(0-59)
  166. return ('' + h + ':' + m)
  167. },
  168. getNextTime() {
  169. let myDate = new Date();
  170. // let h = myDate.getHours() > 9 ? myDate.getHours() : ('0' + myDate.getHours()); //获取当前小时数(0-23)
  171. // let m = myDate.getMinutes() > 9 ? myDate.getMinutes() : ('0' + myDate.getMinutes()); //获取当前分钟数(0-59)
  172. let H = myDate.getHours()
  173. let M = myDate.getMinutes()
  174. let h = ''
  175. let m = ''
  176. if(M <= 30) {
  177. h = (H +1) > 9 ? (H +1) : ('0' + (H +1))
  178. m = '00'
  179. }else {
  180. h = (H +1) > 9 ? (H +1) : ('0' + (H +1))
  181. m = '30'
  182. }
  183. return ('' + h + ':' + m)
  184. },
  185. getPackageList() {
  186. getPackageList().then(res => {
  187. console.log(res,'getPackageList')
  188. })
  189. },
  190. navTo(url) {
  191. uni.switchTab({
  192. url: url
  193. })
  194. },
  195. navto(url) {
  196. console.log('dianji ')
  197. uni.navigateTo({
  198. url: url
  199. })
  200. },
  201. loadData() {
  202. let obj = this
  203. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  204. return
  205. }
  206. obj.loadingType = 'loading'
  207. getPackageList({
  208. page: obj.page,
  209. limit: obj.limit
  210. }).then(({data}) => {
  211. // console.log(res,'getPackageList')
  212. obj.list = obj.list.concat(data)
  213. console.log(obj.list,'dd')
  214. obj.page++
  215. if(obj.limit == data.length) {
  216. obj.loadingType = 'more'
  217. }else {
  218. obj.loadingType = 'noMore'
  219. }
  220. })
  221. },
  222. // 兑换包
  223. packageExchange(item,type) {
  224. let nowTime = this.getNow()
  225. // if(item.start > nowTime) {
  226. // return this.$api.msg('活动未开始')
  227. // }
  228. // if(item.end < nowTime) {
  229. // return this.$api.msg('活动已结束')
  230. // }
  231. console.log(item)
  232. // this.judgeBase()
  233. packageExchange({
  234. package_manager: item.id,
  235. type: type,
  236. price: item.price,
  237. day: item.day,
  238. proportion: item.proportion,
  239. pass: item.pass,
  240. consume_pass: item.consume_pass
  241. }).then( res => {
  242. console.log(res)
  243. uni.showToast({
  244. title:'兑换成功',
  245. duration:2000
  246. });
  247. this.getUserInfo()
  248. }).catch(err => {
  249. console.log(err)
  250. })
  251. },
  252. //预约包
  253. packageReserve(item) {
  254. let nowTime = this.getNow()
  255. // if(item.start > nowTime) {
  256. // return this.$api.msg('活动未开始')
  257. // }
  258. // if(item.end < nowTime) {
  259. // return this.$api.msg('活动已结束')
  260. // }
  261. packageReserve({
  262. package_manager: item.id,
  263. price: item.price,
  264. day: item.day,
  265. proportion: item.proportion,
  266. pass: item.pass
  267. }).then(res => {
  268. uni.showToast({
  269. title:'预约成功',
  270. duration:2000
  271. });
  272. this.getUserInfo()
  273. console.log(res)
  274. }).catch(err => {
  275. console.log(err)
  276. })
  277. },
  278. getUserInfo() {
  279. getUserInfo({})
  280. .then(({ data }) => {
  281. console.log(data)
  282. this.setUserInfo(data);
  283. console.log(data)
  284. })
  285. .catch(e => {
  286. console.log(e);
  287. });
  288. }
  289. }
  290. }
  291. </script>
  292. <style lang="scss" scoped>
  293. .top-wrap {
  294. position: relative;
  295. .top-bg {
  296. width: 750rpx;
  297. height: 100rpx;
  298. background: linear-gradient(30deg, #FF4C4C, #FE6238);
  299. border-radius: 0 0 10rpx 10rpx;
  300. position: absolute;
  301. top: 0;
  302. }
  303. padding-top: 20rpx;
  304. .user-data {
  305. width: 710rpx;
  306. height: 165rpx;
  307. background: #FFFFFF;
  308. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  309. border-radius: 20rpx;
  310. margin: auto;
  311. position: relative;
  312. .data {
  313. display: flex;
  314. width: 33.3%;
  315. flex-direction: column;
  316. justify-content: center;
  317. align-items: center;
  318. font-family: PingFang SC;
  319. font-weight: bold;
  320. color: #666666;
  321. position: relative;
  322. .data-val {
  323. font-size: 36rpx;
  324. }
  325. .data-tit {
  326. font-size: 26rpx;
  327. padding-top: 10rpx;
  328. }
  329. &::after {
  330. content: '';
  331. width: 1px;
  332. height: 36rpx;
  333. background: #d6d6d6;
  334. position: absolute;
  335. right: 0;
  336. top: 0;
  337. bottom: 0;
  338. margin: auto;
  339. }
  340. &:last-of-type {
  341. &::after {
  342. background: #fff;
  343. }
  344. }
  345. }
  346. }
  347. }
  348. .fwb-logo {
  349. height: 99rpx;
  350. display: flex;
  351. justify-content: space-around;
  352. align-items: center;
  353. image {
  354. width: 374rpx;
  355. height: 33rpx;
  356. }
  357. }
  358. .buy-item {
  359. width: 690rpx;
  360. height: 300rpx;
  361. margin: 0 auto 20rpx;
  362. background: #FFFFFF;
  363. box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.05);
  364. border-radius: 20rpx;
  365. padding: 26rpx 30rpx;
  366. position: relative;
  367. .item-top {
  368. display: flex;
  369. justify-content: space-between;
  370. height: 50rpx;
  371. .top-left {
  372. font-size: 34rpx;
  373. font-family: PingFang SC;
  374. font-weight: bold;
  375. color: #0F253A;
  376. line-height: 50rpx;
  377. display: flex;
  378. align-items: center;
  379. image {
  380. width: 48rpx;
  381. height: 46rpx;
  382. }
  383. .top-name {
  384. width: 450rpx;
  385. padding-left: 11rpx;
  386. }
  387. }
  388. .top-right {
  389. line-height: 50rpx;
  390. width: 100rpx;
  391. text-align: right;
  392. font-size: 26rpx;
  393. font-family: PingFang SC;
  394. font-weight: 500;
  395. color: #6D7C88;
  396. }
  397. }
  398. .item-info {
  399. width: 100%;
  400. margin-top: 28rpx;
  401. line-height: 50rpx;
  402. font-size: 26rpx;
  403. font-family: PingFang SC;
  404. display: flex;
  405. flex-wrap: wrap;
  406. .info-data {
  407. width: 50%;
  408. display: flex;
  409. .info-tit {
  410. font-weight: 500;
  411. color: #6D7C88;
  412. }
  413. .info-val {
  414. color: #0F253A;
  415. font-weight: bold;
  416. }
  417. }
  418. }
  419. .mc-btn {
  420. width: 144rpx;
  421. line-height: 50rpx;
  422. border-radius: 25px;
  423. background: #FFFFFF;
  424. font-size: 26rpx;
  425. font-family: PingFang SC;
  426. font-weight: 500;
  427. text-align: center;
  428. position: absolute;
  429. bottom: 25rpx;
  430. color: #999999;
  431. border: 2px solid #EBEBEB;
  432. }
  433. .yy {
  434. // right: 344rpx;
  435. right: 190rpx;
  436. }
  437. .pass {
  438. right: 190rpx;
  439. }
  440. .fail {
  441. right: 36rpx;
  442. }
  443. .could{
  444. color: #FF4C4C;
  445. border: 2px solid #FF4C4C;
  446. }
  447. .cant {
  448. color: #999999;
  449. border: 2px solid #EBEBEB;
  450. }
  451. }
  452. .scoll-wrap {
  453. padding-bottom: 120rpx;
  454. }
  455. .btm-btn {
  456. height: 100rpx;
  457. position: fixed;
  458. bottom: 0;
  459. .btm-left {
  460. flex-direction: column;
  461. justify-content: center;
  462. align-items: center;
  463. height: 100rpx;
  464. width: 136rpx;
  465. background-color: #fff;
  466. image {
  467. width: 48rpx;
  468. height: 48rpx;
  469. background-color: #fff;
  470. }
  471. }
  472. .btm-right {
  473. width: 307rpx;
  474. height: 100rpx;
  475. background: #FFB238;
  476. text-align: center;
  477. color: #fff;
  478. font-size: 34rpx;
  479. font-family: PingFang SC;
  480. font-weight: bold;
  481. line-height: 100rpx;
  482. }
  483. }
  484. </style>