123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <template>
- <view class="content">
- <view class="top-title flex flex-space-between">
- <!-- <view class="left flex">
- <view class="text1">我的卡</view>
- <view class="text2">(共{{bankList?bankList.length:0}}张)</view>
- </view> -->
- <view @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>
- <!-- <image src="../../../static/images/mine/bank/nongyelogo.png" mode=""></image> -->
- <view class="card-list" v-for="(item,index) in bankList" @click="bankCheng(item)">
- <view class="card-list-item" :style='{"background-image":"url("+item.cardColor+")"}'>
- <image style='width:17px;height:17px;position: absolute;z-index: 9999;right: 20rpx;top: 20rpx;' @click.stop="del(item,index)" src="../../../static/mine/sanchu.png" mode=""></image>
- <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>
- <!-- <view @click="addBankCard">添加银行卡</view> -->
- <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true' confirmColor='#2772FB' @confirm="$u.throttle(confirmClick(), 1000)" @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:'确认删除该银行卡?',
- enterprise:"",//判断是否有值(有则是我的公司页面进来的 没有则是首页进来的)
- };
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onLoad(options) {
- if(options && options.enterprise){
- this.enterprise = options.enterprise
- }
- if (!this.hasLogin) {
- uni.$u.route('/pages/public/login');
- }
- this.init();
- },
- onShow() {
- this.init();
- },
- methods: {
- bankCheng(item){
- uni.setStorageSync("bankInfo",item)
- uni.navigateBack({
- delta:1
- })
- },
- 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) {
- this.bankList[i].defaultFlag = 1
- this.$request.baseRequest('post', '/hyCargoOwnerPayeeInfo/api/setDefault', val).then(res => {
- if (res.code == '200') {
- 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=='已认证'){
- if(this.enterprise){
- uni.$u.route('/pages/mine/manageBankCards/addBankCard?enterprise='+this.enterprise);//企业添加银行卡标识
- }else{
- 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 = val
- this.index = index
- 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;
- margin-top: 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;
- position: relative;
- .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;
- }
- </style>
|