details.vue 12 KB

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