hookehuyr

fix(recall): 修复志愿者数量字段名不一致问题并调整活动历史页面显示

修正timeline.vue中volunteer_qty字段名为volunteers_qty以保持一致性
调整ActivityHistoryPage.vue的日期显示格式和金额显示逻辑
优化海报生成路由参数使用campaign_id为id
......@@ -44,12 +44,13 @@
<div class="flex justify-between items-center text-xs text-[#666] mb-2">
<span>单价: ¥{{ item.price.toFixed(2) }}/人</span>
<span>人数: {{ item.count }}</span>
<!-- <span>人数: {{ item.count }}</span> -->
<span class="text-[#FF3B30] font-bold">实付金额: ¥{{ item.price.toFixed(2) }}</span>
</div>
<div class="flex justify-between items-center text-xs text-[#666] mb-4">
<span>下单时间: {{ item.date }}</span>
<span class="text-[#FF3B30] font-bold">实付金额: ¥{{ item.total.toFixed(0) }}</span>
<!-- <span>下单时间: {{ item.date }}</span> -->
<!-- <span class="text-[#FF3B30] font-bold">实付金额: ¥{{ item.total.toFixed(0) }}</span> -->
</div>
<div class="flex justify-end">
......@@ -123,7 +124,12 @@ const missingInfo = ref('')
// 处理生成海报
const handleGeneratePoster = (item) => {
router.push({ path: '/recall/poster', query: { title: item.title, stu_uid: item.stu_uid, campaign_id: item.campaign_id } })
router.push({
path: '/recall/poster',
query: {
title: item.title, stu_uid: item.stu_uid, campaign_id: item.id
}
})
}
const handleCollectCoins = async () => {
......@@ -197,12 +203,16 @@ onMounted(async () => {
title: item.campaign_name || '',
price: item.fee_stu || 0,
count: item.stu_cnt || 0,
date: item.create_time?.substring(0, 10) || '',
date: item.campaign_year|| '',
total: item.fee_stu * item.stu_cnt || 0
}))
// 遍历日期把列表date字段从小到大排序, 获取到其中日期段 比如 2020-2025
const sortedDates = activities.value.map(item => item.date).sort((a, b) => new Date(a) - new Date(b))
recordDate.value = sortedDates[0]?.substring(0, 4) + '-' + sortedDates[sortedDates.length - 1]?.substring(0, 4) || ''
if (sortedDates[0] !== sortedDates[sortedDates.length - 1]) {
recordDate.value = sortedDates[0] + '-' + sortedDates[sortedDates.length - 1] || ''
} else {
recordDate.value = sortedDates[0] || ''
}
}
}
}
......@@ -219,11 +229,15 @@ onMounted(async () => {
title: item.campaign_name || '',
price: item.fee_stu || 0,
count: item.stu_cnt || 0,
date: item.create_time?.substring(0, 10) || '',
date: item.campaign_year || '',
total: item.fee_stu * item.stu_cnt || 0
}));
const sortedDates = activities.value.map(item => item.date).sort((a, b) => new Date(a) - new Date(b))
recordDate.value = sortedDates[0]?.substring(0, 4) + '-' + sortedDates[sortedDates.length - 1]?.substring(0, 4) || ''
if (sortedDates[0] !== sortedDates[sortedDates.length - 1]) {
recordDate.value = sortedDates[0] + '-' + sortedDates[sortedDates.length - 1] || ''
} else {
recordDate.value = sortedDates[0] || ''
}
}
}
}
......
......@@ -178,7 +178,7 @@ onMounted(async () => {
})
if (res.code) {
activityCount.value = res.data?.payment_qty || 0
volunteerCount.value = res.data?.volunteer_qty || 0
volunteerCount.value = res.data?.volunteers_qty || 0
recordDate.value = res.data?.record_date || ''
lastActivityDate.value = res.data?.last_activity_date || ''
}
......@@ -188,7 +188,7 @@ onMounted(async () => {
const res = await searchOldActivityAPI()
if (res.code) {
activityCount.value = res.data?.payment_qty || 0
volunteerCount.value = res.data?.volunteer_qty || 0
volunteerCount.value = res.data?.volunteers_qty || 0
recordDate.value = res.data?.record_date || ''
lastActivityDate.value = res.data?.last_activity_date || ''
}
......