recharge.vue 13 KB

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