fwbDetail.vue 11 KB

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