set_trade_password.vue 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="page">
  3. <pay-keyboard :show_key="show_key" :set_info="set_info" 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. set_times:1,
  17. title: '设置交易密码',
  18. show_key: true,
  19. password:'',
  20. set_msg:'设置交易密码',
  21. set_info:'请输入支付密码,以验证身份',
  22. pageMsg:{
  23. title:'设置交易密码',
  24. info:'请输入支付密码,用于支付验证',
  25. info2:'请再次输入支付密码以确认'
  26. }
  27. }
  28. },
  29. onShow(){
  30. _hook.routeSonHook();
  31. },
  32. onLoad() {
  33. },
  34. methods: {
  35. showFun() {
  36. this.show_key = true
  37. },
  38. hideFun() {
  39. this.show_key = false
  40. },
  41. setTimes(){
  42. switch (this.set_times) {
  43. case 1:
  44. this.set_info = this.pageMsg.info;
  45. break;
  46. case 2:
  47. this.set_info = this.pageMsg.info2;
  48. break;
  49. }
  50. },
  51. getPassword(n) {
  52. let _this = this;
  53. switch (this.set_times) {
  54. case 1:
  55. this.$refs.payKeyboard.cleanNum();
  56. this.password = n.password;
  57. this.set_times++;
  58. _this.setTimes();
  59. break;
  60. case 2:
  61. _this.set_times = 1;
  62. this.$refs.payKeyboard.cleanNum();
  63. if(this.password != n.password){
  64. uni.showToast({
  65. title:'两次密码输入不一致',
  66. icon:'none',
  67. success(res) {
  68. _this.setTimes();
  69. return false;
  70. }
  71. })
  72. }
  73. let params = {};
  74. params.password = this.password;
  75. params.confirm_password = n.password;
  76. _get.setUserTradePassword(params,function(res){
  77. uni.$emit('data_user_info',res);
  78. _this.setTimes();
  79. uni.navigateBack();
  80. });
  81. break;
  82. }
  83. }
  84. }
  85. }
  86. </script>