123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- <template>
- <view class="content">
- <view class="top-title flex flex-space-between">
- <view class="left flex">
- <view class="mybank_title">我的银行卡</view>
- <!-- <view class="text2">(共{{bankList?bankList.length:0}}张)</view> -->
- </view>
- <!-- <view v-if='bankList.length==0' @click="addBankCard" class="add-bankcard flex">
- <view class="car-text">添加银行卡</view>
- <u-icon class="icon" name="plus-circle-fill" color="#2979ff" size="24"></u-icon>
- </view> -->
- <view v-if="bankList.length > 0"><image style='width:17px;height:17px;margin-top: 10rpx;' @click="del()" src="../../../static/mine/sanchu.png" mode=""></image></view>
- </view>
- <!-- <image src="../../../static/images/mine/bank/nongyelogo.png" mode=""></image> -->
- <view class="card-list" v-for="(item,index) in bankList" v-if="bankList.length > 0">
- <view class="card-list-item" :style='{"background-image":"url("+item.cardColor+")"}'>
- <view class="flex flex-end number carNumber">{{item.bankCard}}</view>
- <view class="flex align-center">
- <!-- @/static/images/mine/bank/gflogo.png -->
- <image class="img left" :src="item.imgLogo" mode='widthFix'>
- </image>
- <view class="right">
- <view class="text1">{{item.bankDeposit}}</view>
- <view class="text2">收款人:{{item.cardholderName}}</view>
- </view>
- </view>
- </view>
- <view class="flex flex-space-between row2 align-center">
- <view class="flex align-center">
- <!-- <radio :checked="item.defaultFlag==1" @click='radioChange(item)' />
- <view class="default-card">设为默认收款账户</view> -->
- </view>
- <view>
- </view>
- </view>
- </view>
- <view class="nobank" v-if="bankList.length == 0">
- <image src="../../../static/mine/bank/noBank.png" mode="" class="nobank_img"></image>
- <view class="text_css">您还没有银行卡哦,快来添加吧~</view>
- <view class="add_btn" @click="addBankCard">去添加</view>
- </view>
- <!-- <view @click="addBankCard">添加银行卡</view> -->
- <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick" @cancel="cancelClick"></u-modal>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- bankList: [],
- obj:{},
- index:null,
- isShowAlert:false,
- alertTitle:'确认删除该银行卡?'
- };
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onLoad() {
- if (!this.hasLogin) {
- uni.$u.route('/pages/public/login');
- }
- this.init();
- },
- onShow() {
- this.init();
- },
- methods: {
- confirmClick(){
- this.isShowAlert = false
- this.$request.baseRequest('post', '/hyCargoOwnerPayeeInfo/api/deletePayee', {
- id: this.obj.id
- }).then(res => {
- if (res.code == '200') {
- this.$refs.uToast.show({
- type: 'success',
- message: "删除成功!",
- })
- this.bankList.splice(this.index, 1)
- }
-
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- cancelClick(){
- this.isShowAlert = false
- },
- radioChange(val) {
- for (let i = 0; i < this.bankList.length; i++) {
- if (val.id == this.bankList[i].id) {
- if(this.bankList[i].defaultFlag == 1){
- this.bankList[i].defaultFlag = 0
- this.bankList[i].flag = 2 //取消标志
- }else{
- this.bankList[i].defaultFlag = 1
- this.bankList[i].flag = 1 //设置标志
- }
- this.$request.baseRequest('post', '/hyCargoOwnerPayeeInfo/api/setDefault', val).then(res => {
- if (res.code == '200') {
- if(this.bankList[i].flag == 1){
- this.$refs.uToast.show({
- type: 'success',
- message: "设置成功!",
- })
- }else{
- this.$refs.uToast.show({
- type: 'success',
- message: "取消成功!",
- })
- }
- } else {
- uni.$u.toast(res.message);
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- } else {
- this.bankList[i].defaultFlag = 0
- }
- }
- },
- number(value){
- if(value&&value.length>8) {
- let reg = /^(\d{4})(\d*)(\d{4})$/;
- let str = value.replace(reg, (a, b, c, d)=> {
- return b + c.replace(/\d/g, "*") + d;
- });
- return str
- }else {
- return value
- }
- },
- init() {
- this.$request.baseRequest('get', '/hyCargoOwnerPayeeInfo/selectPayee', {
- commonId: this.userInfo.id,
- pageSize: 10,
- currentPage: 1,
- }).then(res => {
- if (res.code == '200') {
- this.bankList = res.data.records
- for (let i = 0; i < this.bankList.length; i++) {
- let _obj = this.bankList[i]
- _obj.bankCard = this.number(_obj.bankCard)
- switch (_obj.bankDeposit) {
- case "建设银行":
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/jiansheogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/jh.png"
- break
- case "招商银行":
- this.bankList[i].imgLogo =
- "../../../static/images/mine/bank/zhaoshang.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/zsbg.png"
- break
- case "中国银行":
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/zhongyin.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/zsbg.png"
- break
- case "邮政银行":
- this.bankList[i].imgLogo =
- "../../../static/images/mine/bank/youzhenglogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/nh.png"
- break
- case "交通银行":
- this.bankList[i].imgLogo =
- "../../../static/images/mine/bank/jiaotognlogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/jh.png"
- break
- case "工商银行":
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/gslogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/zsbg.png"
- break
- case "农业银行":
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/nongyelogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/nh.png"
- break
- case "民生银行":
- this.bankList[i].imgLogo =
- "../../../static/images/mine/bank/minshenglogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/nh.png"
- break
- case "中信银行":
- this.bankList[i].imgLogo =
- "../../../static/images/mine/bank/zhongxinlogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/zsbg.png"
- break
- case "广发银行":
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/gflogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/zsbg.png"
- break
- case "华夏银行":
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/huaxia.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/zsbg.png"
- break
- case "兴业银行":
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/xingye.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/jh.png"
- break
- default:
- this.bankList[i].imgLogo = "../../../static/images/mine/bank/qitalogo.png"
- this.bankList[i].cardColor = "../../../static/images/mine/bank/qt.png"
- break
- }
- }
- this.$forceUpdate()
- } else {
- uni.$u.toast(res.message);
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- addBankCard() {
- var _this = this;
- // this.dataDetails.driverId = this.userInfo.driverId
- _this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', { //查身份证号
- phone: uni.getStorageSync("userInfo").phone
- }).then(res => {
- if(res.data.authenticationStatus=='已认证'){
- uni.$u.route('/pages/mine/manageBankCards/addBankCard');
- }else{
- this.$refs.uToast.show({
- type: 'error',
- message: "请先进行身份认证!",
- })
- }
- })
-
- },
- edit() {
- uni.$u.route('/pages/mine/manageBankCards/editBankCard');
- let params = {
- type: 'success',
- message: "修改成功",
- iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
- }
- this.$refs.uToast.show({
- ...params
- })
- },
- del(val, index) {
- this.obj = this.bankList[0]
- this.index = 0
- this.isShowAlert = true
-
- }
- },
- }
- </script>
- <style lang="scss">
- .content {
- background: white;
- padding: 20rpx;
- }
- .top-title {
- margin: 0 0 20rpx 0;
- .left {
- .text1 {
- font-size: 29rpx;
- color: #1F1F1F;
- font-weight: 700;
- }
- .text2 {
- font-size: 29rpx;
- color: #999999;
- }
- }
- }
- .card-list {
- padding: 0 20rpx;
- .number {
- color: white;
- }
- }
- .add-bankcard {
- background: #EEF4FF;
- color: #2772FB;
- font-weight: 700;
- font-size: 26rpx;
- align-items: center;
- padding: 4rpx 10rpx 4rpx 20rpx;
- border-radius: 30rpx;
- }
- .card-list-item {
- // background: url(../../../static/images/mine/bank/zsbg.png) center no-repeat;
- background-size: cover;
- padding: 60rpx 43rpx 100rpx 43rpx;
- border-radius: 20rpx;
- .carNumber{
- margin-bottom: 20rpx;
- }
- .img {
- width: 80rpx;
- height: 80rpx;
- margin-right: 20rpx;
- }
- .right {
- .text1 {
- font-size: 36rpx;
- font-weight: 700;
- color: #FFFFFF;
- }
- .text2 {
- // font-size: 24rpx;
- color: #FFFFFF;
- margin-top: 10rpx;
- }
- }
- }
- .row2 {
- margin: 20rpx 0;
- }
- .default-card {
- // font-size: 28rpx;
- color: #333333;
- }
- .mybank_title{
- font-size: 40rpx;
- font-weight: 600;
- }
- .nobank{
- // height: calc(100vh - 13vh);
- // background: red;
- text-align: center;
- .nobank_img{
- width: 344rpx;
- height: 228rpx;
- margin-top: 350rpx;
- }
- .text_css{
- font-size: 30rpx;
- color: #333333;
- margin-top: 90rpx;
- }
- .add_btn{
- background: #2772FB;
- width: 212rpx;
- height: 86rpx;
- margin: 74rpx auto;
- line-height: 86rpx;
- border-radius: 43rpx;
- color: #FFFFFF;
- }
- }
- </style>
|