edit-address.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <v-page >
  3. <v-header :title="`${form.id?$t('assets.d6'):$t('assets.d7')} ${$t('assets.d8')}`"></v-header>
  4. <view class="layout-main">
  5. <view class="coin p-md d-flex justify-between bg-panel-4 m-md rounded box-shadow" @click="coinListShow=true">
  6. <view class="fn-lg color-light">{{form.coin_name}}</view>
  7. <view>
  8. <van-icon name="arrow" />
  9. </view>
  10. </view>
  11. <view class="bg-panel-4 m-md rounded box-shadow">
  12. <view class="form-item border-b p-md">
  13. <view class="label m-b-xs">{{$t('assets.d8')}}</view>
  14. <view class="input color-light">
  15. <v-input v-model="form.address" :placeholder="$t('assets.d9')"></v-input>
  16. </view>
  17. </view>
  18. <view class="form-item border-b p-md">
  19. <view class="label m-b-xs">{{$t('assets.e0')}}</view>
  20. <view class="input color-light">
  21. <v-input v-model="form.address_note" :placeholder="$t('assets.e3')"></v-input>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="p-md">
  27. <v-button class="w-max rounded-lg" block type="blue" ref="btn" @click="submit">{{$t('common.save')}}</v-button>
  28. </view>
  29. <coin-list
  30. ref="coinList"
  31. v-model="form.coin_name"
  32. @close="coinListShow=false"
  33. v-show="coinListShow"
  34. />
  35. </v-page>
  36. </template>
  37. <script>
  38. import coinList from "./coin-list";
  39. import Wallet from "@/api/wallet";
  40. export default {
  41. components: {
  42. coinList,
  43. },
  44. data() {
  45. return {
  46. coinListShow: false,
  47. form: {
  48. address: "",
  49. address_note: "",
  50. coin_name: "",
  51. id: "",
  52. },
  53. };
  54. },
  55. computed:{
  56. },
  57. methods: {
  58. submit() {
  59. if (!this.form.address) {
  60. this.$toast(this.$t('assets.e2'));
  61. return;
  62. }
  63. if (!this.form.address_note) {
  64. this.$toast(this.$t('assets.e1'));
  65. return;
  66. }
  67. let por;
  68. if (this.form.id) {
  69. //编辑
  70. por = Wallet.withdrawalAddressModify(this.form, {
  71. btn: this.$refs.btn,
  72. });
  73. } else {
  74. //添加
  75. por = Wallet.addWithdrawAddress(this.form, { btn: this.$refs.btn });
  76. }
  77. por.then(() => {
  78. this.$back();
  79. this.$toast.success(this.$t('assets.e4'));
  80. });
  81. },
  82. // 删除地址
  83. },
  84. onLoad(query) {
  85. if (query.coin_name) {
  86. this.form.coin_name = query.coin_name;
  87. this.form.address = query.address;
  88. this.form.address_note = query.address_note;
  89. this.form.id = query.id;
  90. }
  91. },
  92. };
  93. </script>