当日数据代码框架
This commit is contained in:
39
src/api/lb-daily-user-trade.js
Normal file
39
src/api/lb-daily-user-trade.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getLbDailyUserTradeList(params) {
|
||||
return request({
|
||||
url: '/lbDailyUserTrade/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getLbDailyUserTradeById(id) {
|
||||
return request({
|
||||
url: `/lbDailyUserTrade/get/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function addLbDailyUserTrade(data) {
|
||||
return request({
|
||||
url: '/lbDailyUserTrade/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateLbDailyUserTrade(data) {
|
||||
return request({
|
||||
url: '/lbDailyUserTrade/update',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteLbDailyUserTrade(id) {
|
||||
return request({
|
||||
url: `/lbDailyUserTrade/delete/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -367,6 +367,33 @@ export const constantRoutes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/lb-business',
|
||||
component: Layout,
|
||||
redirect: '/lb-business/daily-trade',
|
||||
name: 'LbBusinessRoot',
|
||||
meta: { title: '轻美业务', icon: 'el-icon-s-data', alwaysShow: true },
|
||||
children: [
|
||||
{
|
||||
path: 'daily-trade',
|
||||
name: 'LbDailyTrade',
|
||||
component: () => import('@/views/lb-business/daily-trade/index'),
|
||||
meta: { title: '当天交易', icon: 'el-icon-s-order' }
|
||||
},
|
||||
{
|
||||
path: 'daily-report',
|
||||
name: 'LbDailyReport',
|
||||
component: () => import('@/views/lb-business/daily-report/index'),
|
||||
meta: { title: '当天报表', icon: 'el-icon-data-analysis' }
|
||||
},
|
||||
{
|
||||
path: 'report-statistics',
|
||||
name: 'LbReportStatistics',
|
||||
component: () => import('@/views/lb-business/report-statistics/index'),
|
||||
meta: { title: '报表统计', icon: 'el-icon-pie-chart' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/system',
|
||||
|
||||
29
src/views/lb-business/daily-report/index.vue
Normal file
29
src/views/lb-business/daily-report/index.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="never">
|
||||
<div class="placeholder-title">当天报表</div>
|
||||
<div class="placeholder-desc">
|
||||
页面入口已创建,可在此按业务需求补充当天报表统计维度与图表。
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'LbDailyReport'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.placeholder-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.placeholder-desc {
|
||||
color: #606266;
|
||||
line-height: 22px;
|
||||
}
|
||||
</style>
|
||||
383
src/views/lb-business/daily-trade/index.vue
Normal file
383
src/views/lb-business/daily-trade/index.vue
Normal file
@@ -0,0 +1,383 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card class="filter-container" shadow="never">
|
||||
<el-form :model="queryParams" :inline="true" label-width="100px">
|
||||
<el-form-item label="租户ID">
|
||||
<el-input v-model="queryParams.tenantId" clearable placeholder="请输入租户ID" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID">
|
||||
<el-input v-model="queryParams.userId" clearable placeholder="请输入用户ID" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称">
|
||||
<el-input v-model="queryParams.nickname" clearable placeholder="请输入昵称" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推广人">
|
||||
<el-input v-model="queryParams.promoterName" clearable placeholder="请输入推广人" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="action-container" shadow="never">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||
</el-card>
|
||||
|
||||
<el-card class="table-container" shadow="never">
|
||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||
<el-table-column label="ID" prop="id" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="租户ID" prop="tenantId" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="用户ID" prop="userId" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="昵称" prop="nickname" min-width="120" />
|
||||
<el-table-column label="卖出金额" prop="dailySellAmt" min-width="110" />
|
||||
<el-table-column label="买入金额" prop="dailyBuyAmt" min-width="110" />
|
||||
<el-table-column label="差额" prop="diffAmt" min-width="100" />
|
||||
<el-table-column label="推广人ID" prop="promoterId" min-width="120" />
|
||||
<el-table-column label="推广人" prop="promoterName" min-width="120" />
|
||||
<el-table-column label="描述" prop="descContent" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="创建时间" prop="createdAt" min-width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.createdAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" prop="updatedAt" min-width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.updatedAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
:current-page="queryParams.current"
|
||||
:page-size="queryParams.size"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="720px" @close="resetForm">
|
||||
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="110px">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" placeholder="请输入租户ID" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户ID" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="昵称" prop="nickname">
|
||||
<el-input v-model="form.nickname" placeholder="请输入昵称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="推广人ID" prop="promoterId">
|
||||
<el-input v-model="form.promoterId" placeholder="请输入推广人ID" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="推广人" prop="promoterName">
|
||||
<el-input v-model="form.promoterName" placeholder="请输入推广人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="差额" prop="diffAmt">
|
||||
<el-input v-model="form.diffAmt" placeholder="可选,不填则后端自动计算" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="卖出金额" prop="dailySellAmt">
|
||||
<el-input v-model="form.dailySellAmt" placeholder="请输入卖出金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="买入金额" prop="dailyBuyAmt">
|
||||
<el-input v-model="form.dailyBuyAmt" placeholder="请输入买入金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="描述" prop="descContent">
|
||||
<el-input v-model="form.descContent" type="textarea" :rows="3" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addLbDailyUserTrade,
|
||||
deleteLbDailyUserTrade,
|
||||
getLbDailyUserTradeList,
|
||||
updateLbDailyUserTrade
|
||||
} from '@/api/lb-daily-user-trade'
|
||||
|
||||
export default {
|
||||
name: 'LbDailyTrade',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
submitLoading: false,
|
||||
list: [],
|
||||
total: 0,
|
||||
dialogVisible: false,
|
||||
dialogTitle: '',
|
||||
isEdit: false,
|
||||
queryParams: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
tenantId: '',
|
||||
userId: '',
|
||||
nickname: '',
|
||||
promoterId: '',
|
||||
promoterName: '',
|
||||
createdStartTime: '',
|
||||
createdEndTime: ''
|
||||
},
|
||||
form: {
|
||||
id: '',
|
||||
tenantId: '',
|
||||
userId: '',
|
||||
nickname: '',
|
||||
dailySellAmt: '',
|
||||
dailyBuyAmt: '',
|
||||
diffAmt: '',
|
||||
promoterId: '',
|
||||
promoterName: '',
|
||||
descContent: ''
|
||||
},
|
||||
formRules: {
|
||||
tenantId: [{ required: true, message: '请输入租户ID', trigger: 'blur' }],
|
||||
userId: [{ required: true, message: '请输入用户ID', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchList()
|
||||
},
|
||||
methods: {
|
||||
fetchList() {
|
||||
this.loading = true
|
||||
getLbDailyUserTradeList(this.buildListParams())
|
||||
.then((res) => {
|
||||
if (res && (res.code === 20000 || res.code === 200)) {
|
||||
this.list = Array.isArray(res.data) ? res.data : []
|
||||
this.total = typeof res.total === 'number' ? res.total : 0
|
||||
} else {
|
||||
this.list = []
|
||||
this.total = 0
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.list = []
|
||||
this.total = 0
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
buildListParams() {
|
||||
const params = {
|
||||
current: this.queryParams.current,
|
||||
size: this.queryParams.size,
|
||||
tenantId: this.queryParams.tenantId || undefined,
|
||||
userId: this.queryParams.userId || undefined,
|
||||
nickname: this.queryParams.nickname || undefined,
|
||||
promoterId: this.queryParams.promoterId || undefined,
|
||||
promoterName: this.queryParams.promoterName || undefined,
|
||||
createdStartTime: this.queryParams.createdStartTime || undefined,
|
||||
createdEndTime: this.queryParams.createdEndTime || undefined
|
||||
}
|
||||
Object.keys(params).forEach((key) => {
|
||||
if (params[key] === undefined || params[key] === '') delete params[key]
|
||||
})
|
||||
return params
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.current = 1
|
||||
this.fetchList()
|
||||
},
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
current: 1,
|
||||
size: 10,
|
||||
tenantId: '',
|
||||
userId: '',
|
||||
nickname: '',
|
||||
promoterId: '',
|
||||
promoterName: '',
|
||||
createdStartTime: '',
|
||||
createdEndTime: ''
|
||||
}
|
||||
this.fetchList()
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.queryParams.size = size
|
||||
this.fetchList()
|
||||
},
|
||||
handleCurrentChange(current) {
|
||||
this.queryParams.current = current
|
||||
this.fetchList()
|
||||
},
|
||||
handleAdd() {
|
||||
this.dialogTitle = '新增当天交易'
|
||||
this.isEdit = false
|
||||
this.resetFormData()
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||
})
|
||||
},
|
||||
handleEdit(row) {
|
||||
this.dialogTitle = '编辑当天交易'
|
||||
this.isEdit = true
|
||||
this.form = {
|
||||
id: row.id,
|
||||
tenantId: row.tenantId || '',
|
||||
userId: row.userId || '',
|
||||
nickname: row.nickname || '',
|
||||
dailySellAmt: this.toInputString(row.dailySellAmt),
|
||||
dailyBuyAmt: this.toInputString(row.dailyBuyAmt),
|
||||
diffAmt: this.toInputString(row.diffAmt),
|
||||
promoterId: row.promoterId || '',
|
||||
promoterName: row.promoterName || '',
|
||||
descContent: row.descContent || ''
|
||||
}
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('确定删除这条当天交易记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
return deleteLbDailyUserTrade(row.id)
|
||||
}).then((res) => {
|
||||
this.$message.success(res.message || '删除成功')
|
||||
this.fetchList()
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.dataForm.validate((valid) => {
|
||||
if (!valid) return
|
||||
const payload = this.buildPayload()
|
||||
this.submitLoading = true
|
||||
const req = this.isEdit ? updateLbDailyUserTrade(payload) : addLbDailyUserTrade(payload)
|
||||
req.then((res) => {
|
||||
this.$message.success(res.message || (this.isEdit ? '更新成功' : '新增成功'))
|
||||
this.dialogVisible = false
|
||||
this.fetchList()
|
||||
}).finally(() => {
|
||||
this.submitLoading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
buildPayload() {
|
||||
const payload = {
|
||||
tenantId: this.form.tenantId,
|
||||
userId: this.form.userId,
|
||||
nickname: this.form.nickname || undefined,
|
||||
dailySellAmt: this.parseDecimal(this.form.dailySellAmt),
|
||||
dailyBuyAmt: this.parseDecimal(this.form.dailyBuyAmt),
|
||||
diffAmt: this.parseDecimal(this.form.diffAmt),
|
||||
promoterId: this.form.promoterId || undefined,
|
||||
promoterName: this.form.promoterName || undefined,
|
||||
descContent: this.form.descContent || undefined
|
||||
}
|
||||
if (this.isEdit) payload.id = this.form.id
|
||||
Object.keys(payload).forEach((key) => {
|
||||
if (payload[key] === undefined || payload[key] === '') delete payload[key]
|
||||
})
|
||||
return payload
|
||||
},
|
||||
parseDecimal(val) {
|
||||
if (val === null || val === undefined || String(val).trim() === '') return undefined
|
||||
return String(val).trim()
|
||||
},
|
||||
toInputString(val) {
|
||||
if (val === null || val === undefined) return ''
|
||||
return String(val)
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs.dataForm && this.$refs.dataForm.resetFields()
|
||||
this.resetFormData()
|
||||
},
|
||||
resetFormData() {
|
||||
this.form = {
|
||||
id: '',
|
||||
tenantId: '',
|
||||
userId: '',
|
||||
nickname: '',
|
||||
dailySellAmt: '',
|
||||
dailyBuyAmt: '',
|
||||
diffAmt: '',
|
||||
promoterId: '',
|
||||
promoterName: '',
|
||||
descContent: ''
|
||||
}
|
||||
},
|
||||
formatDateTime(dateTime) {
|
||||
if (!dateTime) return '-'
|
||||
const date = new Date(String(dateTime).replace('T', ' '))
|
||||
if (Number.isNaN(date.getTime())) return String(dateTime)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
const hours = String(date.getHours()).padStart(2, '0')
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
.filter-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.action-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
.el-pagination {
|
||||
margin-top: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
29
src/views/lb-business/report-statistics/index.vue
Normal file
29
src/views/lb-business/report-statistics/index.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="never">
|
||||
<div class="placeholder-title">报表统计</div>
|
||||
<div class="placeholder-desc">
|
||||
页面入口已创建,可在此按业务需求补充多维度统计分析内容。
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'LbReportStatistics'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.placeholder-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.placeholder-desc {
|
||||
color: #606266;
|
||||
line-height: 22px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user