details.vue 11 KB

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