bindCompanyUser.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="content">
  3. <view class="bindbox">
  4. <image :src="baseUrl + '/images/bindComUser.png'" mode="aspectFill"></image>
  5. <view>立即绑定,享受更多权益</view>
  6. </view>
  7. <button class="bind-btn" :loading="btnLodaing" :disabled="btnLodaing" @click="handleBind">立即绑定</button>
  8. </view>
  9. </template>
  10. <script>
  11. import { bindCompanyFsUser } from '@/api/companyUser.js'
  12. export default {
  13. data() {
  14. return {
  15. baseUrl:uni.getStorageSync('requestPath'),
  16. btnLodaing: false,
  17. companyUserId: '',
  18. }
  19. },
  20. onLoad(option) {
  21. let q = {}
  22. if(option.q) {
  23. q = decodeURIComponent(option.q) // 获取到二维码原始链接内容
  24. }
  25. this.companyUserId = q.companyUserId || option.companyUserId
  26. },
  27. methods: {
  28. handleBind() {
  29. this.$isLogin().then(
  30. res => {
  31. if(res){
  32. this.submit();
  33. }
  34. else{
  35. uni.navigateTo({
  36. url:'/pages/auth/login'
  37. })
  38. }
  39. }
  40. );
  41. },
  42. submit() {
  43. this.btnLodaing = true
  44. uni.showLoading({
  45. title: '绑定中...'
  46. })
  47. bindCompanyFsUser(this.companyUserId).then(res=>{
  48. this.btnLodaing = false
  49. uni.hideLoading()
  50. uni.showToast({
  51. title: res.msg,
  52. icon: 'none'
  53. })
  54. }).catch(()=>{
  55. this.btnLodaing = false
  56. uni.hideLoading()
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .bindbox {
  64. display: flex;
  65. flex-direction: column;
  66. align-items: center;
  67. justify-content: center;
  68. padding-top: 20vh;
  69. font-family: PingFang SC, PingFang SC;
  70. font-weight: 400;
  71. font-size: 32rpx;
  72. color: #757575;
  73. image {
  74. height: 150rpx;
  75. width: 150rpx;
  76. margin-bottom: 50rpx;
  77. }
  78. }
  79. .content {
  80. width: 100%;
  81. display: flex;
  82. flex-direction: column;
  83. align-items: center;
  84. padding-bottom: calc(var(--window-bottom) + 150rpx);
  85. }
  86. .bind-btn {
  87. margin: 20vh auto 20px auto;
  88. width: 300px;
  89. height: 44px;
  90. line-height: 44px;
  91. text-align: center;
  92. background: #FF5C03 !important;
  93. color: #fff !important;
  94. font-size: 16px;
  95. font-weight: 500;
  96. border-radius: 22px;
  97. display: block;
  98. &:after {
  99. border: none;
  100. }
  101. }
  102. </style>