collect_money.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 _data from '../../common/_data';
  10. import _hook from '../../common/_hook';
  11. export default {
  12. components: {
  13. payKeyboard
  14. },
  15. data() {
  16. return {
  17. title: '请输入交易密码',
  18. show_key: true,
  19. password:'',
  20. set_msg:'',
  21. set_info:'请输入交易密码,以确认身份',
  22. page_params:{},
  23. click:true
  24. }
  25. },
  26. onLoad(options) {
  27. _hook.routeSonHook();
  28. this.page_params = options;
  29. },
  30. onShow(){
  31. this.set_msg = "用户'"+this.page_params.username+"'向你收款"+this.page_params.amount+'元'
  32. },
  33. methods: {
  34. showFun() {
  35. this.show_key = true
  36. },
  37. hideFun() {
  38. this.show_key = false
  39. },
  40. getPassword(n) {
  41. console.log("用户输入的密码", n);
  42. this.page_params.trade_password = n;
  43. let _this = this;
  44. if(!_this.click) return false;
  45. _this.click = false;
  46. uni.showLoading({title:'付款中'});
  47. _get.payAmount({amount:_this.page_params.amount,to_user_id:_this.page_params.id},function(ret){
  48. uni.$emit('data_user_info',ret);
  49. _data.data('user_info',ret);
  50. _this.$refs.payKeyboard.cleanNum();
  51. uni.hideLoading();
  52. uni.showToast({
  53. title:'支付成功',
  54. icon:'none'
  55. });
  56. setTimeout(function(){
  57. uni.redirectTo({
  58. url:'/pages/my/wallet/capital'
  59. })
  60. },1000);
  61. })
  62. },
  63. cleanNum(){
  64. this.$refs.payKeyboard.cleanNum();
  65. }
  66. }
  67. }
  68. </script>