zhifubao.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="container">
  3. <list-cell title="收款人姓名" type="text" placeholder="请输入支付宝收款人姓名" v-model="zhiFuBaoName"></list-cell>
  4. <list-cell title="支付宝账号" type="number" placeholder="请输入要绑定的支付宝手机号" v-model="zhiFuBao"></list-cell>
  5. <wButton text="绑定账户" :rotate="logining" @click.native="toLogin()"></wButton>
  6. <view style="padding: 32upx 64upx;font-size: 24upx;color: #999999;">提示:请正确填写收款人的支付宝账户和真实的收款人姓名,否则将无法正常收款</view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import listCell from '@/components/com-input';
  12. import wButton from '../components/watch-login/watch-button.vue'; //button
  13. export default {
  14. components: {
  15. listCell,
  16. wButton
  17. },
  18. data() {
  19. return {
  20. zhiFuBao: '',
  21. zhiFuBaoName: '',
  22. logining: false
  23. }
  24. },
  25. onLoad() {
  26. let userId = this.$queue.getData("userId");
  27. if (userId) {
  28. // this.$Request.getT("/app/cash/userinfo/" + userId).then(res => {
  29. // if (res.status === 0) {
  30. // if (res.data.zhiFuBao) {
  31. // this.zhiFuBao = res.data.zhiFuBao;
  32. // }
  33. // if (res.data.zhiFuBaoName) {
  34. // this.zhiFuBaoName = res.data.zhiFuBaoName;
  35. // }
  36. // }
  37. // });
  38. this.$Request.get("/app/user/selectUserById").then(res => {
  39. if (res.code == 0) {
  40. if (res.data.zhiFuBao) {
  41. this.zhiFuBao = res.data.zhiFuBao;
  42. }
  43. if (res.data.zhiFuBaoName) {
  44. this.zhiFuBaoName = res.data.zhiFuBaoName;
  45. }
  46. }
  47. });
  48. }
  49. },
  50. methods: {
  51. inputChange(e) {
  52. const key = e.currentTarget.dataset.key;
  53. this[key] = e.detail.value;
  54. },
  55. navBack() {
  56. uni.navigateBack();
  57. },
  58. toLogin() {
  59. let userId = this.$queue.getData("userId");
  60. let token = uni.getStorageSync("token");
  61. const {
  62. zhiFuBao,
  63. zhiFuBaoName
  64. } = this;
  65. if (!zhiFuBao) {
  66. this.$queue.showToast("请设置收款人支付宝账号");
  67. } else if (!zhiFuBaoName) {
  68. this.$queue.showToast("请设置收款人姓名");
  69. } else {
  70. this.$queue.showLoading("修改中...");
  71. let data = {
  72. zhiFuBao: this.zhiFuBao,
  73. zhiFuBaoName: this.zhiFuBaoName
  74. }
  75. this.$Request.postJson('/app/user/updateUser',data).then(res => {
  76. if (res.code === 0) {
  77. uni.setStorageSync('zhiFuBao',zhiFuBao)
  78. uni.setStorageSync('zhiFuBaoName',zhiFuBaoName)
  79. uni.showToast({
  80. title:'修改成功',
  81. icon:'none',
  82. complete() {
  83. setTimeout(function() {
  84. uni.navigateBack();
  85. },1000)
  86. }
  87. })
  88. } else {
  89. this.$queue.showToast(res.msg)
  90. }
  91. uni.hideLoading();
  92. });
  93. }
  94. },
  95. },
  96. }
  97. </script>
  98. <style lang='scss'>
  99. page {
  100. background-color: #F7F7F7;
  101. }
  102. .container {
  103. padding-top: 32upx;
  104. position: relative;
  105. width: 100%;
  106. height: 100%;
  107. overflow: hidden;
  108. background: #FFFFFF;
  109. }
  110. .confirm-btn {
  111. width: 300px;
  112. height: 42px;
  113. line-height: 42px;
  114. border-radius: 30px;
  115. margin-top: 70upx;
  116. background: #e10a07;
  117. color: #fff;
  118. font-size: 32rpx;
  119. &:after {
  120. border-radius: 60px;
  121. }
  122. }
  123. </style>