63 lines
2.1 KiB
Vue
63 lines
2.1 KiB
Vue
<template>
|
|
<view class="page edge">
|
|
<fy-header :title="title" back />
|
|
<fy-scroll class="edge-scroll" @refresh="load">
|
|
<view v-if="loading" class="empty">加载中…</view>
|
|
<view v-else-if="!rows.length" class="empty">暂无记录</view>
|
|
<view v-for="r in rows" :key="r.id || r.no" class="card item" @click="open(r)">
|
|
<view>
|
|
<text class="t">{{ r.title || r.no || r.typeLabel }}</text>
|
|
<text class="s">{{ r.status || '' }} · {{ r.createdAt || r.date || '' }}</text>
|
|
</view>
|
|
<text class="amt">{{ r.amount != null ? '¥' + r.amount : '' }}</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; justify-content: space-between; }
|
|
.t { display: block; font-size: 28rpx; font-weight: 600; }
|
|
.s { font-size: 22rpx; color: #6B7280; }
|
|
.amt { color: #1677FF; font-weight: 700; }
|
|
.empty { padding: 80rpx; text-align: center; color: #6B7280; }
|
|
</style>
|