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