login-share.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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
  6. class="tui-header-box first"
  7. :style="{ height: isCmcustomClass == 'fiexd' ? CustomBar + 6 + 'px' : CustomBar + 6 + 'px' }"
  8. :class="isCmcustomClass"
  9. >
  10. <view class="header-top" :style="{ paddingTop: top + 'px', lineHeight: CustomBar + 20 + 'px' }"></view>
  11. <view class="header-sit">
  12. <text v-if="isNoAuthority"
  13. class="iconfont icon-shouye1"
  14. :style="{ top: CustomBar/2 + 'px',left:'24rpx'}"
  15. @click.stop="this.$api.navigateLinkJump()"
  16. >
  17. </text>
  18. <text class="header-sit-text"></text>
  19. </view>
  20. </view>
  21. <view class="share-empty">
  22. <view class="icon"><image :src="StaticUrl + '/image/icon-noaccess@2x.png'" mode="widthFix"></image></view>
  23. <view class="text">暂无权限查看</view>
  24. </view>
  25. </template>
  26. </view>
  27. </template>
  28. <script>
  29. import { mapMutations } from 'vuex'
  30. import authorize from '@/common/config/authorize.js'
  31. export default {
  32. computed: {
  33. },
  34. data() {
  35. return {
  36. StaticUrl: this.$Static,
  37. CustomBar:this.CustomBar,// 顶部导航栏高度
  38. isIphoneX: this.$store.state.isIphoneX,
  39. CustomBar: this.CustomBar, // 顶部导航栏高度
  40. height: 64, //header高度
  41. top: 0, //标题图标距离顶部距离
  42. scrollH: 0, //滚动总高度
  43. opcity: 1,
  44. isCmcustomClass: 'left',
  45. isNoAuthority:false,
  46. skeletonShow:true,
  47. receiptId:0,
  48. receiptType:1// 收款款项类型:1订单款,2非订单款,3返佣款 4订单款或者非订单款(因财务阶段无法区分订单非订单), 5供应商退款
  49. }
  50. },
  51. onLoad(option) {
  52. this.receiptId = option.id
  53. let obj = {}
  54. // #ifdef MP-WEIXIN
  55. obj = wx.getMenuButtonBoundingClientRect()
  56. // #endif
  57. // #ifdef MP-BAIDU
  58. obj = swan.getMenuButtonBoundingClientRect()
  59. // #endif
  60. // #ifdef MP-ALIPAY
  61. my.hideAddToDesktopMenu()
  62. // #endif
  63. uni.getSystemInfo({
  64. success: res => {
  65. this.width = obj.left || res.windowWidth
  66. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  67. this.top = obj.top ? obj.top + (obj.height - 32) / 2 : res.statusBarHeight + 6
  68. this.scrollH = res.windowWidth * 0.6
  69. }
  70. })
  71. },
  72. methods: {
  73. ...mapMutations(['login', 'logout']),
  74. async getWxAuthorize(){// 初始化授权登录
  75. const WxCode = await authorize.getCode('weixin')
  76. const Wx = await authorize.getUserInfo('weixin')
  77. this.UserService.UserLoginAuthApplets({
  78. code:WxCode,
  79. encryptedData:Wx.encryptedData,
  80. iv:Wx.iv ,
  81. })
  82. .then(response =>{
  83. let data = response.data
  84. this.login(response.data)
  85. this.$store.commit('updateStatus',response.data)
  86. setTimeout(()=>{
  87. this.getOrderReceiptDetailType(this.receiptId)
  88. },1000)
  89. }).catch(error =>{
  90. this.logout()
  91. this.skeletonShow = false
  92. this.isNoAuthority = true
  93. this.$store.commit('updateStatus',error.data)
  94. })
  95. },
  96. getOrderReceiptDetailType(id) {
  97. // 无权限查询收款详情,防止收款账号被更改
  98. this.OrderService.orderReceiptDetailType({ id: id })
  99. .then(response => {
  100. /**
  101. * 用户类型(userType) 1协销人员,2客服,3财务,4超级管理员
  102. * 1. 协销人员跳转到收款列表页面
  103. * 2. 客服跳转到收款列表页面
  104. * 3. 财务人员跳转到款项识别页面
  105. * 4. 超级管理员跳转到款项识别页面
  106. * */
  107. // switch(data.userType){
  108. // case 1:// 协销
  109. // this.navigateLinkJump(receipt)
  110. // break
  111. // case 2:// 客服
  112. // this.navigateLinkJump(receipt)
  113. // break
  114. // case 3:// 财务
  115. // this.navigateLinkJump(receipt)
  116. // break
  117. // case 4:// 超级管理员
  118. // this.navigateLinkJump(receipt)
  119. // break
  120. // }
  121. const receipt = response.data
  122. this.checkedReceiptAdministration(receipt)
  123. })
  124. .catch(err => {
  125. console.log('分享查询收款详情异常====>',err)
  126. })
  127. },
  128. checkedReceiptAdministration(receipt){
  129. // 根据收款账号调用不同收款详情查看权限
  130. if(receipt.receiptType == 1 || receipt.receiptType == 2 || receipt.receiptType == 4){// 订单 非订单
  131. this.getOrderReceiptDetail(receipt)
  132. }else if(receipt.receiptType == 3){
  133. this.getOrderReceiptRebateDetail(receipt)
  134. }else if(receipt.receiptType == 5){
  135. this.getOrderReceiptRefundDetail(receipt)
  136. }
  137. },
  138. getOrderReceiptDetail(receipt) {//
  139. // 订单&&非订单收款详情
  140. this.OrderService.orderReceiptDetail({ id: receipt.id })
  141. .then(response => {
  142. this.navigateLinkJump(receipt)
  143. })
  144. .catch(err => {
  145. setTimeout(()=>{
  146. this.isNoAuthority = true
  147. this.skeletonShow = false
  148. },500)
  149. })
  150. },
  151. getOrderReceiptRebateDetail(receipt) {
  152. // 返佣收款详情
  153. this.OrderService.orderReceiptRebateDetails({ id: receipt.id })
  154. .then(response => {
  155. this.navigateLinkJump(receipt)
  156. })
  157. .catch(err => {
  158. setTimeout(()=>{
  159. this.isNoAuthority = true
  160. this.skeletonShow = false
  161. },500)
  162. })
  163. },
  164. getOrderReceiptRefundDetail(receipt) {
  165. // 供应商退款收款详情
  166. this.OrderService.orderReceiptRefundDetail({ id: receipt.id })
  167. .then(response => {
  168. this.navigateLinkJump(receipt)
  169. })
  170. .catch(err => {
  171. setTimeout(()=>{
  172. this.isNoAuthority = true
  173. this.skeletonShow = false
  174. },500)
  175. })
  176. },
  177. navigateLinkJump(receipt){
  178. // 收款详情查询跳转URL 收款款项类型:1订单款,2非订单款,3返佣款 4订单款或者非订单款(因财务阶段无法区分订单非订单), 5供应商退款
  179. switch(receipt.receiptType){
  180. case 1:// 1:订单 1待确认、2已确认(待审核)、3审核通过、4审核未通过、5收款撤销【线上支付成功为审核通过】
  181. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 订单待确认
  182. console.log('订单待确认')
  183. this.$api.navigateTo(`/pages/relation/ordinary/index?type=share&id=${receipt.id}`)
  184. }else if(receipt.receiptStatus == 2){// 待审核
  185. console.log('待审核')
  186. this.$api.navigateTo(`/pages/relation/ordinary/examine-detail?type=share&id=${receipt.id}`)
  187. }else if(receipt.receiptStatus == 3){// 审核通过
  188. console.log('审核通过')
  189. this.$api.navigateTo(`/pages/relation/ordinary/detail?type=share&id=${receipt.id}`)
  190. }
  191. break
  192. case 2:// 2:非订单
  193. this.$api.navigateTo(`/pages/relation/nonorder/detail?type=share&id=${receipt.id}`)
  194. break
  195. case 3:// 3:返佣
  196. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 返佣待确认
  197. this.$api.navigateTo(`/pages/relation/return/index?type=share&id=${receipt.id}`)
  198. }else if(receipt.receiptStatus == 2){
  199. this.$api.navigateTo(`/pages/relation/return/detail?type=share&id=${receipt.id}`)
  200. }
  201. break
  202. case 5:// 4:供应商退款
  203. if(receipt.receiptStatus == 1 || receipt.receiptStatus == 4 || receipt.receiptStatus == 5){// 返佣待确认
  204. this.$api.navigateTo(`/pages/relation/refund/index?type=share&id=${receipt.id}`)
  205. }else if(receipt.receiptStatus == 2){
  206. this.$api.navigateTo(`/pages/relation/refund/detail?type=share&id=${receipt.id}`)
  207. }
  208. break
  209. }
  210. }
  211. },
  212. onShow() {
  213. this.getWxAuthorize()
  214. }
  215. }
  216. </script>
  217. <style lang="scss">
  218. .container {
  219. width: 100%;
  220. height:100%;
  221. background: #FFFFFF;
  222. display: flex;
  223. align-items: center;
  224. justify-content:center;
  225. .share-empty{
  226. width: 260rpx;
  227. height: 412rpx;
  228. .icon{
  229. width: 150rpx;
  230. height: 150rpx;
  231. margin: 0 auto;
  232. image{
  233. width: 100%;
  234. height: 100%;
  235. display: block;
  236. }
  237. }
  238. .text{
  239. font-size: $font-size-28;
  240. line-height: 60rpx;
  241. color: rgba(70,136,250,0.7);
  242. text-align: center;
  243. }
  244. }
  245. }
  246. .tui-header-box {
  247. width: 100%;
  248. background: #ffffff;
  249. z-index: 999;
  250. position: fixed;
  251. top: 0;
  252. left: 0;
  253. background-size: cover;
  254. background-image: url(https://static.caimei365.com/app/crm/image/statistic_bg2.png);
  255. &.fiexd {
  256. }
  257. &.first {
  258. }
  259. }
  260. .header-top {
  261. width: 100%;
  262. font-size: 16px;
  263. font-weight: 500;
  264. height: 32px;
  265. display: flex;
  266. align-items: center;
  267. justify-content: center;
  268. position: relative;
  269. padding: 0 40rpx;
  270. }
  271. .header-sit {
  272. width: 100%;
  273. box-sizing: border-box;
  274. height: 80rpx;
  275. line-height: 80rpx;
  276. box-sizing: border-box;
  277. color: #ffffff;
  278. .header-sit-text {
  279. text-align: left;
  280. font-size: $font-size-40;
  281. font-weight: 600;
  282. font-family: '正楷';
  283. }
  284. .icon-shouye1{
  285. display: block;
  286. width: 80rpx;
  287. height: 80rpx;
  288. float: left;
  289. text-align: center;
  290. line-height: 80rpx;
  291. font-size: 48rpx;
  292. }
  293. }
  294. </style>