微信小程序支付框样式以及功能
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.商户 ...
随机推荐
- laravel7 jqAjax下拉框搜索
html: 设置页面改变事件 <div id="show"> <div class="page-container" style=" ...
- tp6 的安装步骤 及简易命令
1:https://www.kancloud.cn/manual/thinkphp6_0/1037481 官网下载 composer create-project topthink/think tp6 ...
- nginx 访问php文件报错
问题图: An error occurred. 解决方法(windows版) php.cgi没有启动 cmd中找到cig.exe 的位置然后运行 php-cgi.exe -b 127.0.0.1: ...
- 『现学现忘』Docker常用命令 — 19、容器常用命令(一)
目录 1.新建并启动容器 2.列出当前所有正在运行的容器 3.退出容器 4.启动容器 5.重启容器 6.停止容器 7.强制停止容器 8.删除已停止的容器 有镜像才能创建容器,这是根本前提. 我们下载一 ...
- Applied Social Network Analysis in Python 相关笔记
- P1030
题面 给出一棵二叉树的中序排列与后序排列.求出它的先序排列.(约定树结点用不同的大写字母表示,长度≤8). 输入格式 2行,均为大写字母组成的字符串,表示一棵二叉树的中序排列与后序排列. 输出格式 1 ...
- 什么是BGP
BGP概述 边界网关协议(BGP)是运行于TCP协议上的一种自治系统的路由协议. 是一种外部路由协议. AS概述 自治系统(AS),指的是同一个使用相同策略的设备的集合. 每个AS有自己位移的编号,不 ...
- VUE常见问题
VUE常见问题 对于MVVM的理解 MVVM 是 Model-View-ViewModel 的缩写 Model代表数据模型,也可以在Model中定义数据修改和操作的业务逻辑 View 代表UI 组件, ...
- 常用写法java
迭代器遍历[List.Set.Map] 遍历List方法一:普通for循环 1 for(int i=0;i<list.size();i++){//list为集合的对象名 2 String tem ...
- 去掉一个Vector集合中重复的元素 ?
Vector newVector = new Vector(); For (int i=0;i<vector.size();i++) { Object obj = vector.get(i); ...