login-share.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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="imagePath" 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. CustomBar:this.CustomBar,// 顶部导航栏高度
  27. imagePath:'https://static.caimei365.com/app/img/icon/icon-noremb.png',
  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.skeletonShow = false
  112. },500)
  113. })
  114. },
  115. getOrderReceiptRebateDetail(receipt) {
  116. // 返佣收款详情
  117. this.OrderService.orderReceiptRebateDetails({ id: receipt.id })
  118. .then(response => {
  119. this.navigateLinkJump(receipt)
  120. })
  121. .catch(err => {
  122. setTimeout(()=>{
  123. this.skeletonShow = false
  124. },500)
  125. })
  126. },
  127. getOrderReceiptRefundDetail(receipt) {
  128. // 供应商退款收款详情
  129. this.OrderService.orderReceiptRefundDetail({ id: receipt.id })
  130. .then(response => {
  131. this.navigateLinkJump(receipt)
  132. })
  133. .catch(err => {
  134. setTimeout(()=>{
  135. this.skeletonShow = false
  136. },500)
  137. })
  138. },
  139. navigateLinkJump(receipt){
  140. // 收款详情查询跳转URL 收款款项类型:1订单款,2非订单款,3返佣款 4订单款或者非订单款(因财务阶段无法区分订单非订单), 5供应商退款
  141. switch(receipt.receiptType){
  142. case 1:// 1:订单 1待确认、2已确认(待审核)、3审核通过、4审核未通过、5收款撤销【线上支付成功为审核通过】
  143. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 订单待确认
  144. console.log('订单待确认')
  145. this.$api.navigateTo(`/pages/relation/ordinary/index?type=share&id=${receipt.id}`)
  146. }else if(receipt.receiptStatus == 2){// 待审核
  147. console.log('待审核')
  148. this.$api.navigateTo(`/pages/relation/ordinary/examine-detail?type=share&id=${receipt.id}`)
  149. }else if(receipt.receiptStatus == 3){// 审核通过
  150. console.log('审核通过')
  151. this.$api.navigateTo(`/pages/relation/ordinary/detail?type=share&id=${receipt.id}`)
  152. }
  153. break
  154. case 2:// 2:非订单
  155. this.$api.navigateTo(`/pages/relation/nonorder/detail?type=share&id=${receipt.id}`)
  156. break
  157. case 3:// 3:返佣
  158. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 返佣待确认
  159. this.$api.navigateTo(`/pages/relation/return/index?type=share&id=${receipt.id}`)
  160. }else if(receipt.receiptStatus == 2){
  161. this.$api.navigateTo(`/pages/relation/return/detail?type=share&id=${receipt.id}`)
  162. }
  163. break
  164. case 5:// 4:供应商退款
  165. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 返佣待确认
  166. this.$api.navigateTo(`/pages/relation/refund/index?type=share&id=${receipt.id}`)
  167. }else if(receipt.receiptStatus == 2){
  168. this.$api.navigateTo(`/pages/relation/refund/detail?type=share&id=${receipt.id}`)
  169. }
  170. break
  171. }
  172. }
  173. },
  174. onShow() {
  175. this.getWxAuthorize()
  176. }
  177. }
  178. </script>
  179. <style lang="scss">
  180. .container {
  181. width: 100%;
  182. height:100%;
  183. background: #FFFFFF;
  184. display: flex;
  185. align-items: center;
  186. justify-content:center;
  187. .share-empty{
  188. width: 260rpx;
  189. height: 412rpx;
  190. .icon{
  191. width: 260rpx;
  192. height: 260rpx;
  193. image{
  194. width: 100%;
  195. height: 100%;
  196. display: block;
  197. }
  198. }
  199. .text{
  200. font-size: $font-size-28;
  201. line-height: 60rpx;
  202. color: $color-system;
  203. text-align: center;
  204. }
  205. .icon-shouye1{
  206. display: block;
  207. width: 80rpx;
  208. height: 80rpx;
  209. float: left;
  210. text-align: center;
  211. line-height: 80rpx;
  212. font-size: 48rpx;
  213. position: absolute;
  214. top: 0;
  215. left: 0;
  216. }
  217. }
  218. }
  219. </style>