lxf
2025-04-30 f726ea231b2109be3cb9cc6eca8aa9a002ab3fce
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
<template>
  <div class="wrapper">
    <!-- <div class="header">
      <mt-header title="银行卡">
        <router-link to="/user" slot="left">
          <mt-button icon="back">我的</mt-button>
        </router-link>
        <mt-button icon="more" slot="right"></mt-button>
      </mt-header>
    </div> -->
    <div class="box page-part transaction">
      <div class="box-contain clearfix">
        <div v-if="cardInfo.length<=0" class="empty text-center">
          暂未绑定银行卡
        </div>
        <div v-if="cardInfo.length>0" class="back-info">
          <!-- 银行卡信息 -->
          <p class="name">
            银行账户
          </p>
          <ul>
            <li class="clearfix" v-for="i in cardInfo" :key="i.key">
              <div class="col-xs-3">
                <img src="../../../static/img/pay.png" alt="pay">
              </div>
              <div class="col-xs-9">
                <p>{{i.bankName}}-{{i.bankAddress}}</p>
                <p>{{i.bankNo}}</p>
              </div>
            </li>
          </ul>
          <p class="red">每人最多绑定一张银行卡,如需更换银行卡请联系客服</p>
        </div>
      </div>
    </div>
    <div v-if="cardInfo.length<=0" class="btnbox">
      <span class="text-center btnok" @click="addCard">添加银行卡</span>
    </div>
    <div v-else class="btnbox">
      <span class="text-center btnok" @click="addCard('edit')">修改银行卡</span>
    </div>
  </div>
</template>
 
<script>
import * as api from '@/axios/api'
import { Toast } from 'mint-ui'
 
export default {
  components: {},
  props: {},
  data () {
    return {
      cardInfo: []
    }
  },
  watch: {},
  computed: {},
  created () {
 
  },
  beforeDestroy () {
    if (this.$state.theme =='red') {
      document.body.classList.remove('red-bg')
        document.body.classList.add('black-bg')
    }
  },
  mounted () {
    if (this.$state.theme =='red') {
        document.body.classList.remove('black-bg')
        document.body.classList.add('red-bg')
    }
    this.getCardDetail()
  },
  methods: {
    // 添加银行卡
    addCard (val) {
      if (val === 'edit') {
        this.$router.push({
          path: '/addCard',
          query: {
            type: val
          }
        })
      } else {
        this.$router.push('/addCard')
      }
    },
 
    async getCardDetail () {
      // 获取银行卡信息
      let opts = {
        code: this.$route.query.code
      }
      let data = await api.getBankCard(opts)
      if (data.status === 0) {
        this.cardInfo = []
        this.cardInfo.push(data.data)
        this.$store.state.bankInfo = data.data
      } else {
        Toast(data.msg)
      }
    }
  }
}
</script>
<style lang="less" scoped>
  .back-info {
    padding: 0.2rem 0.3rem;
 
    .name {
      font-size: 0.3rem;
      padding: 0.1rem 0rem;
    }
 
    ul {
      li {
        // border:0.01rem solid #ddd;
        padding: 0.2rem;
 
        img {
          width: 0.84rem;
          margin-top: 0.1rem;
        }
 
        div {
          line-height: 0.35rem;
        }
      }
    }
  }
 
  .transaction {
    color: rgba(100, 100, 100, 0.78);
 
    .empty {
      width: 100%;
      font-size: 0.43rem;
      color: #888888;
      text-align: center;
      line-height: 2rem;
    }
  }
 
  .btnbox {
    width: 30%;
    margin: 0 auto;
  }
</style>