oa_app仓库初始化
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<fy-header :title="title" back />
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FyHeader from '../../components/fy-header.vue'
|
||||
import { store } from '../../utils/store.js'
|
||||
import { asList } from '../../utils/format.js'
|
||||
import { oaGet } from '../../utils/api.js'
|
||||
|
||||
export default {
|
||||
components: { FyHeader },
|
||||
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: #737686; }
|
||||
.amt { color: #004ac6; font-weight: 700; }
|
||||
.empty { padding: 80rpx; text-align: center; color: #737686; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user