login-share.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="container">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="7"></tui-skeleton>
  4. <template v-else>
  5. <view class="share-empty">
  6. <view class="icon"><image :src="imagePath" mode="widthFix"></image></view>
  7. <view class="text">暂无权限查看</view>
  8. </view>
  9. </template>
  10. </view>
  11. </template>
  12. <script>
  13. import { mapMutations } from 'vuex'
  14. import authorize from '@/common/config/authorize.js'
  15. export default {
  16. computed: {
  17. },
  18. data() {
  19. return {
  20. CustomBar:this.CustomBar,// 顶部导航栏高度
  21. imagePath:'https://static.caimei365.com/app/img/icon/icon-noremb.png',
  22. skeletonShow:true,
  23. receiptId:0,
  24. receiptType:1// 收款款项类型:1订单款,2非订单款,3返佣款 4订单款或者非订单款(因财务阶段无法区分订单非订单), 5供应商退款
  25. }
  26. },
  27. onLoad(options) {
  28. this.receiptId = option.id
  29. this.receiptType = option.receiptType
  30. },
  31. methods: {
  32. ...mapMutations(['login', 'logout']),
  33. async getWxAuthorize(){// 初始化授权登录
  34. const WxCode = await authorize.getCode('weixin')
  35. const Wx = await authorize.getUserInfo('weixin')
  36. this.UserService.UserLoginAuthApplets({
  37. code:WxCode,
  38. encryptedData:Wx.encryptedData,
  39. iv:Wx.iv ,
  40. })
  41. .then(response =>{
  42. let data = response.data
  43. this.login(response.data)
  44. this.$store.commit('updateStatus',response.data)
  45. setTimeout(()=>{
  46. this.navigateLink(response.data)
  47. },500)
  48. }).catch(error =>{
  49. this.logout()
  50. this.skeletonShow = false
  51. this.$store.commit('updateStatus',error.data)
  52. })
  53. },
  54. navigateLink(data){// 根据用户权限跳转对应页面
  55. /**
  56. * 用户类型(userType) 1协销人员,2客服,3财务,4超级管理员
  57. * 1. 协销人员跳转到收款列表页面
  58. * 2. 客服跳转到收款列表页面
  59. * 3. 财务人员跳转到款项识别页面
  60. * 4. 超级管理员跳转到款项识别页面
  61. * */
  62. switch(data.userType){
  63. case 1:// 协销
  64. this.receiptTypeJump()
  65. break
  66. case 2:// 客服
  67. this.receiptTypeJump()
  68. break
  69. case 3:// 财务
  70. this.receiptTypeJump()
  71. break
  72. case 4:// 超级管理员
  73. this.receiptTypeJump()
  74. break
  75. }
  76. },
  77. receiptTypeJump(){//跳转URL 收款款项类型:1订单款,2非订单款,3返佣款 4订单款或者非订单款(因财务阶段无法区分订单非订单), 5供应商退款
  78. switch(this.receiptType){
  79. case 1:// 订单款
  80. this.$api.navigateTo(`/pages/relation/ordinary/index?id=${this.receiptId}`)
  81. break
  82. case 2:// 非订单款
  83. this.$api.navigateTo(`/pages/relation/nonorder/detail?id=${this.receiptId}`)
  84. break
  85. case 3:// 返佣款
  86. this.$api.navigateTo(`/pages/relation/return/index?id=${this.receiptId}`)
  87. break
  88. case 4:// 订单款或者非订单款
  89. this.$api.navigateTo(`/pages/relation/ordinary/index?id=${this.receiptId}`)
  90. break
  91. case 5:// 供应商退款管理权限
  92. this.$api.navigateTo(`/pages/relation/refund/index?id=${this.receiptId}`)
  93. break
  94. }
  95. },
  96. permissionNav(data){
  97. /**
  98. * 用户权限(permission) 1录入收款权限,2收款确认权限,3收款审核权限 4返佣管理权限 5供应商退款管理权限
  99. * 1.
  100. * 2.
  101. * 3.
  102. * 4.
  103. * 5.
  104. * */
  105. }
  106. },
  107. onShow() {
  108. this.getWxAuthorize()
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. .container {
  114. width: 100%;
  115. height:100%;
  116. background: #FFFFFF;
  117. display: flex;
  118. align-items: center;
  119. justify-content:center;
  120. .share-empty{
  121. width: 260rpx;
  122. height: 412rpx;
  123. .icon{
  124. width: 260rpx;
  125. height: 260rpx;
  126. image{
  127. width: 100%;
  128. height: 100%;
  129. display: block;
  130. }
  131. }
  132. .text{
  133. font-size: $font-size-28;
  134. line-height: 60rpx;
  135. color: $color-system;
  136. text-align: center;
  137. }
  138. }
  139. }
  140. </style>