recharge.vue 9.9 KB

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