share-info.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="container share" v-if="isRequest">
  3. <view class="share-empty">
  4. <view class="icon"><image :src="imagePath" mode="widthFix"></image></view>
  5. <view class="text">暂无权限查看</view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import { mapState,mapMutations } from 'vuex'
  11. import authorize from '@/common/config/authorize.js'
  12. export default{
  13. data() {
  14. return{
  15. isRequest:false,
  16. invitationCode:'',
  17. imagePath:'https://admin-b.caimei365.com/userfiles/1/images/photo/2020/06/%E6%97%A0%E6%9D%83%E9%99%90%402x.png',
  18. serviceProviderId:'',
  19. shopOrderId:null,
  20. source:1,
  21. shareCode:'',
  22. authority:'',//用户权限
  23. }
  24. },
  25. computed: {
  26. ...mapState(['isWxAuthorize'])
  27. },
  28. onLoad(option) {
  29. // scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
  30. console.log(option);
  31. if(option.scene){
  32. this.shopOrderId = Number(decodeURIComponent(option.scene))
  33. }else{
  34. this.shopOrderId = option.shopOrderId
  35. this.authority = option.authority
  36. if(this.authority == '2'){
  37. this.source = 2
  38. }else if(this.authority == '3'){
  39. this.source = 3
  40. }
  41. }
  42. authorize.getSetting().then(res =>{
  43. console.log('用户是否授权过',res)
  44. if(res == 1){
  45. this.infoMiniShipments();
  46. }else{
  47. this.$api.navigateTo('/pages/authorization/authorization?type=4')
  48. setTimeout(()=>{
  49. this.isRequest = true
  50. },2000)
  51. }
  52. })
  53. },
  54. methods:{
  55. infoMiniShipments(){
  56. authorize.getCode('weixin').then(wechatcode =>{
  57. authorize.getUserInfo('weixin').then(wxResponse =>{
  58. let params = {
  59. code:wechatcode,
  60. encryptedData:wxResponse.encryptedData,
  61. iv:wxResponse.iv,
  62. shopOrderId:this.shopOrderId,
  63. source:this.source,
  64. shareCode:this.shareCode
  65. }
  66. this.ShopService.MiniShipments(params).then(res =>{
  67. switch(res.data.resultCode){
  68. case 1:
  69. this.shopOrderId = res.data.shopOrderId;
  70. this.$api.navigateTo(`/supplier/pages/order/order-service-details?shopOrderId=${this.shopOrderId}`)
  71. break;
  72. case 2:
  73. console.log('供应商联系人');
  74. this.$api.navigateTo(`/supplier/pages/order/order-details?shopOrderId=${this.shopOrderId}`)
  75. break;
  76. case 3:
  77. console.log('供应商发货人员');
  78. this.$api.navigateTo(`/supplier/pages/order/order-details?shopOrderId=${this.shopOrderId}`)
  79. break;
  80. }
  81. }).catch(err =>{
  82. if(this.source == 2){
  83. this.$api.setStorage('bind_supplierInfo', err.data)
  84. this.$api.navigateTo(`/supplier/pages/login/bind-operator?shopOrderId=${this.shopOrderId}`)
  85. }else if(this.source == 3){
  86. this.$api.navigateTo(`/supplier/pages/login/share-login?shopOrderId=${this.shopOrderId}`)
  87. }else{
  88. this.isRequest = true;
  89. }
  90. })
  91. })
  92. })
  93. }
  94. },
  95. onShow() {
  96. authorize.getSetting().then(res =>{
  97. console.log('用户是否授权过',res)
  98. if(res == 1){
  99. this.isRequest = false;
  100. this.infoMiniShipments();
  101. }else{
  102. console.log(new Date +'用户未授权微信信息')
  103. this.$api.navigateTo('/pages/authorization/authorization')
  104. }
  105. })
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. .share{
  111. width: 100%;
  112. height:100%;
  113. background: #FFFFFF;
  114. display: flex;
  115. align-items: center;
  116. justify-content:center;
  117. .share-empty{
  118. width: 376rpx;
  119. height: 460rpx;
  120. .icon{
  121. width: 376rpx;
  122. height: 400rpx;
  123. image{
  124. width: 100%;
  125. height: 100%;
  126. display: block;
  127. }
  128. }
  129. .text{
  130. font-size: $font-size-28;
  131. line-height: 60rpx;
  132. color: $text-color;
  133. text-align: center;
  134. }
  135. }
  136. }
  137. </style>