import { defineComponent, reactive, onMounted, computed } from 'vue' import { Cell, Grid, GridItem, Progress, Icon, List } from 'vant' import OEmpty from '@/components/o-empty' import styles from './index.module.less' import OSticky from '@/components/o-sticky' import OHeader from '@/components/o-header' import request from '@/helpers/request' import dayjs from 'dayjs' import { moneyFormat } from '@/helpers/utils' import { postMessage } from '@/helpers/native-message' export default defineComponent({ name: 'practice-rewards', setup() { const state = reactive({ list: [] as any, listState: { dataShow: true, // 判断是否有数据 loading: false, finished: false }, statistics: { totalTrainingSalary: 0, waitSalary: 0 } }) const getStatistics = async () => { try { const { data } = await request.post('/api-school/schoolWeekSalaryRecord/trainingStatistics') console.log(data) state.statistics = { totalTrainingSalary: data.totalTrainingSalary || 0, waitSalary: data.waitSalary || 0 } } catch { // } } const getList = async () => { try { const res = await request.post('/api-school/schoolWeekSalaryRecord/trainingList', { data: {} }) const result = res.data || [] // 处理重复请求数据 if (state.list.length > 0 && result.current === 1) { return } state.list = res.data || [] state.listState.dataShow = state.list.length > 0 } catch { state.listState.dataShow = false } } onMounted(() => { getStatistics() getList() }) return () => (
{/* {{ right: () => ( { // MANAGE,COURSE,TRAINING postMessage({ api: 'open_app_page', content: { action: 'app', pageTag: 'settlementRecord', url: '', params: JSON.stringify({ type: 'TRAINING' }) } }) }} > 结算记录 ) }} */}
待结算金额 (元)
¥ {moneyFormat(state.statistics.waitSalary)}
{ // MANAGE,COURSE,TRAINING postMessage({ api: 'open_app_page', content: { action: 'app', pageTag: 'settlementRecord', url: '', params: JSON.stringify({ type: 'TRAINING' }) } }) }} > 结算记录
{state.listState.dataShow ? ( state.list.map((item: any) => (
{{ title: () => (
{dayjs(item.startTime).format('YYYY-MM-DD')} 至{' '} {dayjs(item.endTime).format('YYYY-MM-DD')} {!item.settleFlag ? '待结算' : '已结算'}
) }}
{item.targetNum || 0}
练习达标人数
{moneyFormat(item.totalSalary || 0)}
奖励金额
)) ) : ( )}
) } })