bankInfo.vue 7.52 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-11-26 17:49:05
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>
李晓兵's avatar
李晓兵 committed
26
        <img src="@/assets/userBind/add.png" class="icon-right" @click="sendFlag(true)" >
786817560's avatar
786817560 committed
27 28 29 30 31
      </div>
      <div class="clear" />
      <div class="card-content">
        <ul>
          <li v-for="(item,index) in getBankList" :key="index">
linxin's avatar
linxin committed
32
            <item-option class="slider">
786817560's avatar
786817560 committed
33 34 35
              <div
                :style="'background-image: url('+ changeBgImg (item) +')'"
                class="my-bank-card"
linxin's avatar
linxin committed
36
                @click="sendList(item)"
786817560's avatar
786817560 committed
37
              >
linxin's avatar
linxin committed
38
                <div class="card-info" >
786817560's avatar
786817560 committed
39
                  <span class="name">{{ item.bank_full_name }}</span>
linxin's avatar
linxin committed
40
                  <span class="card-type">{{ selectType(item.bank_card_type) }}</span>
786817560's avatar
786817560 committed
41 42
                  <span class="number">卡号</span>
                  <span class="card-number">**** **** **** {{ selectLast (item) }}</span>
李晓兵's avatar
李晓兵 committed
43
                </div>
786817560's avatar
786817560 committed
44 45 46 47 48 49 50
              </div>
              <div slot="buttons" class="button">
                <option-button text @click.native="deleteFun(item.bank_account_num)" />
              </div>
            </item-option>
          </li>
        </ul>
李晓兵's avatar
李晓兵 committed
51 52
      </div>
    </div>
53
  </div>
李晓兵's avatar
李晓兵 committed
54 55 56 57 58
</template>
<script>
import backImg1 from '@/assets/userBind/nong.png'
import backImg2 from '@/assets/userBind/unNong.png'
export default {
786817560's avatar
786817560 committed
59
  props: {
786817560's avatar
786817560 committed
60 61 62
    'getBankList': {
      default: [],
      type: Array,
786817560's avatar
786817560 committed
63
    },
linxin's avatar
linxin committed
64 65 66 67
    'from': {
      default: null,
      type: Boolean,
    },
786817560's avatar
786817560 committed
68
  },
李晓兵's avatar
李晓兵 committed
69 70 71 72 73 74 75
  data () {
    return {
      backImg: null,
      showModalValue: true,
    }
  },
  methods: {
linxin's avatar
linxin committed
76 77 78 79
    selectType (e) {
      if (e === '0') {
        return '未知类型'
      } else if (e === '1') {
80
        return '借记卡'
linxin's avatar
linxin committed
81
      } else if (e === '2') {
82
        return '信用卡'
linxin's avatar
linxin committed
83 84
      }
    },
李晓兵's avatar
李晓兵 committed
85
    sendFlag (isClear) {
李晓兵's avatar
李晓兵 committed
86
      this.showModalValue = true
李晓兵's avatar
李晓兵 committed
87
      this.$emit('getInfo', this.showModalValue, isClear)
李晓兵's avatar
李晓兵 committed
88
    },
linxin's avatar
linxin committed
89 90
    sendList (a) {
      this.$emit('getList', a)
李晓兵's avatar
李晓兵 committed
91
      this.sendFlag(false)
linxin's avatar
linxin committed
92
    },
李晓兵's avatar
李晓兵 committed
93
    changeBgImg (item) {
94
      if (item.bank_full_name.indexOf('农业银行') !== -1) {
李晓兵's avatar
李晓兵 committed
95 96 97 98 99 100
        return backImg1
      } else {
        return backImg2
      }
    },
    selectLast (item) {
101
      console.log('item', item)
李晓兵's avatar
李晓兵 committed
102 103 104 105
      let num = item.bank_account_num
      return num.substring(num.length - 4)
    },
    deleteFun (e) {
linxin's avatar
linxin committed
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
      this.hlsPopup.showConfirm({
        title: '提示',
        content: '您确认删除吗?',
        onConfirm: data => {
          if (data === 1) {
            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'
            let param = {
              'master': {
                'bp_id': this.from ? this.$route.params.bp_id : window.localStorage.getItem('user_id'),
                'bank_account_num': e,
              },
            }
            vm.hlsPopup.showLoading('请稍候')
            vm.hlsHttp.post(url, param).then(function (res) {
              vm.hlsPopup.hideLoading()
              if (res.result === 'S') {
                vm.hlsPopup.showSuccess('删除成功')
              } else {
                vm.hlsPopup.showLongCenter(res.message)
              }
            })
          }
786817560's avatar
786817560 committed
135
        },
李晓兵's avatar
李晓兵 committed
136 137 138 139 140
      })
    },
  },
}
</script>
linxin's avatar
linxin committed
141
<style lang="less">
786817560's avatar
786817560 committed
142 143 144 145 146
  #bank-card {
      .info {
        height: 70px;
        background-color: rgba(142, 195, 30, 0.1);
        .info-icon {
李晓兵's avatar
李晓兵 committed
147
          height: 20px;
786817560's avatar
786817560 committed
148 149 150 151 152 153 154 155 156
          padding-top: 20px;
          display: flex;
          align-items: center;
          img {
            width: 15.8px;
            height: 15.8px;
            margin-left: 17.1px;
          }
          span {
李晓兵's avatar
李晓兵 committed
157
            font-family: PingFangSC-Semibold;
786817560's avatar
786817560 committed
158 159 160 161 162
            font-size: 14px;
            color: #8ec31e;
            margin-left: 9px;
            letter-spacing: 0.5px;
            line-height: 20px;
李晓兵's avatar
李晓兵 committed
163 164
          }
        }
786817560's avatar
786817560 committed
165 166 167 168 169 170 171 172 173
        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
174 175
        }
      }
786817560's avatar
786817560 committed
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
      .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;
李晓兵's avatar
李晓兵 committed
194
              color: @headerColor;
786817560's avatar
786817560 committed
195 196 197 198 199 200 201 202
              letter-spacing: 0.46px;
              .sum {
                font-family: PingFangSC-Semibold;
                font-size: 15px;
                color: #4d5d6c;
                letter-spacing: 0.46px;
              }
            }
李晓兵's avatar
李晓兵 committed
203
          }
786817560's avatar
786817560 committed
204 205 206 207
          .icon-right {
            width: 34px;
            height: 34px;
            float: right;
李晓兵's avatar
李晓兵 committed
208
          }
786817560's avatar
786817560 committed
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
        }
        .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
224
          }
786817560's avatar
786817560 committed
225 226 227 228 229
          .my-bank-card {
            width: 320px;
            height: 190px;
            box-shadow: 0 5px 20px 0 rgba(101, 101, 101, 0.25);
            border-radius: 6px;
230 231
            background-size: 370px 240px;
            background-position: -20px;
786817560's avatar
786817560 committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
            .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
264 265 266
          }
        }
      }
786817560's avatar
786817560 committed
267 268 269 270 271 272 273 274 275
      .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
276 277
    }
</style>