details.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <template>
  2. <view class="container">
  3. <!-- 状态栏占位 -->
  4. <!-- <view class="status_bar"></view> -->
  5. <!-- <view class="topbar-box">
  6. <view class="topbar">
  7. <view class="topbar-left"><image src="../../static/img/img16.png" mode=""></image></view>
  8. <view class="topbar-center"></view>
  9. <view class="topbar-right"></view>
  10. </view>
  11. </view> -->
  12. <!-- 自定义导航栏 -->
  13. <!-- <uni-nav-bar left-icon="back" class="nav-bar" @clickLeft="back">
  14. <view class="topbar-center">
  15. <view :class="{ action: current === 0 }" @click="changeCurrent(0)">商品</view>
  16. <view :class="{ action: current === 1 }" @click="changeCurrent(1)">参数</view>
  17. <view :class="{ action: current === 2 }" @click="changeCurrent(2)">介绍</view>
  18. </view>
  19. </uni-nav-bar> -->
  20. <!-- <view class="list-box"></view> -->
  21. <view class="good-img">
  22. <image :src="list.logo"></image>
  23. </view>
  24. <view class="param-box">
  25. <view class="param-price">{{ list.cost_money * 1 }}{{ list._cost_money_type }}</view>
  26. <view class="param-name">{{ list.name }}</view>
  27. <view class="param-list">
  28. <!-- <view class="list-item">
  29. <view class="item-title">使用周期</view>
  30. <view class="item-val">{{ list.first_step_time + list.second_step_time }}天 + {{list.third_step_time}}天</view>
  31. </view> -->
  32. <view class="list-item">
  33. <view class="item-title">电费</view>
  34. <view class="item-val">{{list.electric_fee|keept}}USDT/天</view>
  35. </view>
  36. <view class="list-item">
  37. <view class="item-title">预计日产出</view>
  38. <view class="item-val">{{(list.day_get*1*list.step).toFixed(8)+list.get_money_type | daiding}}/天</view>
  39. </view>
  40. <view class="list-item">
  41. <view class="item-title">算力</view>
  42. <view class="item-val" v-if="list.get_money_type == 'BZZ'">{{+list.step}}节点</view>
  43. <view class="item-val" v-else>{{ +list.step}}{{list.unit}}</view>
  44. </view>
  45. <view class="list-item">
  46. <view class="item-title">管理费</view>
  47. <view class="item-val">{{ list.service_ratio }}%</view>
  48. </view>
  49. <view class="list-item">
  50. <view class="item-title">上架期</view>
  51. <view class="item-val">{{ list.stand_time }}天</view>
  52. </view>
  53. <view class="list-item">
  54. <view class="item-title">库存</view>
  55. <view class="item-val">{{ list.stock*1 }}台</view>
  56. </view>
  57. <!-- <view class="list-item">
  58. <view class="item-title">上架期</view>
  59. <view class="item-val">{{ list.stand_time }}天</view>
  60. </view> -->
  61. <!-- <view class="list-item">
  62. <view class="item-title">宽带费</view>
  63. <view class="item-val">{{ list.broadband || 0 }}元/月</view>
  64. </view> -->
  65. <!-- <view class="list-item">
  66. <view class="item-title">IP地址费</view>
  67. <view class="item-val">{{ list.ip_address || 0 }}元/月</view>
  68. </view> -->
  69. <!-- <view class="list-item">
  70. <view class="item-title">质押币</view>
  71. <view class="item-val">{{ list.pledge || 0 }}个</view>
  72. </view> -->
  73. </view>
  74. </view>
  75. <view class="list">
  76. <view class="explain"><rich-text :nodes="list.detail"></rich-text></view>
  77. </view>
  78. <!-- <view class="list"> -->
  79. <!-- <view class="list-title">{{ list.name }}</view>
  80. <view class="flex list-item">
  81. <view class="item-name">价格</view>
  82. <view class="item-tpl">{{ list.cost_money * 1 }}{{ list._cost_money_type }}</view>
  83. </view>
  84. <view class="flex list-item" v-if="list.stand_money > 0">
  85. <view class="item-name">质押FIL数量(用户自行支付)</view>
  86. <view class="item-tpl">{{ list.stand_money * 1 }}</view>
  87. </view>
  88. <view class="flex list-item">
  89. <view class="item-name">托管运维费</view>
  90. <view class="item-tpl">{{ list.service_ratio }}%</view>
  91. </view>
  92. <view class="flex list-item">
  93. <view class="item-name">上架期</view>
  94. <view class="item-tpl">{{ list.stand_time }}天</view>
  95. </view> -->
  96. <!-- <view class="flex list-item">
  97. <view class="item-name">封装期</view>
  98. <view class="item-tpl">{{list.first_step_time}}</view>
  99. </view> -->
  100. <!-- <view class="flex list-item">
  101. <view class="item-name">合约期</view>
  102. <view class="item-tpl">{{ list.first_step_time + list.second_step_time + list.third_step_time }}天</view>
  103. </view> -->
  104. <!-- <view class="tpl" v-if="list.stand_money > 0">需完成应质押的FIL后,才能开始进入50天封装期</view> -->
  105. <!-- <view class="list-title">IPFS独享算力包-1T</view> -->
  106. <!-- 产品说明 -->
  107. <!-- <view class="tips">说明:</view> -->
  108. <!-- <view class="explain"><rich-text :nodes="list.detail"></rich-text></view> -->
  109. <!-- <view class="num-box flex">
  110. <view class="num-title">购买数量({{ list.step * 1 }}T)</view>
  111. <uni-number-box class="step" :value="num" :disabled="false" @eventChange="numberChange"></uni-number-box>
  112. </view>
  113. <view class="flex money-box">
  114. <view class="money-name">购买总数</view>
  115. <view class="money-num">{{ list.step * 1 * num}}T</view>
  116. </view>
  117. <view class="flex money-box">
  118. <view class="money-name">金额</view>
  119. <view class="money-num">{{ money * 1 }}{{ list._cost_money_type }}</view>
  120. </view>
  121. <view class="pay-box">支付方式:{{ list._cost_money_type }}</view>
  122. <view class="flex money-box">
  123. <view class="money-name">交易密码</view>
  124. <view class="money-num"><input class="input-box" type="password" v-model="password" placeholder="请输入交易密码" /></view>
  125. </view>
  126. <view class="check_box flex_item">
  127. <view><radio style="transform: scale(0.75)" @click="Getcheckbox" color="#6786FB" :checked="checked" /></view>
  128. <view class="">
  129. 请阅读并同意
  130. <text @click="ToIndex">《矿机租赁协议》</text>
  131. </view>
  132. </view> -->
  133. <!-- </view> -->
  134. <view class="submit-box">
  135. <view class="submit" @click="buy">{{ type == 3 ? '立即质押' : '立即购买' }}</view>
  136. </view>
  137. </view>
  138. </template>
  139. <script>
  140. import { miningDateils, buyMining } from '@/api/calculation.js';
  141. import uniNumberBox from '@/components/uni-number-box.vue';
  142. export default {
  143. components: {
  144. uniNumberBox
  145. },
  146. data() {
  147. return {
  148. id: '',
  149. type: '',
  150. num: 1,
  151. step: 0,
  152. password: '',
  153. price: '',
  154. list: {},
  155. checked: false,
  156. current: 0
  157. };
  158. },
  159. filters: {
  160. Keept(value) {
  161. if(!value) {
  162. return '0.00'
  163. }
  164. value = Math.round(value* 100)/100;
  165. return value
  166. },
  167. daiding(value) {
  168. let num = parseFloat(value)
  169. if(num === 0){
  170. return '待定'
  171. }else {
  172. return value
  173. }
  174. }
  175. },
  176. onLoad(option) {
  177. this.id = option.id;
  178. this.type = option.type;
  179. this.loadData();
  180. },
  181. computed: {
  182. money() {
  183. return this.num * this.price * this.step;
  184. }
  185. },
  186. onShow() {},
  187. methods: {
  188. async loadData() {
  189. let obj = this;
  190. miningDateils({}, obj.id).then(({ data }) => {
  191. obj.list = data;
  192. // obj.money = obj.list.cost_money;
  193. obj.price = obj.list.cost_money;
  194. obj.step = obj.list.step;
  195. console.log(obj.list,'222');
  196. });
  197. },
  198. //阅读并同意
  199. Getcheckbox() {
  200. let obj = this;
  201. obj.checked = !obj.checked;
  202. },
  203. ToIndex() {
  204. uni.navigateTo({
  205. url: '/pages/finance/xieyi'
  206. });
  207. },
  208. pay() {
  209. let obj = this;
  210. if (obj.password == '') {
  211. obj.$api.msg('请输入交易密码!');
  212. return;
  213. }
  214. if (obj.checked == false) {
  215. obj.$api.msg('请阅读并同意协议!');
  216. return;
  217. }
  218. buyMining(
  219. {
  220. num: obj.num * obj.step,
  221. trade_psw: obj.password
  222. },
  223. obj.id
  224. )
  225. .then(data => {
  226. obj.$api.msg(data.msg);
  227. obj.password = '';
  228. obj.num = 1;
  229. })
  230. .catch(e => {
  231. obj.password = '';
  232. obj.num = 1;
  233. if (e.msg == '交易密码错误') {
  234. return;
  235. }
  236. console.log(e);
  237. var reg = new RegExp('购买矿机所需的');
  238. if (e.msg.match(reg) == -1) {
  239. } else {
  240. setTimeout(function() {
  241. uni.navigateTo({
  242. url: '/pages/finance/recharge'
  243. });
  244. }, 1000);
  245. }
  246. });
  247. },
  248. numberChange(data) {
  249. let obj = this;
  250. obj.num = data.number;
  251. },
  252. buy() {
  253. // let list = JSON.stringify(this.list)
  254. uni.navigateTo({
  255. url: '/pages/calculation/pay?&id=' + this.id + '&type=' + this.type
  256. });
  257. // console.log(this.list,'--------------***********')
  258. // console.log('buy click')
  259. },
  260. changeCurrent(index) {
  261. this.current = index;
  262. },
  263. back() {
  264. uni.navigateBack({
  265. url: '/pages/calculation/buyCalculation'
  266. });
  267. }
  268. }
  269. };
  270. </script>
  271. <style lang="scss" scoped>
  272. page {
  273. min-height: 100%;
  274. background-color: #ffffff;
  275. .container {
  276. width: 100%;
  277. }
  278. }
  279. .list-box {
  280. // background-color: #5771df;
  281. width: 100%;
  282. height: 100rpx;
  283. }
  284. .list {
  285. // margin: 0rpx 31rpx;
  286. // padding: 45rpx 35rpx;
  287. // background-color: #ffffff;
  288. // border-radius: 15rpx;
  289. // position: relative;
  290. // top: -100rpx;
  291. .list-title {
  292. font-size: 34rpx;
  293. font-weight: 500;
  294. color: #333333;
  295. padding-bottom: 35rpx;
  296. }
  297. .list-item {
  298. font-size: 24rpx;
  299. font-weight: 500;
  300. color: #666666;
  301. padding-bottom: 35rpx;
  302. .item-tpl {
  303. font-size: 24rpx;
  304. font-weight: bold;
  305. color: #333333;
  306. }
  307. .tpls {
  308. color: #faba38;
  309. }
  310. }
  311. .tpl {
  312. font-size: 26rpx;
  313. font-weight: 500;
  314. color: #faba38;
  315. padding-bottom: 98rpx;
  316. }
  317. .num-box {
  318. font-size: 30rpx;
  319. font-weight: 500;
  320. color: #333333;
  321. padding-bottom: 83rpx;
  322. }
  323. .money-box {
  324. font-size: 32rpx;
  325. font-weight: 500;
  326. color: #333333;
  327. padding-bottom: 102rpx;
  328. .money-num {
  329. font-weight: bold;
  330. .input-box {
  331. text-align: right;
  332. }
  333. }
  334. }
  335. .pay-box {
  336. font-size: 32rpx;
  337. font-weight: 500;
  338. color: #333333;
  339. padding-bottom: 60rpx;
  340. }
  341. .tips {
  342. font-size: 26rpx;
  343. font-weight: 500;
  344. color: #5771df;
  345. padding-bottom: 25rpx;
  346. }
  347. .explain {
  348. word-wrap: break-word;
  349. font-size: 26rpx;
  350. font-weight: 500;
  351. color: #666666;
  352. line-height: 38rpx;
  353. width: 662rpx;
  354. margin: 0 auto;
  355. padding-bottom: 141rpx;
  356. }
  357. }
  358. .submit-box {
  359. position: fixed;
  360. bottom: 0;
  361. padding: 25rpx 0;
  362. width: 100%;
  363. background-color: #fff;
  364. // border-top: 1px solid rgba(0,0,0,0.1);
  365. .submit {
  366. box-sizing: border-box;
  367. width: 662rpx;
  368. height: 91rpx;
  369. line-height: 91rpx;
  370. margin: 0 auto;
  371. background-color: #141E47;
  372. color: #ffffff;
  373. text-align: center;
  374. // padding: 25rpx 0rpx;
  375. border-radius: 50rpx;
  376. }
  377. }
  378. .check_box {
  379. padding: 25rpx 25rpx;
  380. font-size: 28rpx;
  381. padding-bottom: 60rpx;
  382. text {
  383. color: #6786fb;
  384. }
  385. }
  386. .status_bar {
  387. position: fixed;
  388. top: 0;
  389. background-color: #ffffff;
  390. z-index: 999;
  391. height: var(--status-bar-height);
  392. width: 100%;
  393. }
  394. // .topbar-box {
  395. // background-color: #bfa;
  396. // height: 100rpx;
  397. // width: 100%;
  398. // position: fixed;
  399. // top: var(--status-bar-height);
  400. // .topbar {
  401. // .topbar-left {
  402. // }
  403. // .topbar-center {
  404. // }
  405. // .topbar-right {
  406. // }
  407. // }
  408. // }
  409. .nav-bar {
  410. position: fixed;
  411. width: 100%;
  412. top: var(--status-bar-height);
  413. background-color: #fff;
  414. z-index: 999;
  415. .topbar-center {
  416. // width: 450rpx;
  417. height: 41px;
  418. margin: 0 auto;
  419. display: flex;
  420. justify-content: space-around;
  421. color: #9d989e;
  422. font-weight: bold;
  423. view {
  424. margin: 0 40rpx;
  425. }
  426. .action {
  427. color: #000;
  428. border-bottom: 3px #cc6551 solid;
  429. }
  430. }
  431. }
  432. .good-img {
  433. width: 330rpx;
  434. height: 330rpx;
  435. margin: 0 auto;
  436. image {
  437. width: 100%;
  438. height: 100%;
  439. }
  440. }
  441. .param-box {
  442. width: 660rpx;
  443. margin: 0 auto 20rpx;
  444. .param-price {
  445. font-size: 40rpx;
  446. font-weight: bold;
  447. color: #dc4423;
  448. padding: 34rpx 0;
  449. }
  450. .param-name {
  451. font-size: 32rpx;
  452. font-weight: bold;
  453. padding-bottom: 30rpx;
  454. }
  455. .param-list {
  456. box-sizing: border-box;
  457. background-color: #f7f8fc;
  458. color: #000;
  459. display: flex;
  460. flex-wrap: wrap;
  461. padding-bottom: 24rpx;
  462. // margin: 0 19rpx;
  463. .list-item {
  464. width: 33%;
  465. padding: 5rpx 0 0 5rpx;
  466. text-align: center;
  467. // height: 122rpx;
  468. .item-title {
  469. font-size: 30rpx;
  470. padding: 20rpx 0;
  471. color: #8c8b90;
  472. }
  473. .item-val {
  474. font-size: 30rpx;
  475. font-weight: bold;
  476. padding-bottom: 14rpx;
  477. }
  478. }
  479. }
  480. }
  481. </style>