Files

72 lines
2.6 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page edge">
<fy-header :title="title" back />
<fy-scroll class="edge-scroll" @refresh="load">
<view v-if="loading" class="empty">
<wd-skeleton theme="paragraph" />
</view>
<wd-status-tip v-else-if="!rows.length" image="content" tip="暂无记录" />
<view v-for="r in rows" :key="r.id || r.no" class="card item" @click="open(r)">
<view class="main">
<text class="t">{{ r.title || r.no || r.typeLabel }}</text>
<text class="s">{{ r.createdAt || r.date || '' }}</text>
</view>
<view class="side">
<text v-if="r.amount != null" class="amt">¥{{ r.amount }}</text>
<wd-tag v-if="r.status" type="primary" plain>{{ r.status }}</wd-tag>
</view>
<text class="arr"></text>
</view>
</fy-scroll>
</view>
</template>
<script>
import FyHeader from '../../components/fy-header.vue'
import FyScroll from '../../components/fy-scroll.vue'
import { store } from '../../utils/store.js'
import { asList } from '../../utils/format.js'
import { oaGet } from '../../utils/api.js'
export default {
components: { FyHeader, FyScroll },
data() { return { title: '单据', type: 'expense', rows: [], loading: false } },
onLoad(q) {
this.type = q.type || 'expense'
this.title = decodeURIComponent(q.title || (this.type === 'loan' ? '我的借支' : this.type === 'seal' ? '我的用章' : '我的报销'))
this.load()
},
methods: {
async load() {
this.loading = true
try {
if (this.type === 'seal') {
this.rows = asList(await oaGet('/seals/logs?mine=1', store.token))
} else {
this.rows = asList(await oaGet(`/finance/bills?type=${this.type}&mine=1`, store.token))
}
} catch (_) {
this.rows = []
} finally {
this.loading = false
}
},
open(r) {
const no = r.no || r.requestNo
if (no) uni.navigateTo({ url: '/pages/todo/detail?no=' + encodeURIComponent(no) })
}
}
}
</script>
<style scoped>
.item { margin: 16rpx 24rpx; padding: 24rpx; display: flex; align-items: center; }
.main { flex: 1; min-width: 0; }
.t { display: block; font-size: 28rpx; font-weight: 650; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s { display: block; margin-top: 8rpx; font-size: 24rpx; color: #6B7280; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 8rpx; margin-left: 16rpx; }
.amt { color: #1677FF; font-weight: 700; font-size: 28rpx; }
.arr { color: #C4C9D4; font-size: 32rpx; margin-left: 8rpx; }
.empty { padding: 80rpx 40rpx; }
</style>