login-share.vue 11 KB

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