123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- <template>
- <view class="container card clearfix">
- <view class="card-content">
- <view class="card-row">
- <view class="form-label">卡号</view>
- <view class="form-input">{{ params.cardNumber | formatAccNo }}</view>
- </view>
- <view class="card-row picker">
- <view class="form-label">卡类型</view>
- <view class="form-input">
- <picker @change="bindPicker($event)" :value="index" :range="stateActions" range-key="name">
- <input
- class="form-input"
- :class="cardTytpeText === '请选择卡类型' ? 'none' : ''"
- type="text"
- disabled="false"
- v-model="cardTytpeText"
- value=""
- placeholder="请选择"
- />
- </picker>
- </view>
- <view class="iconfont icon-xiayibu"></view>
- </view>
- <view class="card-row">
- <view class="form-label">姓名</view>
- <input
- class="form-input"
- type="number"
- name="input"
- v-model="params.name"
- placeholder="请输入您的姓名"
- maxlength="10"
- />
- </view>
- <view class="card-row">
- <view class="form-label">身份证</view>
- <input
- class="form-input"
- type="number"
- name="input"
- v-model="params.number"
- placeholder="请输入您的身份证号"
- maxlength="18"
- />
- </view>
- <view class="card-row">
- <view class="form-label">预留手机号</view>
- <input
- class="form-input"
- type="number"
- name="input"
- v-model="params.bindMobile"
- placeholder="请输入您的银行预留手机号"
- maxlength="11"
- />
- </view>
- <view class="card-row" v-if="params.type === 2">
- <view class="form-label">有效期</view>
- <input
- class="form-input"
- type="number"
- name="input"
- v-model="params.time"
- placeholder="请选择贷记卡有效期"
- maxlength="11"
- />
- </view>
- <view class="card-row" v-if="params.type === 2">
- <view class="form-label">CVV2</view>
- <input
- class="form-input"
- type="number"
- name="input"
- v-model="params.cvv"
- placeholder="请输入贷记卡背面的安全码"
- maxlength="3"
- />
- </view>
- <view class="card-mains-btn">
- <button class="add-btn" :disabled="disabled" :class="[disabled ? 'disabled' : '']" @click="handleAddCard">
- {{ subButtonText }}
- </button>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- params: {
- type:1,
- name:'',
- number:'',
- bindMobile:'',
- clubId: 0,
- time:'',
- cvv:'',
- cardNumber: '6228481456743154778'
- },
- showCardNumber: '',
- maxLen: 30,
- subType: 1 ,// 1直接绑卡 2//
- cardTytpeText:'请选择卡类型',
- subButtonText:'确认绑卡',
- stateActions: [
- { name: '借记卡', value: 1 },
- { name: '贷记卡', value: 2 },
- ]
- }
- },
- onLoad() {
- // this.GetAccountInitData()
- },
- filters: {
- formatAccNo(value) {
- const newValue = value.replace(/([^0-9])/g, '') // 只允许输入数字
- const formatValue = newValue.replace(/(\d{4})(?=\d)/g, '$1 ') // 每4个数字后面加一个空格
- return formatValue
- }
- },
- computed: {
- disabled() {
- if (this.params.cardNumber.length > 12) {
- return false
- } else {
- return true
- }
- }
- },
- methods: {
- handleAddCard() {
- //提交卡号
- },
- handleClearInput() {
- //清空银行卡
- this.params.cardNumber = this.showCardNumber = ''
- },
- handleInput(e) {
- this.params.cardNumber = e.detail.value
- this.showCardNumber = this.formatAccNo(e.detail.value)
- },
- handleGoSusList() {
- // 跳转支持银行
- this.$api.navigateTo(`/pages/user/pay/card-sus-list`)
- },
- bindPicker(e){//选择联系人身份
- this.cardTytpeText = this.stateActions[e.target.value].name
- this.params.type= this.stateActions[e.target.value].value
- },
- getOriginValue() {
- //获取input的原始值
- return this.showCardNumber.split(' ').join('')
- }
- },
- onShow() {
- // this.beansList = []
- }
- }
- </script>
- <style lang="scss">
- page,
- .container {
- background: #ffffff;
- height: 100%;
- }
- .card-content{
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 32rpx;
- .card-row{
- width: 100%;
- height: 100rpx;
- box-sizing: border-box;
- border-bottom: 1px solid #e1e1e1;
- position: relative;
- float: left;
- &.picker{
- padding-right: 60rpx;
- }
- .form-label {
- float: left;
- height: 100%;
- line-height: 98rpx;
- font-size: $font-size-28;
- text-align: left;
- color: #666666;
- }
- .form-input {
- min-width: 500rpx;
- height: 98rpx;
- line-height: 98rpx;
- font-size: $font-size-28;
- text-align: right;
- color: #333333;
- float: right;
- }
- .icon-xiayibu {
- width: 60rpx;
- height: 100rpx;
- position: absolute;
- right: 0;
- top: 0;
- line-height: 100rpx;
- text-align: center;
- color: #b2b2b2;
- }
- }
- .card-mains-btn {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 0 43rpx;
- margin-top: 180rpx;
- float: left;
- .add-btn {
- width: 100%;
- height: 90rpx;
- font-size: $font-size-30;
- line-height: 90rpx;
- color: #ffffff;
- text-align: center;
- background: $btn-confirm;
- border-radius: 45rpx;
- border-radius: 44rpx;
- margin-top: 80rpx;
- &.disabled {
- background: #e1e1e1;
- border-radius: 44rpx;
- }
- }
- }
- }
- </style>
|