details.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 { domainToUnicode } from 'url'
  12. import dayjs from 'dayjs'
  13. const PageHelperEvoRef = ref<ComponentExposed<typeof PageHelperEvo>>()
  14. const referrerId = ref<number | string>('')
  15. const { data: count, run: setCount } = useRequest(() => referrerCount({}))
  16. const queryReward = computed(() => ({ status: tabsReward.value[tab.value]?.value }))
  17. const queryRecommend = computed(() => (referrerId.value?{ auditStatus: tabsRecommend.value[tab.value]?.value, referrerId:referrerId.value }:{auditStatus: tabsRecommend.value[tab.value]?.value}))
  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. let str = encodeURIComponent(JSON.stringify(record))
  53. // PageHelperEvoRef.value?.reload()
  54. // uni.setNavigationBarTitle({
  55. // title:record.name + "的推荐"
  56. // })
  57. uni.navigateTo({ url: '/pages-sub/mine/refferrer/twoDetails?str=' + str })
  58. }
  59. const handleChange = async (value) => {
  60. if(type.value === "recommend"){
  61. let tab1 = tabsRecommend.value[value.index]
  62. console.log(tab1)
  63. }else{
  64. let tab1 = tabsReward.value[value.index]
  65. console.log(tab1)
  66. }
  67. }
  68. onLoad(async (options:object)=>{
  69. console.log(options)
  70. if(options?.type === "recommend"){
  71. uni.setNavigationBarTitle({
  72. title:"我的推荐"
  73. })
  74. let res = await setCount();
  75. tabsRecommend.value[0].label = tabsRecommend.value[0].label + "(" +res.onePassCount+ ")"
  76. tabsRecommend.value[1].label = tabsRecommend.value[1].label + "(" +res.oneWaitCount+ ")"
  77. tabsRecommend.value[2].label = tabsRecommend.value[2].label + "(" +res.oneRejectCount+ ")"
  78. }else{
  79. uni.setNavigationBarTitle({
  80. title:"奖励明细"
  81. })
  82. }
  83. type.value = options?.type
  84. if(options?.tab){
  85. tab.value = Number(options?.tab)
  86. }
  87. })
  88. </script>
  89. <template>
  90. <view class="flex flex-col">
  91. <PageHelperEvo ref="pageHelperRef" class="flex-grow flex" :request="type === 'recommend'?pageReferrerDetail:getDistributePage" :query="type === 'recommend'?queryRecommend:queryReward">
  92. <template #top>
  93. <wd-tabs v-model="tab" @change="handleChange">
  94. <block v-if="type === 'recommend'">
  95. <block v-for="({ label }, i) in tabsRecommend" :key="i">
  96. <wd-tab :title="`${label}`" class="relative"></wd-tab>
  97. </block>
  98. </block>
  99. <block v-else-if="type === 'reward'">
  100. <block v-for="({ label }, i) in tabsReward" :key="i">
  101. <wd-tab :title="`${label}`" class="relative"></wd-tab>
  102. </block>
  103. </block>
  104. </wd-tabs>
  105. </template>
  106. <template #default="{ source }">
  107. <view class="bg-white rounded-[20rpx] mx-[24rpx] mt-[30rpx] px-[20rpx] py-[30rpx]" v-if="type === 'recommend'">
  108. <view class="flex items-center py-[30rpx] relative" v-for="(it, i) in source.list" :key="i" style="border-bottom: 2rpx solid #FAFAFA;">
  109. <view class="rounded-full w-[88rpx] h-[88rpx] overflow-hidden mr-[20rpx]">
  110. <image :src="it.avatar" mode="widthFix"></image>
  111. </view>
  112. <view class="flex-grow text-[32rpx]">{{ it.name }}</view>
  113. <view class="text-[#586A8F] text-[28rpx]" v-if="it.auditStatus === 0 && !referrerId" @click="toSecond(it)">推荐人数:{{ it.referrerCount }}</view>
  114. <view class="absolute bottom-0 left-[20%] text-[24rpx] text-[#EF4343]" v-if="it.auditStatus == 2">原因:{{ it.remark }}</view>
  115. </view>
  116. </view>
  117. <view class="bg-white rounded-[20rpx] mx-[24rpx] mt-[30rpx] px-[20rpx] py-[30rpx]" v-else>
  118. <view class="flex flex-col mb-[30rpx]" v-for="(it, i) in source.list" :key="i" style="border-bottom: 2rpx solid #FAFAFA;">
  119. <view class="flex items-center">
  120. <view class="rounded-full w-[88rpx] h-[88rpx] overflow-hidden mr-[20rpx]">
  121. <image :src="it.userAvatar" mode="widthFix"></image>
  122. </view>
  123. <view class="flex-grow">
  124. <view class="flex items-center">
  125. <view class="text-[32rpx] mr-[12rpx]">{{ it.userName }}</view>
  126. <view class="text-[20rpx] bg-[#F6F6F6] rounded-full text-black/40 px-[14rpx] py-[6rpx]" v-if=" it.distributeType==1 ">一级奖励</view>
  127. <view class="text-[20rpx] bg-[#F6F6F6] rounded-full text-black/40 px-[14rpx] py-[6rpx]" v-else>二级奖励</view>
  128. </view>
  129. <view class="text-black/30">{{ it.completeTime?dayjs(it.completeTime).format('YYYY/MM/DD HH:mm'):"" }}</view>
  130. </view>
  131. <view class="text-[#EF4343] text-[32rpx]">+{{ it.onePoints }}(*{{ it.oneRatio }})</view>
  132. </view>
  133. <view class="flex py-[40rpx] justify-between text-black/60 text-[24rpx]">
  134. <text>{{ it.pointsName }}</text>
  135. <text>消耗积分:{{ it.points }}</text>
  136. </view>
  137. </view>
  138. </view>
  139. </template>
  140. </PageHelperEvo>
  141. </view>
  142. </template>