fwbDetail.vue 9.9 KB

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