WeChat.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="alipay">
  3. <view class="alipay_ul">
  4. <view class="alipay_li flex">
  5. <text>真实姓名</text>
  6. <input type="text" placeholder="请填写真实姓名" v-model="user.username" placeholder-style="color:#999999" />
  7. </view>
  8. <view class="alipay_li flex">
  9. <text>{{ user.type == 'wechat' ? '微信账号' : '支付宝账号' }}</text>
  10. <input type="text" v-model="user.account" :placeholder="user.type == 'wechat' ? '请填写微信账号' : '请填写支付宝账号' " placeholder-style="color:#999999" />
  11. </view>
  12. </view>
  13. <button hover-class="hover-view" class="alipay_btn" @click="submit">提交</button>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. user:{
  21. type:'wechat',
  22. username:'',
  23. account:''
  24. }
  25. };
  26. },
  27. methods:{
  28. submit () {
  29. if (!this.user.username) return uni.showToast({title:'请填写真实姓名',icon:'none'})
  30. if (!this.user.account) return uni.showToast({title:this.user.type == 'wechat' ? '请填写微信账号' : '请填写支付宝账号',icon:'none'})
  31. this.$api.bindWithdrawalAccount(this.user).then(res=>{
  32. if (res.code === 1) {
  33. uni.showToast({title:res.msg})
  34. setTimeout(()=>{
  35. uni.navigateBack()
  36. },800)
  37. }
  38. })
  39. },
  40. getAccount () {
  41. this.$api.getWithdrawalSetting().then(res=>{
  42. if (res.code === 1) {
  43. this.user.username = this.user.type == 'wechat' ? res.data.wechat.username : res.data.alipay.username
  44. this.user.account = this.user.type == 'wechat' ? res.data.wechat.account : res.data.alipay.account
  45. }
  46. })
  47. }
  48. },
  49. onLoad ({type}) {
  50. this.user.type = type == 0 ? 'wechat' : 'alipay'
  51. uni.setNavigationBarTitle({title:type == 0 ? '微信绑定' : '支付宝绑定'});
  52. this.getAccount()
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .alipay_li {
  58. height: 88rpx;
  59. padding:0 30rpx;
  60. margin-top: 2rpx;
  61. background: #FFFFFF;
  62. text {
  63. font-size: 28rpx;
  64. }
  65. input {
  66. text-align: right;
  67. font-size: 28rpx;
  68. }
  69. }
  70. .alipay_btn {
  71. width: 690rpx;
  72. height: 98rpx;
  73. color: #333333;
  74. margin: 666rpx auto 0;
  75. background: #FFFFFF;
  76. box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(220, 220, 220, 0.2);
  77. border-radius: 20rpx;
  78. }
  79. </style>