feat 现金流水记录

This commit is contained in:
bootx
2024-02-18 23:36:50 +08:00
parent 20de0062d6
commit cb959867de
4 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import { defHttp } from '/@/utils/http/axios'
import { Result, PageResult } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 分页
*/
export function page(params) {
return defHttp.get<Result<PageResult<CashRecord[]>>>({
url: '/cash/record/page',
params,
})
}
/**
* 详情
*/
export function get(id) {
return defHttp.get<Result<CashRecord>>({
url: '/cash/record/findById',
params: { id },
})
}
/**
* 现金记录
*/
export interface CashRecord extends BaseEntity {
// 类型
type: string
// 金额
amount: string
// 交易订单号
orderId: string
// 地址
ip: string
// 备注
remark: string
}

View File

@@ -0,0 +1,100 @@
<template>
<div>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" @query="queryPage" @reset="resetQueryParams" />
</div>
<div class="m-3 p-3 bg-white">
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<vxe-table
row-id="id"
ref="xTable"
:data="pagination.records"
:loading="loading"
:sort-config="{ remote: true, trigger: 'cell' }"
@sort-change="sortChange"
>
<vxe-column type="seq" title="序号" width="60" />
<vxe-column field="orderId" title="本地订单ID" width="170" />
<vxe-column field="amount" title="金额" width="170" />
<vxe-column field="type" title="回调类型">
<template #default="{ row }">
<a-tag>{{ dictConvert('CashRecordType', row.type) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="remark" title="备注" />
<vxe-column field="createTime" title="创建时间" sortable />
<!-- <vxe-column fixed="right" width="60" :showOverflow="false" title="操作">-->
<!-- <template #default="{ row }">-->
<!-- <span>-->
<!-- <a-link @click="show(row)">查看</a-link>-->
<!-- </span>-->
<!-- </template>-->
<!-- </vxe-column>-->
</vxe-table>
<vxe-pager
size="medium"
:loading="loading"
:current-page="pagination.current"
:page-size="pagination.size"
:total="pagination.total"
@page-change="handleTableChange"
/>
</div>
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { page } from './CashRecord.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import { VxeTable, VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, sortChange, sortParam, pages, model, loading } =
useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = computed(() => {
return [{ field: 'orderId', type: STRING, name: '本地订单ID', placeholder: '请输入完整本地订单ID' }] as QueryField[]
})
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
onMounted(() => {
vxeBind()
queryPage()
})
function vxeBind() {
xTable?.connect(xToolbar as VxeToolbarInstance)
}
/**
* 分页查询
*/
function queryPage() {
loading.value = true
page({
...model.queryParam,
...pages,
...sortParam,
}).then(({ data }) => {
pageQueryResHandel(data)
})
return Promise.resolve()
}
/**
* 查看
*/
function show(record) {
}
</script>
<style lang="less" scoped></style>

View File

@@ -19,6 +19,8 @@
<vxe-column field="oldAmount" title="变动之前的金额" />
<vxe-column field="newAmount" title="变动之后的金额" />
<vxe-column field="createTime" title="记录时间" sortable />
<vxe-column field="remark" title="备注" />
<vxe-column field="createTime" title="创建时间" sortable />
</vxe-table>
<vxe-pager
size="medium"

View File

@@ -18,6 +18,7 @@
<vxe-column field="amount" title="金额" />
<vxe-column field="oldAmount" title="变动之前的金额" />
<vxe-column field="newAmount" title="变动之后的金额" />
<vxe-column field="remark" title="备注" />
<vxe-column field="createTime" title="记录时间" sortable />
</vxe-table>
<vxe-pager