feat: 后台新增积分明细页面,查看所有用户积分消耗/充值流水
- 新增云函数 admin/points/sys/getList(jjx-points-log 联表 uni-id-users) - 新增页面 pages/points/log/list(vk-data-table,支持类型/业务类型/时间筛选) - 菜单注册在资金管理下「积分明细」
This commit is contained in:
@@ -144,6 +144,9 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/finance/balance/list"
|
"path": "pages/finance/balance/list"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/points/log/list"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/index",
|
"path": "pages/login/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
<template>
|
||||||
|
<view class="page-body">
|
||||||
|
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
|
||||||
|
@search="search"></vk-data-table-query>
|
||||||
|
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
|
||||||
|
:pagination="true"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@selection-change="selectionChange"></vk-data-table>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var that;
|
||||||
|
var vk = uni.vk;
|
||||||
|
|
||||||
|
const typeData = [
|
||||||
|
{ value: "spend", label: "消耗" },
|
||||||
|
{ value: "earn", label: "充值/收入" }
|
||||||
|
];
|
||||||
|
|
||||||
|
const bizTypeData = [
|
||||||
|
{ value: "contract_review", label: "合同审查" },
|
||||||
|
{ value: "recharge", label: "积分充值" },
|
||||||
|
{ value: "other", label: "其他" }
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
table1: {
|
||||||
|
action: "admin/points/sys/getList",
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
key: "userInfo",
|
||||||
|
title: "用户",
|
||||||
|
type: "html",
|
||||||
|
align: "left",
|
||||||
|
width: 200,
|
||||||
|
formatter: (val, row) => {
|
||||||
|
const user = row.userInfo && row.userInfo[0] ? row.userInfo[0] : {};
|
||||||
|
const name = user.nickname || "未设置昵称";
|
||||||
|
const mobile = user.mobile || "-";
|
||||||
|
return `<div>${name}</div><div style="color:#999;font-size:12px;">${mobile}</div>`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "type",
|
||||||
|
title: "类型",
|
||||||
|
type: "select",
|
||||||
|
align: "center",
|
||||||
|
width: 110,
|
||||||
|
data: typeData
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "amount",
|
||||||
|
title: "变动积分",
|
||||||
|
type: "html",
|
||||||
|
align: "center",
|
||||||
|
width: 120,
|
||||||
|
formatter: (val) => {
|
||||||
|
const num = Number(val || 0);
|
||||||
|
const color = num >= 0 ? "#67c23a" : "#f56c6c";
|
||||||
|
return `<span style="color:${color};font-weight:bold;">${num >= 0 ? "+" : ""}${num}</span>`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "balance_after",
|
||||||
|
title: "变动后余额",
|
||||||
|
type: "text",
|
||||||
|
align: "center",
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "reason",
|
||||||
|
title: "事由",
|
||||||
|
type: "text",
|
||||||
|
align: "left",
|
||||||
|
minWidth: 260
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "biz_type",
|
||||||
|
title: "业务类型",
|
||||||
|
type: "select",
|
||||||
|
align: "center",
|
||||||
|
width: 120,
|
||||||
|
data: bizTypeData
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "_add_time",
|
||||||
|
title: "时间",
|
||||||
|
type: "time",
|
||||||
|
width: 180,
|
||||||
|
sortable: "custom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
multipleSelection: [],
|
||||||
|
selectItem: ""
|
||||||
|
},
|
||||||
|
queryForm1: {
|
||||||
|
formData: {},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
key: "type",
|
||||||
|
title: "类型",
|
||||||
|
type: "select",
|
||||||
|
mode: "=",
|
||||||
|
data: typeData
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "biz_type",
|
||||||
|
title: "业务类型",
|
||||||
|
type: "select",
|
||||||
|
mode: "=",
|
||||||
|
data: bizTypeData
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "_add_time",
|
||||||
|
title: "时间",
|
||||||
|
type: "datetimerange",
|
||||||
|
width: 380,
|
||||||
|
mode: "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(options = {}) {
|
||||||
|
that = this;
|
||||||
|
vk = that.vk;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
search() {
|
||||||
|
that.$refs.table1.search();
|
||||||
|
},
|
||||||
|
currentChange(val) {
|
||||||
|
that.table1.selectItem = val;
|
||||||
|
},
|
||||||
|
selectionChange(list) {
|
||||||
|
that.table1.multipleSelection = list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.page-body {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -63,6 +63,11 @@
|
|||||||
"menu_id": "jjx-finance-balance",
|
"menu_id": "jjx-finance-balance",
|
||||||
"name": "资金明细",
|
"name": "资金明细",
|
||||||
"url": "/pages/finance/balance/list"
|
"url": "/pages/finance/balance/list"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"menu_id": "jjx-finance-points",
|
||||||
|
"name": "积分明细",
|
||||||
|
"url": "/pages/points/log/list"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
'use strict';
|
||||||
|
module.exports = {
|
||||||
|
/**
|
||||||
|
* 积分流水列表(所有用户)
|
||||||
|
* @url admin/points/sys/getList 前端调用的url参数地址
|
||||||
|
* data 请求参数说明
|
||||||
|
* @param {Number} pageIndex 当前页码
|
||||||
|
* @param {Number} pageSize 每页显示数量
|
||||||
|
* @param {Object} formData 查询条件数据源
|
||||||
|
* @param {Array} columns 查询条件规则
|
||||||
|
*/
|
||||||
|
main: async (event) => {
|
||||||
|
let { data = {}, util } = event;
|
||||||
|
let { vk, _ } = util;
|
||||||
|
let res = { code: 0, msg: '' };
|
||||||
|
// 业务逻辑开始-----------------------------------------------------------
|
||||||
|
res = await vk.baseDao.getTableData({
|
||||||
|
dbName: "jjx-points-log",
|
||||||
|
data,
|
||||||
|
whereJson: {},
|
||||||
|
sortArr: [{ name: "_add_time", type: "desc" }],
|
||||||
|
foreignDB: [{
|
||||||
|
dbName: "uni-id-users",
|
||||||
|
localKey: "user_id",
|
||||||
|
foreignKey: "_id",
|
||||||
|
as: "userInfo",
|
||||||
|
limit: 1,
|
||||||
|
fieldJson: {
|
||||||
|
nickname: true,
|
||||||
|
mobile: true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
// 业务逻辑结束-----------------------------------------------------------
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user