bankInfo.vue 6.61 KB
Newer Older
786817560's avatar
786817560 committed
1 2 3 4
<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-24 21:29:35
5
 * @LastEditTime: 2019-09-27 10:15:09
786817560's avatar
786817560 committed
6 7
 * @LastEditors: Please set LastEditors
 -->
李晓兵's avatar
李晓兵 committed
8
<template>
786817560's avatar
786817560 committed
9 10 11 12 13
  <div id="bank-card">
    <div class="info">
      <div class="info-icon">
        <img src="@/assets/userBind/info.png" >
        <span>温馨提示</span>
李晓兵's avatar
李晓兵 committed
14
      </div>
786817560's avatar
786817560 committed
15 16 17 18 19 20 21 22 23 24
      <p>推荐使用农行卡,农行卡支付免收手续费!</p>
    </div>
    <div class="my-card">
      <div class="top">
        <div class="left">
          <img src="@/assets/userBind/bankIcon.png" class="icon" >
          <span class="top-word">
            我的卡
            <span class="sum">(共{{ getBankList.length }}张)</span>
          </span>
李晓兵's avatar
李晓兵 committed
25
        </div>
786817560's avatar
786817560 committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
        <img src="@/assets/userBind/add.png" class="icon-right" @click="sendFlag" >
      </div>
      <div class="clear" />
      <div class="card-content">
        <ul>
          <li v-for="(item,index) in getBankList" :key="index">
            <item-option class="slider">
              <div
                :style="'background-image: url('+ changeBgImg (item) +')'"
                class="my-bank-card"
              >
                <div class="card-info">
                  <span class="name">{{ item.bank_full_name }}</span>
                  <span class="card-type">{{ item.bank_card_type }}</span>
                  <span class="number">卡号</span>
                  <span class="card-number">**** **** **** {{ selectLast (item) }}</span>
李晓兵's avatar
李晓兵 committed
42
                </div>
786817560's avatar
786817560 committed
43 44 45 46 47 48 49
              </div>
              <div slot="buttons" class="button">
                <option-button text @click.native="deleteFun(item.bank_account_num)" />
              </div>
            </item-option>
          </li>
        </ul>
李晓兵's avatar
李晓兵 committed
50 51
      </div>
    </div>
52
  </div>
李晓兵's avatar
李晓兵 committed
53 54 55 56 57
</template>
<script>
import backImg1 from '@/assets/userBind/nong.png'
import backImg2 from '@/assets/userBind/unNong.png'
export default {
786817560's avatar
786817560 committed
58
  props: {
786817560's avatar
786817560 committed
59 60 61
    'getBankList': {
      default: [],
      type: Array,
786817560's avatar
786817560 committed
62 63
    },
  },
李晓兵's avatar
李晓兵 committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
  data () {
    return {
      backImg: null,
      showModalValue: true,
    }
  },
  methods: {
    sendFlag () {
      this.showModalValue = true
      this.$emit('getInfo', this.showModalValue)
    },
    changeBgImg (item) {
      if (item.bank_full_name === '中国农业银行') {
        return backImg1
      } else {
        return backImg2
      }
    },
    selectLast (item) {
83
      console.log('item', item)
李晓兵's avatar
李晓兵 committed
84 85 86 87
      let num = item.bank_account_num
      return num.substring(num.length - 4)
    },
    deleteFun (e) {
786817560's avatar
786817560 committed
88 89 90 91 92 93 94 95
      let index = this.getBankList.findIndex(item => {
        if (item.bank_account_num === e) {
          return true
        }
      })
      this.getBankList.splice(index, 1)
      let vm = this
      let url = process.env.basePath + 'bp_bank_delete'
786817560's avatar
786817560 committed
96 97
      let param = {
        'master': {
786817560's avatar
786817560 committed
98
          'bp_id': window.localStorage.user_id,
786817560's avatar
786817560 committed
99
          'bank_account_num': e,
786817560's avatar
786817560 committed
100 101
        },
      }
786817560's avatar
786817560 committed
102 103 104
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
786817560's avatar
786817560 committed
105
        if (res.result === 'S') {
786817560's avatar
786817560 committed
106
          console.log(res)
786817560's avatar
786817560 committed
107
        }
李晓兵's avatar
李晓兵 committed
108 109 110 111 112 113
      })
    },
  },
}
</script>
<style lang="less" scoped>
786817560's avatar
786817560 committed
114 115 116 117 118
  #bank-card {
      .info {
        height: 70px;
        background-color: rgba(142, 195, 30, 0.1);
        .info-icon {
李晓兵's avatar
李晓兵 committed
119
          height: 20px;
786817560's avatar
786817560 committed
120 121 122 123 124 125 126 127 128
          padding-top: 20px;
          display: flex;
          align-items: center;
          img {
            width: 15.8px;
            height: 15.8px;
            margin-left: 17.1px;
          }
          span {
李晓兵's avatar
李晓兵 committed
129
            font-family: PingFangSC-Semibold;
786817560's avatar
786817560 committed
130 131 132 133 134
            font-size: 14px;
            color: #8ec31e;
            margin-left: 9px;
            letter-spacing: 0.5px;
            line-height: 20px;
李晓兵's avatar
李晓兵 committed
135 136
          }
        }
786817560's avatar
786817560 committed
137 138 139 140 141 142 143 144 145
        p {
          font-family: PingFangSC-Regular;
          font-size: 13px;
          color: #656464;
          width: 310px;
          margin-left: 42px;
          letter-spacing: 0.4px;
          line-height: 18px;
          margin-top: 8px;
李晓兵's avatar
李晓兵 committed
146 147
        }
      }
786817560's avatar
786817560 committed
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
      .my-card {
        .top {
          width: 320px;
          margin: 0 auto;
          margin-top: 13px;
          .left {
            height: 32px;
            display: flex;
            align-items: center;
            float: left;
            .icon {
              width: 18px;
              height: 20px;
              margin-right: 4px;
            }
            .top-word {
              font-family: PingFangSC-Semibold;
              font-size: 15px;
              color: #00469c;
              letter-spacing: 0.46px;
              .sum {
                font-family: PingFangSC-Semibold;
                font-size: 15px;
                color: #4d5d6c;
                letter-spacing: 0.46px;
              }
            }
李晓兵's avatar
李晓兵 committed
175
          }
786817560's avatar
786817560 committed
176 177 178 179
          .icon-right {
            width: 34px;
            height: 34px;
            float: right;
李晓兵's avatar
李晓兵 committed
180
          }
786817560's avatar
786817560 committed
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
        }
        .clear {
          clear: both;
        }
        .card-content {
          width: 350px;
          padding-left: 28px;
          overflow: hidden;
          margin-top: 16px;
          li {
            margin-bottom: 10px;
            .slider {
              height: 100%;
              margin-left: -14px;
            }
李晓兵's avatar
李晓兵 committed
196
          }
786817560's avatar
786817560 committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
          .my-bank-card {
            width: 320px;
            height: 190px;
            box-shadow: 0 5px 20px 0 rgba(101, 101, 101, 0.25);
            border-radius: 6px;
            background-size: 320px 190px;
            .card-info {
              font-family: PingFangSC-Medium;
              color: #ffffff;
              margin-left: 18px;
              padding-top: 15px;
              .name,
              .card-type {
                font-size: 16px;
                letter-spacing: 5.5px;
                line-height: 24px;
              }
              .card-type {
                display: block;
                margin-top: 9px;
              }
              .number {
                font-size: 12px;
                letter-spacing: 0;
                line-height: 16px;
                margin-top: 33px;
                display: block;
                margin-top: 33px;
              }
              .card-number {
                display: block;
                font-family: Avenir-Heavy;
                font-size: 16px;
                color: #ffffff;
                letter-spacing: 6px;
                line-height: 24px;
              }
            }
李晓兵's avatar
李晓兵 committed
235 236 237
          }
        }
      }
786817560's avatar
786817560 committed
238 239 240 241 242 243 244 245 246
      .swipeout-list .item .function {
        left: 330px;
        border-radius: 6px;
        width: 54px;
        height: 190px;
        background: url("../../../assets/userBind/delete.png") 16px 84.9px #fde5e8
        no-repeat;
        background-size: 20px 20px;
      }
李晓兵's avatar
李晓兵 committed
247 248
    }
</style>