share-info.vue 3.5 KB

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