share-info.vue 3.6 KB

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