jhzh
2024-09-23 e678ec74066a2c5b5b3b404d3344bffbd3cf59bd
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
<template>
  <div class="addBank">
    <order-nav class="mb-56" :title="$t('添加 Al-Rafidain QiServices')"/>
    <div class="content pr-32 pl-32">
      <c2c-input
          label="Name"
          color="#7B7F87"
          v-model="info.name"
          placeholder="James"
      />
      <c2c-input
          label="Phone Number"
          v-model="info.phone"
          placeholder="Phone Number"
      />
      <c2c-input
          label="Bank Account Number"
          v-model="bankNumber"
          placeholder="Bank Account Number"
      />
      <c2c-input :label="$t('Note(选填)')">
        <textarea
            class="w-full h-240"
            :style="{'background': '#F5F5F5'}"
            v-model="info.desc"
            placeholder="Note"></textarea>
      </c2c-input>
    </div>
    <div class="fixed bottom-0 left-0 w-full pl-32 pr-32 pb-72 box-border">
      <div class="font-24 mb-24" :style="{'color': '#868D9A'}">
        {{ $t('温馨提示:当您出售数字货币时,您选择的收款方式将向买方展示,请确认信息填写准确无误。') }}
      </div>
      <van-button
          v-show="disabled"
          class="w-full"
          type="info"
          @click="save"
      >{{ $t('保存') }}
      </van-button>
      <van-button
          v-show="!disabled"
          disabled
          color="#EAEBEE"
          class="w-full"
      >{{ $t('保存') }}
      </van-button>
    </div>
  </div>
</template>
 
<script>
import {Button, Toast,} from 'vant';
 
import OrderNav from "@/components/order-nav/OrderNav";
import C2cInput from "@/page/placeAnOrder/components/c2cInput/C2cInput";
 
export default {
  name: "CN",
  props: ["data"], // query传参
  data() {
    return {
      disabled: "",
      info: {
        name: "", // 姓名
        number: "", // 银行卡号
        phone: "",
        desc: "", // 支行
      }
    }
  },
  created() {
    console.log(this.data);
    if (this.data) {
      this.info.name = this.data.name;
      this.info.phone = this.data.phone;
      this.info.number = this.data.number;
      this.info.desc = this.data.desc;
    }
  },
  methods: {
    save() {
      Toast(this.$t("保存"))
    }
  },
  computed: {
    bankNumber: {
      get() {
        return this.info.number && this.info.number.replace(/(\d{4})/g, '$1 ').trim()
      },
      set(newVal) {
        this.info.number = newVal;
      }
    },
  },
  components: {
    [Button.name]: Button,
    OrderNav,
    C2cInput,
  },
  watch: {
    // 是否存在空值
    info: {
      deep: true,
      handler() {
        const res = Object.keys(this.info).filter(key => this.info[key] === "" || this.info[key] === undefined)
 
        this.disabled = res.length === 0;
        console.log(this.disabled)
      },
      immediate: true
    }
  }
}
</script>
 
<style lang="scss" scoped>
.addBank{
  width: 100%;
  box-sizing: border-box;
}
::v-deep {
  .payment-input-wrapper {
    margin-bottom: 60px;
 
    input {
      height: 100px;
    }
  }
}
 
.desc {
  width: 100%;
  padding: 46px 24px;
  border-radius: 8px;
  background: #F0F1F4;
}
</style>