feat(admin): full integration of order, product, and finance modules with real RPC data streams

This commit is contained in:
comlibmb
2026-02-11 16:59:38 +08:00
parent cd7b92d496
commit 7e2246fec5
33 changed files with 2535 additions and 2093 deletions

View File

@@ -4,10 +4,10 @@
<view class="filter-card border-shadow">
<view class="filter-row">
<view class="filter-item">
<text class="filter-label">创建时间:</text>
<text class="filter-label">时间筛选:</text>
<view class="date-picker-wrap">
<text class="calendar-icon">📅</text>
<text class="date-placeholder">开始日期 - 结束日期</text>
<text class="date-placeholder">最近30天</text>
</view>
</view>
</view>
@@ -17,36 +17,45 @@
<view class="content-card border-shadow">
<!-- 汇总选项卡 -->
<view class="tab-header">
<view class="tab-item active"><text class="tab-txt active-txt">日账单</text></view>
<view class="tab-item"><text class="tab-txt">周账单</text></view>
<view class="tab-item"><text class="tab-txt">月账单</text></view>
<view
v-for="(item, index) in intervalOptions"
:key="index"
:class="['tab-item', currentTab === index ? 'active' : '']"
@click="handleTabChange(index)"
>
<text :class="['tab-txt', currentTab === index ? 'active-txt' : '']">{{ item.label }}</text>
</view>
</view>
<!-- 表格区域 -->
<view class="table-container">
<view class="table-header">
<view class="th col-id"><text class="th-txt">ID</text></view>
<view class="th col-title"><text class="th-txt">标题</text></view>
<view class="th col-date"><text class="th-txt">期</text></view>
<view class="th col-id"><text class="th-txt">序号</text></view>
<view class="th col-title"><text class="th-txt">账单周期</text></view>
<view class="th col-date"><text class="th-txt">具体日期/周期</text></view>
<view class="th col-income"><text class="th-txt">收入金额</text></view>
<view class="th col-expense"><text class="th-txt">支出金额</text></view>
<view class="th col-entry"><text class="th-txt">入账金额</text></view>
<view class="th col-entry"><text class="th-txt">入账</text></view>
<view class="th col-ops"><text class="th-txt">操作</text></view>
</view>
<view class="table-body">
<view class="table-row" v-for="item in tableData" :key="item.id">
<view class="td col-id"><text class="td-txt">{{ item.id }}</text></view>
<view class="td col-title text-left"><text class="td-txt">{{ item.title }}</text></view>
<view class="td col-date"><text class="td-txt">{{ item.date }}</text></view>
<view class="td col-income"><text class="td-txt red-txt">¥{{ item.income }}</text></view>
<view class="td col-expense"><text class="td-txt green-txt">¥{{ item.expense }}</text></view>
<view class="td col-entry"><text class="td-txt">¥{{ item.entry }}</text></view>
<view v-if="loading" class="table-loading" style="padding: 40px; text-align: center;">
<text>加载中...</text>
</view>
<view v-else-if="tableData.length === 0" class="table-empty" style="padding: 40px; text-align: center;">
<text>暂无账单数据</text>
</view>
<view v-else class="table-row" v-for="(item, index) in tableData" :key="index">
<view class="td col-id"><text class="td-txt">{{ index + 1 }}</text></view>
<view class="td col-title text-left"><text class="td-txt">{{ intervalOptions[currentTab].label }}</text></view>
<view class="td col-date"><text class="td-txt">{{ item.date_group }}</text></view>
<view class="td col-income"><text class="td-txt red-txt">¥{{ item.income.toFixed(2) }}</text></view>
<view class="td col-expense"><text class="td-txt green-txt">¥{{ item.expense.toFixed(2) }}</text></view>
<view class="td col-entry"><text class="td-txt">¥{{ item.net_entry.toFixed(2) }}</text></view>
<view class="td col-ops">
<view class="ops-wrap">
<text class="op-link">账单详情</text>
<text class="op-divider">|</text>
<text class="op-link">下载</text>
<text class="op-link">查看流水</text>
</view>
</view>
</view>
@@ -57,29 +66,46 @@
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { ref, onMounted } from 'vue'
import { fetchFinanceBillSummary } from '@/services/admin/financeService.uts'
interface BillSumRecord {
id: number
title: string
date: string
income: string
expense: string
entry: string
const currentTab = ref(0)
const loading = ref(false)
const tableData = ref<any[]>([])
const intervalOptions = [
{ label: '日账单', value: 'day' },
{ label: '周账单', value: 'week' },
{ label: '月账单', value: 'month' }
]
async function loadData() {
loading.value = true
const endTime = new Date().toISOString()
const startTime = new Date(Date.now() - 90 * 24 * 60 * 60 * 1000).toISOString() // 默认查最近90天
try {
const res = await fetchFinanceBillSummary(
startTime,
endTime,
intervalOptions[currentTab.value].value
)
tableData.value = res
} catch (e) {
uni.showToast({ title: '加载账单失败', icon: 'none' })
} finally {
loading.value = false
}
}
const tableData = ref<BillSumRecord[]>([
{ id: 1, title: '日账单', date: '2026-02-03', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 2, title: '日账单', date: '2026-02-01', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 3, title: '日账单', date: '2026-01-30', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 4, title: '日账单', date: '2026-01-29', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 5, title: '日账单', date: '2026-01-28', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 6, title: '日账单', date: '2026-01-27', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 7, title: '日账单', date: '2026-01-26', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 8, title: '日账单', date: '2026-01-25', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 9, title: '日账单', date: '2026-01-23', income: '0.00', expense: '0.00', entry: '0.00' },
{ id: 10, title: '日账单', date: '2026-01-22', income: '0.00', expense: '0.00', entry: '0.00' }
])
onMounted(() => {
loadData()
})
const handleTabChange = (index : number) => {
currentTab.value = index
loadData()
}
</script>
<style scoped lang="scss">
@@ -187,7 +213,7 @@ const tableData = ref<BillSumRecord[]>([
}
.table-header {
background-color: #e6f0ff; /* 对应截图的淡蓝色背景 */
background-color: #e6f0ff;
display: flex;
flex-direction: row;
}
@@ -227,7 +253,6 @@ const tableData = ref<BillSumRecord[]>([
color: #606266;
}
/* 列宽分配 */
.col-id { width: 80px; }
.col-title { width: 150px; }
.col-date { width: 220px; }
@@ -240,16 +265,14 @@ const tableData = ref<BillSumRecord[]>([
justify-content: flex-start;
}
/* 颜色 */
.red-txt {
color: #f5222d; /* 收入红色 */
color: #f5222d;
}
.green-txt {
color: #52c41a; /* 支出绿色 */
color: #52c41a;
}
/* 操作项 */
.ops-wrap {
display: flex;
flex-direction: row;
@@ -261,162 +284,4 @@ const tableData = ref<BillSumRecord[]>([
color: #1890ff;
cursor: pointer;
}
.op-divider {
margin: 0 8px;
color: #e8e8e8;
font-size: 12px;
}
</style>
<style scoped lang="scss">
.finance-bill {
padding: 20px;
background-color: #f5f7fa;
min-height: 100vh;
}
.border-shadow {
background-color: #fff;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.filter-card {
padding: 20px 24px;
margin-bottom: 20px;
}
.filter-row {
display: flex;
flex-direction: row;
align-items: center;
}
.filter-item {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 28px;
}
.filter-label {
font-size: 14px;
color: #333;
margin-right: 10px;
}
.date-picker-wrap, .select-box {
width: 200px;
height: 32px;
border: 1px solid #dcdfe6;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 12px;
}
.calendar-icon {
font-size: 12px;
margin-right: 8px;
}
.date-placeholder, .select-txt {
font-size: 13px;
color: #606266;
}
.arrow-down {
margin-left: auto;
font-size: 8px;
color: #c0c4cc;
}
.btn-query, .btn-export {
height: 32px;
padding: 0 20px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
margin-left: 10px;
}
.btn-query {
background-color: #1890ff;
}
.btn-export {
background-color: #fff;
border: 1px solid #dcdfe6;
}
.btn-txt { color: #fff; font-size: 14px; }
.export-txt { color: #606266; font-size: 14px; }
/* 表格样式 */
.table-container {
display: flex;
flex-direction: column;
}
.table-header {
background-color: #f8f9fb;
display: flex;
flex-direction: row;
border-bottom: 1px solid #ebeef5;
}
.th {
padding: 15px 10px;
display: flex;
align-items: center;
justify-content: center;
}
.th-txt {
font-size: 14px;
font-weight: 600;
color: #909399;
}
.table-row {
display: flex;
flex-direction: row;
border-bottom: 1px solid #ebeef5;
}
.td {
padding: 15px 10px;
display: flex;
align-items: center;
justify-content: center;
}
.td-txt {
font-size: 13px;
color: #606266;
}
.col-id { width: 100px; }
.col-title { width: 150px; }
.col-type { width: 120px; }
.col-amount { width: 120px; }
.col-time { width: 180px; }
.col-remark { flex: 1; min-width: 200px; }
.text-left { justify-content: flex-start; }
.type-tag {
font-size: 12px;
padding: 2px 8px;
border-radius: 2px;
}
.tag-green { background-color: #f0f9eb; color: #67c23a; border: 1px solid #e1f3d8; }
.tag-orange { background-color: #fdf6ec; color: #e6a23c; border: 1px solid #faecd8; }
.green-txt { color: #67c23a; }
.red-txt { color: #f56c6c; }
</style>