recharge.vue 11 KB

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