input_password.vue 2.1 KB

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