Merge remote-tracking branch 'yudao/dev' into dev

This commit is contained in:
jason
2025-11-03 09:14:09 +08:00
109 changed files with 3455 additions and 3671 deletions

View File

@@ -1,4 +1,6 @@
<script lang="ts" setup>
defineOptions({ name: 'CardTitle' });
// TODO @jawe from xingyuhttps://gitee.com/yudaocode/yudao-ui-admin-vben/pulls/243/files#diff_note_47350213这个组件没有必要直接用antdv card 的slot去做就行了只有这一个地方用没有必要单独写一个组件
defineProps({
title: {
@@ -6,10 +8,6 @@ defineProps({
required: true,
},
});
defineComponent({
name: 'CardTitle',
});
</script>
<template>

View File

@@ -169,8 +169,8 @@ const [Modal, modalApi] = useVbenModal({
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
gridApi.grid.clearCheckboxRow();
gridApi.grid.clearRadioRow();
await gridApi.grid.clearCheckboxRow();
await gridApi.grid.clearRadioRow();
return;
}

View File

@@ -101,6 +101,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
formatter: 'formatDateTime',
},
{
field: 'actions',
title: '操作',
width: 100,
fixed: 'right',

View File

@@ -7,7 +7,6 @@ import { ref } from 'vue';
import { DocAlert, Page } from '@vben/common-ui';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { $t } from '@vben/locales';
import { message, TabPane, Tabs } from 'ant-design-vue';
@@ -32,7 +31,7 @@ function handleRefresh() {
/** 删除优惠券 */
async function handleDelete(row: MallCouponApi.Coupon) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
content: '回收中...',
duration: 0,
});
try {

View File

@@ -3,12 +3,16 @@ import type { MallKefuConversationApi } from '#/api/mall/promotion/kefu/conversa
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { confirm } from '@vben/common-ui';
import { IconifyIcon } from '@vben/icons';
import { formatPast, jsonParse } from '@vben/utils';
import { Avatar, Badge, message } from 'ant-design-vue';
import { Avatar, Badge, Layout, message } from 'ant-design-vue';
import * as KeFuConversationApi from '#/api/mall/promotion/kefu/conversation';
import {
deleteConversation,
updateConversationPinned,
} from '#/api/mall/promotion/kefu/conversation';
import { useMallKefuStore } from '#/store/mall/kefu';
import { KeFuMessageContentTypeEnum } from './tools/constants';
@@ -108,27 +112,29 @@ function closeRightMenu() {
}
/** 置顶会话 */
async function updateConversationPinned(adminPinned: boolean) {
async function updateConversationPinnedFn(pinned: boolean) {
// 1. 会话置顶/取消置顶
await KeFuConversationApi.updateConversationPinned({
await updateConversationPinned({
id: rightClickConversation.value.id,
adminPinned,
pinned,
});
message.success(adminPinned ? '置顶成功' : '取消置顶成功');
message.success(pinned ? '置顶成功' : '取消置顶成功');
// 2. 关闭右键菜单,更新会话列表
closeRightMenu();
await kefuStore.updateConversation(rightClickConversation.value.id);
}
/** 删除会话 */
async function deleteConversation() {
async function deleteConversationFn() {
// 1. 删除会话
// TODO @jave使用全局的 confirm这样 ele 和 antd 可以相对复用;
await message.confirm('您确定要删除该会话吗?');
await KeFuConversationApi.deleteConversation(rightClickConversation.value.id);
// 2. 关闭右键菜单,更新会话列表
closeRightMenu();
kefuStore.deleteConversation(rightClickConversation.value.id);
confirm({
content: '您确定要删除该会话吗?',
}).then(async () => {
await deleteConversation(rightClickConversation.value.id);
// 2. 关闭右键菜单,更新会话列表
closeRightMenu();
kefuStore.deleteConversation(rightClickConversation.value.id);
});
}
/** 监听右键菜单的显示状态,添加点击事件监听器 */
@@ -154,7 +160,7 @@ onBeforeUnmount(() => {
</script>
<template>
<a-layout-sider class="kefu h-full pt-[5px]" width="260px">
<Layout.Sider class="kefu h-full pt-[5px]" width="260px">
<div class="color-[#999] my-[10px] font-bold">
会话记录({{ kefuStore.getConversationList.length }})
</div>
@@ -206,7 +212,7 @@ onBeforeUnmount(() => {
<li
v-show="!rightClickConversation.adminPinned"
class="flex items-center"
@click.stop="updateConversationPinned(true)"
@click.stop="updateConversationPinnedFn(true)"
>
<IconifyIcon class="mr-[5px]" icon="ep:top" />
置顶会话
@@ -214,12 +220,12 @@ onBeforeUnmount(() => {
<li
v-show="rightClickConversation.adminPinned"
class="flex items-center"
@click.stop="updateConversationPinned(false)"
@click.stop="updateConversationPinnedFn(false)"
>
<IconifyIcon class="mr-[5px]" icon="ep:bottom" />
取消置顶
</li>
<li class="flex items-center" @click.stop="deleteConversation">
<li class="flex items-center" @click.stop="deleteConversationFn">
<IconifyIcon class="mr-[5px]" color="red" icon="ep:delete" />
删除会话
</li>
@@ -228,7 +234,7 @@ onBeforeUnmount(() => {
取消
</li>
</ul>
</a-layout-sider>
</Layout.Sider>
</template>
<style lang="scss" scoped>

View File

@@ -14,11 +14,22 @@ import { formatDate, isEmpty, jsonParse } from '@vben/utils';
import { vScroll } from '@vueuse/components';
import { useDebounceFn, useScroll } from '@vueuse/core';
import { Avatar, Empty, Image, notification } from 'ant-design-vue'; // 添加 Empty 组件导入
import {
Avatar,
Empty,
Image,
Layout,
notification,
Textarea,
} from 'ant-design-vue';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import * as KeFuMessageApi from '#/api/mall/promotion/kefu/message';
import {
getKeFuMessageList,
sendKeFuMessage,
updateKeFuMessageReadStatus,
} from '#/api/mall/promotion/kefu/message';
import { useMallKefuStore } from '#/store/mall/kefu';
import MessageItem from './message/MessageItem.vue';
@@ -56,18 +67,18 @@ const getMessageContent = computed(
/** 获得消息列表 */
// TODO @javeidea 的 linter 报错,处理下;
async function getMessageList() {
const res = await KeFuMessageApi.getKeFuMessageList(queryParams);
const res: any = await getKeFuMessageList(queryParams as any);
if (isEmpty(res)) {
// 当返回的是空列表说明没有消息或者已经查询完了历史消息
skipGetMessageList.value = true;
return;
}
queryParams.createTime = formatDate(res.at(-1).createTime) as any;
queryParams.createTime = formatDate((res as any).at(-1).createTime) as any;
// 情况一:加载最新消息
if (queryParams.createTime) {
// 情况二:加载历史消息
for (const item of res) {
for (const item of res as any) {
pushMessage(item);
}
} else {
@@ -184,7 +195,7 @@ async function handleSendMessage(event: any) {
/** 真正发送消息 【共用】*/
async function sendMessage(msg: MallKefuMessageApi.MessageSend) {
// 发送消息
await KeFuMessageApi.sendKeFuMessage(msg);
await sendKeFuMessage(msg);
message.value = '';
// 加载消息列表
await refreshMessageList();
@@ -211,7 +222,7 @@ async function scrollToBottom() {
// scrollbarRef.value!.setScrollTop(innerRef.value!.clientHeight)
showNewMessageTip.value = false;
// 2.2 消息已读
await KeFuMessageApi.updateKeFuMessageReadStatus(conversation.value.id);
await updateKeFuMessageReadStatus(conversation.value.id);
}
/** 查看新消息 */
@@ -268,11 +279,11 @@ function showTime(item: MallKefuMessageApi.Message, index: number) {
</script>
<template>
<a-layout v-if="showKeFuMessageList" class="kefu">
<a-layout-header class="kefu-header">
<Layout v-if="showKeFuMessageList()" class="kefu">
<Layout.Header class="kefu-header">
<div class="kefu-title">{{ conversation.userNickname }}</div>
</a-layout-header>
<a-layout-content class="kefu-content">
</Layout.Header>
<Layout.Content class="kefu-content">
<div
ref="scrollbarRef"
class="flex h-full overflow-y-auto"
@@ -396,8 +407,8 @@ function showTime(item: MallKefuMessageApi.Message, index: number) {
<span>有新消息</span>
<IconifyIcon class="ml-5px" icon="ep:bottom" />
</div>
</a-layout-content>
<a-layout-footer class="kefu-footer">
</Layout.Content>
<Layout.Footer class="kefu-footer">
<div class="chat-tools flex items-center">
<EmojiSelectPopover @select-emoji="handleEmojiSelect" />
<PictureSelectUpload
@@ -405,20 +416,20 @@ function showTime(item: MallKefuMessageApi.Message, index: number) {
@send-picture="handleSendPicture"
/>
</div>
<a-textarea
<Textarea
v-model:value="message"
:rows="6"
placeholder="输入消息Enter发送Shift+Enter换行"
style="border-style: none"
@keyup.enter.prevent="handleSendMessage"
/>
</a-layout-footer>
</a-layout>
<a-layout v-else class="kefu">
<a-layout-content>
</Layout.Footer>
</Layout>
<Layout v-else class="kefu">
<Layout.Content>
<Empty description="请选择左侧的一个会话后开始" class="mt-[50px]" />
</a-layout-content>
</a-layout>
</Layout.Content>
</Layout>
</template>
<style lang="scss" scoped>

View File

@@ -3,4 +3,4 @@ export { default as KeFuMessageList } from './KeFuMessageList.vue';
export { default as MemberInfo } from './member/MemberInfo.vue';
// TODO @jawecomponents =》modules在 vben 里modules 是给自己用的,把一个大 vue 拆成 n 个小 vuecomponents 是给别的模块使用的;
// TODO @jawe1组件名小写类似 conversation-list.vue2KeFu 开头可以去掉,因为已经是当前模块下,不用重复拼写;
// TODO @jawe1组件名小写类似 conversation-list.vue2KeFu 开头可以去掉,因为已经是当前模块下,不用重复拼写;

View File

@@ -1,6 +1,8 @@
<!-- 右侧信息会员信息 + 最近浏览 + 交易订单 -->
<script lang="ts" setup>
import type { MallKefuConversationApi } from '#/api/mall/promotion/kefu/conversation';
import type { MemberUserApi } from '#/api/member/user';
import type { PayWalletApi } from '#/api/pay/wallet/balance';
import { computed, nextTick, ref } from 'vue';
@@ -9,11 +11,10 @@ import { isEmpty } from '@vben/utils';
// TODO @jawedebounce 是不是还是需要的哈;应该有 2 处需要;可以微信沟通哈;
// import { debounce } from 'lodash-es'
import { useDebounceFn } from '@vueuse/core';
import { Card, Empty, message } from 'ant-design-vue';
import { Card, Empty, Layout, message } from 'ant-design-vue';
import * as UserApi from '#/api/member/user';
import * as WalletApi from '#/api/pay/wallet/balance';
import { CardTitle } from '#/components/card-title';
import { getUser } from '#/api/member/user';
import { getWallet } from '#/api/pay/wallet/balance';
import AccountInfo from '#/views/member/user/detail/modules/account-info.vue';
import BasicInfo from '#/views/member/user/detail/modules/basic-info.vue';
@@ -91,12 +92,12 @@ async function initHistory(val: MallKefuConversationApi.Conversation) {
defineExpose({ initHistory });
/** 处理消息列表滚动事件(debounce 限流) */
const scrollbarRef = ref<InstanceType>();
const handleScroll = useDebounceFn(() => {
const scrollbarRef = ref<InstanceType<any>>();
const handleScroll = useDebounceFn(async () => {
const wrap = scrollbarRef.value?.wrapRef;
// 触底重置
if (Math.abs(wrap!.scrollHeight - wrap!.clientHeight - wrap!.scrollTop) < 1) {
loadMore();
await loadMore();
}
}, 200);
@@ -106,8 +107,8 @@ const WALLET_INIT_DATA = {
balance: 0,
totalExpense: 0,
totalRecharge: 0,
} as WalletApi.WalletVO; // 钱包初始化数据
const wallet = ref<WalletApi.WalletVO>(WALLET_INIT_DATA); // 钱包信息
} as PayWalletApi.Wallet; // 钱包初始化数据
const wallet = ref<PayWalletApi.Wallet>(WALLET_INIT_DATA); // 钱包信息
async function getUserWallet() {
if (!conversation.value.userId) {
@@ -115,21 +116,21 @@ async function getUserWallet() {
return;
}
wallet.value =
(await WalletApi.getWallet({ userId: conversation.value.userId })) ||
(await getWallet({ userId: conversation.value.userId })) ||
WALLET_INIT_DATA;
}
/** 获得用户 */
const loading = ref(true); // 加载中
const user = ref<UserApi.UserVO>({} as UserApi.UserVO);
const user = ref<MemberUserApi.User>({} as MemberUserApi.User);
async function getUserData() {
loading.value = true;
try {
const res = await UserApi.getUser(conversation.value.userId);
const res = await getUser(conversation.value.userId);
if (res) {
user.value = res;
} else {
user.value = {} as UserApi.UserVO;
user.value = {} as MemberUserApi.User;
message.error('会员不存在!');
}
} finally {
@@ -140,8 +141,8 @@ async function getUserData() {
<template>
<!-- TODO @javefrom xingyua- 换成大写的方式另外组件没有进行导入其他页面也有这个问题 -->
<a-layout class="kefu">
<a-layout-header class="kefu-header">
<Layout class="kefu">
<Layout.Header class="kefu-header">
<div
:class="{ 'kefu-header-item-activation': tabActivation('会员信息') }"
class="kefu-header-item flex cursor-pointer items-center justify-center"
@@ -163,13 +164,13 @@ async function getUserData() {
>
交易订单
</div>
</a-layout-header>
<a-layout-content class="kefu-content p-10px!">
</Layout.Header>
<Layout.Content class="kefu-content p-10px!">
<div v-if="!isEmpty(conversation)" v-loading="loading">
<!-- 基本信息 -->
<BasicInfo v-if="activeTab === '会员信息'" :user="user" mode="kefu">
<template #header>
<CardTitle title="基本信息" />
<template #title>
<span class="text-sm font-bold">基本信息</span>
</template>
</BasicInfo>
<!-- 账户信息 -->
@@ -178,8 +179,8 @@ async function getUserData() {
class="mt-10px h-full"
shadow="never"
>
<template #header>
<CardTitle title="账户信息" />
<template #title>
<span class="text-sm font-bold">账户信息</span>
</template>
<AccountInfo :column="1" :user="user" :wallet="wallet" />
</Card>
@@ -203,8 +204,8 @@ async function getUserData() {
description="请选择左侧的一个会话后开始"
class="mt-[50px]"
/>
</a-layout-content>
</a-layout>
</Layout.Content>
</Layout>
</template>
<style lang="scss" scoped>

View File

@@ -43,13 +43,9 @@ function openDetail(spuId: number) {
</script>
<template>
<div
class="product-warp"
style="cursor: pointer"
@click.stop="openDetail(spuId)"
>
<div class="product-warp cursor-pointer" @click.stop="openDetail(spuId)">
<!-- 左侧商品图片-->
<div class="product-warp-left mr-[24px]">
<div class="product-warp-left mr-6">
<Image
:initial-index="0"
:preview-src-list="[picUrl]"
@@ -63,8 +59,8 @@ function openDetail(spuId: number) {
<!-- 右侧商品信息 -->
<div class="product-warp-right">
<div class="description">{{ title }}</div>
<div class="my-[5px]">
<span class="mr-[20px]">库存: {{ stock || 0 }}</span>
<div class="my-1">
<span class="mr-5">库存: {{ stock || 0 }}</span>
<span>销量: {{ salesCount || 0 }}</span>
</div>
<div class="flex items-center justify-between">

View File

@@ -6,16 +6,15 @@ import { computed } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { List } from 'ant-design-vue';
import { List, Popover } from 'ant-design-vue';
import { useEmoji } from './emoji';
defineOptions({ name: 'EmojiSelectPopover' });
/** 选择 emoji 表情 */
// TODO @jawe这里有 linter 告警,看看要不要处理下;
const emits = defineEmits<{
(e: 'selectEmoji', v: Emoji);
(e: 'selectEmoji', v: Emoji): void;
}>();
const { getEmojiList } = useEmoji();
const emojiList = computed(() => getEmojiList());
@@ -27,7 +26,7 @@ function handleSelect(item: Emoji) {
</script>
<template>
<a-popover :width="500" placement="top" trigger="click">
<Popover :width="500" placement="top" trigger="click">
<template #content>
<List height="300px">
<ul class="ml-2 flex flex-wrap px-2">
@@ -42,15 +41,15 @@ function handleSelect(item: Emoji) {
class="icon-item w-1/10 mr-2 mt-1 flex cursor-pointer items-center justify-center border border-solid p-2"
@click="handleSelect(item)"
>
<img :src="item.url" class="h-[24px] w-[24px]" />
<img :src="item.url" class="h-6 w-6" />
</li>
</ul>
</List>
</template>
<IconifyIcon
:size="30"
class="ml-[10px] cursor-pointer"
class="ml-2.5 cursor-pointer"
icon="twemoji:grinning-face"
/>
</a-popover>
</Popover>
</template>

View File

@@ -2,7 +2,7 @@
<script lang="ts" setup>
import { message } from 'ant-design-vue';
import * as FileApi from '#/api/infra/file';
import { uploadFile } from '#/api/infra/file';
import Picture from '#/views/mall/promotion/kefu/asserts/picture.svg';
defineOptions({ name: 'PictureSelectUpload' });
@@ -17,7 +17,7 @@ async function selectAndUpload() {
message.success('图片发送中请稍等。。。');
// TODO @jawe直接使用 updateFile不通过 FileApi。vben 这里的规范;
// TODO @jawe这里的上传看看能不能替换成 export function useUpload(directory?: string) {;它支持前端直传,更统一;
const res = await FileApi.updateFile({ file: files[0].file });
const res = await uploadFile({ file: files[0].file });
emits('sendPicture', res.data);
}

View File

@@ -65,7 +65,7 @@ export const useEmoji = () => {
const initStaticEmoji = async () => {
const pathList = import.meta.glob('../../asserts/*.{png,jpg,jpeg,svg}');
for (const path in pathList) {
const imageModule: any = await pathList[path]();
const imageModule: any = await pathList[path]?.();
emojiPathList.value.push({ path, src: imageModule.default });
}
};

View File

@@ -1,11 +1,13 @@
<script lang="ts" setup>
import type { MallKefuConversationApi } from '#/api/mall/promotion/kefu/conversation';
import { defineOptions, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { Page } from '@vben/common-ui';
import { useAccessStore } from '@vben/stores';
import { useWebSocket } from '@vueuse/core';
import { message } from 'ant-design-vue';
import { Layout, message } from 'ant-design-vue';
import { useMallKefuStore } from '#/store/mall/kefu';
@@ -81,10 +83,10 @@ watch(
const keFuChatBoxRef = ref<InstanceType<typeof KeFuMessageList>>();
const memberInfoRef = ref<InstanceType<typeof MemberInfo>>();
// TODO @jawe这里没导入
const handleChange = (conversation: KeFuConversationRespVO) => {
keFuChatBoxRef.value?.getNewMessageList(conversation);
function handleChange(conversation: MallKefuConversationApi.Conversation) {
keFuChatBoxRef.value?.getNewMessageList(conversation as any);
memberInfoRef.value?.initHistory(conversation);
};
}
const keFuConversationRef = ref<InstanceType<typeof KeFuConversationList>>();
/** 初始化 */
@@ -107,14 +109,14 @@ onBeforeUnmount(() => {
<template>
<Page>
<!-- TODO @jawestyle 使用 tailwindcssAI 友好 -->
<a-layout-content class="kefu-layout hrow">
<Layout.Content class="kefu-layout hrow">
<!-- 会话列表 -->
<KeFuConversationList ref="keFuConversationRef" @change="handleChange" />
<!-- 会话详情选中会话的消息列表 -->
<KeFuMessageList ref="keFuChatBoxRef" />
<!-- 会员信息选中会话的会员信息 -->
<MemberInfo ref="memberInfoRef" />
</a-layout-content>
</Layout.Content>
</Page>
</template>

View File

@@ -131,7 +131,6 @@ export function useGridColumns(): VxeGridPropTypes.Columns {
{
field: 'user.nickname',
title: '买家',
align: 'center',
minWidth: 120,
},
{
@@ -144,11 +143,10 @@ export function useGridColumns(): VxeGridPropTypes.Columns {
field: 'status',
title: '售后状态',
width: 100,
align: 'center',
cellRender: {
name: 'CellDict',
props: {
dictType: DICT_TYPE.TRADE_AFTER_SALE_STATUS,
type: DICT_TYPE.TRADE_AFTER_SALE_STATUS,
},
},
},
@@ -156,11 +154,10 @@ export function useGridColumns(): VxeGridPropTypes.Columns {
field: 'way',
title: '售后方式',
width: 100,
align: 'center',
cellRender: {
name: 'CellDict',
props: {
dictType: DICT_TYPE.TRADE_AFTER_SALE_WAY,
type: DICT_TYPE.TRADE_AFTER_SALE_WAY,
},
},
},

View File

@@ -117,7 +117,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<Tag
color="blue"
v-for="property in item.properties"
:key="property.id"
:key="property.propertyId"
>
{{ property.propertyName }} : {{ property.valueName }}
</Tag>

View File

@@ -17,9 +17,14 @@ import { $t } from '#/locales';
import Form from '../modules/form.vue';
import AccountInfo from './modules/account-info.vue';
import AddressList from './modules/address-list.vue';
import AfterSaleList from './modules/after-sale-list.vue';
import BalanceList from './modules/balance-list.vue';
import BasicInfo from './modules/basic-info.vue';
import BrokerageList from './modules/brokerage-list.vue';
import CouponList from './modules/coupon-list.vue';
import ExperienceRecordList from './modules/experience-record-list.vue';
import FavoriteList from './modules/favorite-list.vue';
import OrderList from './modules/order-list.vue';
import PointList from './modules/point-list.vue';
import SignList from './modules/sign-list.vue';
@@ -100,34 +105,19 @@ onMounted(async () => {
<AddressList class="h-full" :user-id="userId" />
</TabPane>
<TabPane tab="订单管理" key="OrderList">
<!-- Todo: 商城模块 -->
<div class="h-full">
<h1>订单管理</h1>
</div>
<OrderList class="h-full" :user-id="userId" />
</TabPane>
<TabPane tab="售后管理" key="AfterSaleList">
<!-- Todo: 商城模块 -->
<div class="h-full">
<h1>售后管理</h1>
</div>
<AfterSaleList class="h-full" :user-id="userId" />
</TabPane>
<TabPane tab="收藏记录" key="FavoriteList">
<!-- Todo: 商城模块 -->
<div class="h-full">
<h1>收藏记录</h1>
</div>
<FavoriteList class="h-full" :user-id="userId" />
</TabPane>
<TabPane tab="优惠劵" key="CouponList">
<!-- Todo: 商城模块 -->
<div class="h-full">
<h1>优惠劵</h1>
</div>
<CouponList class="h-full" :user-id="userId" />
</TabPane>
<TabPane tab="推广用户" key="BrokerageList">
<!-- Todo: 商城模块 -->
<div class="h-full">
<h1>推广用户</h1>
</div>
<BrokerageList class="h-full" :user-id="userId" />
</TabPane>
</Tabs>
</Card>

View File

@@ -8,7 +8,7 @@ import { Card } from 'ant-design-vue';
import { useDescription } from '#/components/description';
withDefaults(
const props = withDefaults(
defineProps<{
mode?: 'kefu' | 'member';
user: MemberUserApi.User;
@@ -20,6 +20,8 @@ withDefaults(
);
const [Descriptions] = useDescription({
bordered: false,
column: props.mode === 'member' ? 2 : 1,
schema: [
{
field: 'levelName',

View File

@@ -2,9 +2,7 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MemberAddressApi } from '#/api/member/address';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { DICT_TYPE } from '@vben/constants';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getAddressList } from '#/api/member/address';
@@ -13,58 +11,52 @@ const props = defineProps<{
userId: number;
}>();
const columns = [
{
field: 'id',
title: '地址编号',
minWidth: 100,
},
{
field: 'name',
title: '收件人名称',
minWidth: 120,
},
{
field: 'mobile',
title: '手机号',
minWidth: 130,
},
{
field: 'areaId',
title: '地区编码',
minWidth: 120,
},
{
field: 'detailAddress',
title: '收件详细地址',
minWidth: 200,
},
{
field: 'defaultStatus',
title: '是否默认',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
},
},
{
field: 'createTime',
title: '创建时间',
formatter: 'formatDateTime',
minWidth: 160,
},
];
const [Grid] = useVbenVxeGrid({
gridOptions: {
columns: [
{
field: 'id',
title: '地址编号',
minWidth: 100,
},
{
field: 'name',
title: '收件人名称',
minWidth: 120,
},
{
field: 'mobile',
title: '手机号',
minWidth: 130,
},
{
field: 'areaId',
title: '地区编码',
minWidth: 120,
},
{
field: 'detailAddress',
title: '收件详细地址',
minWidth: 200,
},
{
field: 'defaultStatus',
title: '是否默认',
minWidth: 100,
slots: {
default: ({ row }) => {
return h(
Tag,
{
class: 'mr-1',
color: row.defaultStatus ? 'blue' : 'red',
},
() => (row.defaultStatus ? '是' : '否'),
);
},
},
},
{
field: 'createTime',
title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime',
},
],
columns,
keepSource: true,
pagerConfig: {
enabled: false,

View File

@@ -0,0 +1,155 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallAfterSaleApi } from '#/api/mall/trade/afterSale';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { Button, Image, Tabs, Tag } from 'ant-design-vue';
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getAfterSalePage } from '#/api/mall/trade/afterSale';
import {
useGridColumns,
useGridFormSchema,
} from '#/views/mall/trade/afterSale/data';
const props = defineProps<{
userId: number;
}>();
const { push } = useRouter();
const statusTabs = ref([
{
label: '全部',
value: '0',
},
]);
const statusTab = ref(statusTabs.value[0]!.value);
/** 处理退款 */
function handleOpenAfterSaleDetail(row: MallAfterSaleApi.AfterSale) {
push({ name: 'TradeAfterSaleDetail', params: { id: row.id } });
}
/** 查看订单详情 */
function handleOpenOrderDetail(row: MallAfterSaleApi.AfterSale) {
push({ name: 'TradeOrderDetail', params: { id: row.orderId } });
}
/** 切换售后状态 */
function handleChangeStatus(key: number | string) {
statusTab.value = key.toString();
gridApi.query();
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
cellConfig: {
height: 60,
},
columns: useGridColumns(),
keepSource: true,
pagerConfig: {
pageSize: 10,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getAfterSalePage({
pageNo: page.currentPage,
pageSize: page.pageSize,
userId: props.userId,
status:
statusTab.value === '0' ? undefined : Number(statusTab.value),
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<MallAfterSaleApi.AfterSale>,
});
/** 初始化 */
onMounted(() => {
for (const dict of getDictOptions(DICT_TYPE.TRADE_AFTER_SALE_STATUS)) {
statusTabs.value.push({
label: dict.label,
value: dict.value.toString(),
});
}
});
</script>
<template>
<Grid>
<template #toolbar-actions>
<Tabs
v-model:active-key="statusTab"
class="w-full"
@change="handleChangeStatus"
>
<Tabs.TabPane
v-for="tab in statusTabs"
:key="tab.value"
:tab="tab.label"
/>
</Tabs>
</template>
<template #orderNo="{ row }">
<Button type="link" @click="handleOpenOrderDetail(row)">
{{ row.orderNo }}
</Button>
</template>
<template #productInfo="{ row }">
<div class="flex items-start gap-2 text-left">
<Image
v-if="row.picUrl"
:src="row.picUrl"
:width="40"
:height="40"
:preview="{ src: row.picUrl }"
/>
<div class="flex flex-1 flex-col gap-1">
<span class="text-sm">{{ row.spuName }}</span>
<div class="mt-1 flex flex-wrap gap-1">
<Tag
v-for="property in row.properties"
:key="property.propertyId!"
size="small"
color="blue"
>
{{ property.propertyName }}: {{ property.valueName }}
</Tag>
</div>
</div>
</div>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: '处理退款',
type: 'link',
onClick: handleOpenAfterSaleDetail.bind(null, row),
},
]"
/>
</template>
</Grid>
</template>

View File

@@ -4,6 +4,7 @@ import type { WalletTransactionApi } from '#/api/pay/wallet/transaction';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getTransactionPage } from '#/api/pay/wallet/transaction';
import { useTransactionGridColumns } from '#/views/pay/wallet/balance/data';
const props = defineProps<{
walletId: number | undefined;
@@ -11,36 +12,7 @@ const props = defineProps<{
const [Grid] = useVbenVxeGrid({
gridOptions: {
columns: [
{
field: 'id',
title: '编号',
minWidth: 100,
},
{
field: 'title',
title: '关联业务标题',
minWidth: 200,
},
{
field: 'price',
title: '交易金额',
minWidth: 120,
formatter: 'formatFenToYuanAmount',
},
{
field: 'balance',
title: '钱包余额',
minWidth: 120,
formatter: 'formatFenToYuanAmount',
},
{
field: 'createTime',
title: '交易时间',
minWidth: 180,
formatter: 'formatDateTime',
},
],
columns: useTransactionGridColumns(),
keepSource: true,
proxyConfig: {
ajax: {

View File

@@ -11,7 +11,7 @@ import { Avatar, Card, Col, Row } from 'ant-design-vue';
import { useDescription } from '#/components/description';
import { DictTag } from '#/components/dict-tag';
withDefaults(
const props = withDefaults(
defineProps<{ mode?: 'kefu' | 'member'; user: MemberUserApi.User }>(),
{
mode: 'member',
@@ -19,6 +19,8 @@ withDefaults(
);
const [Descriptions] = useDescription({
bordered: false,
column: props.mode === 'member' ? 2 : 1,
schema: [
{
field: 'name',
@@ -35,10 +37,10 @@ const [Descriptions] = useDescription({
{
field: 'sex',
label: '性别',
content: (data) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.SYSTEM_USER_SEX,
value: data.sex,
value: val,
}),
},
{
@@ -52,17 +54,17 @@ const [Descriptions] = useDescription({
{
field: 'birthday',
label: '生日',
content: (data) => formatDate(data.birthday)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
{
field: 'createTime',
label: '注册时间',
content: (data) => formatDate(data.createTime)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
{
field: 'loginDate',
label: '最后登录时间',
content: (data) => formatDate(data.loginDate)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
],
});

View File

@@ -0,0 +1,125 @@
<script setup lang="ts">
import type {
VxeGridPropTypes,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { MallBrokerageUserApi } from '#/api/mall/trade/brokerage/user';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getBrokerageUserPage } from '#/api/mall/trade/brokerage/user';
import { getRangePickerDefaultProps } from '#/utils';
defineOptions({ name: 'BrokerageList' });
const props = defineProps<{
userId: number;
}>();
const formSchema = (): any[] => {
return [
{
fieldName: 'level',
label: '用户类型',
component: 'Select',
componentProps: {
options: [
{
label: '全部',
value: 0,
},
{
label: '一级',
value: 1,
},
{
label: '二级',
value: 2,
},
],
placeholder: '请选择用户类型',
allowClear: true,
},
},
{
fieldName: 'bindUserTime',
label: '绑定时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
clearable: true,
},
},
];
};
const columns = (): VxeGridPropTypes.Columns => {
return [
{
field: 'id',
title: '用户编号',
},
{
field: 'avatar',
title: '头像',
cellRender: {
name: 'CellImage',
props: {
height: 40,
width: 40,
shape: 'circle',
},
},
},
{
field: 'nickname',
title: '昵称',
},
{
field: 'level',
title: '等级',
formatter: (row: any) => {
return row.level === 1 ? '一级' : '二级';
},
},
{
field: 'bindUserTime',
title: '绑定时间',
formatter: 'formatDateTime',
},
];
};
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: formSchema(),
},
gridOptions: {
columns: columns(),
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getBrokerageUserPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
bindUserId: props.userId,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<MallBrokerageUserApi.BrokerageUser>,
});
</script>
<template>
<Grid />
</template>

View File

@@ -0,0 +1,148 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallCouponApi } from '#/api/mall/promotion/coupon/coupon';
import { ref } from 'vue';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { message, TabPane, Tabs } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteCoupon,
getCouponPage,
} from '#/api/mall/promotion/coupon/coupon';
import {
useGridColumns as useCouponGridColumns,
useGridFormSchema as useCouponGridFormSchema,
} from '#/views/mall/promotion/coupon/data';
const props = defineProps<{
userId: number;
}>();
const activeTab = ref('all');
const statusTabs = ref(getStatusTabs());
/** 列表的搜索表单(过滤掉会员相关字段) */
function useGridFormSchema() {
const excludeFields = new Set(['nickname']);
return useCouponGridFormSchema().filter(
(item) => !excludeFields.has(item.fieldName),
);
}
/** 列表的字段(过滤掉会员相关字段) */
function useGridColumns() {
const excludeFields = new Set(['nickname']);
return useCouponGridColumns()?.filter(
(item) => item.field && !excludeFields.has(item.field),
);
}
/** 获取状态选项卡配置 */
function getStatusTabs() {
const tabs = [
{
label: '全部',
value: 'all',
},
];
const statusOptions = getDictOptions(DICT_TYPE.PROMOTION_COUPON_STATUS);
for (const option of statusOptions) {
tabs.push({
label: option.label,
value: String(option.value),
});
}
return tabs;
}
/** Tab 切换 */
function handleTabChange(tabName: any) {
activeTab.value = tabName;
gridApi.query();
}
/** 删除优惠券 */
async function handleDelete(row: MallCouponApi.Coupon) {
const hideLoading = message.loading({
content: '回收中...',
duration: 0,
});
try {
await deleteCoupon(row.id!);
message.success('回收成功');
await gridApi.query();
} finally {
hideLoading();
}
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
keepSource: true,
pagerConfig: {
pageSize: 10,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
const params = {
pageNo: page.currentPage,
pageSize: page.pageSize,
userId: props.userId,
...formValues,
// Tab状态过滤
status:
activeTab.value === 'all' ? undefined : Number(activeTab.value),
};
return await getCouponPage(params);
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<MallCouponApi.Coupon>,
});
</script>
<template>
<Grid>
<template #toolbar-actions>
<Tabs class="w-full" @change="handleTabChange">
<TabPane v-for="tab in statusTabs" :key="tab.value" :tab="tab.label" />
</Tabs>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: '回收',
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['promotion:coupon:delete'],
popConfirm: {
title:
'回收将会收回会员领取的待使用的优惠券,已使用的将无法回收,确定要回收所选优惠券吗?',
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</template>

View File

@@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeGridProps, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MemberExperienceRecordApi } from '#/api/member/experience-record';
import { h } from 'vue';
@@ -17,103 +18,109 @@ const props = defineProps<{
userId: number;
}>();
/** 表单搜索 schema */
function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'bizType',
label: '业务类型',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.MEMBER_EXPERIENCE_BIZ_TYPE, 'number'),
placeholder: '请选择业务类型',
allowClear: true,
},
},
{
fieldName: 'title',
label: '标题',
component: 'Input',
componentProps: {
placeholder: '请输入标题',
allowClear: true,
},
},
{
fieldName: 'createDate',
label: '获得时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},
];
}
/** 表格列配置 */
function useGridColumns(): VxeGridProps['columns'] {
return [
{
field: 'id',
title: '编号',
minWidth: 100,
},
{
field: 'createTime',
title: '获得时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{
field: 'experience',
title: '经验',
minWidth: 100,
slots: {
default: ({ row }) => {
return h(
Tag,
{
class: 'mr-1',
color: row.experience > 0 ? 'blue' : 'red',
},
() => (row.experience > 0 ? `+${row.experience}` : row.experience),
);
},
},
},
{
field: 'totalExperience',
title: '总经验',
minWidth: 100,
},
{
field: 'title',
title: '标题',
minWidth: 200,
},
{
field: 'description',
title: '描述',
minWidth: 250,
},
{
field: 'bizId',
title: '业务编号',
minWidth: 120,
},
{
field: 'bizType',
title: '业务类型',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.MEMBER_EXPERIENCE_BIZ_TYPE },
},
},
];
}
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: [
{
fieldName: 'bizType',
label: '业务类型',
component: 'Select',
componentProps: {
options: getDictOptions(
DICT_TYPE.MEMBER_EXPERIENCE_BIZ_TYPE,
'number',
),
placeholder: '请选择业务类型',
allowClear: true,
},
},
{
fieldName: 'title',
label: '标题',
component: 'Input',
componentProps: {
placeholder: '请输入标题',
allowClear: true,
},
},
{
fieldName: 'createDate',
label: '获得时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},
],
schema: useGridFormSchema(),
},
gridOptions: {
columns: [
{
field: 'id',
title: '编号',
minWidth: 100,
},
{
field: 'createTime',
title: '获得时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{
field: 'experience',
title: '经验',
minWidth: 100,
slots: {
default: ({ row }) => {
return h(
Tag,
{
class: 'mr-1',
color: row.experience > 0 ? 'blue' : 'red',
},
() =>
row.experience > 0 ? `+${row.experience}` : row.experience,
);
},
},
},
{
field: 'totalExperience',
title: '总经验',
minWidth: 100,
},
{
field: 'title',
title: '标题',
minWidth: 200,
},
{
field: 'description',
title: '描述',
minWidth: 250,
},
{
field: 'bizId',
title: '业务编号',
minWidth: 120,
},
{
field: 'bizType',
title: '业务类型',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.MEMBER_EXPERIENCE_BIZ_TYPE },
},
},
],
columns: useGridColumns(),
keepSource: true,
proxyConfig: {
ajax: {
@@ -136,7 +143,6 @@ const [Grid] = useVbenVxeGrid({
search: true,
},
} as VxeTableGridOptions<MemberExperienceRecordApi.ExperienceRecord>,
separator: false,
});
</script>

View File

@@ -0,0 +1,98 @@
<script setup lang="ts">
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallFavoriteApi } from '#/api/mall/product/favorite';
import { DICT_TYPE } from '@vben/constants';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import * as FavoriteApi from '#/api/mall/product/favorite';
const props = defineProps<{
userId: number;
}>();
const columns = [
{
field: 'id',
title: '商品编号',
minWidth: 100,
},
{
field: 'picUrl',
title: '商品图',
minWidth: 100,
cellRender: {
name: 'CellImage',
props: {
width: 24,
height: 24,
},
},
},
{
field: 'name',
title: '商品名称',
minWidth: 200,
},
{
field: 'price',
title: '商品售价',
formatter: 'formatAmount2',
minWidth: 120,
},
{
field: 'salesCount',
title: '销量',
minWidth: 100,
},
{
field: 'createTime',
title: '收藏时间',
formatter: 'formatDateTime',
minWidth: 160,
},
{
field: 'status',
title: '状态',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.PRODUCT_SPU_STATUS },
},
},
];
const [Grid] = useVbenVxeGrid({
gridOptions: {
columns,
keepSource: true,
pagerConfig: {
pageSize: 10,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await FavoriteApi.getFavoritePage({
pageNo: page.currentPage,
pageSize: page.pageSize,
userId: props.userId,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<MallFavoriteApi.Favorite>,
});
</script>
<template>
<Grid />
</template>

View File

@@ -0,0 +1,128 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallOrderApi } from '#/api/mall/trade/order';
import { useRouter } from 'vue-router';
import { DICT_TYPE } from '@vben/constants';
import { fenToYuan } from '@vben/utils';
import { Image, List, Tag } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getOrderPage } from '#/api/mall/trade/order';
import { DictTag } from '#/components/dict-tag';
import { $t } from '#/locales';
import {
useGridColumns,
useGridFormSchema as useOrderGridFormSchema,
} from '#/views/mall/trade/order/data';
const props = defineProps<{
userId: number;
}>();
const { push } = useRouter();
/** 列表的搜索表单(过滤掉用户相关字段) */
function useGridFormSchema() {
const excludeFields = new Set(['userId', 'userNickname']);
return useOrderGridFormSchema().filter(
(item) => !excludeFields.has(item.fieldName),
);
}
/** 详情 */
function handleDetail(row: MallOrderApi.Order) {
push({ name: 'TradeOrderDetail', params: { id: row.id } });
}
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
expandConfig: {
trigger: 'row',
expandAll: true,
padding: true,
},
columns: useGridColumns(),
keepSource: true,
pagerConfig: {
pageSize: 10,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getOrderPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
userId: props.userId,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<MallOrderApi.Order>,
});
</script>
<template>
<Grid table-title="订单列表">
<template #expand_content="{ row }">
<List item-layout="vertical" :data-source="row.items">
<template #renderItem="{ item }">
<List.Item>
<List.Item.Meta>
<template #title>
{{ item.spuName }}
<Tag
color="blue"
v-for="property in item.properties"
:key="property.propertyId"
>
{{ property.propertyName }} : {{ property.valueName }}
</Tag>
</template>
<template #avatar>
<Image :src="item.picUrl" :width="40" :height="40" />
</template>
<template #description>
{{
`原价:${fenToYuan(item.price)} 元 / 数量:${item.count}`
}}
|
<DictTag
:type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
:value="item.afterSaleStatus"
/>
</template>
</List.Item.Meta>
</List.Item>
</template>
</List>
</template>
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.detail'),
type: 'link',
icon: ACTION_ICON.VIEW,
auth: ['trade:order:query'],
onClick: handleDetail.bind(null, row),
},
]"
/>
</template>
</Grid>
</template>

View File

@@ -2,54 +2,43 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MemberPointRecordApi } from '#/api/member/point/record';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getRecordPage } from '#/api/member/point/record';
import { getRangePickerDefaultProps } from '#/utils';
import { useGridColumns } from '#/views/member/point/record/data';
import {
useGridColumns as usePointGridColumns,
useGridFormSchema as usePointGridFormSchema,
} from '#/views/member/point/record/data';
const props = defineProps<{
userId: number;
}>();
/** 列表的搜索表单(过滤掉用户相关字段) */
function useGridFormSchema() {
const excludeFields = new Set(['nickname']);
return usePointGridFormSchema().filter(
(item) => !excludeFields.has(item.fieldName),
);
}
/** 列表的字段(过滤掉用户相关字段) */
function useGridColumns() {
const excludeFields = new Set(['nickname']);
return usePointGridColumns()?.filter(
(item) => item.field && !excludeFields.has(item.field),
);
}
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: [
{
fieldName: 'bizType',
label: '业务类型',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.MEMBER_POINT_BIZ_TYPE, 'number'),
placeholder: '请选择业务类型',
allowClear: true,
},
},
{
fieldName: 'title',
label: '积分标题',
component: 'Input',
componentProps: {
placeholder: '请输入积分标题',
allowClear: true,
},
},
{
fieldName: 'createDate',
label: '获得时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},
],
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
keepSource: true,
pagerConfig: {
pageSize: 10,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
@@ -71,7 +60,6 @@ const [Grid] = useVbenVxeGrid({
search: true,
},
} as VxeTableGridOptions<MemberPointRecordApi.Record>,
separator: false,
});
</script>

View File

@@ -4,35 +4,34 @@ import type { MemberSignInRecordApi } from '#/api/member/signin/record';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getSignInRecordPage } from '#/api/member/signin/record';
import { getRangePickerDefaultProps } from '#/utils';
import { useGridColumns } from '#/views/member/signin/record/data';
import {
useGridColumns as useSignInGridColumns,
useGridFormSchema as useSignInGridFormSchema,
} from '#/views/member/signin/record/data';
const props = defineProps<{
userId: number;
}>();
/** 列表的搜索表单(过滤掉用户相关字段) */
function useGridFormSchema() {
const excludeFields = new Set(['nickname']);
return useSignInGridFormSchema().filter(
(item) => !excludeFields.has(item.fieldName),
);
}
/** 列表的字段(过滤掉用户相关字段) */
function useGridColumns() {
const excludeFields = new Set(['nickname']);
return useSignInGridColumns()?.filter(
(item) => item.field && !excludeFields.has(item.field),
);
}
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: [
{
fieldName: 'day',
label: '签到天数',
component: 'Input',
componentProps: {
placeholder: '请输入签到天数',
allowClear: true,
},
},
{
fieldName: 'createTime',
label: '签到时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},
],
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
@@ -58,7 +57,6 @@ const [Grid] = useVbenVxeGrid({
search: true,
},
} as VxeTableGridOptions<MemberSignInRecordApi.SignInRecord>,
separator: false,
});
</script>