recharge.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <template>
  2. <view class="container">
  3. <view class="list-box">
  4. <view class="list flex">
  5. <view class="flex_item list-item">
  6. <image :src="logo"></image>
  7. <view>{{ name }}</view>
  8. </view>
  9. <view class="flex_item list-tpl">
  10. <view class="content" @click="useOutClickSide"><selectss ref="easySelect" :options="moneyTypeList" :value="name" @selectOne="selectOne"></selectss></view>
  11. <image src="../../static/img/img23.png"></image>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="image-box" v-if="way[0] !== 'NO'&&code !== 'USDT'">
  16. <!-- <view class="image-box" v-if="charge != 0"> -->
  17. <!-- <view class="tuijianbox" v-if="isShow">
  18. <view class="item" @click="gogo()">
  19. <image v-if="idx == 2" src="../../static/img/befor.png"></image>
  20. <image v-else src="../../static/img/after.png"></image>
  21. </view>
  22. </view> -->
  23. <view class="way-wrapper">
  24. <view class="way" v-for="item in way" :key="item" @click="goway(item)">
  25. {{item}}
  26. </view>
  27. </view>
  28. <tki-qrcode
  29. :cid="cid"
  30. ref="qrcode"
  31. :val="address"
  32. :size="size"
  33. :unit="unit"
  34. :background="background"
  35. :foreground="foreground"
  36. :pdground="pdground"
  37. :iconSize="iconSize"
  38. :lv="lv"
  39. :onval="onval"
  40. :loadMake="loadMake"
  41. :usingComponents="usingComponents"
  42. @result="qrR"
  43. />
  44. <!-- <image :src="qr" mode="aspectFit"></image> -->
  45. </view>
  46. <view class="from-box" v-if="way[0] !== 'NO'&&code !== 'USDT'">
  47. <view class="from-title">充币地址</view>
  48. <view class="flex input-tpl">
  49. <input class="input-box" disabled="disabled" type="text" v-model="address" />
  50. <view class="all" @click="copy(address)">复制</view>
  51. </view>
  52. <!-- 弃用bin -->
  53. <!-- <view class="from-title">充币数量</view>
  54. <input class="input-box" type="text" v-model="num" placeholder="请输入充币数量" /> -->
  55. <!-- <view class="submit" v-if="showBtn" @click="bangidng">绑定钱包</view> -->
  56. <!-- <view class="" v-if="orderShow == true">
  57. <view class="from-title">订单号</view>
  58. <view class="flex input-tpl">
  59. <input class="input-box" disabled="disabled" type="text" v-model="order_id" />
  60. <view class="all" @click="copy(order_id)">复制</view>
  61. </view>
  62. <view class="add-img-item" @click.stop="scImg()">
  63. <image class="add-img" :src="image" mode="aspectFit"></image>
  64. </view>
  65. <view class="addr-text" @click="moneyList">上传凭证</view>
  66. </view> -->
  67. <!-- 弃用end -->
  68. <view class="text-box" style="text-indent:2em;">{{ mark }}</view>
  69. </view>
  70. <view class="qidai" v-else>{{ mark }}</view>
  71. <uni-popup ref="popup" type="center">
  72. <view class="popup">
  73. <view class="cancel flex" @click="close">
  74. <view></view>
  75. <view class="tip">x</view>
  76. </view>
  77. <view class="list-boxs">
  78. <view class="popup-text">绑定地址:</view>
  79. <view class="password"><input type="text" v-model="keysAddr" placeholder="请输入绑定地址" /></view>
  80. <view class="confirm-btn" @click="bd"><text>确认绑定</text></view>
  81. </view>
  82. </view>
  83. </uni-popup>
  84. </view>
  85. </template>
  86. <script>
  87. import { recharge, edit } from '@/api/finance.js';
  88. import { upload, money } from '@/api/finance.js';
  89. import selectss from '@/components/select.vue';
  90. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js';
  91. import { moneyType } from '@/api/index.js';
  92. import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
  93. export default {
  94. components: {
  95. selectss,
  96. tkiQrcode
  97. },
  98. data() {
  99. return {
  100. moneyTypeList: [],
  101. charge: 0,
  102. logo: '',
  103. name: '',
  104. code: '',
  105. qr: '',
  106. address: '',
  107. image: '../../static/img/add.png',
  108. order_id: '',
  109. id: '',
  110. orderShow: false,
  111. mark: '',
  112. addr: '',
  113. ids: '',
  114. way: [],
  115. num: '',
  116. password: '',
  117. keysAddr: '',
  118. showBtn: false,
  119. idx: 1,
  120. isShow: false,
  121. cid: 'cid',
  122. size: 150,
  123. unit: '150',
  124. background: '#FFFFFF',
  125. foreground: '#000000',
  126. pdground: '#000000',
  127. icon: '',
  128. iconSize: 40,
  129. lv: 3,
  130. onval: true,
  131. loadMake: true,
  132. usingComponents: true,
  133. wayAddress: []
  134. };
  135. },
  136. onLoad(option) {
  137. if (option.name) {
  138. this.way = option.way.split(",")
  139. this.charge = option.charge;
  140. this.name = option.name;
  141. this.logo = option.logo;
  142. this.code = option.code;
  143. this.mark = option.mark;
  144. this.ids = option.ids;
  145. this.keysAddr = option.keysAddr;
  146. this.qr = option._address_qr;
  147. this.address = option.address
  148. this.ids = option.ids;
  149. this.addr = option.keysAddr;
  150. this.wayAddress = JSON.parse(option.waypath)
  151. if (this.addr == null || this.addr == '') {
  152. this.showBtn = true;
  153. }
  154. }
  155. this.moneyType();
  156. },
  157. onShow() {},
  158. methods: {
  159. // 所有币种
  160. async moneyType() {
  161. let obj = this;
  162. moneyType({}).then(({ data }) => {
  163. console.log(data,'9999999999999999999999999S')
  164. obj.moneyTypeList = data;
  165. //暂时数据
  166. for(let i = 0; i< obj.moneyTypeList.length ; i++) {
  167. if(obj.moneyTypeList[i].code === 'FIL') {
  168. obj.moneyTypeList[i].way = 'FIL'
  169. obj.moneyTypeList[i].wallet.address_FIL = 'f1dzghtxhbnxjqhk4ha25majfbmk2w3gft463spyi'
  170. }
  171. if(obj.moneyTypeList[i].code === 'USDT') {
  172. obj.moneyTypeList[i].way = 'NO'
  173. obj.moneyTypeList[i].wallet.address_TRC20 = null
  174. }
  175. }
  176. console.log(obj.moneyTypeList)
  177. if (obj.logo == '') {
  178. // obj.charge = obj.moneyTypeList[0].charge;
  179. // obj.logo = obj.moneyTypeList[0].LOGO;
  180. // obj.name = obj.moneyTypeList[0].name;
  181. // obj.code = obj.moneyTypeList[0].code;
  182. // obj.money = obj.moneyTypeList[0].price;
  183. // obj.way = obj.moneyTypeList[0].way.split(",")
  184. // if(obj.way[0] === "NO"){
  185. // obj.address = ''
  186. // }else {
  187. // obj.address = obj.moneyTypeList[0].wallet['address'+obj.way[0]]
  188. // }
  189. // obj.qr = obj.moneyTypeList[0]._address_qr;
  190. // obj.mark = obj.moneyTypeList[0].mark;
  191. // obj.addr = obj.moneyTypeList[0].wallet.address;
  192. // if (obj.addr == null || obj.addr == '') {
  193. // obj.showBtn = true;
  194. // }
  195. // obj.ids = obj.moneyTypeList[0].wallet.id;
  196. for(let i = 0 ; i < obj.moneyTypeList.length ; i++){
  197. if(obj.moneyTypeList[i].way !== 'NO') {
  198. console.log(obj.moneyTypeList[i].way)
  199. obj.charge = obj.moneyTypeList[i].charge;
  200. obj.logo = obj.moneyTypeList[i].LOGO;
  201. obj.name = obj.moneyTypeList[i].name;
  202. obj.code = obj.moneyTypeList[i].code;
  203. obj.money = obj.moneyTypeList[i].price;
  204. obj.way = obj.moneyTypeList[i].way.split(",")
  205. console.log(obj.way,'obj.way++++++++++++++++++++++++++++')
  206. obj.address = obj.moneyTypeList[i].wallet['address_'+obj.way[0]]
  207. console.log(obj.address,'obj.address----------------')
  208. obj.qr = obj.moneyTypeList[i]._address_qr;
  209. console.log(obj.qr)
  210. obj.mark = obj.moneyTypeList[i].mark;
  211. obj.addr = obj.moneyTypeList[i].wallet.address;
  212. if (obj.addr == null || obj.addr == '') {
  213. obj.showBtn = true;
  214. }
  215. obj.ids = obj.moneyTypeList[i].wallet.id;
  216. return
  217. }
  218. }
  219. }
  220. });
  221. },
  222. //单张上传图片
  223. scImg() {
  224. let obj = this;
  225. upload({
  226. file: ''
  227. }).then(function(e) {
  228. if (e[0] == undefined || e[0] == '') {
  229. obj.$api.msg('图片上传失败!');
  230. } else {
  231. obj.image = e[0].url;
  232. obj.$api.msg('图片上传成功!');
  233. }
  234. });
  235. },
  236. close() {
  237. this.$refs.popup.close();
  238. },
  239. bd() {
  240. let obj = this;
  241. edit(
  242. {
  243. key: obj.keysAddr
  244. },
  245. obj.ids
  246. ).then(e => {
  247. obj.showBtn = false;
  248. obj.$api.msg(e.msg);
  249. obj.$refs.popup.close();
  250. });
  251. },
  252. bangidng() {
  253. let obj = this;
  254. obj.$refs.popup.open();
  255. },
  256. moneyList() {
  257. let obj = this;
  258. if (obj.image == '../../static/img/add.png') {
  259. obj.$api.msg('请上传凭证!');
  260. return;
  261. }
  262. money(
  263. {
  264. proof: obj.image
  265. },
  266. obj.id
  267. ).then(e => {
  268. obj.$api.msg(e.msg);
  269. setTimeout(function() {
  270. uni.switchTab({
  271. url: '/pages/finance/index'
  272. });
  273. }, 1000);
  274. });
  275. },
  276. //复制
  277. copy(item) {
  278. let obj = this;
  279. let content = item; //需要复制的内容
  280. content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  281. const result = uniCopy(content);
  282. if (result === false) {
  283. uni.showToast({
  284. title: '不支持'
  285. });
  286. } else {
  287. uni.showToast({
  288. title: '复制成功',
  289. icon: 'none'
  290. });
  291. }
  292. },
  293. recharge() {
  294. let obj = this;
  295. if (obj.num == '') {
  296. obj.$api.msg('请输入充币数量!');
  297. return;
  298. }
  299. recharge({
  300. money_type: obj.code,
  301. num: obj.num
  302. }).then(data => {
  303. obj.order_id = data.data.order_id;
  304. obj.id = data.data.id;
  305. obj.num = '';
  306. obj.$api.msg(data.msg);
  307. obj.orderShow = true;
  308. });
  309. },
  310. selectOne(options) {
  311. console.log("selectOne9999999999999999999",options)
  312. this.logo = options.LOGO;
  313. this.charge = options.charge;
  314. console.log(this.charge,'...........................')
  315. this.name = options.name;
  316. this.code = options.code;
  317. this.money = options.price;
  318. // this.address = options.wallet.address_TRC20;
  319. this.qr = options._address_qr;
  320. this.qr = options._address_qr;
  321. this.mark = options.mark;
  322. this.addr = options.wallet.address;
  323. this.ids = options.wallet.id;
  324. this.way = options.way.split(",")
  325. console.log('this.way-----',this.way)
  326. if(this.way[0] === "NO"){
  327. this.wayAddress = []
  328. }else {
  329. this.way.forEach((item)=> {
  330. this.wayAddress[item] = options.wallet['address_'+item]
  331. })
  332. this.address = this.wayAddress[this.way[0]]
  333. console.log(this.wayAddress)
  334. }
  335. if (options.name == 'USDT') {
  336. this.isShow = true;
  337. } else {
  338. this.isShow = false;
  339. }
  340. },
  341. useOutClickSide() {
  342. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  343. },
  344. sub() {
  345. this.idx = 2;
  346. this.$api.msg('敬请期待!');
  347. },
  348. gogo() {
  349. this.idx = 1;
  350. },
  351. qrR(res) {
  352. this.src = res;
  353. },
  354. creatQrcode() {
  355. this.$refs.qrcode._makeCode();
  356. },
  357. goway(data) {
  358. this.address = this.wayAddress[data]
  359. // this.address = 'www.baudu.com'
  360. }
  361. }
  362. };
  363. </script>
  364. <style lang="scss">
  365. page {
  366. min-height: 100%;
  367. background-color: #ffffff;
  368. .container {
  369. width: 100%;
  370. }
  371. }
  372. .list-box {
  373. padding: 60rpx 30rpx;
  374. height: 300rpx;
  375. background-color: #5771df;
  376. .list {
  377. background-color: #ffffff;
  378. border-radius: 15rpx;
  379. padding: 15rpx 23rpx;
  380. .list-item {
  381. font-size: 30rpx;
  382. font-weight: bold;
  383. color: #333333;
  384. image {
  385. width: 43rpx;
  386. height: 43rpx;
  387. margin-right: 15rpx;
  388. }
  389. }
  390. .list-tpl {
  391. image {
  392. width: 15rpx;
  393. height: 25rpx;
  394. margin-left: 20rpx;
  395. }
  396. }
  397. }
  398. }
  399. .image-box {
  400. position: relative;
  401. top: -100rpx;
  402. padding: 50rpx 0rpx;
  403. text-align: center;
  404. image {
  405. width: 300rpx;
  406. height: 300rpx;
  407. border-radius: 15rpx;
  408. }
  409. }
  410. .from-box {
  411. margin: 30rpx 30rpx;
  412. padding: 44rpx 25rpx;
  413. background-color: #ffffff;
  414. border-radius: 15rpx;
  415. position: relative;
  416. top: -180rpx;
  417. .from-title {
  418. font-size: 24rpx;
  419. font-weight: bold;
  420. color: #333333;
  421. }
  422. .input-box {
  423. font-size: 26rpx;
  424. font-weight: 500;
  425. color: #666666;
  426. margin: 35rpx 0rpx;
  427. width: 85%;
  428. }
  429. .all {
  430. font-size: 30rpx;
  431. font-weight: 500;
  432. color: #5771df;
  433. }
  434. .all-num {
  435. font-size: 24rpx;
  436. font-weight: bold;
  437. color: #333333;
  438. text {
  439. font-size: 26rpx;
  440. padding: 0rpx 10rpx;
  441. color: #5771df;
  442. }
  443. }
  444. .submit {
  445. background-color: #5771df;
  446. margin-top: 160rpx;
  447. margin-bottom: 80rpx;
  448. color: #ffffff;
  449. text-align: center;
  450. padding: 26rpx 0rpx;
  451. border-radius: 15rpx;
  452. }
  453. .tpl-box {
  454. text-align: left;
  455. font-size: 28rpx;
  456. font-weight: 500;
  457. color: #fb3a2f;
  458. margin-top: 26rpx;
  459. }
  460. }
  461. .add-img-item {
  462. text-align: center;
  463. width: 100%;
  464. padding: 80rpx 0rpx;
  465. .add-img {
  466. width: 280rpx;
  467. height: 280rpx;
  468. }
  469. }
  470. .image {
  471. text-align: center;
  472. padding: 77rpx 0rpx 36rpx 0rpx;
  473. font-size: 30rpx;
  474. font-weight: bold;
  475. color: #333333;
  476. .addr-img {
  477. width: 188rpx;
  478. height: 188rpx;
  479. margin-top: 18rpx;
  480. }
  481. }
  482. .addr-text {
  483. text-align: center;
  484. width: 500rpx;
  485. margin: 0rpx auto;
  486. line-height: 80rpx;
  487. color: #ffffff;
  488. background-color: #5771df;
  489. border-radius: 50rpx;
  490. margin-bottom: 114rpx;
  491. }
  492. .text-box {
  493. font-size: 24rpx;
  494. padding: 25rpx 0rpx;
  495. line-height: 50rpx;
  496. }
  497. //弹窗
  498. .popup {
  499. background-color: #ffffff;
  500. border-radius: 25rpx;
  501. font-size: 30rpx;
  502. .cancel {
  503. text-align: center;
  504. width: 100%;
  505. line-height: 60rpx;
  506. .tip {
  507. background-color: #5771df;
  508. color: #ffffff;
  509. width: 70rpx;
  510. height: 70rpx;
  511. border-top-right-radius: 25rpx;
  512. }
  513. }
  514. .list-boxs {
  515. padding: 0rpx 80rpx;
  516. .password {
  517. padding: 50rpx 0rpx;
  518. width: 100%;
  519. input {
  520. width: 90%;
  521. height: 80rpx;
  522. border: 2rpx solid #999999;
  523. padding-left: 25rpx;
  524. box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.27);
  525. border-radius: 11rpx;
  526. }
  527. }
  528. .confirm-btn {
  529. margin-left: 80rpx;
  530. padding-bottom: 120rpx;
  531. padding-top: 30rpx;
  532. text {
  533. background-color: #5771df;
  534. color: #ffffff;
  535. width: 100%;
  536. text-align: center;
  537. padding: 25rpx 90rpx;
  538. border-radius: 15rpx;
  539. }
  540. }
  541. }
  542. }
  543. .tuijianbox {
  544. width: 100%;
  545. display: flex;
  546. height: 40rpx;
  547. margin-bottom: 60rpx;
  548. .item {
  549. margin-left: 40rpx;
  550. font-size: 20rpx;
  551. position: relative;
  552. line-height: 40rpx;
  553. color: #ffffff;
  554. image {
  555. width: 150rpx;
  556. height: 100rpx;
  557. }
  558. }
  559. }
  560. .qidai {
  561. width: 100%;
  562. font-size: 100rpx;
  563. text-align: center;
  564. }
  565. .way-wrapper {
  566. width: 90%;
  567. padding: 0 5%;
  568. display: flex;
  569. height: 40rpx;
  570. margin-bottom: 60rpx;
  571. justify-content: start;
  572. .way {
  573. width: 120rpx;
  574. height: 75rpx;
  575. line-height: 75rpx;
  576. text-align: center;
  577. border: 1px solid #7c90e3;
  578. border-radius: 10rpx 10rpx 10rpx 10rpx;
  579. color: #7c90e3;
  580. background-color: #eff2ff;
  581. font-size: 36rpx;
  582. font-weight: bold;
  583. margin-right: 30rpx;
  584. }
  585. }
  586. </style>