recharge.vue 11 KB

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