input_password.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <view class="page">
  3. <pay-keyboard :set_info = "set_info" :show_key="show_key" ref="payKeyboard" :set_msg="set_msg" @hideFun="hideFun" @getPassword="getPassword" :password="password"></pay-keyboard>
  4. </view>
  5. </template>
  6. <script>
  7. import payKeyboard from '../../../components/uni-keyword/uni-keyword';
  8. import _get from '../../../common/_get';
  9. import _hook from '../../../common/_hook';
  10. export default {
  11. components: {
  12. payKeyboard
  13. },
  14. data() {
  15. return {
  16. title: '请输入交易密码',
  17. show_key: true,
  18. password:'',
  19. set_msg:'请输入交易密码',
  20. set_info:'请输入交易密码,以确认身份',
  21. page_params:{},
  22. click:true
  23. }
  24. },
  25. onLoad(options) {
  26. this.page_params = options;
  27. },
  28. onShow(){
  29. _hook.routeSonHook();
  30. uni.$on('clean_password_data',this.cleanNum);
  31. },
  32. methods: {
  33. showFun() {
  34. this.show_key = true
  35. },
  36. hideFun() {
  37. this.show_key = false
  38. },
  39. getPassword(n) {
  40. console.log("用户输入的密码", n);
  41. this.page_params.trade_password = n.password;
  42. let _this = this;
  43. if(!_this.click) return false;
  44. _this.click = false;
  45. //此处实际应用时应该post到服务器,然后服务器广播长连接
  46. uni.showLoading({title:'提交中'});
  47. _get.createHongBao( _this.page_params,function (res) {
  48. uni.navigateBack();
  49. },function (res) {
  50. uni.hideLoading();
  51. uni.showToast({title:res.msg,icon:'none'});
  52. _this.click = true;
  53. _this.$refs.payKeyboard.cleanNum();
  54. })
  55. },
  56. cleanNum(){
  57. this.$refs.payKeyboard.cleanNum();
  58. }
  59. }
  60. }
  61. </script>