投屏pc端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

202 lines
5.2 KiB

6 years ago
6 years ago
6 years ago
  1. <template>
  2. <div class="global-width">
  3. <div class="container">
  4. <!--当前位置-->
  5. <div class="hc-breadcrumb">
  6. <span class="hc-color4" @click="$router.push('/assets/coincoin')">{{$t('币币账户')}}</span>
  7. <i class="hc-breadcrumb-icon"></i>
  8. <span class="margin0">{{$t('提币地址管理')}}</span>
  9. </div>
  10. <div class="hc-breadcrumb second-position">
  11. <span class="hc-color1">
  12. <img src="../../assets/images/icon-money.png" />{{$t('提币地址管理')}}
  13. </span>
  14. </div>
  15. <div class="recharge-warp">
  16. <div class="withdrawmoney-box">
  17. <div class="form-box">
  18. <div class="form-group">
  19. <label class="form-label">{{$t('选择提币币种')}}</label>
  20. <div class="form-control">
  21. <div class="hc-form-warp" @click="showCoin = !showCoin" v-if="withdrawCoin">
  22. <img class="hc-select-img" :src="'data:img/jpg;base64,' + withdrawCoinImg" v-if="withdrawCoinImg">
  23. <span class="hc-select-span1">{{withdrawCoin}}</span>
  24. <span class="hc-form-down-icon">
  25. <i class="fa-caret-down"></i>
  26. </span>
  27. </div>
  28. <div class="hc-form-warp" @click="showCoin = !showCoin" v-else>
  29. <span class="hc-select-span1">{{$t('选择提币币种')}}</span>
  30. <span class="hc-form-down-icon">
  31. <i class="fa-caret-down"></i>
  32. </span>
  33. </div>
  34. <!-- 选择币种弹框 -->
  35. <div class="choose-currencies" v-if="showCoin">
  36. <div class="hc-select-options" v-for="item of allCoinList" :key="item.id" @click="chooseCoin(item)">
  37. <img class="hc-select-img" :src="'data:img/jpg;base64,' + item.image" v-if="item.image">
  38. <span class="hc-select-span1">{{item.id}}</span>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label class="form-label">
  45. {{$t('提币地址')}}
  46. </label>
  47. <div class="form-control">
  48. <el-input class="text-input" :placeholder="$t('请输入提币地址')" v-model="withdrawAddress" type="text" clearable autocomplete="off" @keyup.enter.native="submit">
  49. </el-input>
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. <el-button class="form-submit-btn" type="primary" :loading="true" v-if="loading">{{$t('提交中...')}}</el-button>
  54. <el-button class="form-submit-btn" type="primary" @click="submit" v-else>{{$t('保存地址')}}</el-button>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="address-line"></div>
  59. <div class="address-bot">
  60. <div class="address-div1">
  61. <div class="address-div2">{{withdrawCoin}} {{$t('地址列表')}}</div>
  62. </div>
  63. <table class="table">
  64. <thead>
  65. <tr>
  66. <th>
  67. <div class="cell">{{$t('币种')}}</div>
  68. </th>
  69. <th>
  70. <div class="cell">{{$t('提币地址')}}</div>
  71. </th>
  72. <th>
  73. <div class="cell">
  74. {{$t('操作')}}
  75. </div>
  76. </th>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. <tr v-for="item of addressList" :key="item.id">
  81. <td>
  82. <div class="cell">{{withdrawCoin}}</div>
  83. </td>
  84. <td>
  85. <div class="cell">{{item.addr}}</div>
  86. </td>
  87. <td>
  88. <button class="operatione-btn">选择地址</button>
  89. </td>
  90. </tr>
  91. </tbody>
  92. </table>
  93. <no-content :isText="$t('暂无数据')" :isContent="isContent"></no-content>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </template>
  99. <script>
  100. import { mapState } from 'vuex'
  101. import noContent from '@/components/no_content'
  102. export default {
  103. name: 'withdrawAddress',
  104. components: {
  105. noContent,
  106. },
  107. data() {
  108. return {
  109. withdrawCoin: '', //提币币种
  110. showCoin: false, //选择币种弹窗
  111. withdrawAddress: '',
  112. addressList: [],
  113. isContent: false,
  114. loading: false,
  115. }
  116. },
  117. computed: {
  118. ...mapState('trend', ['allCoinList']),
  119. withdrawCoinImg() { //充值币种的图片
  120. let img;
  121. this.allCoinList.forEach(item => {
  122. if (item.id == this.withdrawCoin) {
  123. img = item.image;
  124. }
  125. })
  126. return img;
  127. },
  128. },
  129. methods: {
  130. getAddressList() { //获取地址列表
  131. this.getAxios('/api/user/withdraw/list/' + this.withdrawCoin)
  132. .then(data => {
  133. if (data.data.length == 0) {
  134. this.isContent = true;
  135. } else {
  136. this.isContent = false;
  137. }
  138. this.addressList = data.data;
  139. })
  140. },
  141. chooseCoin(item) { //选择币种
  142. this.withdrawCoin = item.id;
  143. this.showCoin = false;
  144. },
  145. submit() {
  146. if(this.loading) {
  147. return;
  148. }
  149. if(!this.withdrawAddress) {
  150. this.$message.error(this.$t('请输入提币地址!'));
  151. return;
  152. }
  153. this.loading = true;
  154. let params = {
  155. coinId: this.withdrawCoin,
  156. addr: this.withdrawAddress,
  157. id: ''
  158. }
  159. this.postAxios('/api/user/withdraw/add', params)
  160. .then(() => {
  161. this.$message.success(this.$t('提币地址添加成功!'));
  162. this.getAddressList();
  163. this.clearData();
  164. })
  165. .catch(() => {
  166. this.loading = false;
  167. })
  168. },
  169. clearData() {
  170. this.withdrawAddress = '';
  171. }
  172. },
  173. created() {
  174. this.withdrawCoin = this.$route.params.id;
  175. this.getAddressList();
  176. }
  177. }
  178. </script>
  179. <style>
  180. </style>