details.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <view class="container">
  3. <view class="logo"><image :src="logo"></image></view>
  4. <view class="select-box flex_item">
  5. <view @tap="handleTap('picker')">{{ title }}</view>
  6. <lb-picker
  7. ref="picker"
  8. v-model="value"
  9. mode="selector"
  10. :list="typeList"
  11. :dataset="{ name: 'type' }"
  12. @change="handleChange"
  13. @confirm="handleConfirm"
  14. @cancel="handleCancel"
  15. ></lb-picker>
  16. <image src="../../static/img/xiaj.png"></image>
  17. </view>
  18. <view class="list" v-show="list.length > 0">
  19. <view class="list-box" v-for="(ls, index) in list" :key="index" @click="nav(index)">
  20. <view class="flex">
  21. <view class="list-tpl flex_item">
  22. <image src="../../static/img/qian.png"></image>
  23. <view class="tpl-name">{{ ls.title }}</view>
  24. </view>
  25. <view class="num clamp" v-if="ls.pm === 0">- {{ ls.number }}</view>
  26. <view class="num clamp" v-else>+ {{ ls.number }}</view>
  27. </view>
  28. <view class="tpl-time">{{ ls.add_time }}</view>
  29. </view>
  30. </view>
  31. <view class="empty-box" v-show="list.length == 0"><u-empty></u-empty></view>
  32. <view class="flex submit-box">
  33. <view class="submit" @click="recharge">充币</view>
  34. <view class="tip"></view>
  35. <view class="submit" @click="withdraw">提币</view>
  36. </view>
  37. <uni-popup ref="popup" type="center">
  38. <view class="popup">
  39. <view class="cancel flex" @click="close">
  40. <view></view>
  41. <view class="tip">x</view>
  42. </view>
  43. <view class="list-boxs">
  44. <view class="popup-text">购买数量:</view>
  45. <view class="password"><input type="number" v-model="num" placeholder="请输入算力数量" /></view>
  46. <view class="popup-text">币种选择:</view>
  47. <view class="content" @click="useOutClickSide"><easy-select ref="easySelect" :options="moneyTypeList" :value="name" @selectOne="selectOne"></easy-select></view>
  48. <view class="confirm-btn" @click="pay"><text>确认充币</text></view>
  49. </view>
  50. </view>
  51. </uni-popup>
  52. <uni-popup ref="mation" type="center">
  53. <view class="popup">
  54. <view class="cancel flex" @click="close2"><view class="tip">x</view></view>
  55. <view class="list-boxs">
  56. <view class="textBox flex">
  57. <view class="font">交易前:</view>
  58. <view class="number">{{ before * 1 }} {{ code }}</view>
  59. </view>
  60. <view class="xian"></view>
  61. <view class="textBox flex">
  62. <view class="font">交易额:</view>
  63. <view class="number">{{ pm }}{{ number * 1 }} {{ code }}</view>
  64. </view>
  65. <view class="xian"></view>
  66. <view class="textBox flex">
  67. <view class="font">交易后:</view>
  68. <view class="number">{{ balance * 1 }} {{ code }}</view>
  69. </view>
  70. <view class="xian"></view>
  71. <scroll-view scroll-y="true" class="textBox">
  72. <view class="font">流水详情:</view>
  73. <view class="text">{{ text }}</view>
  74. </scroll-view>
  75. </view>
  76. </view>
  77. </uni-popup>
  78. </view>
  79. </template>
  80. <script>
  81. import { moneyLog, recharge } from '@/api/finance.js';
  82. import LbPicker from '@/components/lb-picker';
  83. export default {
  84. components: {
  85. LbPicker,
  86. },
  87. data() {
  88. return {
  89. code: '',
  90. title: '筛选',
  91. type: '',
  92. value: '',
  93. index: 0,
  94. typeList: [],
  95. list: '',
  96. num: '',
  97. moneyTypeList: [],
  98. money: '',
  99. name: '',
  100. logo: '',
  101. price: '',
  102. mark: '',
  103. charge: 0,
  104. _address_qr: '',
  105. __money_address: '',
  106. ids: '',
  107. keysAddr: '',
  108. text: '',
  109. balance: '',
  110. before: '',
  111. number: '',
  112. pm: '',
  113. way: [],
  114. address: '',
  115. waypath: '',
  116. less: '',
  117. page: 1,
  118. limit: 5,
  119. isLast: true
  120. };
  121. },
  122. onLoad(option) {
  123. console.log(option, 'detail-option');
  124. this.waypath = option.waypath;
  125. console.log(this.waypath, '+++++++++++++++++++++');
  126. this.way = option.way;
  127. console.log('detail', this.way);
  128. this.code = option.code;
  129. this.logo = option.logo;
  130. this.name = option.name;
  131. this.price = option.price;
  132. this.charge = option.charge;
  133. this.address = option.address;
  134. console.log(this.address, 'detail');
  135. this._address_qr = option._address_qr;
  136. this.__money_address = option.__money_address;
  137. this.mark = option.mark;
  138. this.ids = option.ids;
  139. this.keysAddr = option.keysAddr;
  140. this.moneyType();
  141. this.loadData();
  142. },
  143. onShow() {},
  144. methods: {
  145. async loadData() {
  146. let obj = this;
  147. moneyLog(
  148. {
  149. page: 1,
  150. limit: 10000,
  151. type: obj.type
  152. },
  153. obj.code
  154. ).then(({ data }) => {
  155. obj.typeList = data.type_list;
  156. obj.list = data.list;
  157. console.log(obj.list);
  158. });
  159. },
  160. // 所有币种
  161. async moneyType() {
  162. let obj = this;
  163. // moneyType({}).then(({ data }) => {
  164. // obj.moneyTypeList = data;
  165. // });
  166. },
  167. pay() {
  168. let obj = this;
  169. recharge(
  170. {
  171. num: obj.num,
  172. money_type: obj.code
  173. },
  174. obj.buyId
  175. )
  176. .then(({ data }) => {
  177. obj.$api.msg(data.msg);
  178. obj.$refs.popup.close();
  179. obj.num = '';
  180. obj.code = '';
  181. uni.navigateTo({
  182. url: '/pages/finance/recharge?LOGO=' + data._address_qr + '&order_id=' + data.order_id + '&ddress=' + data.__money_address + '&id=' + data.id
  183. });
  184. })
  185. .catch(e => {
  186. obj.$refs.popup.close();
  187. });
  188. },
  189. selectOne(options) {
  190. this.name = options.name;
  191. this.code = options.code;
  192. },
  193. useOutClickSide() {
  194. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  195. },
  196. handleTap(name) {
  197. this.$refs[name].show();
  198. },
  199. handleChange(e) {
  200. // this.title = e.item.title;
  201. // this.type = e.item.type;
  202. },
  203. handleConfirm(e) {
  204. this.title = e.item.title;
  205. this.type = e.item.type;
  206. this.loadData();
  207. },
  208. handleCancel(e) {},
  209. recharge() {
  210. let url = '/pages/finance/recharge?logo=' +
  211. this.logo +
  212. '&name=' +
  213. this.name +
  214. '&code=' +
  215. this.code +
  216. '&_address_qr=' +
  217. this._address_qr +
  218. '&__money_address=' +
  219. this.__money_address +
  220. '&mark=' +
  221. this.mark +
  222. '&ids=' +
  223. this.ids +
  224. '&keysAddr=' +
  225. this.keysAddr +
  226. '&charge=' +
  227. this.charge +
  228. '&address=' +
  229. this.address +
  230. '&way=' +
  231. this.way +
  232. '&waypath=' +
  233. this.waypath
  234. if(this.code === 'FIL') {
  235. console.log("555555555")
  236. url='/pages/finance/recharge'
  237. }
  238. uni.navigateTo({
  239. url:url
  240. // '/pages/finance/recharge?logo=' +
  241. // this.logo +
  242. // '&name=' +
  243. // this.name +
  244. // '&code=' +
  245. // this.code +
  246. // '&_address_qr=' +
  247. // this._address_qr +
  248. // '&__money_address=' +
  249. // this.__money_address +
  250. // '&mark=' +
  251. // this.mark +
  252. // '&ids=' +
  253. // this.ids +
  254. // '&keysAddr=' +
  255. // this.keysAddr +
  256. // '&charge=' +
  257. // this.charge +
  258. // '&address=' +
  259. // this.address +
  260. // '&way=' +
  261. // this.way +
  262. // '&waypath=' +
  263. // this.waypath
  264. });
  265. // this.$refs.popup.open();
  266. },
  267. close() {
  268. this.$refs.popup.close();
  269. },
  270. withdraw() {
  271. uni.navigateTo({
  272. url: '/pages/finance/withdraw?logo=' + this.logo + '&name=' + this.name + '&code=' + this.code + '&money=' + this.price
  273. });
  274. },
  275. navTo(url) {
  276. uni.navigateTo({
  277. url
  278. });
  279. },
  280. nav(index) {
  281. const obj = this;
  282. obj.text = obj.list[index].mark;
  283. obj.balance = obj.list[index].balance;
  284. obj.number = obj.list[index].number;
  285. if (obj.list[index].pm == 1) {
  286. obj.pm = '+';
  287. obj.before = obj.subNum(obj.balance, obj.number);
  288. } else {
  289. obj.pm = '-';
  290. obj.before = this.addNum(obj.balance, obj.number);
  291. }
  292. this.$refs.mation.open();
  293. },
  294. addNum(num1, num2) {
  295. let sq1, sq2, multiple;
  296. try {
  297. sq1 = num1.toString().split('.')[1].length;
  298. } catch (e) {
  299. sq1 = 0;
  300. }
  301. try {
  302. sq2 = num2.toString().split('.')[1].length;
  303. } catch (e) {
  304. sq2 = 0;
  305. }
  306. multiple = Math.pow(10, Math.max(sq1, sq2) + 1);
  307. return (num1 * multiple + num2 * multiple) / multiple;
  308. },
  309. close2() {
  310. this.$refs.mation.close();
  311. },
  312. subNum(num1, num2) {
  313. let sq1, sq2, multiple;
  314. try {
  315. sq1 = num1.toString().split('.')[1].length;
  316. } catch (e) {
  317. sq1 = 0;
  318. }
  319. try {
  320. sq2 = num2.toString().split('.')[1].length;
  321. } catch (e) {
  322. sq2 = 0;
  323. }
  324. multiple = Math.pow(10, Math.max(sq1, sq2) + 1);
  325. return (num1 * multiple - num2 * multiple) / multiple;
  326. }
  327. }
  328. };
  329. </script>
  330. <style lang="scss">
  331. page {
  332. min-height: 100%;
  333. background-color: #ffffff;
  334. .container {
  335. width: 100%;
  336. padding: 60rpx 30rpx 120rpx 30rpx;
  337. }
  338. }
  339. .logo {
  340. text-align: center;
  341. image {
  342. width: 119rpx;
  343. height: 119rpx;
  344. }
  345. }
  346. .select-box {
  347. position: absolute;
  348. right: 0;
  349. padding: 30rpx 30rpx;
  350. font-size: 32rpx;
  351. font-weight: 500;
  352. color: #333333;
  353. image {
  354. width: 21rpx;
  355. height: 11rpx;
  356. margin-left: 15rpx;
  357. }
  358. .select-name {
  359. padding-right: 15rpx;
  360. }
  361. }
  362. .list {
  363. margin-top: 120rpx;
  364. }
  365. .list-box {
  366. padding: 60rpx 0rpx 30rpx 0rpx;
  367. font-size: 30rpx;
  368. font-weight: 400;
  369. color: #333333;
  370. .tpl-time {
  371. font-size: 24rpx;
  372. font-weight: 400;
  373. color: #999999;
  374. width: 100%;
  375. text-align: right;
  376. padding-top: 25rpx;
  377. }
  378. .list-tpl {
  379. image {
  380. width: 39rpx;
  381. height: 43rpx;
  382. }
  383. .tpl-name {
  384. padding: 0rpx 15rpx 0rpx 30rpx;
  385. }
  386. }
  387. .num {
  388. font-size: 36rpx;
  389. font-weight: 400;
  390. color: #fb3a2f;
  391. width: 50%;
  392. text-align: right;
  393. }
  394. }
  395. .empty-box {
  396. width: 100%;
  397. height: 500rpx;
  398. padding-top: 200rpx;
  399. }
  400. .submit-box {
  401. position: fixed;
  402. bottom: 0;
  403. left: 0;
  404. width: 100%;
  405. background-color: #5771df;
  406. color: #ffffff;
  407. .submit {
  408. padding: 20rpx 20%;
  409. }
  410. .tip {
  411. width: 2rpx;
  412. height: 37rpx;
  413. background: #ffffff;
  414. }
  415. }
  416. //弹窗
  417. .popup {
  418. background-color: #ffffff;
  419. border-radius: 25rpx;
  420. font-size: 30rpx;
  421. .cancel {
  422. text-align: center;
  423. width: 100%;
  424. line-height: 60rpx;
  425. .tip {
  426. background-color: #5771df;
  427. color: #ffffff;
  428. width: 70rpx;
  429. height: 70rpx;
  430. border-top-right-radius: 25rpx;
  431. }
  432. }
  433. .list-boxs {
  434. padding: 0rpx 80rpx;
  435. .password {
  436. padding: 50rpx 0rpx;
  437. width: 100%;
  438. input {
  439. width: 70%;
  440. height: 80rpx;
  441. border: 2rpx solid #999999;
  442. padding-left: 25rpx;
  443. box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.27);
  444. border-radius: 11rpx;
  445. }
  446. }
  447. .confirm-btn {
  448. padding-bottom: 120rpx;
  449. padding-top: 30rpx;
  450. text {
  451. background-color: #5771df;
  452. color: #ffffff;
  453. width: 70%;
  454. text-align: center;
  455. padding: 25rpx 90rpx;
  456. border-radius: 15rpx;
  457. }
  458. }
  459. }
  460. }
  461. .popup {
  462. height: 618rpx;
  463. background: #ffffff;
  464. box-shadow: 3rpx 3rpx 6rpx 0rpx rgba(31, 31, 31, 0.17);
  465. border-radius: 40rpx;
  466. width: 700rpx;
  467. .cancel {
  468. text-align: center;
  469. width: 100%;
  470. line-height: 60rpx;
  471. position: relative;
  472. .tip {
  473. color: #000000;
  474. width: 70rpx;
  475. height: 70rpx;
  476. position: absolute;
  477. top: 0;
  478. right: 0;
  479. background-color: #fff;
  480. }
  481. }
  482. .list-boxs {
  483. width: 90%;
  484. margin: 0 auto;
  485. margin-top: 100rpx;
  486. .textBox {
  487. padding: 24rpx 18rpx;
  488. .font {
  489. font-size: 28rpx;
  490. font-family: PingFang SC;
  491. font-weight: bold;
  492. color: #4f4f4f;
  493. }
  494. .number {
  495. font-size: 28rpx;
  496. font-family: PingFang SC;
  497. font-weight: bold;
  498. color: #fb3a2f;
  499. }
  500. .text {
  501. text-indent: 2em;
  502. font-size: 28rpx;
  503. font-family: PingFang SC;
  504. font-weight: bold;
  505. color: #4f4f4f;
  506. }
  507. }
  508. .xian {
  509. width: 100%;
  510. height: 1px;
  511. background: #e7dfe8;
  512. }
  513. }
  514. }
  515. </style>