share-info.vue 3.4 KB

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