zhifubao.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="container" v-if="XCXIsSelect=='是'">
  3. <list-cell title="收款人姓名" type="text" placeholder="请输入支付宝收款人姓名" v-model="zhiFuBaoName"></list-cell>
  4. <list-cell title="支付宝账号" type="text" 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. XCXIsSelect: '否'
  24. }
  25. },
  26. onLoad() {
  27. // #ifdef MP-WEIXIN
  28. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  29. // #endif
  30. // #ifndef MP-WEIXIN
  31. this.XCXIsSelect = '是'
  32. // #endif
  33. if (this.XCXIsSelect == '否') {
  34. uni.setNavigationBarTitle({
  35. title: '隐私政策'
  36. });
  37. } else {
  38. uni.setNavigationBarTitle({
  39. title: '提现账号'
  40. });
  41. }
  42. this.getUserInfo()
  43. let userId = this.$queue.getData("userId");
  44. if (userId) {
  45. this.$Request.get("/sys/user/info").then(res => {
  46. if (res.code == 0) {
  47. if (res.user.userEntity.zhiFuBao) {
  48. this.zhiFuBao = res.user.userEntity.zhiFuBao;
  49. }
  50. if (res.user.userEntity.zhiFuBaoName) {
  51. this.zhiFuBaoName = res.user.userEntity.zhiFuBaoName;
  52. }
  53. }
  54. });
  55. }
  56. },
  57. methods: {
  58. inputChange(e) {
  59. const key = e.currentTarget.dataset.key;
  60. this[key] = e.detail.value;
  61. },
  62. navBack() {
  63. uni.navigateBack();
  64. },
  65. toLogin() {
  66. let userId = this.$queue.getData("userId");
  67. let token = uni.getStorageSync("token");
  68. const {
  69. zhiFuBao,
  70. zhiFuBaoName
  71. } = this;
  72. if (!zhiFuBao) {
  73. this.$queue.showToast("请设置收款人支付宝账号");
  74. } else if (!zhiFuBaoName) {
  75. this.$queue.showToast("请设置收款人姓名");
  76. } else {
  77. this.$queue.showLoading("修改中...");
  78. let data = {
  79. zhiFuBao: this.zhiFuBao,
  80. zhiFuBaoName: this.zhiFuBaoName
  81. }
  82. this.$Request.postJson('/shop/shopmoney/updateUser', data).then(res => {
  83. if (res.code === 0) {
  84. // uni.setStorageSync('zhiFuBao',zhiFuBao)
  85. // uni.setStorageSync('zhiFuBaoName',zhiFuBaoName)
  86. uni.showToast({
  87. title: '修改成功',
  88. icon: 'none',
  89. complete() {
  90. setTimeout(function() {
  91. uni.navigateBack();
  92. }, 1000)
  93. }
  94. })
  95. } else {
  96. this.$queue.showToast(res.msg)
  97. }
  98. uni.hideLoading();
  99. });
  100. }
  101. },
  102. getUserInfo() {
  103. this.$Request.getA("/sys/user/info").then(res => {
  104. if (res.code == 0) {
  105. this.$queue.setData("zhiFuBao", res.user.userEntity.zhiFuBao);
  106. this.$queue.setData("zhiFuBaoName", res.user.userEntity.zhiFuBaoName);
  107. }
  108. });
  109. },
  110. },
  111. }
  112. </script>
  113. <style lang='scss'>
  114. page {
  115. background-color: #FFFFFF;
  116. }
  117. .container {
  118. padding-top: 32upx;
  119. position: relative;
  120. width: 100%;
  121. height: 100%;
  122. overflow: hidden;
  123. background: #FFFFFF;
  124. }
  125. .confirm-btn {
  126. width: 300px;
  127. height: 42px;
  128. line-height: 42px;
  129. border-radius: 30px;
  130. margin-top: 70upx;
  131. background: #e10a07;
  132. color: #fff;
  133. font-size: 32rpx;
  134. &:after {
  135. border-radius: 60px;
  136. }
  137. }
  138. </style>