edit_trade_password.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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"
  4. @getPassword="getPassword" :password="password"></pay-keyboard>
  5. </view>
  6. </template>
  7. <script>
  8. import payKeyboard from '../../../components/uni-keyword/uni-keyword';
  9. import _get from '../../../common/_get';
  10. import _hook from '../../../common/_hook';
  11. export default {
  12. components: {
  13. payKeyboard
  14. },
  15. data() {
  16. return {
  17. set_times: 1,
  18. title: '修改交易密码',
  19. show_key: true,
  20. password: '',
  21. set_msg: '修改交易密码',
  22. set_info: '请输入支付密码,以验证身份',
  23. pageMsg: {
  24. title: '修改交易密码',
  25. info: '请输入支付密码,用于支付验证',
  26. info2: '请设置支付密码,用于支付验证',
  27. info3: '请再次输入支付密码以确认',
  28. info4: '两次密码输入不一致',
  29. },
  30. requestParams: {}
  31. }
  32. },
  33. onLoad(options) {
  34. this.pageParams = options;
  35. },
  36. onShow() {
  37. _hook.routeSonHook();
  38. },
  39. methods: {
  40. setTimes() {
  41. switch (this.set_times) {
  42. case 1:
  43. this.set_info = this.pageMsg.info;
  44. break;
  45. case 2:
  46. this.set_info = this.pageMsg.info2;
  47. break;
  48. case 3:
  49. this.set_info = this.pageMsg.info3;
  50. break;
  51. }
  52. },
  53. showFun() {
  54. this.show_key = true
  55. },
  56. hideFun() {
  57. this.show_key = false
  58. },
  59. getPassword(n) {
  60. let _this = this;
  61. switch (this.set_times) {
  62. case 1:
  63. _this.$refs.payKeyboard.cleanNum();
  64. _get.checkUserTradePassword(n,function (res) {
  65. _this.set_times++;
  66. _this.setTimes();
  67. });
  68. //TODO 校验密码
  69. break;
  70. case 2:
  71. _this.$refs.payKeyboard.cleanNum();
  72. _this.password = n.password;
  73. this.set_times++;
  74. _this.setTimes();
  75. break;
  76. case 3:
  77. _this.$refs.payKeyboard.cleanNum();
  78. _this.requestParams.password = _this.password;
  79. _this.requestParams.confirm_password = n.password;
  80. if (_this.password != n.password) {
  81. uni.showToast({
  82. title: '两次密码输入不一致',
  83. icon: 'none',
  84. success(res) {
  85. _this.set_times--;
  86. _this.set_info = _this.pageMsg.info4;
  87. }
  88. })
  89. }
  90. _this.requestParams.is_edit = 1;
  91. _get.setUserTradePassword(_this.requestParams, function (res) {
  92. uni.navigateBack({
  93. success(res) {
  94. _this.set_times = 1;
  95. _this.setTimes();
  96. }
  97. });
  98. });
  99. }
  100. }
  101. }
  102. }
  103. </script>