login-share.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="container">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="7"></tui-skeleton>
  4. <template v-else>
  5. <view class="share-empty">
  6. <view class="icon"><image :src="StaticUrl + '/image/icon-noaccess@2x.png'" mode="widthFix"></image></view>
  7. <view class="text">暂无权限查看</view>
  8. <text v-if="isNoAuthority"
  9. class="iconfont icon-shouye1"
  10. :style="{ top: CustomBar/2 + 'px',left:'24rpx'}"
  11. @click.stop="this.$api.navigateLinkJump()"
  12. >
  13. </text>
  14. </view>
  15. </template>
  16. </view>
  17. </template>
  18. <script>
  19. import { mapMutations } from 'vuex'
  20. import authorize from '@/common/config/authorize.js'
  21. export default {
  22. computed: {
  23. },
  24. data() {
  25. return {
  26. StaticUrl: this.$Static,
  27. CustomBar:this.CustomBar,// 顶部导航栏高度
  28. isNoAuthority:false,
  29. skeletonShow:true,
  30. receiptId:0,
  31. receiptType:1// 收款款项类型:1订单款,2非订单款,3返佣款 4订单款或者非订单款(因财务阶段无法区分订单非订单), 5供应商退款
  32. }
  33. },
  34. onLoad(option) {
  35. this.receiptId = option.id
  36. },
  37. methods: {
  38. ...mapMutations(['login', 'logout']),
  39. async getWxAuthorize(){// 初始化授权登录
  40. const WxCode = await authorize.getCode('weixin')
  41. const Wx = await authorize.getUserInfo('weixin')
  42. this.UserService.UserLoginAuthApplets({
  43. code:WxCode,
  44. encryptedData:Wx.encryptedData,
  45. iv:Wx.iv ,
  46. })
  47. .then(response =>{
  48. let data = response.data
  49. this.login(response.data)
  50. this.$store.commit('updateStatus',response.data)
  51. setTimeout(()=>{
  52. this.getOrderReceiptDetailType(this.receiptId)
  53. },1000)
  54. }).catch(error =>{
  55. this.logout()
  56. this.skeletonShow = false
  57. this.isNoAuthority = true
  58. this.$store.commit('updateStatus',error.data)
  59. })
  60. },
  61. getOrderReceiptDetailType(id) {
  62. // 无权限查询收款详情,防止收款类型被更改
  63. this.OrderService.orderReceiptDetailType({ id: id })
  64. .then(response => {
  65. /**
  66. * 用户类型(userType) 1协销人员,2客服,3财务,4超级管理员
  67. * 1. 协销人员跳转到收款列表页面
  68. * 2. 客服跳转到收款列表页面
  69. * 3. 财务人员跳转到款项识别页面
  70. * 4. 超级管理员跳转到款项识别页面
  71. * */
  72. // switch(data.userType){
  73. // case 1:// 协销
  74. // this.navigateLinkJump(receipt)
  75. // break
  76. // case 2:// 客服
  77. // this.navigateLinkJump(receipt)
  78. // break
  79. // case 3:// 财务
  80. // this.navigateLinkJump(receipt)
  81. // break
  82. // case 4:// 超级管理员
  83. // this.navigateLinkJump(receipt)
  84. // break
  85. // }
  86. const receipt = response.data
  87. this.checkedReceiptAdministration(receipt)
  88. })
  89. .catch(err => {
  90. console.log('分享查询收款详情异常====>',err)
  91. })
  92. },
  93. checkedReceiptAdministration(receipt){
  94. // 根据收款类型调用不同收款详情查看权限
  95. if(receipt.receiptType == 1 || receipt.receiptType == 2 || receipt.receiptType == 4){// 订单 非订单
  96. this.getOrderReceiptDetail(receipt)
  97. }else if(receipt.receiptType == 3){
  98. this.getOrderReceiptRebateDetail(receipt)
  99. }else if(receipt.receiptType == 5){
  100. this.getOrderReceiptRefundDetail(receipt)
  101. }
  102. },
  103. getOrderReceiptDetail(receipt) {//
  104. // 订单&&非订单收款详情
  105. this.OrderService.orderReceiptDetail({ id: receipt.id })
  106. .then(response => {
  107. this.navigateLinkJump(receipt)
  108. })
  109. .catch(err => {
  110. setTimeout(()=>{
  111. this.isNoAuthority = true
  112. this.skeletonShow = false
  113. },500)
  114. })
  115. },
  116. getOrderReceiptRebateDetail(receipt) {
  117. // 返佣收款详情
  118. this.OrderService.orderReceiptRebateDetails({ id: receipt.id })
  119. .then(response => {
  120. this.navigateLinkJump(receipt)
  121. })
  122. .catch(err => {
  123. setTimeout(()=>{
  124. this.isNoAuthority = true
  125. this.skeletonShow = false
  126. },500)
  127. })
  128. },
  129. getOrderReceiptRefundDetail(receipt) {
  130. // 供应商退款收款详情
  131. this.OrderService.orderReceiptRefundDetail({ id: receipt.id })
  132. .then(response => {
  133. this.navigateLinkJump(receipt)
  134. })
  135. .catch(err => {
  136. setTimeout(()=>{
  137. this.isNoAuthority = true
  138. this.skeletonShow = false
  139. },500)
  140. })
  141. },
  142. navigateLinkJump(receipt){
  143. // 收款详情查询跳转URL 收款款项类型:1订单款,2非订单款,3返佣款 4订单款或者非订单款(因财务阶段无法区分订单非订单), 5供应商退款
  144. switch(receipt.receiptType){
  145. case 1:// 1:订单 1待确认、2已确认(待审核)、3审核通过、4审核未通过、5收款撤销【线上支付成功为审核通过】
  146. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 订单待确认
  147. console.log('订单待确认')
  148. this.$api.navigateTo(`/pages/relation/ordinary/index?type=share&id=${receipt.id}`)
  149. }else if(receipt.receiptStatus == 2){// 待审核
  150. console.log('待审核')
  151. this.$api.navigateTo(`/pages/relation/ordinary/examine-detail?type=share&id=${receipt.id}`)
  152. }else if(receipt.receiptStatus == 3){// 审核通过
  153. console.log('审核通过')
  154. this.$api.navigateTo(`/pages/relation/ordinary/detail?type=share&id=${receipt.id}`)
  155. }
  156. break
  157. case 2:// 2:非订单
  158. this.$api.navigateTo(`/pages/relation/nonorder/detail?type=share&id=${receipt.id}`)
  159. break
  160. case 3:// 3:返佣
  161. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 返佣待确认
  162. this.$api.navigateTo(`/pages/relation/return/index?type=share&id=${receipt.id}`)
  163. }else if(receipt.receiptStatus == 2){
  164. this.$api.navigateTo(`/pages/relation/return/detail?type=share&id=${receipt.id}`)
  165. }
  166. break
  167. case 5:// 4:供应商退款
  168. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 返佣待确认
  169. this.$api.navigateTo(`/pages/relation/refund/index?type=share&id=${receipt.id}`)
  170. }else if(receipt.receiptStatus == 2){
  171. this.$api.navigateTo(`/pages/relation/refund/detail?type=share&id=${receipt.id}`)
  172. }
  173. break
  174. }
  175. }
  176. },
  177. onShow() {
  178. this.getWxAuthorize()
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. .container {
  184. width: 100%;
  185. height:100%;
  186. background: #FFFFFF;
  187. display: flex;
  188. align-items: center;
  189. justify-content:center;
  190. .share-empty{
  191. width: 260rpx;
  192. height: 412rpx;
  193. .icon{
  194. width: 150rpx;
  195. height: 150rpx;
  196. margin: 0 auto;
  197. image{
  198. width: 100%;
  199. height: 100%;
  200. display: block;
  201. }
  202. }
  203. .text{
  204. font-size: $font-size-28;
  205. line-height: 60rpx;
  206. color: rgba(70,136,250,0.7);
  207. text-align: center;
  208. }
  209. .icon-shouye1{
  210. display: block;
  211. width: 80rpx;
  212. height: 80rpx;
  213. float: left;
  214. text-align: center;
  215. line-height: 80rpx;
  216. font-size: 48rpx;
  217. position: absolute;
  218. top: 0;
  219. left: 0;
  220. }
  221. }
  222. }
  223. </style>