f
This commit is contained in:
2
src/components.d.ts
vendored
2
src/components.d.ts
vendored
@@ -23,8 +23,8 @@ declare module 'vue' {
|
|||||||
WdFormItem: typeof import('wot-design-uni/components/wd-form-item/wd-form-item.vue')['default']
|
WdFormItem: typeof import('wot-design-uni/components/wd-form-item/wd-form-item.vue')['default']
|
||||||
WdIcon: typeof import('wot-design-uni/components/wd-icon/wd-icon.vue')['default']
|
WdIcon: typeof import('wot-design-uni/components/wd-icon/wd-icon.vue')['default']
|
||||||
WdInput: typeof import('wot-design-uni/components/wd-input/wd-input.vue')['default']
|
WdInput: typeof import('wot-design-uni/components/wd-input/wd-input.vue')['default']
|
||||||
|
WdLoadmore: typeof import('wot-design-uni/components/wd-loadmore/wd-loadmore.vue')['default']
|
||||||
WdNavbar: typeof import('wot-design-uni/components/wd-navbar/wd-navbar.vue')['default']
|
WdNavbar: typeof import('wot-design-uni/components/wd-navbar/wd-navbar.vue')['default']
|
||||||
WdPagination: typeof import('wot-design-uni/components/wd-pagination/wd-pagination.vue')['default']
|
|
||||||
WdPicker: typeof import('wot-design-uni/components/wd-picker/wd-picker.vue')['default']
|
WdPicker: typeof import('wot-design-uni/components/wd-picker/wd-picker.vue')['default']
|
||||||
WdPopup: typeof import('wot-design-uni/components/wd-popup/wd-popup.vue')['default']
|
WdPopup: typeof import('wot-design-uni/components/wd-popup/wd-popup.vue')['default']
|
||||||
WdTabbar: typeof import('wot-design-uni/components/wd-tabbar/wd-tabbar.vue')['default']
|
WdTabbar: typeof import('wot-design-uni/components/wd-tabbar/wd-tabbar.vue')['default']
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="min-h-screen bg-gray-50">
|
<scroll-view
|
||||||
<!-- 收益列表 -->
|
scroll-y
|
||||||
<uni-list :loading="loading" :loadmore="loadMoreStatus" @loadmore="onLoadMore">
|
class="scroll-container"
|
||||||
<EmptyState v-if="!loading && list.length === 0" text="暂无直推报告" />
|
@scrolltolower="onScrollToLower"
|
||||||
|
>
|
||||||
|
<EmptyState v-if="!loading && data.list.length === 0" text="暂无直推报告" />
|
||||||
|
|
||||||
<view v-for="(item, index) in list" :key="index" class="mx-4 my-2 bg-white rounded-lg p-4 shadow-sm">
|
<view v-for="(item, index) in data.list" :key="index" class="mx-4 my-2 bg-white rounded-lg p-4 shadow-sm">
|
||||||
<view class="flex justify-between items-center mb-2">
|
<view class="flex justify-between items-center mb-2">
|
||||||
<text class="text-gray-500 text-sm">{{ item.create_time || '-' }}</text>
|
<text class="text-gray-500 text-sm">{{ item.create_time || '-' }}</text>
|
||||||
<text class="font-bold" :class="getAmountColor(item)">
|
<text class="font-bold" :class="getAmountColor(item)">
|
||||||
@@ -27,17 +29,21 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 加载更多/加载完成提示 -->
|
<view v-if="loading" class="py-4 text-center text-sm text-gray-400">
|
||||||
<uni-load-more :status="loadMoreStatus" />
|
加载中...
|
||||||
</uni-list>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view v-else-if="!data.list.length" class="py-4 text-center text-sm text-gray-400">
|
||||||
|
暂无记录
|
||||||
|
</view>
|
||||||
|
<wd-loadmore :state="loadMoreState" @reload="getData" />
|
||||||
|
</scroll-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getAgentCommission } from '@/apis/agent'
|
import { getAgentCommission } from '@/apis/agent'
|
||||||
|
|
||||||
// 颜色配置(根据产品名称映射)
|
|
||||||
const typeColors = {
|
const typeColors = {
|
||||||
'老板企业报告': { bg: 'bg-blue-100', text: 'text-blue-800', dot: 'bg-blue-500' },
|
'老板企业报告': { bg: 'bg-blue-100', text: 'text-blue-800', dot: 'bg-blue-500' },
|
||||||
'人事背调': { bg: 'bg-green-100', text: 'text-green-800', dot: 'bg-green-500' },
|
'人事背调': { bg: 'bg-green-100', text: 'text-green-800', dot: 'bg-green-500' },
|
||||||
@@ -46,24 +52,24 @@ const typeColors = {
|
|||||||
'贷前背调': { bg: 'bg-orange-100', text: 'text-orange-800', dot: 'bg-orange-500' },
|
'贷前背调': { bg: 'bg-orange-100', text: 'text-orange-800', dot: 'bg-orange-500' },
|
||||||
'租赁风险': { bg: 'bg-indigo-100', text: 'text-indigo-800', dot: 'bg-indigo-500' },
|
'租赁风险': { bg: 'bg-indigo-100', text: 'text-indigo-800', dot: 'bg-indigo-500' },
|
||||||
'个人风险': { bg: 'bg-red-100', text: 'text-red-800', dot: 'bg-red-500' },
|
'个人风险': { bg: 'bg-red-100', text: 'text-red-800', dot: 'bg-red-500' },
|
||||||
// 默认类型
|
|
||||||
'default': { bg: 'bg-gray-100', text: 'text-gray-800', dot: 'bg-gray-500' }
|
'default': { bg: 'bg-gray-100', text: 'text-gray-800', dot: 'bg-gray-500' }
|
||||||
}
|
}
|
||||||
|
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
const total = ref(0)
|
const data = ref({
|
||||||
const list = ref([])
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
})
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const loadMoreStatus = ref('more') // 'more'|'loading'|'noMore'
|
const hasMore = ref(true)
|
||||||
|
const loadMoreState = ref('loading')
|
||||||
|
|
||||||
// 获取颜色样式
|
|
||||||
const getReportTypeStyle = (name) => {
|
const getReportTypeStyle = (name) => {
|
||||||
const color = typeColors[name] || typeColors.default
|
const color = typeColors[name] || typeColors.default
|
||||||
return `${color.bg} ${color.text}`
|
return `${color.bg} ${color.text}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取小圆点颜色
|
|
||||||
const getDotColor = (name) => {
|
const getDotColor = (name) => {
|
||||||
return (typeColors[name] || typeColors.default).dot
|
return (typeColors[name] || typeColors.default).dot
|
||||||
}
|
}
|
||||||
@@ -73,7 +79,6 @@ const toNumber = (value) => {
|
|||||||
return Number.isFinite(n) ? n : 0
|
return Number.isFinite(n) ? n : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// 与 H5 对齐:优先显示 net_amount,缺失时退化为 amount-refunded_amount
|
|
||||||
const getDisplayAmount = (item) => {
|
const getDisplayAmount = (item) => {
|
||||||
if (item && item.net_amount !== undefined && item.net_amount !== null)
|
if (item && item.net_amount !== undefined && item.net_amount !== null)
|
||||||
return toNumber(item.net_amount)
|
return toNumber(item.net_amount)
|
||||||
@@ -119,77 +124,81 @@ const getStatusStyle = (item) => {
|
|||||||
return 'bg-gray-100 text-gray-800'
|
return 'bg-gray-100 text-gray-800'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载更多数据
|
function mergeUniqueById(oldList, newList) {
|
||||||
const onLoadMore = async () => {
|
const map = new Map()
|
||||||
if (loadMoreStatus.value === 'noMore') return
|
const resolveKey = (item, index) => String(item?.id ?? item?.order_id ?? `${item?.create_time || ''}_${item?.product_name || ''}_${index}`)
|
||||||
|
oldList.forEach((item, index) => {
|
||||||
page.value++
|
map.set(resolveKey(item, index), item)
|
||||||
await getData()
|
})
|
||||||
|
newList.forEach((item, index) => {
|
||||||
|
map.set(resolveKey(item, oldList.length + index), item)
|
||||||
|
})
|
||||||
|
return Array.from(map.values())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取数据
|
async function getData(reset = false) {
|
||||||
const getData = async () => {
|
|
||||||
try {
|
try {
|
||||||
|
if (loading.value)
|
||||||
|
return
|
||||||
|
if (!reset && !hasMore.value)
|
||||||
|
return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
loadMoreStatus.value = 'loading'
|
if (reset) {
|
||||||
|
page.value = 1
|
||||||
|
hasMore.value = true
|
||||||
|
loadMoreState.value = 'loading'
|
||||||
|
data.value = { total: 0, list: [] }
|
||||||
|
}
|
||||||
const res = await getAgentCommission({
|
const res = await getAgentCommission({
|
||||||
page: page.value,
|
page: page.value,
|
||||||
page_size: pageSize.value
|
page_size: pageSize.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// 首次加载
|
const incoming = res.data.list || []
|
||||||
if (page.value === 1) {
|
data.value.total = res.data.total || 0
|
||||||
list.value = res.data.list
|
data.value.list = reset ? incoming : mergeUniqueById(data.value.list, incoming)
|
||||||
total.value = res.data.total
|
const isLastPage = incoming.length < pageSize.value || data.value.list.length >= data.value.total
|
||||||
} else {
|
hasMore.value = !isLastPage
|
||||||
// 分页加载
|
loadMoreState.value = isLastPage ? 'finished' : 'loading'
|
||||||
list.value.push(...res.data.list)
|
if (!isLastPage)
|
||||||
|
page.value += 1
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
// 判断是否加载完成
|
loadMoreState.value = 'error'
|
||||||
if (list.value.length >= res.data.total || res.data.list.length < pageSize.value) {
|
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||||
loadMoreStatus.value = 'noMore'
|
|
||||||
} else {
|
|
||||||
loadMoreStatus.value = 'more'
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg || '加载失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
catch (error) {
|
||||||
uni.showToast({
|
loadMoreState.value = 'error'
|
||||||
title: '网络错误',
|
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||||
icon: 'none'
|
}
|
||||||
})
|
finally {
|
||||||
} finally {
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载
|
function onScrollToLower() {
|
||||||
onMounted(() => {
|
|
||||||
getData()
|
getData()
|
||||||
})
|
|
||||||
|
|
||||||
// 页面下拉刷新
|
|
||||||
const onPullDownRefresh = () => {
|
|
||||||
page.value = 1
|
|
||||||
loadMoreStatus.value = 'more'
|
|
||||||
getData().then(() => {
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出页面生命周期方法
|
onMounted(() => {
|
||||||
defineExpose({
|
getData(true)
|
||||||
onPullDownRefresh
|
})
|
||||||
|
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
getData(true).then(() => {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.scroll-container {
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<route type="page" lang="json">
|
<route type="page" lang="json">
|
||||||
{
|
{
|
||||||
"layout": "page",
|
"layout": "page",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="min-h-screen bg-gray-50">
|
<scroll-view
|
||||||
<!-- 收益列表 -->
|
scroll-y
|
||||||
<uni-list :loading="loading" :loadmore="loadMoreStatus" @loadmore="onLoadMore">
|
class="scroll-container"
|
||||||
|
@scrolltolower="onScrollToLower"
|
||||||
|
>
|
||||||
<EmptyState v-if="!loading && filteredList.length === 0" text="暂无收益记录" />
|
<EmptyState v-if="!loading && filteredList.length === 0" text="暂无收益记录" />
|
||||||
|
|
||||||
<view v-for="(item, index) in filteredList" :key="index" class="mx-4 my-2 bg-white rounded-lg p-4 shadow-sm">
|
<view v-for="(item, index) in filteredList" :key="index" class="mx-4 my-2 bg-white rounded-lg p-4 shadow-sm">
|
||||||
@@ -18,17 +20,21 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 加载更多/加载完成提示 -->
|
<view v-if="loading" class="py-4 text-center text-sm text-gray-400">
|
||||||
<uni-load-more :status="loadMoreStatus" />
|
加载中...
|
||||||
</uni-list>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view v-else-if="!data.list.length" class="py-4 text-center text-sm text-gray-400">
|
||||||
|
暂无记录
|
||||||
|
</view>
|
||||||
|
<wd-loadmore :state="loadMoreState" @reload="getData" />
|
||||||
|
</scroll-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, reactive, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
|
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getAgentRewards } from '@/apis/agent'
|
import { getAgentRewards } from '@/apis/agent'
|
||||||
|
|
||||||
// 类型映射配置
|
|
||||||
const typeConfig = {
|
const typeConfig = {
|
||||||
descendant_promotion: {
|
descendant_promotion: {
|
||||||
chinese: '下级推广奖励',
|
chinese: '下级推广奖励',
|
||||||
@@ -54,102 +60,109 @@ const typeConfig = {
|
|||||||
|
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
const total = ref(0)
|
const data = ref({
|
||||||
const list = ref([])
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
})
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const loadMoreStatus = ref('more') // 'more'|'loading'|'noMore'
|
const hasMore = ref(true)
|
||||||
|
const loadMoreState = ref('loading')
|
||||||
|
|
||||||
const filteredList = computed(() => {
|
const filteredList = computed(() => {
|
||||||
return (list.value || []).filter(item => {
|
return (data.value.list || []).filter(item => {
|
||||||
const type = item?.type
|
const type = item?.type
|
||||||
return type !== 'descendant_stay_activedescendant' && type !== 'new_active'
|
return type !== 'descendant_stay_activedescendant' && type !== 'new_active'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 类型转中文
|
|
||||||
const typeToChinese = (type) => {
|
const typeToChinese = (type) => {
|
||||||
return typeConfig[type]?.chinese || typeConfig.default.chinese
|
return typeConfig[type]?.chinese || typeConfig.default.chinese
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取颜色样式
|
|
||||||
const getReportTypeStyle = (type) => {
|
const getReportTypeStyle = (type) => {
|
||||||
const config = typeConfig[type] || typeConfig.default
|
const config = typeConfig[type] || typeConfig.default
|
||||||
return `${config.color.bg} ${config.color.text}`
|
return `${config.color.bg} ${config.color.text}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取小圆点颜色
|
|
||||||
const getDotColor = (type) => {
|
const getDotColor = (type) => {
|
||||||
return typeConfig[type]?.color.dot || typeConfig.default.color.dot
|
return typeConfig[type]?.color.dot || typeConfig.default.color.dot
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载更多数据
|
function mergeUniqueById(oldList, newList) {
|
||||||
const onLoadMore = async () => {
|
const map = new Map()
|
||||||
if (loadMoreStatus.value === 'noMore') return
|
const resolveKey = (item, index) => String(item?.id ?? item?.order_id ?? `${item?.create_time || ''}_${item?.type || ''}_${index}`)
|
||||||
|
oldList.forEach((item, index) => {
|
||||||
page.value++
|
map.set(resolveKey(item, index), item)
|
||||||
await getData()
|
})
|
||||||
|
newList.forEach((item, index) => {
|
||||||
|
map.set(resolveKey(item, oldList.length + index), item)
|
||||||
|
})
|
||||||
|
return Array.from(map.values())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取数据
|
async function getData(reset = false) {
|
||||||
const getData = async () => {
|
|
||||||
try {
|
try {
|
||||||
|
if (loading.value)
|
||||||
|
return
|
||||||
|
if (!reset && !hasMore.value)
|
||||||
|
return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
loadMoreStatus.value = 'loading'
|
if (reset) {
|
||||||
|
page.value = 1
|
||||||
|
hasMore.value = true
|
||||||
|
loadMoreState.value = 'loading'
|
||||||
|
data.value = { total: 0, list: [] }
|
||||||
|
}
|
||||||
const res = await getAgentRewards({
|
const res = await getAgentRewards({
|
||||||
page: page.value,
|
page: page.value,
|
||||||
page_size: pageSize.value
|
page_size: pageSize.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (page.value === 1) {
|
const incoming = res.data.list || []
|
||||||
list.value = res.data.list
|
data.value.total = res.data.total || 0
|
||||||
total.value = res.data.total
|
data.value.list = reset ? incoming : mergeUniqueById(data.value.list, incoming)
|
||||||
} else {
|
const isLastPage = incoming.length < pageSize.value || data.value.list.length >= data.value.total
|
||||||
list.value.push(...res.data.list)
|
hasMore.value = !isLastPage
|
||||||
|
loadMoreState.value = isLastPage ? 'finished' : 'loading'
|
||||||
|
if (!isLastPage)
|
||||||
|
page.value += 1
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (list.value.length >= res.data.total || res.data.list.length < pageSize.value) {
|
loadMoreState.value = 'error'
|
||||||
loadMoreStatus.value = 'noMore'
|
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||||
} else {
|
|
||||||
loadMoreStatus.value = 'more'
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg || '加载失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
catch (error) {
|
||||||
uni.showToast({
|
loadMoreState.value = 'error'
|
||||||
title: '网络错误',
|
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||||
icon: 'none'
|
}
|
||||||
})
|
finally {
|
||||||
} finally {
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载
|
function onScrollToLower() {
|
||||||
onMounted(() => {
|
|
||||||
getData()
|
getData()
|
||||||
})
|
|
||||||
|
|
||||||
// 页面下拉刷新
|
|
||||||
const onPullDownRefresh = () => {
|
|
||||||
page.value = 1
|
|
||||||
loadMoreStatus.value = 'more'
|
|
||||||
getData().then(() => {
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出页面生命周期方法
|
onMounted(() => {
|
||||||
defineExpose({
|
getData(true)
|
||||||
onPullDownRefresh
|
})
|
||||||
|
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
getData(true).then(() => {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.scroll-container {
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<route type="page" lang="json">
|
<route type="page" lang="json">
|
||||||
{
|
{
|
||||||
"layout": "page",
|
"layout": "page",
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getAgentSubordinateContributionDetail } from '@/apis/agent'
|
import { getAgentSubordinateContributionDetail } from '@/apis/agent'
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const hasMore = ref(true)
|
||||||
|
const loadMoreState = ref('loading')
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const pageSize = 8
|
const pageSize = 10
|
||||||
const total = ref(0)
|
const data = ref({
|
||||||
const rewardDetails = ref([])
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
})
|
||||||
const userInfo = ref({})
|
const userInfo = ref({})
|
||||||
const summary = ref({})
|
const summary = ref({})
|
||||||
const statistics = ref([])
|
const statistics = ref([])
|
||||||
const subordinateId = ref(0)
|
const subordinateId = ref(0)
|
||||||
|
const initialized = ref(false)
|
||||||
|
|
||||||
function normalizeAgentLevel(value) {
|
function normalizeAgentLevel(value) {
|
||||||
const raw = String(value || '').trim()
|
const raw = String(value || '').trim()
|
||||||
@@ -72,11 +78,31 @@ function formatNumber(num) {
|
|||||||
return Number(num).toFixed(2)
|
return Number(num).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchRewardDetails() {
|
function mergeUniqueById(oldList, newList) {
|
||||||
|
const map = new Map()
|
||||||
|
const resolveKey = (item, index) => String(item?.id ?? `${item?.type || ''}_${item?.create_time || ''}_${index}`)
|
||||||
|
oldList.forEach((item, index) => {
|
||||||
|
map.set(resolveKey(item, index), item)
|
||||||
|
})
|
||||||
|
newList.forEach((item, index) => {
|
||||||
|
map.set(resolveKey(item, oldList.length + index), item)
|
||||||
|
})
|
||||||
|
return Array.from(map.values())
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getData(reset = false) {
|
||||||
|
try {
|
||||||
if (loading.value || !subordinateId.value)
|
if (loading.value || !subordinateId.value)
|
||||||
return
|
return
|
||||||
|
if (!reset && !hasMore.value)
|
||||||
|
return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
if (reset) {
|
||||||
|
page.value = 1
|
||||||
|
hasMore.value = true
|
||||||
|
loadMoreState.value = 'loading'
|
||||||
|
data.value = { total: 0, list: [] }
|
||||||
|
}
|
||||||
const res = await getAgentSubordinateContributionDetail({
|
const res = await getAgentSubordinateContributionDetail({
|
||||||
subordinate_id: subordinateId.value,
|
subordinate_id: subordinateId.value,
|
||||||
page: page.value,
|
page: page.value,
|
||||||
@@ -118,19 +144,33 @@ async function fetchRewardDetails() {
|
|||||||
item.amount = stats[keys[0]] || 0
|
item.amount = stats[keys[0]] || 0
|
||||||
item.count = stats[keys[1]] || 0
|
item.count = stats[keys[1]] || 0
|
||||||
})
|
})
|
||||||
|
initialized.value = true
|
||||||
}
|
}
|
||||||
total.value = res.data.total || 0
|
const incoming = res.data.list || []
|
||||||
rewardDetails.value = res.data.list || []
|
data.value.total = res.data.total || 0
|
||||||
|
data.value.list = reset ? incoming : mergeUniqueById(data.value.list, incoming)
|
||||||
|
const isLastPage = incoming.length < pageSize || data.value.list.length >= data.value.total
|
||||||
|
hasMore.value = !isLastPage
|
||||||
|
loadMoreState.value = isLastPage ? 'finished' : 'loading'
|
||||||
|
if (!isLastPage)
|
||||||
|
page.value += 1
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
loadMoreState.value = 'error'
|
||||||
|
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
loadMoreState.value = 'error'
|
||||||
|
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPageChange({ value }) {
|
function onScrollToLower() {
|
||||||
page.value = value
|
getData()
|
||||||
fetchRewardDetails()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad((query) => {
|
onLoad((query) => {
|
||||||
@@ -144,12 +184,22 @@ onMounted(() => {
|
|||||||
setTimeout(() => uni.navigateBack(), 800)
|
setTimeout(() => uni.navigateBack(), 800)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fetchRewardDetails()
|
getData(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
getData(true).then(() => {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="reward-detail">
|
<scroll-view
|
||||||
|
scroll-y
|
||||||
|
class="scroll-container"
|
||||||
|
@scrolltolower="onScrollToLower"
|
||||||
|
>
|
||||||
<view class="p-4">
|
<view class="p-4">
|
||||||
<view class="mb-4 rounded-xl bg-white p-5 shadow-sm">
|
<view class="mb-4 rounded-xl bg-white p-5 shadow-sm">
|
||||||
<view class="mb-4 flex items-center justify-between">
|
<view class="mb-4 flex items-center justify-between">
|
||||||
@@ -221,15 +271,15 @@ onMounted(() => {
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mb-4 rounded-xl bg-white p-4 shadow-sm">
|
<view class="rounded-xl bg-white p-4 shadow-sm">
|
||||||
<view class="text-base text-gray-800 font-medium">
|
<view class="text-base text-gray-800 font-medium">
|
||||||
贡献记录
|
贡献记录
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-scroll p-4">
|
<view>
|
||||||
<view v-if="rewardDetails.length === 0" class="py-8 text-center text-gray-500">
|
<view v-if="!loading && data.list.length === 0" class="py-8 text-center text-gray-500">
|
||||||
暂无贡献记录
|
暂无贡献记录
|
||||||
</view>
|
</view>
|
||||||
<view v-for="item in rewardDetails" v-else :key="item.id" class="reward-item">
|
<view v-for="item in data.list" v-else :key="item.id" class="reward-item">
|
||||||
<view class="mb-3 border-b border-gray-200 pb-3">
|
<view class="mb-3 border-b border-gray-200 pb-3">
|
||||||
<view class="flex items-center justify-between">
|
<view class="flex items-center justify-between">
|
||||||
<view>
|
<view>
|
||||||
@@ -252,24 +302,15 @@ onMounted(() => {
|
|||||||
加载中...
|
加载中...
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="px-4 pb-4">
|
<wd-loadmore :state="loadMoreState" @reload="getData" />
|
||||||
<wd-pagination
|
|
||||||
v-model="page"
|
|
||||||
:total="total"
|
|
||||||
:page-size="pageSize"
|
|
||||||
show-icon
|
|
||||||
show-message
|
|
||||||
@change="onPageChange"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</scroll-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.reward-detail {
|
.scroll-container {
|
||||||
min-height: 100vh;
|
height: 100vh;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,10 +321,6 @@ onMounted(() => {
|
|||||||
.reward-item:active {
|
.reward-item:active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-scroll {
|
|
||||||
min-height: 50vh;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<route type="page" lang="json">
|
<route type="page" lang="json">
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getAgentSubordinateList } from '@/apis/agent'
|
import { getAgentSubordinateList } from '@/apis/agent'
|
||||||
|
|
||||||
const subordinates = ref([])
|
const data = ref({
|
||||||
const loading = ref(false)
|
total: 0,
|
||||||
const page = ref(1)
|
list: [],
|
||||||
const pageSize = 8
|
|
||||||
const statistics = ref({
|
|
||||||
totalSubordinates: 0,
|
|
||||||
})
|
})
|
||||||
|
const loading = ref(false)
|
||||||
|
const hasMore = ref(true)
|
||||||
|
const loadMoreState = ref('loading')
|
||||||
|
const page = ref(1)
|
||||||
|
const pageSize = 10
|
||||||
|
|
||||||
function normalizeLevel(value) {
|
function normalizeLevel(value) {
|
||||||
const raw = String(value || '').trim()
|
const raw = String(value || '').trim()
|
||||||
@@ -51,28 +54,61 @@ function formatNumber(num) {
|
|||||||
return Number(num).toFixed(2)
|
return Number(num).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchSubordinates() {
|
function mergeUniqueById(oldList, newList) {
|
||||||
|
const map = new Map()
|
||||||
|
const resolveKey = (item, index) => String(item?.id ?? `${item?.mobile || ''}_${item?.create_time || ''}_${index}`)
|
||||||
|
oldList.forEach((item, index) => {
|
||||||
|
map.set(resolveKey(item, index), item)
|
||||||
|
})
|
||||||
|
newList.forEach((item, index) => {
|
||||||
|
map.set(resolveKey(item, oldList.length + index), item)
|
||||||
|
})
|
||||||
|
return Array.from(map.values())
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getData(reset = false) {
|
||||||
|
try {
|
||||||
if (loading.value)
|
if (loading.value)
|
||||||
return
|
return
|
||||||
|
if (!reset && !hasMore.value)
|
||||||
|
return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
if (reset) {
|
||||||
|
page.value = 1
|
||||||
|
hasMore.value = true
|
||||||
|
loadMoreState.value = 'loading'
|
||||||
|
data.value = { total: 0, list: [] }
|
||||||
|
}
|
||||||
const res = await getAgentSubordinateList({
|
const res = await getAgentSubordinateList({
|
||||||
page: page.value,
|
page: page.value,
|
||||||
page_size: pageSize,
|
page_size: pageSize,
|
||||||
})
|
})
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
statistics.value.totalSubordinates = res.data.total || 0
|
const incoming = res.data.list || []
|
||||||
subordinates.value = res.data.list || []
|
data.value.total = res.data.total || 0
|
||||||
|
data.value.list = reset ? incoming : mergeUniqueById(data.value.list, incoming)
|
||||||
|
const isLastPage = incoming.length < pageSize || data.value.list.length >= data.value.total
|
||||||
|
hasMore.value = !isLastPage
|
||||||
|
loadMoreState.value = isLastPage ? 'finished' : 'loading'
|
||||||
|
if (!isLastPage)
|
||||||
|
page.value += 1
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
loadMoreState.value = 'error'
|
||||||
|
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
loadMoreState.value = 'error'
|
||||||
|
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPageChange({ value }) {
|
function onScrollToLower() {
|
||||||
page.value = value
|
getData()
|
||||||
fetchSubordinates()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewDetail(item) {
|
function viewDetail(item) {
|
||||||
@@ -87,12 +123,22 @@ function viewDetail(item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchSubordinates()
|
getData(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
getData(true).then(() => {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="subordinate-list">
|
<scroll-view
|
||||||
|
scroll-y
|
||||||
|
class="scroll-container"
|
||||||
|
@scrolltolower="onScrollToLower"
|
||||||
|
>
|
||||||
<view class="p-4 pb-0">
|
<view class="p-4 pb-0">
|
||||||
<view class="rounded-xl bg-white p-4 shadow-sm">
|
<view class="rounded-xl bg-white p-4 shadow-sm">
|
||||||
<view class="flex items-center justify-center">
|
<view class="flex items-center justify-center">
|
||||||
@@ -101,15 +147,15 @@ onMounted(() => {
|
|||||||
下级总数
|
下级总数
|
||||||
</view>
|
</view>
|
||||||
<view class="text-2xl text-blue-600 font-semibold">
|
<view class="text-2xl text-blue-600 font-semibold">
|
||||||
{{ statistics.totalSubordinates }}
|
{{ data.total }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="subordinate-scroll p-4">
|
<view class="p-4">
|
||||||
<view v-for="(item, index) in subordinates" :key="item.id" class="subordinate-item">
|
<view v-for="(item, index) in data.list" :key="item.id" class="subordinate-item">
|
||||||
<view class="mb-4 flex flex-col rounded-xl bg-white p-5 shadow-sm">
|
<view class="mb-4 flex flex-col rounded-xl bg-white p-5 shadow-sm">
|
||||||
<view class="mb-4 flex items-center justify-between">
|
<view class="mb-4 flex items-center justify-between">
|
||||||
<view class="flex items-center space-x-3">
|
<view class="flex items-center space-x-3">
|
||||||
@@ -169,33 +215,20 @@ onMounted(() => {
|
|||||||
<view v-if="loading" class="py-4 text-center text-sm text-gray-400">
|
<view v-if="loading" class="py-4 text-center text-sm text-gray-400">
|
||||||
加载中...
|
加载中...
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="!subordinates.length" class="py-4 text-center text-sm text-gray-400">
|
<view v-else-if="!data.list.length" class="py-4 text-center text-sm text-gray-400">
|
||||||
暂无下级代理
|
暂无下级代理
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="px-4 pb-4">
|
<wd-loadmore :state="loadMoreState" @reload="getData" />
|
||||||
<wd-pagination
|
</scroll-view>
|
||||||
v-model="page"
|
|
||||||
:total="statistics.totalSubordinates"
|
|
||||||
:page-size="pageSize"
|
|
||||||
show-icon
|
|
||||||
show-message
|
|
||||||
@change="onPageChange"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.subordinate-list {
|
.scroll-container {
|
||||||
min-height: 100vh;
|
height: 100vh;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subordinate-scroll {
|
|
||||||
height: calc(100vh - 180px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.subordinate-item {
|
.subordinate-item {
|
||||||
transition: transform 0.2s;
|
transition: transform 0.2s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="min-h-screen bg-gray-50">
|
<scroll-view
|
||||||
<!-- 提现记录列表 -->
|
scroll-y
|
||||||
<uni-list :loading="loading" :loadmore="loadMoreStatus" @loadmore="onLoadMore">
|
class="scroll-container"
|
||||||
<EmptyState v-if="!loading && list.length === 0" text="暂无提现记录" />
|
@scrolltolower="onScrollToLower"
|
||||||
|
>
|
||||||
|
<EmptyState v-if="!loading && data.list.length === 0" text="暂无提现记录" />
|
||||||
|
|
||||||
<view v-for="(item, index) in list" :key="index" class="mx-4 my-2 bg-white rounded-lg p-4 shadow-sm">
|
<view v-for="(item, index) in data.list" :key="index" class="mx-4 my-2 bg-white rounded-lg p-4 shadow-sm">
|
||||||
<view class="flex justify-between items-center mb-2">
|
<view class="flex justify-between items-center mb-2">
|
||||||
<text class="text-gray-500 text-sm">{{ item.create_time || '-' }}</text>
|
<text class="text-gray-500 text-sm">{{ item.create_time || '-' }}</text>
|
||||||
<text class="font-bold" :class="getAmountColor(item.status)">{{ item.amount.toFixed(2) }}元</text>
|
<text class="font-bold" :class="getAmountColor(item.status)">{{ item.amount.toFixed(2) }}元</text>
|
||||||
@@ -22,18 +24,22 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 加载更多/加载完成提示 -->
|
<view v-if="loading" class="py-4 text-center text-sm text-gray-400">
|
||||||
<uni-load-more :status="loadMoreStatus" />
|
加载中...
|
||||||
</uni-list>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view v-else-if="!data.list.length" class="py-10 text-center text-sm text-gray-400">
|
||||||
|
暂无提现记录
|
||||||
|
</view>
|
||||||
|
<wd-loadmore :state="loadMoreState" @reload="getData" />
|
||||||
|
</scroll-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getWithdrawalRecords } from '@/apis/agent'
|
import { getWithdrawalRecords } from '@/apis/agent'
|
||||||
import { maskName } from '@/utils/format'
|
import { maskName } from '@/utils/format'
|
||||||
|
|
||||||
// 状态映射配置
|
|
||||||
const statusConfig = {
|
const statusConfig = {
|
||||||
1: {
|
1: {
|
||||||
chinese: '处理中',
|
chinese: '处理中',
|
||||||
@@ -66,103 +72,106 @@ const statusConfig = {
|
|||||||
|
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
const total = ref(0)
|
const data = ref({
|
||||||
const list = ref([])
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
})
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const loadMoreStatus = ref('more') // 'more'|'loading'|'noMore'
|
const hasMore = ref(true)
|
||||||
|
const loadMoreState = ref('loading')
|
||||||
|
|
||||||
// 状态转中文
|
|
||||||
const statusToChinese = (status) => {
|
const statusToChinese = (status) => {
|
||||||
return statusConfig[status]?.chinese || '未知状态'
|
return statusConfig[status]?.chinese || '未知状态'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取状态样式
|
|
||||||
const getStatusStyle = (status) => {
|
const getStatusStyle = (status) => {
|
||||||
const config = statusConfig[status] || {}
|
const config = statusConfig[status] || {}
|
||||||
return `${config.color?.bg || 'bg-gray-100'} ${config.color?.text || 'text-gray-800'}`
|
return `${config.color?.bg || 'bg-gray-100'} ${config.color?.text || 'text-gray-800'}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取小圆点颜色
|
|
||||||
const getDotColor = (status) => {
|
const getDotColor = (status) => {
|
||||||
return statusConfig[status]?.color.dot || 'bg-gray-500'
|
return statusConfig[status]?.color.dot || 'bg-gray-500'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取金额颜色
|
|
||||||
const getAmountColor = (status) => {
|
const getAmountColor = (status) => {
|
||||||
return statusConfig[status]?.color.amount || 'text-gray-500'
|
return statusConfig[status]?.color.amount || 'text-gray-500'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载更多数据
|
function mergeUniqueById(oldList, newList) {
|
||||||
const onLoadMore = async () => {
|
const map = new Map()
|
||||||
if (loadMoreStatus.value === 'noMore') return
|
const resolveKey = (item, index) => String(item?.id ?? item?.withdraw_no ?? `${item?.create_time || ''}_${item?.amount || ''}_${index}`)
|
||||||
|
oldList.forEach((item, index) => {
|
||||||
page.value++
|
map.set(resolveKey(item, index), item)
|
||||||
await getData()
|
})
|
||||||
|
newList.forEach((item, index) => {
|
||||||
|
map.set(resolveKey(item, oldList.length + index), item)
|
||||||
|
})
|
||||||
|
return Array.from(map.values())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取数据
|
async function getData(reset = false) {
|
||||||
const getData = async () => {
|
|
||||||
try {
|
try {
|
||||||
|
if (loading.value)
|
||||||
|
return
|
||||||
|
if (!reset && !hasMore.value)
|
||||||
|
return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
loadMoreStatus.value = 'loading'
|
if (reset) {
|
||||||
|
page.value = 1
|
||||||
|
hasMore.value = true
|
||||||
|
loadMoreState.value = 'loading'
|
||||||
|
data.value = { total: 0, list: [] }
|
||||||
|
}
|
||||||
const res = await getWithdrawalRecords({
|
const res = await getWithdrawalRecords({
|
||||||
page: page.value,
|
page: page.value,
|
||||||
page_size: pageSize.value
|
page_size: pageSize.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (page.value === 1) {
|
const incoming = res.data.list || []
|
||||||
list.value = res.data.list
|
data.value.total = res.data.total || 0
|
||||||
total.value = res.data.total
|
data.value.list = reset ? incoming : mergeUniqueById(data.value.list, incoming)
|
||||||
} else {
|
const isLastPage = incoming.length < pageSize.value || data.value.list.length >= data.value.total
|
||||||
list.value.push(...res.data.list)
|
hasMore.value = !isLastPage
|
||||||
|
loadMoreState.value = isLastPage ? 'finished' : 'loading'
|
||||||
|
if (!isLastPage)
|
||||||
|
page.value += 1
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (list.value.length >= res.data.total || res.data.list.length < pageSize.value) {
|
loadMoreState.value = 'error'
|
||||||
loadMoreStatus.value = 'noMore'
|
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||||
} else {
|
|
||||||
loadMoreStatus.value = 'more'
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg || '加载失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
catch (error) {
|
||||||
uni.showToast({
|
loadMoreState.value = 'error'
|
||||||
title: '网络错误',
|
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||||
icon: 'none'
|
}
|
||||||
})
|
finally {
|
||||||
} finally {
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载
|
function onScrollToLower() {
|
||||||
onMounted(() => {
|
|
||||||
getData()
|
getData()
|
||||||
})
|
|
||||||
|
|
||||||
// 页面下拉刷新
|
|
||||||
const onPullDownRefresh = () => {
|
|
||||||
page.value = 1
|
|
||||||
loadMoreStatus.value = 'more'
|
|
||||||
getData().then(() => {
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出页面生命周期方法
|
onMounted(() => {
|
||||||
defineExpose({
|
getData(true)
|
||||||
onPullDownRefresh
|
})
|
||||||
|
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
getData(true).then(() => {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
/* 自定义样式 */
|
.scroll-container {
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<route type="page" lang="json">{
|
<route type="page" lang="json">{
|
||||||
"layout": "page",
|
"layout": "page",
|
||||||
"title": "提现记录",
|
"title": "提现记录",
|
||||||
|
|||||||
@@ -99,6 +99,25 @@ function request(options) {
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
// 响应拦截器逻辑
|
// 响应拦截器逻辑
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
|
// 检测会员过期响应头,自动刷新代理信息
|
||||||
|
const header = res.header || {}
|
||||||
|
if (header['X-Membership-Expired'] === 'true' || header['x-membership-expired'] === 'true') {
|
||||||
|
const { getAgentInfo } = require('@/apis/agent.js')
|
||||||
|
getAgentInfo().then(res => {
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
uni.setStorageSync('agentInfo', {
|
||||||
|
level: res.data.level,
|
||||||
|
isAgent: res.data.is_agent,
|
||||||
|
status: res.data.status,
|
||||||
|
agentID: res.data.agent_id,
|
||||||
|
mobile: res.data.mobile,
|
||||||
|
isRealName: res.data.is_real_name,
|
||||||
|
expiryTime: res.data.expiry_time
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
if (res.data?.code === USER_DISABLED_CODE || res.data?.code === USER_CANCELLED_CODE) {
|
if (res.data?.code === USER_DISABLED_CODE || res.data?.code === USER_CANCELLED_CODE) {
|
||||||
forceLogoutToLogin()
|
forceLogoutToLogin()
|
||||||
reject(res.data)
|
reject(res.data)
|
||||||
|
|||||||
Reference in New Issue
Block a user