private.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view class="content">
  3. <top></top>
  4. <view class="main">
  5. <view class="record" @click="openRecord()">
  6. <br />
  7. </view>
  8. <image class="main-bg" src="../../static/img/sm-bg.png" mode=""></image>
  9. <view class="title">恒星私募</view>
  10. <view class="font">私募单价</view>
  11. <view class="num">{{ money }}{{ moneyType }}</view>
  12. <view class="tip-title">【私募相关】</view>
  13. <view class="tip">
  14. 恒星是一个集“元宇宙+NFT卡牌+DeFi+养成/经营/竞技”的加密链上游戏,是一款基于Solidity语言开发的去中心化GameFi应用,首发BSC链,基于银河系元宇宙原型,打造了一个集抽取盲盒开卡牌,NFT交易,LP质押获得收益的链上元宇宙游戏,
  15. 结合区块链的游戏内容,铸成有价值的TCG游戏。
  16. </view>
  17. </view>
  18. <view class="bottom">
  19. <image class="bottom-bg" src="../../static/img/bottom.png" mode=""></image>
  20. <view class="btn" @click="nav()">私募认购</view>
  21. </view>
  22. <uni-popup ref="popup" type="center">
  23. <view class="popup-record">
  24. <view class="record-title">私募记录</view>
  25. <view class="xian"><image src="../../static/img/xian.png" mode=""></image></view>
  26. <scroll-view scroll-y="true" class="yj-info-scroll" @scrolltolower="list">
  27. <view class="record-main-title flex">
  28. <view class="item">认购金额</view>
  29. <view class="item">认购数量</view>
  30. <view class="item">认购时间</view>
  31. </view>
  32. <view class="record-main flex" v-for="(item, index) in activity">
  33. <view class="item">{{ item.number * 1 }}{{ item.token }}</view>
  34. <view class="item">{{ item.get_num * 1 }}{{ item.get_token }}</view>
  35. <view class="item">{{ item.createtime }}</view>
  36. </view>
  37. <uni-load-more :status="loadingType"></uni-load-more>
  38. </scroll-view>
  39. </view>
  40. <view class="popup-x" @click="closeRecord()"><image src="../../static/img/x.png" mode=""></image></view>
  41. </uni-popup>
  42. <uni-popup ref="popup1" type="center">
  43. <view class="popup-buy">
  44. <view class="record-title ">私募认购</view>
  45. <view class="xian"><image src="../../static/img/xian.png" mode=""></image></view>
  46. <view class="buy-num">
  47. <view class="shu"></view>
  48. <view class="num-font">
  49. 私募单价:
  50. <text>{{ money }}{{ moneyType }}</text>
  51. </view>
  52. </view>
  53. <view class="buy-num ren-num">
  54. <view class="shu"></view>
  55. <view class="num-font">认购金额</view>
  56. </view>
  57. <view class="buy-input">
  58. <input type="text" class="input" placeholder="请输入认购金额" placeholder-class="inputPlace" v-model="num" value="" />
  59. <view class="unit">USDT</view>
  60. </view>
  61. <!-- <view class="buy-tip">可用</view> -->
  62. <view class="buy-num ren-num">
  63. <view class="shu"></view>
  64. <view class="num-font">认购数量</view>
  65. </view>
  66. <view class="buy-input" style="padding-bottom: 18rpx;">
  67. <view class="input" style="color: #08EDE7;">{{ HXB }}</view>
  68. <view class="unit">HXB</view>
  69. </view>
  70. <view class="btn-box">
  71. <view class="btn-left" @click="close()">取消</view>
  72. <view class="btn-right " @click="buy()">购买</view>
  73. </view>
  74. </view>
  75. </uni-popup>
  76. </view>
  77. </template>
  78. <script>
  79. import top from '@/components/top/top.vue';
  80. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  81. import { getTime } from '@/utils/rocessor.js';
  82. import { addSpread, index } from '@/api/index.js';
  83. import { mapState, mapMutations } from 'vuex';
  84. import { buyHXB, transferDate, activityList } from '@/api/money.js';
  85. export default {
  86. comments: {
  87. top,
  88. uniPopup
  89. },
  90. data() {
  91. return {
  92. num: '',
  93. money: '',
  94. moneyType: '',
  95. activity: [],
  96. page: 1,
  97. limit: 10,
  98. loadingType: 'more'
  99. };
  100. },
  101. computed: {
  102. ...mapState('user', ['address', 'hasLogin', 'userInfo']),
  103. HXB() {
  104. return (this.num / this.money).toFixed(2) * 1;
  105. }
  106. },
  107. onShow() {
  108. this.loadData();
  109. },
  110. methods: {
  111. shua() {
  112. window.location.reload();
  113. },
  114. loadData() {
  115. index({}).then(({ data }) => {
  116. this.money = data.activateNumber * 1;
  117. this.moneyType = data.activateToken;
  118. });
  119. this.list();
  120. },
  121. list() {
  122. let obj = this;
  123. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  124. return;
  125. }
  126. activityList({ page: this.page, limit: this.limit }).then(({ data }) => {
  127. data.data.list.forEach(e => {
  128. e.createtime = getTime(e.createtime);
  129. });
  130. this.activity = this.activity.concat(data.data.list);
  131. if(data.data.list.length != obj.limit){
  132. obj.loadingType = 'noMore'
  133. }else {
  134. obj.page++
  135. obj.loadingType = 'more'
  136. }
  137. });
  138. },
  139. nav() {
  140. this.$refs.popup1.open();
  141. },
  142. close() {
  143. this.$refs.popup1.close();
  144. },
  145. openRecord() {
  146. this.$refs.popup.open();
  147. },
  148. closeRecord() {
  149. this.$refs.popup.close();
  150. },
  151. buy() {
  152. uni.showLoading({
  153. title: '加载中...'
  154. });
  155. const obj = this;
  156. obj.show = false;
  157. transferDate({ to: '', amount: obj.num }).then(e => {
  158. console.log(obj.address, 'datajm');
  159. const params = [
  160. {
  161. from: obj.address,
  162. to: e.data.to,
  163. data: e.data.data
  164. }
  165. ];
  166. obj.$refs.popup.close();
  167. obj.$refs.popup1.close();
  168. console.log(params);
  169. ethereum
  170. .request({
  171. method: 'eth_sendTransaction',
  172. params
  173. })
  174. .then(result => {
  175. console.log(result, 'result');
  176. uni.hideLoading();
  177. buyHXB({
  178. usdt_num: obj.num,
  179. transactionHash: result
  180. }).then(e => {
  181. this.num = '';
  182. obj.shua();
  183. obj.$api.msg(e.msg);
  184. });
  185. })
  186. .catch(error => {
  187. uni.hideLoading();
  188. console.log(error, 'error');
  189. });
  190. });
  191. }
  192. }
  193. };
  194. </script>
  195. <style lang="less">
  196. page,
  197. .content {
  198. height: 100%;
  199. background: #000;
  200. }
  201. .main {
  202. position: relative;
  203. width: 680rpx;
  204. height: 962rpx;
  205. margin: 0 auto 0;
  206. .main-bg {
  207. position: absolute;
  208. top: 0;
  209. left: 0;
  210. right: 0;
  211. width: 100%;
  212. height: 100%;
  213. }
  214. }
  215. .title {
  216. position: relative;
  217. z-index: 2;
  218. text-align: center;
  219. font-size: 44rpx;
  220. font-family: zihun100hao-fangfangxianfengti;
  221. font-weight: 400;
  222. color: #08ede7;
  223. line-height: 100rpx;
  224. }
  225. .record {
  226. position: absolute;
  227. z-index: 2;
  228. top: 160rpx;
  229. right: 0;
  230. background: #08ede7;
  231. padding: 20rpx 10rpx 20rpx 20rpx;
  232. border-radius: 10rpx 0px 0px 10rpx;
  233. font-size: 32rpx;
  234. font-family: PingFang SC;
  235. font-weight: bold;
  236. color: #001337;
  237. line-height: 40rpx;
  238. }
  239. .font {
  240. position: relative;
  241. z-index: 2;
  242. margin-top: 280rpx;
  243. text-align: center;
  244. font-size: 30rpx;
  245. font-family: PingFang SC;
  246. font-weight: bold;
  247. color: #ffffff;
  248. }
  249. .num {
  250. position: relative;
  251. z-index: 2;
  252. margin: 22rpx auto 0;
  253. width: 394rpx;
  254. height: 80rpx;
  255. background: linear-gradient(90deg, rgba(8, 237, 231, 0), #08ede7, #08ede7, rgba(8, 237, 231, 0));
  256. font-size: 42rpx;
  257. font-family: PingFang SC;
  258. font-weight: bold;
  259. color: #001337;
  260. text-align: center;
  261. line-height: 80rpx;
  262. }
  263. .tip-title {
  264. position: relative;
  265. z-index: 2;
  266. margin-top: 34rpx;
  267. text-align: center;
  268. font-size: 32rpx;
  269. font-family: PingFang SC;
  270. font-weight: bold;
  271. color: #ffffff;
  272. }
  273. .tip {
  274. position: relative;
  275. z-index: 2;
  276. margin: 30rpx auto 0;
  277. width: 570rpx;
  278. font-size: 26rpx;
  279. font-family: PingFang SC;
  280. font-weight: bold;
  281. color: #ffffff;
  282. line-height: 38rpx;
  283. }
  284. .bottom {
  285. padding-top: 182rpx;
  286. position: relative;
  287. width: 750rpx;
  288. height: 434rpx;
  289. margin-top: -118rpx;
  290. .bottom-bg {
  291. position: absolute;
  292. top: 0;
  293. left: 0;
  294. right: 0;
  295. height: 100%;
  296. width: 100%;
  297. }
  298. .btn {
  299. position: relative;
  300. z-index: 3;
  301. margin: 0 auto;
  302. width: 450rpx;
  303. height: 76rpx;
  304. background: linear-gradient(0deg, #ff7206, #ffdd7e);
  305. box-shadow: 0px 2px 8px 0px rgba(207, 126, 57, 0.7);
  306. border-radius: 38rpx;
  307. text-align: center;
  308. line-height: 76rpx;
  309. font-size: 36rpx;
  310. font-family: zihun164hao-fangyuehei;
  311. font-weight: 400;
  312. color: #ffffff;
  313. }
  314. }
  315. .record-title {
  316. text-align: center;
  317. font-size: 46rpx;
  318. font-family: zihun100hao-fangfangxianfengti;
  319. font-weight: 400;
  320. color: #ffffff;
  321. }
  322. .xian {
  323. margin: 14rpx auto 0;
  324. width: 326rpx;
  325. height: 16rpx;
  326. image {
  327. width: 100%;
  328. height: 100%;
  329. }
  330. }
  331. .popup-record {
  332. width: 680rpx;
  333. height: 854rpx;
  334. background: linear-gradient(180deg, #254fab 0%, #230a8e 100%);
  335. border-radius: 20rpx;
  336. padding: 62rpx 34rpx 0;
  337. .record-main {
  338. margin-top: 10rpx;
  339. }
  340. .item {
  341. font-size: 28rpx;
  342. font-family: PingFang SC;
  343. font-weight: bold;
  344. color: #ffffff;
  345. opacity: 0.8;
  346. }
  347. }
  348. .popup-x {
  349. margin: 62rpx auto 0;
  350. width: 66rpx;
  351. height: 66rpx;
  352. image {
  353. width: 100%;
  354. height: 100%;
  355. }
  356. }
  357. .popup-buy {
  358. width: 630rpx;
  359. background: linear-gradient(180deg, #254fab 0%, #230a8e 100%);
  360. border-radius: 20rpx;
  361. padding: 68rpx 74rpx 74rpx;
  362. .buy-num {
  363. display: flex;
  364. justify-content: flex-start;
  365. align-items: center;
  366. margin-top: 62rpx;
  367. .shu {
  368. width: 10rpx;
  369. height: 30rpx;
  370. background: #08ede7;
  371. border-radius: 5rpx;
  372. }
  373. .num-font {
  374. margin-left: 10rpx;
  375. font-size: 32rpx;
  376. font-family: PingFang SC;
  377. font-weight: bold;
  378. color: #ffffff;
  379. text {
  380. color: #08ede7;
  381. }
  382. }
  383. }
  384. .ren-num {
  385. margin-top: 40rpx;
  386. }
  387. .buy-input {
  388. display: flex;
  389. margin-top: 32rpx;
  390. justify-content: space-between;
  391. align-items: flex-end;
  392. width: 100%;
  393. border-bottom: 1px solid #ffffff;
  394. padding-bottom: 12rpx;
  395. .input {
  396. width: 90%;
  397. height: 40rpx;
  398. color: #ffffff;
  399. font-size: 40rpx;
  400. }
  401. .inputPlace {
  402. font-size: 40rpx;
  403. font-family: PingFang SC;
  404. font-weight: bold;
  405. color: #ffffff;
  406. line-height: 38px;
  407. opacity: 0.35;
  408. }
  409. .unit {
  410. font-size: 27rpx;
  411. font-family: PingFang SC;
  412. font-weight: bold;
  413. color: #ffffff;
  414. }
  415. }
  416. .buy-tip {
  417. margin-top: 10rpx;
  418. font-size: 26rpx;
  419. font-family: PingFang SC;
  420. font-weight: bold;
  421. color: #ffffff;
  422. }
  423. .btn-box {
  424. display: flex;
  425. justify-content: space-between;
  426. margin-top: 62rpx;
  427. .btn-left {
  428. width: 230rpx;
  429. height: 66rpx;
  430. background: #e8e8e8;
  431. border-radius: 10rpx;
  432. text-align: center;
  433. line-height: 66rpx;
  434. font-size: 28rpx;
  435. font-family: PingFang SC;
  436. font-weight: bold;
  437. color: #001337;
  438. }
  439. .btn-right {
  440. width: 230rpx;
  441. height: 66rpx;
  442. background: #08ede7;
  443. border-radius: 10rpx;
  444. text-align: center;
  445. line-height: 66rpx;
  446. font-size: 28rpx;
  447. font-family: PingFang SC;
  448. font-weight: bold;
  449. color: #001337;
  450. }
  451. }
  452. }
  453. .yj-info-scroll {
  454. width: 100%;
  455. height: 600rpx;
  456. margin-top: 60rpx;
  457. }
  458. </style>