zhifubao.vue 3.4 KB

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