# yuPay 付款组件

付款组件,点击付款的底部弹出框,通常与yuPasswordInput密码输入组件、yuChooseBankcard银行卡选择组件搭配使用

# 效果预览

<template>
  <yu-pay :pay-show.sync="payShow" title="向宇信科技付款" :bankName="bankName" :bankNum="banNum" money="100" :bankLogo="bankLog" @comfirm="comfirm" @changePay="changePay"></yu-pay>
  <yu-password-input :password-show.sync="passwordShow" :money="money" @cancel="cancelPay" type="transfer" title="请输入六位支付密码" receiveNum="2734739574547716" receiveBank="中国银行" receiveName="宇信小甜甜" :payAct="banNum" @comfirm="comfirmPay"></yu-password-input>
  <yu-choose-bankcard :show.sync="chooseShow" :card-list="cardList" @check="checkFn" @cancel="chooseShow = false" @comfirm="comfirmChooseBank" ></yu-choose-bankcard>
  <van-button type="primary" @click="payShow = true" block>选择支付</van-button>
<template>
<script>
  import yuPay from '@/components/yu-pay/index.vue'
  import yuPasswordInput from '@/components/yu-password-input/index.vue'
  import yuChooseBankcard from '@/components/yu-choose-bankcard/index.vue'
  import ZGYH from '@/assets/img/banklogo/104100000004.png'
  import { BANK_TYPE } from '@/common/params/index.js'
  export default {
    components: {
      demoSection,
      demoBlock,
      yuPay, 
      yuPasswordInput,
      yuChooseBankcard
    },
    data() {
      return {
        passwordShow: false,
        payShow: true,
        banNum: '6217898356782450001',
        bankLog: ZGYH,
        bankName: '中国银行',
        money: '2000',
        chooseShow: false,
        cardList: [
          {
            accountNo: '6217898356782452098',
            checked: true,
            bankNo: '103100000026'
          },
          {
            accountNo: '6217898356782450927',
            bankNo: '104100000004'
          },
          {
            accountNo: '6217898356782453546',
            bankNo: '105100000017'
          },
          {
            accountNo: '621789835678245323',
            bankNo: '308584000013'
          }
        ]     
      };
    },
    activated() {
      this.payShow = true;
    },
    methods: {
      comfirm(value) {
        this.payShow = false;
        this.passwordShow = true;
        console.log('输入密码111', value)
      },
      comfirmPay(value) {
        console.log('确认支付', value)
      },
      cancelPay() {

      },
      changePay() {
        this.chooseShow = true;
      },
      checkFn() {

      },
      comfirmChooseBank(item) {
        this.banNum = item.accountNo;
        this.bankLog = `@/assets/img/banklogo/${item.bankNo}.png`
        this.bankName = BANK_TYPE[`${item.bankNo.substring(0, 3)}`];
      }

    }
  };
</script>

<style lang="scss">

</style>

# Attributes

参数 说明 类型 可选值 默认值
payShow 显示弹出层 Boolean true false false
bankName 付款标题 string - 付款
bankNum 付款金额 string - -
money 付款金额 string - -
title 付款标题 string - 付款
banklogo 付款账户银行logo png svg 等 - -
comfirmText 提交按钮文字 string - 确定

# Events

方法名 说明 参数
comfirm 确定付款按钮触发
changePay 切换付款账户
close 关闭弹出框
Last Updated: 5/15/2024, 4:47:26 PM