提交 58d81b7f47a0147a29277910540622a18b38594f

作者 wangyu
1 个父辈 ecb2dc03

添加提现页面以及输入密码相关弹窗

@@ -39,6 +39,7 @@ @@ -39,6 +39,7 @@
39 "pages/main/rewardpoint/home", 39 "pages/main/rewardpoint/home",
40 "pages/main/rewardpoint/cashout/cashout", 40 "pages/main/rewardpoint/cashout/cashout",
41 "pages/main/rewardpoint/exchange/exchange", 41 "pages/main/rewardpoint/exchange/exchange",
  42 + "pages/main/rewardpoint/bindcard/bindcard",
42 43
43 "pages/login/login", 44 "pages/login/login",
44 "pages/main/advancepayment/adPayDetails/adPayDetails", 45 "pages/main/advancepayment/adPayDetails/adPayDetails",
  1 +// pages/main/rewardpoint/bindcard/bindcard.js
  2 +Page({
  3 +
  4 + /**
  5 + * Page initial data
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * Lifecycle function--Called when page load
  13 + */
  14 + onLoad: function (options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * Lifecycle function--Called when page is initially rendered
  20 + */
  21 + onReady: function () {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * Lifecycle function--Called when page show
  27 + */
  28 + onShow: function () {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 下一步
  34 + */
  35 + nestStep:function(){
  36 +
  37 + },
  38 +
  39 + /**
  40 + * Lifecycle function--Called when page hide
  41 + */
  42 + onHide: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * Lifecycle function--Called when page unload
  48 + */
  49 + onUnload: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * Page event handler function--Called when user drop down
  55 + */
  56 + onPullDownRefresh: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * Called when page reach bottom
  62 + */
  63 + onReachBottom: function () {
  64 +
  65 + },
  66 +
  67 + /**
  68 + * Called when user click on the top right corner to share
  69 + */
  70 + onShareAppMessage: function () {
  71 +
  72 + }
  73 +})
  1 +{
  2 + "navigationBarTitleText": "添加银行卡"
  3 +}
  1 +<!--pages/main/rewardpoint/bindcard/bindcard.wxml-->
  2 +<view>
  3 +
  4 +<view>
  5 +
  6 +</view>
  7 +
  8 +<view class="view_bottom">
  9 + <button class="btn_blue_radius" style="margin:20rpx" bindtap='nextStep'> 下一步</button>
  10 + <!-- <button wx:else class="btn_gray_radius" style="margin:20rpx"> 提现</button> -->
  11 + </view>
  12 +</view>
  1 +/* pages/main/rewardpoint/bindcard/bindcard.wxss */
  2 +.view_bottom {
  3 + background: #fff;
  4 + width: 100%;
  5 + position: fixed;
  6 + bottom: 0;
  7 + display: flex;
  8 + flex-direction: row;
  9 +}
  10 +
  11 +.placeholder_input_wrap{
  12 + color:#ccc;
  13 + font-size:30rpx;
  14 +}
  15 +
  16 +.input_wrap{
  17 + width:356rpx;
  18 + color:#333;
  19 + font-size:56rpx;
  20 +}
  21 +
  22 +.btn_blue_radius {
  23 + background: #357aeb;
  24 + border-radius: 5px;
  25 + flex: 1;
  26 + color: #fff;
  27 +}
@@ -5,6 +5,17 @@ Page({ @@ -5,6 +5,17 @@ Page({
5 * Page initial data 5 * Page initial data
6 */ 6 */
7 data: { 7 data: {
  8 + showModal:false,
  9 + hasBind:true,
  10 + cashNum:6989.88,
  11 + inputNum:"",
  12 + pwdList: [1, 2, 3, 4, 5, 6],
  13 + //输入框聚焦状态
  14 + isFocus: false,
  15 + //输入框聚焦样式 是否自动获取焦点
  16 + focusType: true,
  17 + valueData: '', //输入的值
  18 + dataLength: '',
8 19
9 }, 20 },
10 21
@@ -30,6 +41,66 @@ Page({ @@ -30,6 +41,66 @@ Page({
30 }, 41 },
31 42
32 /** 43 /**
  44 + * 绑定银行卡
  45 + */
  46 + bindCard:function(){
  47 + wx.navigateTo({
  48 + url: '../bindcard/bindcard',
  49 + })
  50 + },
  51 +
  52 + /**
  53 + * 实时监听输入框内容
  54 + */
  55 + getInput:function(e){
  56 + var money;
  57 + if (/^(\d?)+(\.\d{0,2})?$/.test(e.detail.value)) { //正则验证,提现金额小数点后不能大于两位数字
  58 + money = e.detail.value;
  59 + } else {
  60 + money = e.detail.value.substring(0, e.detail.value.length - 1);
  61 + }
  62 + this.setData({
  63 + inputNum: money
  64 + })
  65 + },
  66 +
  67 + /**
  68 + * 清空输入内容
  69 + */
  70 + clear:function(){
  71 + this.setData({
  72 + inputNum: ""
  73 + })
  74 + },
  75 +
  76 + /**
  77 + * 全部提现
  78 + */
  79 + cashAll:function(){
  80 + this.setData({
  81 + inputNum: this.data.cashNum
  82 + })
  83 + },
  84 +
  85 + /**
  86 + * 提现
  87 + */
  88 + cashOut:function(){
  89 + var inputnum = this.data.inputNum
  90 + var maxnum = this.data.cashNum
  91 + if(inputnum&&inputnum>0&&inputnum<=maxnum){
  92 + this.setData({
  93 + showModal: !this.data.showModal?true:this.data.showModal,
  94 + })
  95 + }else{
  96 + wx.showToast({
  97 + title: '请输入正确提现金额',
  98 + icon:"none"
  99 + })
  100 + }
  101 + },
  102 +
  103 + /**
33 * Lifecycle function--Called when page hide 104 * Lifecycle function--Called when page hide
34 */ 105 */
35 onHide: function () { 106 onHide: function () {
@@ -62,5 +133,47 @@ Page({ @@ -62,5 +133,47 @@ Page({
62 */ 133 */
63 onShareAppMessage: function () { 134 onShareAppMessage: function () {
64 135
  136 + },
  137 +
  138 + // 获得焦点时
  139 + handleUseFocus() {
  140 + this.setData({
  141 + focusType: true
  142 + })
  143 + },
  144 +
  145 + // 失去焦点时
  146 + handleUseBlur() {
  147 + this.setData({
  148 + focusType: false
  149 + })
  150 + },
  151 +
  152 + // 点击6个框聚焦
  153 + handleFocus() {
  154 + this.setData({
  155 + isFocus: true
  156 + })
  157 + },
  158 +
  159 + // 获取输入框的值
  160 + handleSetData(e) {
  161 + // 更新数据
  162 + this.setData({
  163 + dataLength: e.detail.value.length,
  164 + valueData: e.detail.value
  165 + })
  166 + // 当输入框的值等于6时(发起支付等...)
  167 + if (e.detail.value.length === 6) {
  168 + // 通知用户输入数字达到6位数可以发送接口校验密码是否正确
  169 + this.triggerEvent('initData', e.detail.value)
  170 + }
  171 + },
  172 +
  173 + closeModal:function(){
  174 + this.setData({
  175 + showModal:false
  176 + })
65 } 177 }
  178 +
66 }) 179 })
1 <view style="background:#f5f5f5;width:100%;height:1600rpx"> 1 <view style="background:#f5f5f5;width:100%;height:1600rpx">
2 2
3 - <view class='card_rectangle_bg_row' style='padding:30rpx;flex-direction:column'>  
4 - <view style="flex-direction:row;padding-top:14rpx"> 3 + <view style="height:26rpx"></view>
  4 + <view class='card_rectangle_bg_row' style='padding:26rpx;flex-direction:column'>
  5 + <view style="padding-top:10rpx">
5 <text style="font-size:28rpx;color:#333">到账银行卡:</text> 6 <text style="font-size:28rpx;color:#333">到账银行卡:</text>
6 - <view style="float:right">  
7 - <image src="/images/reward_point.png" style="width:64rpx;height:64rpx"></image>  
8 - <view style="font-size:30rpx;color:#333;line-height:64rpx">招商银行(9214)</view>  
9 - <image src="/images/arrow_right.png" style="width:64rpx;height:64rpx"></image> 7 + <view wx:if="{{hasBind}}" style="display:flex;float:right">
  8 + <image src="/images/reward_point.png" style="width:64rpx;height:64rpx;margin:0 14rpx"></image>
  9 + <view style="font-size:30rpx;color:#333;line-height:64rpx">招商银行(9214)</view>
  10 + <image hidden="{{true}}" src="/images/arrow_right.png" style="width:64rpx;height:64rpx"></image>
  11 + </view>
  12 + <view wx:else style="display:flex;float:right" bindtap="bindCard">
  13 + <view style="font-size:30rpx;color: #FA4B4B;line-height:64rpx;margin-bottom:30rpx">未绑定银行卡</view>
  14 + <image src="/images/arrow_right.png" style="width:64rpx;height:64rpx"></image>
10 </view> 15 </view>
11 </view> 16 </view>
12 - <view style="width:100%;float:right;margin-right:60rpx;font-size:28rpx;color:#333">2小时内到账</view> 17 + <text wx:if="{{hasBind}}" style="text-align: right;margin-right:64rpx;font-size:28rpx;color:#999">2小时内到账</text>
  18 + <view style='background:#eee;height:1rpx;margin-top:14rpx'></view>
13 <view style="font-size:28rpx;color:#999;line-height:96rpx">提现金额</view> 19 <view style="font-size:28rpx;color:#999;line-height:96rpx">提现金额</view>
14 - <view></view> 20 + <view style="height:112rpx;display:flex;align-items: center;">
  21 + <text style="font-size:48rpx;color:#333;margin-right:6rpx">¥</text>
  22 + <input placeholder-class="placeholder_input_wrap" class="input_wrap" type="digit" maxlength="14" placeholder="当前余额{{cashNum}}元" value="{{inputNum}}" bindinput="getInput" />
  23 + <image wx:if="{{inputNum&&inputNum>0}}" src="/images/clear.png" style="width:32rpx;height:32rpx;padding:36rpx" bindtap="clear"></image>
  24 + <text style="height:100%;font-size:30rpx;color: #357AEB;line-height:112rpx;margin: auto;" bindtap="cashAll">全部提现</text>
  25 + </view>
  26 +
  27 + <view wx:if="{{inputNum&&inputNum>cashNum}}">
  28 + <view style='background:#eee;height:2rpx;margin:16rpx 0 26rpx 0'></view>
  29 + <view style="font-size:30rpx;color: #FA4B4B;line-height: 42rpx;">超过可提现金额</view>
  30 + </view>
  31 +
  32 +
15 </view> 33 </view>
16 <view class="view_bottom"> 34 <view class="view_bottom">
17 - <button wx:if="{true}" class="btn_white_radius" style="margin:20rpx" bindtap='cashout'> 提现</button>  
18 - <button wx:else class="btn_blue_radius" style="margin:20rpx" bindtap='goexchange'> 提现</button> 35 + <button wx:if="{{hasBind}}" class="btn_blue_radius" style="margin:20rpx" bindtap='cashOut'> 提现</button>
  36 + <button wx:else class="btn_gray_radius" style="margin:20rpx"> 提现</button>
  37 + </view>
  38 +
  39 + <!-- 密码支付弹窗 -->
  40 + <view wx:if="{{showModal}}" class="mask"></view>
  41 + <view wx:if="{{showModal}}" class="modal_lg" style="padding:30rpx">
  42 + <view style="width:100%;display:flex">
  43 + <text style="font-size:36rpx;color:#333;width: 100%;text-align: center;">请输入支付密码</text>
  44 + <text style="font-size:36rpx;color:#333;float:right;width" bindtap='closeModal'>x</text>
  45 + </view>
  46 + <view style="font-size:28rpx;color:#999;margin-top:40rpx">提现</view>
  47 + <view style="font-size:54rpx;color:#333;margin-top:10rpx">300.00</view>
  48 + <view style="margin-top:30rpx;width: 100%;">
  49 + <text style="font-size:28rpx;color:#333;float:left">服务费</text>
  50 + <text style="font-size:28rpx;color:#333;float:right">¥75.00</text>
  51 + </view>
  52 + <view style="margin-top:12rpx;width: 100%;">
  53 + <text style="font-size:28rpx;color:#333;float:left">费率</text>
  54 + <text style="font-size:28rpx;color: #FA4B4B;float:right">25%</text>
  55 + </view>
  56 +
  57 + <view style="margin:26rpx 0;display:flex">
  58 + <!-- <view wx:for="{{pwdList}}" wx:key="" wx:for-index="idx">
  59 +
  60 + <input wx:if="{{idx==0}}" class="pwd_wrap_bg" length="1" type="number"></input>
  61 + <input wx:else class="pwd_wrap_bg b-l-n" length="1" type="number"></input>
  62 + </view>
  63 + </view> -->
  64 +
  65 +
  66 +
  67 + <!-- 模拟输入框 -->
  68 + <view class='pay-box {{focusType ? "focus-border" : ""}}' bindtap="handleFocus">
  69 + <block wx:for="{{pwdList}}" wx:key="" wx:for-index="idx">
  70 + <view class=' password-box' style='{{idx == 0 ? "":"border-left:none"}}'>
  71 + <view wx:if="{{(dataLength === item - 1)&& focusType}}" class="cursor"></view>
  72 + <view wx:if="{{dataLength >= item}}" class="input-black-dot"></view>
  73 + </view>
  74 + </block>
  75 + </view>
  76 + <!-- 隐藏input框 -->
  77 + <input focus="{{isFocus}}" maxlength="6" type="number" style="position:fixed;color:#fff;font-size:8rpx;height: 96rpx;padding-left: 2rpx;" bindinput="handleSetData" bindfocus="handleUseFocus" bindblur="handleUseFocus" />
  78 + </view>
19 </view> 79 </view>
20 </view> 80 </view>
@@ -8,6 +8,17 @@ @@ -8,6 +8,17 @@
8 flex-direction: row; 8 flex-direction: row;
9 } 9 }
10 10
  11 +.placeholder_input_wrap{
  12 + color:#ccc;
  13 + font-size:30rpx;
  14 +}
  15 +
  16 +.input_wrap{
  17 + width:356rpx;
  18 + color:#333;
  19 + font-size:56rpx;
  20 +}
  21 +
11 .btn_blue_radius { 22 .btn_blue_radius {
12 background: #357aeb; 23 background: #357aeb;
13 border-radius: 5px; 24 border-radius: 5px;
@@ -15,11 +26,107 @@ @@ -15,11 +26,107 @@
15 color: #fff; 26 color: #fff;
16 } 27 }
17 28
18 -.btn_white_radius { 29 +.btn_gray_radius {
19 flex: 1; 30 flex: 1;
20 height: 42px; 31 height: 42px;
21 - background: #FFFFFF; 32 + background: #D0D0D0;
22 border-radius: 5px; 33 border-radius: 5px;
23 - border: 1px solid #EEEEEE;  
24 - color: #666666;  
25 -}  
  34 + color: #999;
  35 +}
  36 +
  37 +/* 遮罩层 */
  38 +
  39 +.mask {
  40 + width: 100%;
  41 + height: 100%;
  42 + position: fixed;
  43 + top: 0;
  44 + left: 0;
  45 + background: #000;
  46 + opacity: 0.7;
  47 + z-index: 10;
  48 +}
  49 +
  50 +.modal_lg {
  51 + width: 80%;
  52 + position: fixed;
  53 + left: 0;
  54 + right: 0;
  55 + margin: 0 auto;
  56 + background-color: #fff;
  57 + border-radius: 16rpx;
  58 + display: flex;
  59 + flex-direction: column;
  60 + align-items: center;
  61 + top: 180rpx;
  62 + z-index: 10;
  63 +}
  64 +
  65 +
  66 +.pwd_wrap_bg{
  67 + width: 96rpx;
  68 + height: 96rpx;
  69 + background: #FFFFFF;
  70 + border: 1px solid #E5E5E5;
  71 + text-align: center;
  72 + font-size: 50rpx;
  73 +
  74 +}
  75 +
  76 +.b-l-n {
  77 + border-left: none;
  78 +}
  79 +
  80 +.pay-box {
  81 + margin: 0 auto;
  82 + display: flex;
  83 + flex-direction: row;
  84 + background: #FFFFFF;
  85 + width: 582rpx;
  86 + height: 96rpx;
  87 +}
  88 +
  89 +/* 支付密码框聚焦的时候 */
  90 +
  91 +.focus-border {
  92 + border-color: #E5E5E5;
  93 +}
  94 +
  95 +/* 单个格式样式(聚焦的时候) */
  96 +.password-box {
  97 + flex: 1;
  98 + border: 1px solid #E5E5E5;
  99 + display: flex;
  100 + align-items: center;
  101 + justify-content: center;
  102 +}
  103 +
  104 +/* 模拟光标 */
  105 +
  106 +.cursor {
  107 + width: 2rpx;
  108 + height: 36rpx;
  109 + background-color: #333;
  110 + animation: focus 1.2s infinite;
  111 +}
  112 +
  113 +/* 光标动画 */
  114 +
  115 +@keyframes focus {
  116 + from {
  117 + opacity: 1;
  118 + }
  119 +
  120 + to {
  121 + opacity: 0;
  122 + }
  123 +}
  124 +
  125 +/* 模拟输入的password的黑点 */
  126 +
  127 +.input-black-dot {
  128 + width: 24rpx;
  129 + height: 24rpx;
  130 + background-color: #000;
  131 + border-radius: 50%;
  132 +}
@@ -5,7 +5,7 @@ Page({ @@ -5,7 +5,7 @@ Page({
5 * Page initial data 5 * Page initial data
6 */ 6 */
7 data: { 7 data: {
8 - 8 + cashList:["",""],
9 }, 9 },
10 10
11 /** 11 /**
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <view class="text_gray_32">积分明细</view> 11 <view class="text_gray_32">积分明细</view>
12 </view> 12 </view>
13 13
14 -<view wx:if="{true}" wx:for="{'',''}" style="background:#fff;width:100%;height:140rpx"> 14 +<view wx:if="{true}" wx:for="{{cashList}}" style="background:#fff;width:100%;height:140rpx">
15 <view style='background:#f5f5f5;height:2rpx;'></view> 15 <view style='background:#f5f5f5;height:2rpx;'></view>
16 <view style="margin:26rpx 40rpx"> 16 <view style="margin:26rpx 40rpx">
17 <view style="float:left;display:flex;flex-direction:column;"> 17 <view style="float:left;display:flex;flex-direction:column;">
注册登录 后发表评论