details.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <route lang="json">
  2. { "style": { "navigationBarTitleText": "", "navigationBarBackgroundColor": "#fff" } }
  3. </route>
  4. <script setup lang="ts">
  5. import { phone, right } from '../../../core/libs/svgs'
  6. import { pageReferrerDetail, getDistributePage, referrerCount } from '../../../core/libs/requests'
  7. import { handleCall } from '../../../core/utils/common'
  8. import { onLoad } from '@dcloudio/uni-app'
  9. import PageHelperEvo from '@/components/page-helper-evo.vue'
  10. import { ComponentExposed } from 'vue-component-type-helpers'
  11. import dayjs from "dayjs";
  12. const PageHelperEvoRef = ref<ComponentExposed<typeof PageHelperEvo>>()
  13. const referrerId = ref<number | string>('')
  14. const { data: count, run: setCount } = useRequest(() => referrerCount({ referrerId:id.value }))
  15. const queryReward = computed(() => ({ status: tabsReward.value[tab.value]?.value,referrerId:id.value }))
  16. const queryRecommend = computed(() => (referrerId.value?{ auditStatus: tabsRecommend.value[tab.value]?.value, referrerId:referrerId.value,userId:id.value }:{auditStatus: tabsRecommend.value[tab.value]?.value,referrerId:id.value}))
  17. const id = ref()
  18. const type = ref("recommend")
  19. const tab = ref(0)
  20. const tabsReward = ref([
  21. {
  22. label: '已完成',
  23. value: "2",
  24. },
  25. {
  26. label: '待入账',
  27. value: "1"
  28. },
  29. {
  30. label: '已取消',
  31. value: "3",
  32. },
  33. ])
  34. const tabsRecommend = ref([
  35. {
  36. label: '已认证',
  37. value: "0",
  38. },
  39. {
  40. label: '审核中',
  41. value: "1"
  42. },
  43. {
  44. label: '未通过',
  45. value: "2",
  46. },
  47. ])
  48. const handleClick = () => {
  49. uni.navigateTo({ url: '/pages-sub/mine/orders/detail/index' })
  50. }
  51. const toSecond = (record) =>{
  52. // referrerId.value = record.userId
  53. // PageHelperEvoRef.value?.reload()
  54. let str = encodeURIComponent(JSON.stringify(record))
  55. uni.navigateTo({ url: '/pages/mine/refferrer/twoDetails?str=' + str })
  56. }
  57. const handleChange = async (value) => {
  58. if(type.value === "recommend"){
  59. let tab1 = tabsRecommend.value[value.index]
  60. console.log(tab1)
  61. }else{
  62. let tab1 = tabsReward.value[value.index]
  63. console.log(tab1)
  64. }
  65. }
  66. onLoad(async(options)=>{
  67. if(options?.type === "recommend"){
  68. uni.setNavigationBarTitle({
  69. title:"我的推荐"
  70. })
  71. }else{
  72. uni.setNavigationBarTitle({
  73. title:"奖励明细"
  74. })
  75. }
  76. id.value = options?.id
  77. type.value = options?.type
  78. let res = await setCount();
  79. tabsRecommend.value[0].label = tabsRecommend.value[0].label + "(" +res.onePassCount+ ")"
  80. tabsRecommend.value[1].label = tabsRecommend.value[1].label + "(" +res.oneWaitCount+ ")"
  81. tabsRecommend.value[2].label = tabsRecommend.value[2].label + "(" +res.oneRejectCount+ ")"
  82. })
  83. </script>
  84. <template>
  85. <view class="flex flex-col">
  86. <PageHelperEvo ref="pageHelperRef" class="flex-grow flex" :request="type === 'recommend'?pageReferrerDetail:getDistributePage" :query="type === 'recommend'?queryRecommend:queryReward">
  87. <template #top>
  88. <wd-tabs v-model="tab" @change="handleChange">
  89. <block v-if="type === 'recommend'">
  90. <block v-for="({ label }, i) in tabsRecommend" :key="i">
  91. <wd-tab :title="`${label}`" class="relative"></wd-tab>
  92. </block>
  93. </block>
  94. <block v-else-if="type === 'reward'">
  95. <block v-for="({ label }, i) in tabsReward" :key="i">
  96. <wd-tab :title="`${label}`" class="relative"></wd-tab>
  97. </block>
  98. </block>
  99. </wd-tabs>
  100. </template>
  101. <template #default="{ source }">
  102. <view class="bg-white rounded-[20rpx] mx-[24rpx] mt-[30rpx] px-[20rpx] py-[30rpx]" v-if="type === 'recommend'">
  103. <view class="flex items-center py-[30rpx] relative" v-for="(it, i) in source.list" :key="i" style="border-bottom: 2rpx solid #FAFAFA;">
  104. <view class="rounded-full w-[88rpx] h-[88rpx] overflow-hidden mr-[20rpx]">
  105. <image :src="it.avatar" mode="widthFix"></image>
  106. </view>
  107. <view class="flex-grow text-[32rpx]">{{ it.name }}</view>
  108. <view class="text-[#586A8F] text-[28rpx]" v-if="it.auditStatus === 0 && !referrerId" @click="toSecond(it)">推荐人数:{{ it.referrerCount }}</view>
  109. <view class="absolute bottom-0 left-[20%] text-[24rpx] text-[#EF4343]" v-if="it.auditStatus == 2">原因:{{ it.remark }}</view>
  110. </view>
  111. </view>
  112. <view class="bg-white rounded-[20rpx] mx-[24rpx] mt-[30rpx] px-[20rpx] py-[30rpx]" v-else>
  113. <view class="flex flex-col mb-[30rpx]" v-for="(it, i) in source.list" :key="i" style="border-bottom: 2rpx solid #FAFAFA;">
  114. <view class="flex items-center">
  115. <view class="rounded-full w-[88rpx] h-[88rpx] overflow-hidden mr-[20rpx]">
  116. <image :src="it.userAvatar" mode="widthFix"></image>
  117. </view>
  118. <view class="flex-grow">
  119. <view class="flex items-center">
  120. <view class="text-[32rpx] mr-[12rpx]">{{ it.userName }}</view>
  121. <view class="text-[20rpx] bg-[#F6F6F6] rounded-full text-black/40 px-[14rpx] py-[6rpx]" v-if=" it.distributeType==1 ">一级奖励</view>
  122. <view class="text-[20rpx] bg-[#F6F6F6] rounded-full text-black/40 px-[14rpx] py-[6rpx]" v-else>二级奖励</view>
  123. </view>
  124. <view class="text-black/30">{{ it.completeTime?dayjs(it.completeTime).format('YYYY/MM/DD HH:mm'):"" }}</view>
  125. </view>
  126. <view class="text-[#EF4343] text-[32rpx]">+{{ it.onePoints }}(*{{ it.oneRatio }}%)</view>
  127. </view>
  128. <view class="flex py-[40rpx] justify-between text-black/60 text-[24rpx]">
  129. <text>{{ it.pointsName }}</text>
  130. <text>消耗积分:{{ it.points }}</text>
  131. </view>
  132. </view>
  133. </view>
  134. </template>
  135. </PageHelperEvo>
  136. </view>
  137. </template>