微信小程序自定义键盘微信小程序自定义键盘 内部虚拟支付内部虚拟支付
主要为大家详细介绍了微信小程序自定义键盘,内部虚拟支付,具有一定的参考价值,感兴趣的小伙伴们可以
参考一下
本文实例为大家分享了微信小程序自定义键盘的具体代码,供大家参考,具体内容如下
先看效果图 :
微信支付的话,调用微信支付接口是有自己的小键盘的,因为小程序没有内部键盘,所以有时候商城内部需要零钱支付 ,会员卡
支付,输入密码就需要自己做一个小键盘了。
css 跟 html不做过多说明 直接照搬就行 页面上面的3个小图片就不提供了 js 部分做了详细注释
<view class="popup-memu">
<view class="line" style="background-color: rgb(255, 255, 255)"></view>
<view class="payMode" bindtap="pay" data-pay_type='weipay'>
<image src="/images/wechat.png"></image>
<text style="width:70%">微信</text>
<image src="/images/arrows-right.png"></image>
</view>
<view class="payMode" bindtap="pay" data-pay_type='1'>
<image src="/images/vip.png"></image>
<text style="width:70%">会员卡</text>
<image src="/images/arrows-right.png"></image>
</view>
<view class="payMode" bindtap="pay" data-pay_type='2'>
<image src="/images/payPacket.png"></image>
<text style="width:70%">零钱</text>
<image src="/images/arrows-right.png"></image>
</view>
</view>
<!-- 密码框带键盘 -->
<action-sheet hidden="{{passwordInputHidden}}" bindchange="passwordInputHidden">
<view class='password-input'>
<view>
<text style="display:{{inputPassword[0]?'':'none'}}"></text>
</view>
<view>
<text style="display:{{inputPassword[1]?'':'none'}}"></text>
</view>
<view>
<text style="display:{{inputPassword[2]?'':'none'}}"></text>
</view>
<view>
<text style="display:{{inputPassword[3]?'':'none'}}"></text>
</view>
<view>
<text style="display:{{inputPassword[4]?'':'none'}}"></text>
</view>
<view>
<text style="display:{{inputPassword[5]?'':'none'}}"></text>
</view>
</view>
<view class='tips'>请输入支付密码(
<text>-¥100</text>)</view>
<view class='keyboard'>
<view class='left number'>
<view data-key="1" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>1</view>
<view data-key="2" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>2</view>
<view data-key="3" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>3</view>
<view data-key="4" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>4</view>
<view data-key="5" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>5</view>
<view data-key="6" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>6</view>
<view data-key="7" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>7</view>
<view data-key="8" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>8</view>
<view data-key="9" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>9</view>
<view data-key="X" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>X</view>
<view data-key="0" hover-class='active' hover-stay-time='100' bindtap='inputPassword'>0</view>
<view data-key="." hover-class='active' hover-stay-time='100' bindtap='inputPassword'>.</view>
</view>
<view class='right ctr-btn'>
<view class='ctr-btn-item' hover-class='active' hover-stay-time='100' bindtap='clear'>
<label class='iconfont icon-shanchu'></label>
</view>
<view class='ctr-btn-item' hover-class='active' hover-stay-time='100' bindtap='passwordInputHidden'>取消</view>
</view>