微信小程序支付框样式以及功能
1、页面代码
<view catchtap='showInputLayer' class="btn_pay">立即支付</view>
<!-- 密码输入框 -->
<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>输入支付密码</text>
</view>
<view class='input_tip'><text>使用会员卡余额支付需要验证身份,验证通过后才可进行支付。</text></view>
<view class='input_row' catchtap='getFocus'>
<view class='pwd_item' wx:for='{{6}}' wx:key='item' wx:for-index='i'>
<text wx:if='{{pwdVal.length>i}}'></text>
</view>
</view>
<view class='forget_pwd' catchtap='hidePayLayer'>忘记密码</view>
<input class='input_control' password type='number' focus='{{payFocus}}' bindinput='inputPwd' maxlength='6'/>
</view>
</view>
js代码
//index.js
//获取应用实例
const app = getApp() Page({
data: {
showPayPwdInput: false, //是否展示密码输入层
pwdVal: '', //输入的密码
payFocus: true, //文本框焦点
},
onLoad: function () {
this.showInputLayer();
},
/**
* 显示支付密码输入层
*/
showInputLayer: function(){
this.setData({ showPayPwdInput: true, payFocus: true });
},
/**
* 隐藏支付密码输入层
*/
hidePayLayer: function(){
/**获取输入的密码**/
var val = this.data.pwdVal;
/**在这调用支付接口**/
this.setData({ showPayPwdInput: false, payFocus: false, pwdVal: '' }, function(){
/**弹框**/
wx.showToast({
title: val,
})
}); },
/**
* 获取焦点
*/
getFocus: function(){
this.setData({ payFocus: true });
},
/**
* 输入密码监听
*/
inputPwd: function(e){
this.setData({ pwdVal: e.detail.value }); if (e.detail.value.length >= 6){
this.hidePayLayer();
}
}
})
css样式
.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;
}
微信小程序支付框样式以及功能的更多相关文章
- 微信小程序 —搜索框
wxSearch优雅的微信小程序搜索框 一.功能 支持自定义热门key 支持搜索历史 支持搜索建议 支持搜索历史(记录)缓存 二.使用 1.将wxSearch文件夹整个拷贝到根目录下 2.引入 // ...
- 微信小程序支付功能 C# .NET开发
微信小程序支付功能的开发的时候坑比较多,不过对于钱的事谨慎也是好事.网上关于小程序支付的实例很多,但是大多多少有些问题,C#开发的更少.此篇文档的目的是讲开发过程中遇到的问题做一个备注,也方便其他开发 ...
- 微信小程序wxss设置样式
微信小程序wxss设置样式 对于以前搞客户端开发的来说,有着客户端的逻辑,就是不知道怎么设置样式,把对应的控件显示出来 一.wxml 界面结构wxmL比较容易理解,主要是由八大类基础组件构成: 一.视 ...
- 微信小程序支付及退款流程详解
微信小程序的支付和退款流程 近期在做微信小程序时,涉及到了小程序的支付和退款流程,所以也大概的将这方面的东西看了一个遍,就在这篇博客里总结一下. 首先说明一下,微信小程序支付的主要逻辑集中在后端,前端 ...
- php对接微信小程序支付
前言:这里我就假装你已经注册了微信小程序,并且基本的配置都已经好了.注: 个人注册小程序不支持微信支付,所以我还是假装你是企业或者个体工商户的微信小程序,其他的商户号注册,二者绑定,授权,支付开通,就 ...
- 微信小程序支付接入注意点
一.微信支付后台服务器部署 服务器采用ubuntu16.04 + php7.0 + apache2.0. 微信支付后台服务使用了curl 和 samplexml ,因此php.ini配置中必须开启这两 ...
- SpringBoot2.0微信小程序支付多次回调问题
SpringBoot2.0微信小程序支付多次回调问题 WxJava - 微信开发 Java SDK(开发工具包); 支持包括微信支付.开放平台.公众号.企业微信/企业号.小程序等微信功能的后端开发. ...
- Java实现微信小程序支付(准备)
Java语言开发微信小程序支付功能: 1.通过https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=11_1路径到官方下载Java的支付SD ...
- .NET Core 微信小程序支付——(统一下单)
最近公司研发了几个电商小程序,还有一个核心的电商直播,只要是电商一般都会涉及到交易信息,离不开支付系统,这里我们统一实现小程序的支付流程(与服务号实现步骤一样). 目录1.开通小程序的支付能力2.商户 ...
随机推荐
- mysql破解root口令
破解root口令 [root@centos8 ~]#vim /etc/my.cnf [mysqld] skip-grant-tables #取消密码验证 skip-networking # mysql ...
- LGP1397题解
并不是那么的有意思呢 首先,我们可以将题目给出的地推式看做一个一次函数 \(k * x+b\),来思考一个问题,如果给出两个一次函数 \(F(x)\) 和 \(G(x)\),那么 \(F(G(x))\ ...
- 从SpringBoot到SpringCloudAlibaba简明教程(一):初识SpringBoot及其基础项目构建
前言 Spring框架的大名想必大家早已如雷贯耳,我们来看一下springboot诞生的初衷,以及它在springframe的基础上解决了哪些痛点. 很久以前,J2EE还是java企业级应用的标准规范 ...
- Flask 之路由系统
Flask中的路由系统其实我们并不陌生了,从一开始到现在都一直在应用 @app.route("/",methods=["GET","POST" ...
- 程序流程控制1 if 分支机构
通常,程序结构分为三种,顺序结构,循环结构和分支结构.程序中的语句按照先后顺序执行,成为顺序结构.分支结构则根据测试条件执行不同的代码.循环结构指重复执行相同的代码.Python用if ...
- 【技术干货】华为云FusionInsight MRS的自研超级调度器Superior Scheduler
Superior Scheduler是一个专门为Hadoop YARN分布式资源管理系统设计的调度引擎,是针对企业客户融合资源池,多租户的业务诉求而设计的高性能企业级调度器. Superior Sch ...
- vs2017连接sqlsever数据库
vs2017连接mysql数据库操作步骤 怎样使用vs2017连接数据库 [C++]VS2015/VS2017连接Mysql数据库教程
- Java常见的垃圾收集器有哪些?
守拙者_6a98关注 2020.04.11 22:06:31字数 2,135阅读 394 实际上,垃圾收集器( GC , Garbage Collector )是和具体 JVM 实现紧密相关的,不同厂 ...
- Dubbo 用到哪些设计模式?
Dubbo 框架在初始化和通信过程中使用了多种设计模式,可灵活控制类加载.权 限控制等功能. 工厂模式 Provider 在 export 服务时,会调用 ServiceConfig 的 export ...
- Mybatis框架基础入门(五)--输入映射和输出映射
1.parameterType(输入类型) 1.1 传递简单类型 使用#{}占位符,或者${}进行sql拼接. <select id="caseCountByQueryCaseVo&q ...