Merge branch 'main' of gitea.haiyihy.com:hy/chatapp3-admin

This commit is contained in:
zhx 2026-05-06 15:07:19 +08:00
commit 9d20c3a789
9 changed files with 465 additions and 42 deletions

View File

@ -21,3 +21,16 @@ export async function reviewGmGoldOperation(data: Record<string, any>) {
data,
);
}
export async function submitGmVipGift(data: Record<string, any>) {
return requestClient.post<Record<string, any>>('/gm/vip-gift', data);
}
export async function pageGmVipGift(params: Record<string, any>) {
return requestClient.get<LegacyPageResult<Record<string, any>>>(
'/gm/vip-gift/page',
{
params,
},
);
}

View File

@ -36,6 +36,11 @@ const ROUTE_MENU_OVERRIDES: Record<
routers: ['open_pay/country'],
titles: ['开通支付国家'],
},
PaymentOrderList: {
aliases: ['OrderDetails'],
routers: ['order/details', 'operate/manager/order/details'],
titles: ['订单详情'],
},
PropsResourceConfig: { aliases: ['PropsConfig'], routers: ['props/config'] },
PropsSourceGroup: {
aliases: ['PropsActivityRewardCnf'],

View File

@ -17,6 +17,12 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/gm/gold-operation.vue'),
meta: { title: '金币操作' },
},
{
name: 'GmVipGift',
path: 'vip-gift',
component: () => import('#/views/gm/vip-gift.vue'),
meta: { title: 'VIP赠送' },
},
{
name: 'GmGoldOperationReview',
path: 'gold-operation-review',

View File

@ -71,12 +71,6 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/operate/order-abnormal.vue'),
meta: { title: '异常订单' },
},
{
name: 'OperateOrderDetails',
path: 'order/details',
component: () => import('#/views/operate/order-details.vue'),
meta: { title: '订单详情' },
},
{
name: 'OperateReimburse',
path: 'reimburse',

View File

@ -9,8 +9,15 @@ const routes: RouteRecordRaw[] = [
},
name: 'PaymentManager',
path: '/payment/manager',
redirect: '/payment/manager/country',
redirect: '/payment/manager/order/list',
children: [
{
name: 'PaymentOrderList',
path: 'order/list',
alias: '/operate/manager/order/details',
component: () => import('#/views/operate/order-details.vue'),
meta: { title: '订单列表' },
},
{
name: 'PayCountry',
path: 'country',

View File

@ -0,0 +1,361 @@
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue';
import { Page } from '@vben/common-ui';
import {
Button,
Card,
DatePicker,
Form,
FormItem,
Input,
message,
Modal,
Pagination,
Select,
Table,
Tag,
TextArea,
} from 'antdv-next';
import { pageGmVipGift, submitGmVipGift } from '#/api/legacy/gm';
import { getUserBaseInfoBySysOriginAccount } from '#/api/legacy/user';
import AccountInput from '#/components/account-input.vue';
import UserProfileLink from '#/views/operate/components/user-profile-link.vue';
import {
formatDate,
getDisplaySysOriginText,
} from '#/views/system/shared';
defineOptions({ name: 'GmVipGift' });
const VIP_OPTIONS = [1, 2, 3, 4, 5].map((level) => ({
label: `VIP${level}`,
value: level,
}));
const loading = ref(false);
const submitting = ref(false);
const open = ref(false);
const list = ref<Array<Record<string, any>>>([]);
const total = ref(0);
const rangeDate = ref<[string, string] | null>(null);
const userSearch = ref('');
const query = reactive({
applicantId: '',
endTime: '',
pageIndex: 1,
pageSize: 20,
startTime: '',
status: '',
userId: '',
vipLevel: undefined as number | undefined,
});
const form = reactive({
remarks: '',
userSearch: '',
vipLevel: 1,
});
const columns = [
{ dataIndex: 'userProfile', key: 'userProfile', title: '获赠用户', width: 240 },
{ dataIndex: 'sysOrigin', key: 'sysOrigin', title: '系统', width: 100 },
{ dataIndex: 'vipLevel', key: 'vipLevel', title: '赠送VIP', width: 110 },
{ dataIndex: 'fromLevel', key: 'fromLevel', title: '原VIP', width: 110 },
{ dataIndex: 'durationDays', key: 'durationDays', title: '天数', width: 90 },
{ dataIndex: 'status', key: 'status', title: '状态', width: 100 },
{ dataIndex: 'expireAt', key: 'expireAt', title: '到期时间', width: 180 },
{ dataIndex: 'applicant', key: 'applicant', title: '操作人', width: 160 },
{ dataIndex: 'remarks', key: 'remarks', title: '备注', width: 240 },
{ dataIndex: 'createTime', key: 'createTime', title: '操作时间', width: 180 },
];
watch(rangeDate, (value) => {
query.startTime = value?.[0] || '';
query.endTime = value?.[1] || '';
});
function parseEncodedValue(value: unknown) {
const raw = String(value ?? '');
const match = raw.match(/^\*(.*)\*$/);
if (!match) {
return {
accountType: '',
content: raw,
sysOrigin: '',
};
}
const body = match[1] || '';
return {
accountType: body.match(/accountType:([^,]*)/)?.[1] || '',
content: body.match(/content:(.*)$/)?.[1] || '',
sysOrigin: body.match(/sysOrigin:([^,]*)/)?.[1] || '',
};
}
async function resolveUserIdValue(value: unknown, required = false) {
const parsed = parseEncodedValue(value);
const content = String(parsed.content || '').trim();
if (!content) {
if (required) {
message.warning('请输入用户ID');
return null;
}
return '';
}
if (!parsed.accountType || parsed.accountType === 'LONG') {
return content.replace(/[^\d]/g, '');
}
if (!parsed.sysOrigin) {
message.warning('请选择系统');
return null;
}
const result = await getUserBaseInfoBySysOriginAccount(parsed.sysOrigin, content);
const userId = result?.id || result?.userId;
if (!userId) {
message.warning('未找到用户');
return null;
}
return String(userId);
}
function resetForm() {
form.remarks = '';
form.userSearch = '';
form.vipLevel = 1;
}
function statusColor(status?: string) {
return status === 'SUCCESS' ? 'success' : 'default';
}
async function loadData(reset = false) {
if (reset) {
query.pageIndex = 1;
}
const resolvedUserId = await resolveUserIdValue(userSearch.value);
if (resolvedUserId === null) {
return;
}
loading.value = true;
try {
query.userId = resolvedUserId;
const result = await pageGmVipGift({
...query,
applicantId: query.applicantId || undefined,
status: query.status || undefined,
userId: query.userId || undefined,
vipLevel: query.vipLevel,
});
list.value = result.records || [];
total.value = result.total || 0;
} finally {
loading.value = false;
}
}
function handlePageChange(page: number, pageSize: number) {
query.pageIndex = page;
query.pageSize = pageSize;
void loadData();
}
async function handleSubmit() {
const userId = await resolveUserIdValue(form.userSearch, true);
if (!userId) {
return;
}
if (!form.vipLevel) {
message.warning('请选择VIP等级');
return;
}
if (!String(form.remarks || '').trim()) {
message.warning('请输入备注');
return;
}
submitting.value = true;
try {
await submitGmVipGift({
remarks: form.remarks,
userId,
vipLevel: form.vipLevel,
});
message.success('VIP已赠送');
open.value = false;
resetForm();
await loadData(true);
} finally {
submitting.value = false;
}
}
void loadData(true);
</script>
<template>
<Page title="VIP赠送">
<Card>
<div class="page-head">
<div class="page-head__title">VIP赠送记录</div>
<Button type="primary" @click="open = true">赠送</Button>
</div>
<div class="toolbar">
<Select
v-model:value="query.vipLevel"
allow-clear
placeholder="VIP等级"
style="width: 140px"
:options="VIP_OPTIONS"
/>
<Select
v-model:value="query.status"
allow-clear
placeholder="状态"
style="width: 140px"
:options="[{ label: '已赠送', value: 'SUCCESS' }]"
/>
<AccountInput
v-model:value="userSearch"
default-select-type="LONG"
placeholder="用户ID"
style="width: 260px"
/>
<Input
v-model:value="query.applicantId"
allow-clear
placeholder="操作人后台ID"
style="width: 160px"
/>
<DatePicker.RangePicker
v-model:value="rangeDate"
show-time
style="width: 360px"
value-format="x"
/>
<Button :loading="loading" type="primary" @click="loadData(true)">
查询
</Button>
</div>
<Table
:columns="columns"
:data-source="list"
:loading="loading"
:pagination="false"
row-key="id"
:scroll="{ x: 1400 }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'userProfile'">
<UserProfileLink :profile="record.userProfile" />
</template>
<template v-else-if="column.key === 'sysOrigin'">
{{ getDisplaySysOriginText(record.sysOrigin) }}
</template>
<template v-else-if="column.key === 'vipLevel'">
<Tag color="blue">{{ record.levelCode || `VIP${record.vipLevel}` }}</Tag>
</template>
<template v-else-if="column.key === 'fromLevel'">
{{ record.fromLevelName || '非VIP' }}
</template>
<template v-else-if="column.key === 'durationDays'">
{{ record.durationDays || 30 }}
</template>
<template v-else-if="column.key === 'status'">
<Tag :color="statusColor(record.status)">
{{ record.statusName || record.status || '-' }}
</Tag>
</template>
<template v-else-if="column.key === 'expireAt'">
{{ formatDate(record.expireAt) }}
</template>
<template v-else-if="column.key === 'applicant'">
{{ record.applicantName || record.applicantId || '-' }}
</template>
<template v-else-if="column.key === 'remarks'">
{{ record.remarks || '-' }}
</template>
<template v-else-if="column.key === 'createTime'">
{{ formatDate(record.createTime) }}
</template>
</template>
</Table>
<div class="pagination">
<Pagination
:current="query.pageIndex"
:page-size="query.pageSize"
:total="total"
show-size-changer
@change="handlePageChange"
/>
</div>
</Card>
<Modal
v-model:open="open"
title="VIP赠送"
:confirm-loading="submitting"
width="560px"
@cancel="resetForm"
@ok="handleSubmit"
>
<Form layout="vertical">
<FormItem label="用户ID">
<AccountInput
v-model:value="form.userSearch"
default-select-type="LONG"
placeholder="请输入长ID或短ID"
/>
</FormItem>
<FormItem label="VIP等级">
<Select v-model:value="form.vipLevel" :options="VIP_OPTIONS" />
</FormItem>
<FormItem label="有效期">
<Input value="30天" disabled />
</FormItem>
<FormItem label="备注">
<TextArea
v-model:value="form.remarks"
:maxlength="500"
:rows="4"
show-count
placeholder="请输入赠送原因"
/>
</FormItem>
</Form>
</Modal>
</Page>
</template>
<style scoped>
.page-head {
align-items: center;
display: flex;
justify-content: space-between;
margin-bottom: 16px;
}
.page-head__title {
color: #111827;
font-size: 16px;
font-weight: 600;
}
.toolbar {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
.pagination {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
</style>

View File

@ -39,7 +39,7 @@ import {
import OrderDetailsDrawer from './components/order-details-drawer.vue';
import UserProfileLink from './components/user-profile-link.vue';
defineOptions({ name: 'OperateOrderDetails' });
defineOptions({ name: 'PaymentOrderList' });
const router = useRouter();
const accessStore = useAccessStore();
@ -89,16 +89,6 @@ const columns = [
{ dataIndex: 'actions', key: 'actions', title: '操作', width: 100, fixed: 'right' as const },
];
watch(
sysOriginOptions,
(options) => {
if (sysOrigins.value.length === 0 && options.length > 0) {
sysOrigins.value = [String(options[0]?.value || '')];
}
},
{ immediate: true },
);
watch(
rangeDate,
(value) => {
@ -112,7 +102,7 @@ function getEffectiveSysOrigin() {
if (sysOrigins.value.length > 0) {
return sysOrigins.value.join(',');
}
return sysOriginOptions.value.map((item) => String(item.value)).join(',');
return '';
}
async function loadRegions() {
@ -125,7 +115,7 @@ async function loadData(reset = false) {
query.lastId = '';
notMore.value = false;
}
query.sysOrigins = getEffectiveSysOrigin();
const params = buildQueryParams();
if (reset) {
loading.value = true;
} else {
@ -133,8 +123,8 @@ async function loadData(reset = false) {
}
try {
const [result, amountResult] = await Promise.all([
listInAppPurchase({ ...query }),
getOrderAmount({ ...query }),
listInAppPurchase(params),
getOrderAmount(params),
]);
const current = result || [];
list.value = reset ? current : [...list.value, ...current];
@ -147,6 +137,18 @@ async function loadData(reset = false) {
}
}
function buildQueryParams() {
query.sysOrigins = getEffectiveSysOrigin();
return Object.fromEntries(
Object.entries({ ...query }).filter(([, value]) => {
if (Array.isArray(value)) {
return value.length > 0;
}
return value !== '' && value !== undefined && value !== null;
}),
);
}
function handleSearch() {
void loadData(true);
}
@ -170,7 +172,7 @@ void loadData(true);
</script>
<template>
<Page title="订单详情">
<Page title="订单列表">
<Card>
<div class="toolbar">
<SysOriginSelect
@ -184,7 +186,7 @@ void loadData(true);
<Select option-label-prop="label"
v-model:value="query.factoryPlatform"
allow-clear
placeholder="支付平台"
placeholder="支付平台(全部)"
style="width: 140px"
:options="ORIGIN_PLATFORM_OPTIONS.map((item) => ({ label: `${item.name}`, value: item.value as any }))"
@ -192,7 +194,7 @@ void loadData(true);
<Select option-label-prop="label"
v-model:value="query.status"
allow-clear
placeholder="订单状态"
placeholder="订单状态(全部)"
style="width: 140px"
:options="ORDER_STATUS_OPTIONS.map((item) => ({ label: `${item.name}`, value: item.value as any }))"
@ -200,7 +202,7 @@ void loadData(true);
<Select option-label-prop="label"
v-model:value="query.receiptType"
allow-clear
placeholder="订单类型"
placeholder="订单类型(全部)"
style="width: 140px"
:options="ORDER_RECEIPT_TYPE_OPTIONS.map((item) => ({ label: `${item.name}`, value: item.value as any }))"

View File

@ -16,7 +16,6 @@ import { getAllowedSysOrigins } from '#/views/system/shared';
import {
Button,
Card,
Image,
Input,
InputNumber,
Modal,
@ -320,6 +319,11 @@ function formatNumber(value: number | string | undefined) {
return Number.isFinite(numeric) ? numeric.toLocaleString() : '0';
}
function coverBackgroundStyle(url?: string) {
const coverUrl = String(url || '').trim();
return coverUrl ? { backgroundImage: `url(${JSON.stringify(coverUrl)})` } : {};
}
function handleRecordPageChange(page: number, pageSize: number) {
recordQuery.cursor = page;
recordQuery.limit = pageSize;
@ -471,7 +475,12 @@ watch(
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'room'">
<div class="room-cell">
<Image :preview="false" :src="record.roomCover" class="room-cover" />
<div
v-if="record.roomCover"
class="room-cover"
:style="coverBackgroundStyle(record.roomCover)"
/>
<div v-else class="room-cover placeholder">R</div>
<div class="room-copy">
<Button type="link" @click="openRoomDetails(record.roomId)">
{{ record.roomName || '-' }}
@ -526,7 +535,12 @@ watch(
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'room'">
<div class="room-cell">
<Image :preview="false" :src="record.roomCover" class="room-cover" />
<div
v-if="record.roomCover"
class="room-cover"
:style="coverBackgroundStyle(record.roomCover)"
/>
<div v-else class="room-cover placeholder">R</div>
<div class="room-copy">
<Button type="link" @click="openRoomDetails(record.roomId)">
{{ record.roomName || '-' }}
@ -608,9 +622,23 @@ watch(
}
.room-cover {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
border-radius: 8px;
height: 48px;
width: 48px;
flex: 0 0 40px;
height: 40px;
width: 40px;
}
.room-cover.placeholder {
align-items: center;
background: rgb(226 232 240);
color: rgb(100 116 139);
display: flex;
font-size: 13px;
font-weight: 600;
justify-content: center;
}
.room-copy {

View File

@ -228,6 +228,11 @@ function statusColor(status: string) {
}
}
function avatarBackgroundStyle(url?: string) {
const avatarUrl = String(url || '').trim();
return avatarUrl ? { backgroundImage: `url(${JSON.stringify(avatarUrl)})` } : {};
}
function assignForm(next: Record<string, any>) {
Object.assign(form, createEmptyForm(selectedSysOrigin.value), next);
}
@ -775,11 +780,10 @@ watch(
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'user'">
<div class="user-cell">
<Image
<div
v-if="record.userAvatar"
:preview="false"
:src="record.userAvatar"
class="avatar"
:style="avatarBackgroundStyle(record.userAvatar)"
/>
<div v-else class="avatar placeholder">U</div>
<div class="user-meta">
@ -829,11 +833,10 @@ watch(
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'user'">
<div class="user-cell">
<Image
<div
v-if="record.userAvatar"
:preview="false"
:src="record.userAvatar"
class="avatar"
:style="avatarBackgroundStyle(record.userAvatar)"
/>
<div v-else class="avatar placeholder">U</div>
<div class="user-meta">
@ -901,11 +904,10 @@ watch(
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'user'">
<div class="user-cell">
<Image
<div
v-if="record.userAvatar"
:preview="false"
:src="record.userAvatar"
class="avatar"
:style="avatarBackgroundStyle(record.userAvatar)"
/>
<div v-else class="avatar placeholder">U</div>
<div class="user-meta">
@ -1202,8 +1204,7 @@ watch(
font-size: 12px;
}
.thumb,
.avatar {
.thumb {
border-radius: 8px;
height: 48px;
object-fit: cover;
@ -1211,7 +1212,13 @@ watch(
}
.avatar {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
border-radius: 999px;
flex: 0 0 40px;
height: 40px;
width: 40px;
}
.placeholder {