Micro-channel payment applet box style and function

1, page code

<view catchtap = 'showInputLayer' class = "btn_pay"> payment </ view> Now 
<- - password input box!> 
<View WX: IF = '{} {} showPayPwdInput'> 
    <View class = 'bg_layer' > </ View> 
    <View class = 'input_main'> 
        <View class = 'input_title'> 
            <View class = 'input_back' catchtap = 'hidePayLayer'> <text> </ text> </ View> 
            <text> input payment password </ text> 
        </ View> 
        <View class = 'input_tip'> <text> use the membership card balance of payments need to authenticate before they can be paid after verification by. </ text> </ View> 
        <View class = 'input_row' catchtap = 'the getFocus'> 
            <View class = 'pwd_item'
        <view class='forget_pwd' catchtap='hidePayLayer'>忘记密码</view>
        <input class='input_control' password type='number' focus='{{payFocus}}' bindinput='inputPwd' maxlength='6'/>
    </view>
</view>

  js code

//index.js 
// Get Application Example 
const = getApp App () 

Page ({ 
  Data: { 
    showPayPwdInput: to false, // whether to show the password input layer 
    pwdVal: '', // password entered 
    payFocus: true, // text focus frame 
  }, 
  the onLoad: function () { 
    this.showInputLayer (); 
  }, 
  / ** 
   * payment password input layer display 
   * / 
  showInputLayer: function () { 
    this.setData ({showPayPwdInput: to true, payFocus: to true}); 
  } 
  / ** 
   * payment password hidden layer 
   * / 
  hidePayLayer: function () { 
    / * get the password entered * / 
    var = Val this.data.pwdVal;  
	/ ** ** payment interface in this call /
    this.setData ({showPayPwdInput: to false, payFocus: to false , pwdVal: ''}, function () {
      / ** elastic block ** / 
      wx.showToast ({ 
        title: Val, 
      }) 
    }); 

  }, 
  / * 
   * get focus 
   * / 
  the getFocus: function () { 
    this.setData (payFocus {:} to true); 
  } , 
  / ** 
   * password listener 
   * / 
  inputPwd: function (E) { 
      this.setData ({pwdVal: e.detail.value}); 

      IF (e.detail.value.length> =. 6) { 
        this.hidePayLayer ( ); 
      } 
  } 
})

  css styles

.btn_pay{
  margin: 100rpx auto; width: 600rpx; height: 100rpx; line-height: 100rpx; border-radius: 100rpx;
  background-color: #d3a95a; color: #fff; font-size: 36rpx; text-align: center; 
}
/* 支付密码css start */
.bg_layer{
  position: fixed; left: 0; top: 0; bottom: 0; right: 0;
  background-color: rgba(0, 0, 0, 0.6); z-index: 9998;
}
.input_main{
    position: fixed; left: 0; bottom: 500rpx; width: 100%; height: 394rpx;
    background-color: #fff; z-index: 9999;
}
.input_title{
    width: 100%; height: 90rpx; line-height: 90rpx; text-align: center; 
    font-size: 32rpx; border-bottom: 1rpx solid #e2e2e2;
}
.input_back{
    position: absolute; left: 0; top: 0;
    width: 80rpx; height: 90rpx; display: flex; justify-content: center; align-items: center;
}
.input_back text{
  width: 20rpx;
  height: 20rpx;
  background-color: white;
  border: 1rpx solid #aaa;
  border-width: 5rpx 0 0 5rpx;
  transform: rotate(-45deg);
}

.input_tip{  margin: 30rpx; font-size: 24rpx; color: #888; }

/* 密码掩码模拟 */
.input_row{
  width: 690rpx; margin: 0 auto; height: 98rpx; position: relative;
  display: flex; align-items: center; border: 1rpx solid #e2e2e2; border-radius: 20rpx;
}
.input_row .pwd_item{
  flex: 1; display: flex; align-items: center; justify-content: center; 
  height: 100%; border-right: 1rpx solid #e2e2e2; position: relative;
}
.pwd_item:nth-last-of-type(1) { border-right: 0; } 
.pwd_item text { 
  width: 30rpx; height: 30rpx; border-radius: 30rpx; background-color: #555;
}


.forget_pwd{ 
  float: right; margin: 30rpx; width: 100rpx; text-align: right; font-size: 24rpx; color: #ff7800;
}

/* 文本输入框位置: 设置到左边隐藏 */
.input_control { 
  position: relative; left: -300rpx; bottom: 0; width: 100rpx; height: 100rpx;
}

  

 

Guess you like

Origin www.cnblogs.com/wuliujun521/p/11743332.html