1
PC-20250623MANY\Administrator
2025-08-13 79db9782438e27a9006d540d18d649c720180a31
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<template>
  <div class="transfer_new">
    <van-nav-bar
      :placeholder="true"
      :safe-area-inset-top="true"
      :title="$t('划转')"
      left-arrow
      @click-left="$router.go(-1)"
    >
    </van-nav-bar>
 
    <div style="position: relative;">
      <div class="card">
        <div class="flex-center">
          <span style="margin-right: 1em;">{{ $t("从") }}</span>
          <van-field
            v-model="moneyRevise"
            type="number"
            :placeholder="$t('请输入')"
          >
            <template #button>
              <van-button size="small" class="butn2" type="primary">{{
                $t("全部")
              }}</van-button>
            </template>
          </van-field>
          <span style="margin-left: 1em;">{{ cValue.currency }}</span>
        </div>
        <div class="mt-1">
          <van-popover
            v-model="showPopover"
            trigger="click"
            :actions="actions"
            @select="onSelect"
          >
            <template #reference>
              <div>{{ cValue.text }}</div>
            </template>
          </van-popover>
        </div>
      </div>
 
      <div class="card mt-1">
        <div class="flex-center">
          <span style="margin-right: 1em;">{{ $t("到") }}</span>
          <div style="flex:1">{{ this.moneyReviseTo }}</div>
          <span style="margin-left: 1em;">{{ dValue.currency }}</span>
        </div>
        <div class="mt-1">
          <van-popover
            v-model="showPopover1"
            trigger="click"
            :actions="actions"
            @select="onSelect1"
          >
            <template #reference>
              <div>{{ dValue.text }}</div>
            </template>
          </van-popover>
        </div>
      </div>
 
      <img src="@/assets/img/transfer.png" class="swap" @click="onSwap" />
    </div>
 
    <van-button type="info" class="butn" @click="submit">
      {{ $t("qr") }}
    </van-button>
  </div>
</template>
 
<script>
import * as api from "@/axios/api";
import { Toast } from "vant";
export default {
  data() {
    return {
      moneyRevise: 0, // 划转金额
      maxMoneyRevise: 0, // 最大划转金额
      showPopover: false,
      showPopover1: false,
      actions: [
        { text: this.$t("美国"), value: "US", currency: "USD" },
        { text: this.$t("hk1"), value: "HK", currency: "HKD" },
        { text: this.$t("tw"), value: "TW", currency: "TWD" },
        { text: this.$t("id1"), value: "IN", currency: "INR" }
      ],
      cValue: {},
      dValue: {},
      usM: {}, // 账户金额 us
      twM: {}, // 账户金额 tw
      inM: {}, // 账户金额 in
      hkM: {}, // 账户金额 hk
    };
  },
  computed: {
    moneyReviseTo() {
      return this.moneyRevise * 7;
    }
  },
  created() {
    this.cValue = this.actions[0]; // 默认值
    this.dValue = this.actions[1]; // 默认值
    this.getMoney();
  },
  methods: {
    // 获取账户金额
    async getMoney() {
      let data = await api.getMoney();
      if (data.status === 0) {
        data.data.forEach(item=>{
            // if(item.)
        })
      }
    },
    // 划转上下调换
    onSwap() {
      let a = this.cValue,
        b = this.dValue;
      this.cValue = b;
      this.dValue = a;
    },
    // 选择
    onSelect(action) {
      this.cValue = action;
    },
    // 选择
    onSelect1(action) {
      this.dValue = action;
    },
    async submit() {
      let opt = {
        fromType: this.cValue.value,
        toType: this.dValue.value,
        amt: this.moneyRevise
      };
      let data = await api.transfer(opt);
      if (data.status === 0) {
        Toast.success(this.$t(data.msg));
        this.getMoney();
      }
    }
  }
};
</script>
 
<style lang="less" scoped>
/deep/ .van-nav-bar__content {
  height: 65px;
}
 
/deep/ .van-nav-bar__title {
  font-family: "DINPro";
  width: 100%;
  height: 1.17333em;
  display: flex;
  justify-content: center;
  align-items: center;
  font-style: normal;
  font-weight: 700;
  font-size: 0.48em;
  color: #14181f;
}
.transfer_new {
  padding: 0rem 0.25em 0.5em 0.25em;
  width: 100%;
  min-height: 100vh;
  background: #fff;
  font-size: 10vw;
  .butn {
    width: 100%;
    margin-top: 40px;
    height: 60px;
    border-radius: 8px;
    background: #c4d600;
    border: none;
  }
  .butn2 {
    border-radius: 8px;
    background: #c4d600;
    border: none;
  }
 
  .card {
    background: #f7f7f7;
    padding: 2em 1.2em;
    border-radius: 0.5em;
    font-size: 0.4em;
    border: none;
  }
 
  .swap {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1em;
  }
 
  .hint {
    font-size: 0.35em;
    margin-bottom: 150px;
 
    span {
      color: #333;
    }
  }
 
  .label_but {
    color: #333;
  }
 
  .transfer_label {
    font-size: 0.4em;
  }
}
</style>