fwbDetail.vue 10.0 KB

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