ckPass.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="assembly">
  3. <!-- 支付层 -->
  4. <view class="pay_node fx-h">
  5. <view class="pay_title"></view>
  6. <view class="pay_body fx-h">
  7. <view class="pay-pwd-input fx-r fx-bc fx-ac">
  8. <view class="pay-pwd-grid" v-for="(value, index) in payPwdGrid" :key="index">
  9. {{value.text}}
  10. </view>
  11. </view>
  12. <view class="keyboard-node">
  13. <view class="keyboard-12 fx-h">
  14. <view class="fx-r keyboard-row">
  15. <view @tap="inputPwd($event)" class="keyboard" data-char="1" >1</view>
  16. <view @tap="inputPwd($event)" class="keyboard" data-char="2" >2</view>
  17. <view @tap="inputPwd($event)" class="keyboard" data-char="3" >3</view>
  18. </view>
  19. <view class="fx-r keyboard-row">
  20. <view @tap="inputPwd($event)" class="keyboard" data-char="4" >4</view>
  21. <view @tap="inputPwd($event)" class="keyboard" data-char="5" >5</view>
  22. <view @tap="inputPwd($event)" class="keyboard" data-char="6" >6</view>
  23. </view>
  24. <view class="fx-r keyboard-row">
  25. <view @tap="inputPwd($event)" class="keyboard" data-char="7" >7</view>
  26. <view @tap="inputPwd($event)" class="keyboard" data-char="8" >8</view>
  27. <view @tap="inputPwd($event)" class="keyboard" data-char="9" >9</view>
  28. </view>
  29. <view class="fx-r keyboard-row">
  30. <view class="keyboard"></view>
  31. <view @tap="inputPwd($event)" class="keyboard" data-char="0" >0</view>
  32. <view @tap="backspace()" class="keyboard" data-char="×" >×</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. shader: false,
  45. password: [],
  46. payPwdGrid: [
  47. {
  48. text: ''
  49. },
  50. {
  51. text: ''
  52. },
  53. {
  54. text: ''
  55. },
  56. {
  57. text: ''
  58. },
  59. {
  60. text: ''
  61. },
  62. {
  63. text: ''
  64. }
  65. ],
  66. token:"",
  67. newPassword:""
  68. };
  69. },
  70. onLoad(options) {
  71. console.log(options.token);
  72. this.token = options.token || "";
  73. this.newPassword = options.val;
  74. },
  75. methods: {
  76. /* 小键盘输入 */
  77. inputPwd(e) {
  78. let char = e.currentTarget.dataset.char;
  79. let args = {
  80. target: this,
  81. data: char
  82. };
  83. let passIndex = this.password.length;
  84. if (passIndex < 6) {
  85. this.password.push(char);
  86. this.payPwdGrid[passIndex].text = "●";
  87. if (this.password.length === this.payPwdGrid.length) {
  88. let newPaswd = this.password.join('');
  89. if(newPaswd != this.newPassword) {
  90. this.utils.Tip("二次密码错误,请检查在操作");
  91. return;
  92. }
  93. this.utils.loadIng("提交中...");
  94. this
  95. .request
  96. .post("userPayment",{password:newPaswd,token:this.token})
  97. .then(res=>{
  98. uni.hideLoading();
  99. if(res.code == 200) {
  100. this.utils.Tip(res.msg);
  101. uni.redirectTo({ url:"success"});
  102. }else{
  103. this.utils.Tip(res.msg);
  104. }
  105. }).catch(()=>{
  106. uni.hideLoading();
  107. this.utils.Tip("网络错误,请稍后尝试");
  108. });
  109. }
  110. }
  111. },
  112. /* 回退 */
  113. backspace() {
  114. let passIndex = this.password.length;
  115. if (this.password.length > 0) {
  116. // 改变密码框
  117. this.password = this.password.slice(0, this.password.length - 1);
  118. this.payPwdGrid[passIndex - 1].text = "";
  119. return;
  120. }
  121. }
  122. }
  123. };
  124. </script>
  125. <style>
  126. page{background: #fff;}
  127. .pay_title{font-size: 16px;text-align: center;height: 40px;border-bottom: 1px solid #f1fff1;line-height: 40px;}
  128. .pay-pwd-grid{width: 14%;height: 15vw;margin-right: 2%;border: 1px solid #f1f1ff;line-height: 15vw;text-align: center;}
  129. .pay-pwd-grid:last-child{margin-right: 0;}
  130. /* 自定义键盘 */
  131. .keyboard-node {
  132. width: 750upx;
  133. margin-top: 120upx;
  134. height: 320px;
  135. line-height: 320px;
  136. position: fixed;
  137. bottom: 0;
  138. box-sizing: border-box;
  139. }
  140. .keyboard-12 {
  141. width: 750upx;
  142. height: 100%;
  143. line-height: 100%;
  144. box-sizing: border-box;
  145. }
  146. .keyboard-row {
  147. width: 750upx;
  148. height: 25%;
  149. line-height: 25%;
  150. box-sizing: border-box;
  151. }
  152. .keyboard {
  153. box-sizing: border-box;
  154. width: 250upx;
  155. height: 100%;
  156. line-height: 100%;
  157. background-color: #ffffff;
  158. border-top: #f7f4f4 solid 0.1upx;
  159. border-left: #f7f4f4 solid 0.1upx;
  160. font-size: 40upx;
  161. font-weight: 600;
  162. display: flex;
  163. justify-content: center;
  164. align-items: Center;
  165. }
  166. .keyboard:active {
  167. background: #f1f1f1;
  168. }
  169. .keyboard-row .keyboard:nth-child(1) {
  170. border-left: none;
  171. }
  172. .keyboard-row:nth-child(4) .keyboard:nth-child(1),
  173. .keyboard-row:nth-child(4) .keyboard:nth-child(3) {
  174. background-color: #e3e8ec;
  175. }
  176. .hovers{
  177. }
  178. @keyframes showPopup{
  179. 0%{
  180. opacity: 0;
  181. background-color: #d8d8d8;
  182. }
  183. 100%{
  184. opacity: 1;
  185. }
  186. }
  187. .container {
  188. width: 100%;
  189. height: 100%;
  190. z-index: 999;
  191. overflow: hidden;
  192. position: absolute;
  193. top: 0;
  194. left: 0;
  195. background: rgba(0,0,0,.7);
  196. box-sizing: border-box;
  197. }
  198. </style>