Merge pull request 'master' (#17) from master into deploy
Build and Deploy Vue3 / build (push) Successful in 1m34s
Build and Deploy Vue3 / deploy (push) Successful in 1m57s

Reviewed-on: lin/ApiServer-Web-admin_dashboard_pc#17
This commit was merged in pull request #17.
This commit is contained in:
2026-01-06 21:58:14 +08:00
4 changed files with 201 additions and 622 deletions
+11 -1
View File
@@ -53,7 +53,7 @@ export const updateUserInfo = (data) => {
/**删除用户 */
export const deleteUser = (data) => {
return http2.delete('/api/v1/admin/user/user/delete?group_id='+data.group_id)
return http2.delete('/api/v1/admin/user/user/delete?user_id='+data.user_id)
}
/**修改用户头像 */
export const updateUserAvatar = (data) => {
@@ -162,4 +162,14 @@ export const addUserGroupMember = (data) => {
'Content-Type':'multipart/form-data'
}
})
}
/**退款对应账单 */
export const refundBalance = (data) => {
return http2.get('/api/v1/admin/user/balance/refund', {
params:data,
headers: {
'Content-Type': 'multipart/form-data'
}
})
}
+58 -8
View File
@@ -5,6 +5,30 @@
<!-- 搜索和操作栏 -->
<div class="filter-section">
<div class="filter-content">
<el-form :inline="true" :model="queryParams" class="filter-form">
<el-form-item label="关键词">
<el-input v-model="queryParams.key" placeholder="订单名称/ID" clearable style="width: 150px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="用户ID">
<el-input v-model="queryParams.user_id" placeholder="用户ID" clearable style="width: 120px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="用户关键词">
<el-input v-model="queryParams.user_key" placeholder="用户名/手机号/邮箱" clearable style="width: 180px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryParams.state" placeholder="全部" clearable style="width: 120px">
<el-option label="待支付" value="0" />
<el-option label="已支付" value="1" />
<el-option label="已失效" value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">
<el-icon><Search /></el-icon>搜索
</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="action-bar">
<el-button type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>新增订单
@@ -220,9 +244,12 @@ import { getOrderList, getOrderDetail, createOrder, updateOrder, deleteOrder } f
// 查询参数
const queryParams = reactive({
page: 1,
count: 10
count: 10,
key: '',
state: '',
user_id: '',
user_key: ''
})
// 订单表单
@@ -282,7 +309,14 @@ const orderFormRef = ref(null)
const fetchOrderList = async () => {
loading.value = true
try {
const res = await getOrderList(queryParams)
// 过滤空值参数
const params = {}
Object.keys(queryParams).forEach(key => {
if (queryParams[key] !== '' && queryParams[key] !== null && queryParams[key] !== undefined) {
params[key] = queryParams[key]
}
})
const res = await getOrderList(params)
console.log('订单列表数据:', res.data)
if (res.data.code === 200) {
orderList.value = res.data.data.list || []
@@ -337,10 +371,10 @@ const handleQuery = () => {
// 重置查询
const resetQuery = () => {
queryParams.order_no = ''
queryParams.key = ''
queryParams.state = ''
queryParams.user_id = ''
queryParams.status = ''
queryParams.dateRange = []
queryParams.user_key = ''
queryParams.page = 1
fetchOrderList()
}
@@ -532,13 +566,29 @@ onMounted(() => {
.filter-content {
display: flex;
justify-content: flex-end;
align-items: center;
justify-content: space-between;
align-items: flex-start;
padding: 16px 20px;
gap: 20px;
flex-wrap: wrap;
}
.filter-form {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.filter-form :deep(.el-form-item) {
margin-bottom: 0;
margin-right: 8px;
}
.filter-form :deep(.el-form-item__label) {
font-size: 13px;
}
.action-bar {
display: flex;
gap: 12px;
+112 -5
View File
@@ -77,11 +77,21 @@
</template>
</el-table-column>
<el-table-column prop="Note" label="备注" min-width="200" show-overflow-tooltip />
<el-table-column prop="PaymentOrderId" label="支付订单ID" width="150" show-overflow-tooltip>
<template #default="{ row }">
{{ row.PaymentOrderId || '-' }}
</template>
</el-table-column>
<el-table-column label="创建时间" width="180">
<template #default="{ row }">
{{ formatDateTime(row.CreatedAt) }}
</template>
</el-table-column>
<el-table-column label="操作" width="100" fixed="right">
<template #default="{ row }">
<el-button type="warning" size="small" @click="handleRefund(row)">退款</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-wrapper">
@@ -151,6 +161,10 @@
<template #prepend>¥</template>
</el-input>
</el-form-item>
<el-form-item label="支付平台订单id" prop="paymentOrderId">
<el-input v-model="recordForm.paymentOrderId" placeholder="请输入支付平台订单ID" />
</el-form-item>
<el-form-item label="备注" prop="note">
<el-input v-model="recordForm.note" type="textarea" :rows="3" placeholder="请输入备注" />
</el-form-item>
@@ -160,15 +174,38 @@
<el-button type="primary" @click="submitRecordForm">确定</el-button>
</template>
</el-dialog>
<!-- 退款对话框 -->
<el-dialog v-model="refundDialogVisible" title="退款" width="500px">
<el-form ref="refundFormRef" :model="refundForm" :rules="refundRules" label-width="120px">
<el-form-item label="余额记录ID">
<el-input :value="refundForm.history_id" disabled />
</el-form-item>
<el-form-item label="订单ID" prop="order_id">
<el-input v-model="refundForm.order_id" :min="0" style="width: 100%" placeholder="请输入订单ID" />
</el-form-item>
<el-form-item label="退款方式" prop="bandwidth">
<el-radio-group v-model="refundForm.bandwidth">
<el-radio :label="false">退回余额</el-radio>
<el-radio :label="true">提现</el-radio>
</el-radio-group>
<div class="form-tip">退回余额将退款金额添加到对应余额提现将退款金额提现</div>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="refundDialogVisible = false">取消</el-button>
<el-button type="warning" @click="submitRefundForm" :loading="refundLoading">确认退款</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref, reactive, onMounted, computed } from 'vue'
import { ref, reactive, onMounted, computed, watch } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { Refresh } from '@element-plus/icons-vue'
import { getUserBalance, getUserBalanceRecord, editUserBalance, addUserConsumption, getUserBalanceCount, getUserList } from '@/api/admin/user'
import { getUserBalance, getUserBalanceRecord, editUserBalance, addUserConsumption, getUserBalanceCount, getUserList, refundBalance } from '@/api/admin/user'
const route = useRoute()
@@ -203,8 +240,11 @@ const userList = ref([])
// 对话框
const balanceDialogVisible = ref(false)
const recordDialogVisible = ref(false)
const refundDialogVisible = ref(false)
const balanceFormRef = ref(null)
const recordFormRef = ref(null)
const refundFormRef = ref(null)
const refundLoading = ref(false)
// 余额表单
const balanceForm = reactive({
@@ -231,7 +271,8 @@ const recordForm = reactive({
apply_balance: false,
price: 0,
state: 'add',
note: ''
note: '',
paymentOrderId: ''
})
const recordRules = {
@@ -243,6 +284,18 @@ const recordRules = {
note: [{ required: true, message: '请输入备注', trigger: 'blur' }]
}
// 退款表单
const refundForm = reactive({
history_id: 0,
order_id: 0,
bandwidth: false
})
const refundRules = {
order_id: [{ required: true, message: '请输入订单ID', trigger: 'blur' }],
bandwidth: [{ required: true, message: '请选择退款方式', trigger: 'change' }]
}
// 当前余额显示
const currentBalanceDisplay = computed(() => {
const balance = balanceList.value.find(b => userBalance[b.type]?.type === balanceForm.balance_type)
@@ -365,7 +418,7 @@ const fetchBalanceRecord = async () => {
const res = await getUserBalanceRecord(recordParams)
if (res.data.code === 200) {
recordList.value = res.data.data.data || []
recordTotal.value = res.data.data.all_count || 0
recordTotal.value = res.data.data.total || 0
} else {
ElMessage.error(res.data.message || '获取余额记录失败')
}
@@ -401,7 +454,8 @@ const handleAddRecord = (balanceType) => {
apply_balance: false,
price: 0,
state: 'add',
note: ''
note: '',
paymentOrderId: ''
})
recordDialogVisible.value = true
}
@@ -457,6 +511,40 @@ const handleRecordCurrentChange = () => {
fetchBalanceRecord()
}
// 退款
const handleRefund = (row) => {
Object.assign(refundForm, {
history_id: row.Id,
order_id: String(row.OrderId) || 0,
bandwidth: false
})
refundDialogVisible.value = true
}
// 提交退款
const submitRefundForm = () => {
refundFormRef.value?.validate(async (valid) => {
if (valid) {
refundLoading.value = true
try {
const res = await refundBalance(refundForm)
if (res.data.code === 200) {
ElMessage.success('退款成功')
refundDialogVisible.value = false
fetchUserBalance()
} else {
ElMessage.error(res.data.message || '退款失败')
}
} catch (error) {
console.error('退款错误:', error)
ElMessage.error('退款失败')
} finally {
refundLoading.value = false
}
}
})
}
// 初始化
onMounted(() => {
getUserListData()
@@ -466,6 +554,19 @@ onMounted(() => {
ElMessage.warning('缺少用户ID参数')
}
})
// 监听路由参数变化
watch(
() => route.query.user_id,
(newUserId) => {
if (newUserId && newUserId !== queryParams.user_id) {
queryParams.user_id = newUserId
recordParams.user_id = newUserId
fetchUserBalance()
}
},
{ immediate: true }
)
</script>
<style scoped>
@@ -684,6 +785,12 @@ onMounted(() => {
background: #fafafa;
}
.form-tip {
font-size: 12px;
color: #909399;
margin-top: 4px;
}
/* 响应式 */
@media (max-width: 1200px) {
.balance-cards {
+20 -608
View File
@@ -7,29 +7,27 @@
},
"tags": [],
"paths": {
"/api/v1/admin/activity/group_buy/type/list": {
"/api/v1/admin/order/list": {
"get": {
"summary": "获取拼团活动类型列表",
"summary": "获取订单列表",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "page",
"name": "count",
"in": "query",
"description": "获取页码 默认 1",
"description": "获取条数 默认 10",
"required": false,
"example": "",
"schema": {
"type": "string"
}
},
{
"name": "count",
"name": "page",
"in": "query",
"description": "获取条数 默认 10",
"description": "获取页码 默认 1",
"required": false,
"example": "",
"schema": {
"type": "string"
}
@@ -39,619 +37,32 @@
"in": "query",
"description": "关键词筛选",
"required": false,
"example": "",
"schema": {
"type": "string"
}
},
{
"name": "expire_time",
"name": "state",
"in": "query",
"description": "过期时间筛选 时间戳",
"required": false,
"example": 0,
"schema": {
"type": "integer"
}
},
{
"name": "tag",
"in": "query",
"description": "标签筛选",
"required": false,
"example": "",
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/type/tags": {
"get": {
"summary": "获取拼团活动类型tag列表",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/type/add": {
"post": {
"summary": "新增拼团活动类型",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"name": {
"description": "名称",
"example": "",
"type": "string"
},
"note": {
"description": "备注",
"example": "",
"type": "string"
},
"price": {
"description": "价格 /分",
"example": "",
"type": "string"
},
"renew_price": {
"description": "续费价格 /分",
"example": "",
"type": "string"
},
"max_person": {
"description": "拼团需要人数",
"example": "",
"type": "string"
},
"tag": {
"description": "标签",
"example": "",
"type": "string"
},
"expire_time": {
"description": "活动过期时间",
"example": 0,
"type": "integer"
}
}
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/type/update": {
"post": {
"summary": "修改拼团活动类型",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"id": {
"description": "ID 编号",
"example": "",
"type": "string"
},
"name": {
"description": "名称",
"example": "",
"type": "string"
},
"note": {
"description": "备注",
"example": "",
"type": "string"
},
"price": {
"description": "价格 /分",
"example": "",
"type": "string"
},
"renew_price": {
"description": "续费价格 /分",
"example": "",
"type": "string"
},
"max_person": {
"description": "拼团需要人数",
"example": "",
"type": "string"
},
"tag": {
"description": "标签",
"example": "",
"type": "string"
},
"expire_time": {
"description": "活动过期时间",
"example": 0,
"type": "integer"
}
}
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/type/delete": {
"delete": {
"summary": "删除拼团活动类型",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "id",
"in": "query",
"description": "",
"description": "状态筛选",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/check": {
"get": {
"summary": "检查队伍列表",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"required": false,
"example": "{{Token}}",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/add_random_user": {
"post": {
"summary": "为队伍添加随机伪人",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"required": false,
"example": "{{Token}}",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"group_buy_id": {
"example": "",
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/add_random_group": {
"post": {
"summary": "创建随机伪人队伍",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"required": false,
"example": "{{Token}}",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"name": {
"description": "队伍名称",
"example": "",
"type": "string"
},
"group_buy_type_id": {
"description": "队伍类型id",
"example": "",
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/export_idc_info": {
"get": {
"summary": "导出成功队伍信息",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"required": false,
"example": "{{Token}}",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/set_order": {
"post": {
"summary": "为指定队伍下发订单",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"group_buy_id": {
"description": "队伍id",
"example": "",
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/remove": {
"delete": {
"summary": "删除指定队伍",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "group_buy_id",
"in": "query",
"description": "队伍id",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/clear": {
"delete": {
"summary": "清除所有队伍",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
}
}
},
"security": []
}
},
"/api/v1/admin/activity/group_buy/user_clear": {
"delete": {
"summary": "清除指定用户的所有队伍",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "user_id",
"in": "query",
"description": "用户ID",
"description": "用户id筛选",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "user_key",
"in": "query",
"description": "用户关键词筛选(用户名 手机号 邮箱)",
"required": false,
"schema": {
"type": "string"
@@ -678,7 +89,8 @@
"properties": {}
}
}
}
},
"headers": {}
}
},
"security": []