share-info.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. // if(uni.getStorageSync('_WX_State')){
  54. // this.infoMiniShipments();
  55. // }else{
  56. // this.$api.navigateTo('/pages/authorization/authorization?type=4')
  57. // setTimeout(()=>{
  58. // this.isRequest = true
  59. // },2000)
  60. // }
  61. },
  62. methods:{
  63. infoMiniShipments(){
  64. authorize.getCode('weixin').then(wechatcode =>{
  65. authorize.getUserInfo('weixin').then(wxResponse =>{
  66. let params = {
  67. code:wechatcode,
  68. encryptedData:wxResponse.encryptedData,
  69. iv:wxResponse.iv,
  70. shopOrderId:this.shopOrderId,
  71. source:this.source,
  72. shareCode:this.shareCode
  73. }
  74. this.ShopService.MiniShipments(params).then(res =>{
  75. switch(res.data.resultCode){
  76. case 1:
  77. this.shopOrderId = res.data.shopOrderId;
  78. this.$api.navigateTo(`/supplier/pages/order/order-service-details?shopOrderId=${this.shopOrderId}`)
  79. break;
  80. case 2:
  81. console.log('供应商联系人');
  82. this.$api.navigateTo(`/supplier/pages/order/order-details?shopOrderId=${this.shopOrderId}`)
  83. break;
  84. case 3:
  85. console.log('供应商发货人员');
  86. this.$api.navigateTo(`/supplier/pages/order/order-details?shopOrderId=${this.shopOrderId}`)
  87. break;
  88. }
  89. }).catch(err =>{
  90. if(this.source == 2){
  91. this.$api.setStorage('bind_supplierInfo', err.data)
  92. this.$api.navigateTo(`/supplier/pages/login/bind-operator?shopOrderId=${this.shopOrderId}`)
  93. }else if(this.source == 3){
  94. this.$api.navigateTo(`/supplier/pages/login/share-login?shopOrderId=${this.shopOrderId}`)
  95. }else{
  96. this.isRequest = true;
  97. }
  98. })
  99. })
  100. })
  101. }
  102. },
  103. onShow() {
  104. authorize.getSetting().then(res =>{
  105. console.log('用户是否授权过',res)
  106. if(res == 1){
  107. this.isRequest = false;
  108. this.infoMiniShipments();
  109. }else{
  110. console.log(new Date +'用户未授权微信信息')
  111. this.$api.navigateTo('/pages/authorization/authorization')
  112. }
  113. })
  114. // if(uni.getStorageSync('_WX_State')){
  115. // this.isRequest = false;
  116. // this.infoMiniShipments();
  117. // }else{
  118. // console.log(new Date +'用户未授权微信信息')
  119. // this.$api.navigateTo('/pages/authorization/authorization')
  120. // }
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. .share{
  126. width: 100%;
  127. height:100%;
  128. background: #FFFFFF;
  129. display: flex;
  130. align-items: center;
  131. justify-content:center;
  132. .share-empty{
  133. width: 376rpx;
  134. height: 460rpx;
  135. .icon{
  136. width: 376rpx;
  137. height: 400rpx;
  138. image{
  139. width: 100%;
  140. height: 100%;
  141. display: block;
  142. }
  143. }
  144. .text{
  145. font-size: $font-size-28;
  146. line-height: 60rpx;
  147. color: $text-color;
  148. text-align: center;
  149. }
  150. }
  151. }
  152. </style>