feat(shop): 新增线下付款支持及优化Dashboard数据统计

- 新增线下付款(payType=9)支付方式,支持订单中标识和确认收款操作
- 实现商家确认线下付款后订单进入待发货状态功能
- 更新支付方式组件和订单列表及详情页的支付状态显示
- 优化shop/dashboard快捷操作按钮为商城常用功能,修正快速入口路由路径
- 修复Dashboard待发货订单数统计时未过滤商城订单导致数据不准的问题
- 修复Dashboard运行天数为0的异常,将租户信息请求独立处理,避免某些请求失败影响
- 修复statisticsStore中couponUsedCount与getter同名冲突,改名为safeCouponUsedCount并同步更新引用
This commit is contained in:
2026-07-14 22:17:39 +08:00
parent 5106fe101c
commit 894592c290
11 changed files with 217 additions and 46 deletions

View File

@@ -180,27 +180,30 @@
<a-button
type="primary"
block
@click="navigateTo('/website/field')"
:loading="loading"
@click="navigateTo('/shop/shopOrder')"
>
<UngroupOutlined />
参数配置
</a-button>
<a-button block @click="navigateTo('/shop/shopOrder')">
<CalendarOutlined />
<ShoppingCartOutlined />
订单管理
</a-button>
<a-button block @click="navigateTo('/system/user')">
<UserOutlined />
用户管理
</a-button>
<a-button block @click="navigateTo('/website/index')">
<a-button block @click="navigateTo('/shop/shopGoods')">
<ShopOutlined />
站点管理
商品管理
</a-button>
<a-button block @click="navigateTo('/system/login-record')">
<FileTextOutlined />
登录日志
<a-button block @click="navigateTo('/shop/shopGoodsCategory')">
<AppstoreOutlined />
商品分类
</a-button>
<a-button block @click="navigateTo('/shop/shopCoupon')">
<GiftOutlined />
优惠券管理
</a-button>
<a-button block @click="navigateTo('/shop/shopUser')">
<TeamOutlined />
会员管理
</a-button>
<a-button block @click="navigateTo('/shop/shopSetting')">
<SettingOutlined />
商城设置
</a-button>
<a-button block @click="handleClearCache">
<ClearOutlined />
@@ -221,11 +224,12 @@ import { useOrderNotify } from '@/views/shop/shopOrder/useOrderNotify';
import {
ReloadOutlined,
RightOutlined,
UngroupOutlined,
CalendarOutlined,
UserOutlined,
ShoppingCartOutlined,
ShopOutlined,
FileTextOutlined,
AppstoreOutlined,
GiftOutlined,
TeamOutlined,
SettingOutlined,
ClearOutlined,
InfoCircleOutlined
} from '@ant-design/icons-vue';
@@ -234,6 +238,7 @@ import { useSiteStore } from '@/store/modules/site';
import { useStatisticsStore } from '@/store/modules/statistics';
import { useUserStore } from '@/store/modules/user';
import { pageShopOrder } from '@/api/shop/shopOrder';
import { getTenantInfo } from '@/api/layout';
import { storeToRefs } from 'pinia';
import { removeSiteInfoCache } from '@/api/cms/cmsWebsite';
@@ -257,7 +262,13 @@ const systemInfo = reactive({
});
// 计算属性
const runDays = computed(() => siteStore.runDays);
const now = ref(Date.now());
const tenantCreateTime = ref<string>('');
let runDaysTimer: ReturnType<typeof setInterval>;
const runDays = computed(() => {
if (!tenantCreateTime.value) return 0;
return Math.floor((now.value - new Date(tenantCreateTime.value).getTime()) / (24 * 60 * 60 * 1000));
});
const userCount = computed(() => statisticsStore.userCount);
const orderCount = computed(() => statisticsStore.orderCount);
const totalSales = computed(() => statisticsStore.totalSales);
@@ -279,7 +290,7 @@ const coreStats = computed(() => [
// 待处理事项数据
const pendingShipmentCount = ref(0);
const pendingRefundCount = ref(0);
const couponUsedCount = computed(() => statisticsStore.couponUsedCount);
const couponUsedCount = computed(() => statisticsStore.safeCouponUsedCount);
// 待处理事项使用computed确保响应式更新
const todoItems = computed(() => [
@@ -298,12 +309,12 @@ const todayStats = computed(() => ({
// 快速入口
const quickLinks = [
{ to: '/website/field', icon: '⚙️', label: '参数配置', bg: '#eff6ff' },
{ to: '/shop/shopOrder', icon: '📦', label: '订单管理', bg: '#f0fdf4' },
{ to: '/system/user', icon: '👥', label: '用户管理', bg: '#fff7ed' },
{ to: '/website/index', icon: '🏪', label: '站点管理', bg: '#faf5ff' },
{ to: '/shopGoods', icon: '🏸', label: '商品管理', bg: '#ecfdf5' },
{ to: '/cmsArticle', icon: '📝', label: '文章管理', bg: '#fefce8' },
{ to: '/shop/shopGoods', icon: '🏸', label: '商品管理', bg: '#ecfdf5' },
{ to: '/shop/shopGoodsCategory', icon: '🗂️', label: '商品分类', bg: '#eff6ff' },
{ to: '/shop/shopCoupon', icon: '🎁', label: '优惠券', bg: '#fff7ed' },
{ to: '/shop/shopUser', icon: '👥', label: '会员管理', bg: '#faf5ff' },
{ to: '/shop/shopSetting', icon: '⚙️', label: '商城设置', bg: '#fefce8' },
];
// 导航跳转
@@ -348,6 +359,15 @@ const refreshStatistics = async () => {
// 加载数据
const loadData = async () => {
// 独立请求租户信息,不受其他请求失败影响
getTenantInfo()
.then((res) => {
tenantCreateTime.value = res?.createTime || '';
})
.catch((e) => {
console.warn('获取租户信息失败:', e);
});
try {
await Promise.all([
siteStore.fetchSiteInfo(),
@@ -356,8 +376,9 @@ const loadData = async () => {
// 获取待处理事项数据
try {
// 获取待发货订单数(使用 statusFilter=1 对应待发货)
// 获取待发货订单数(type=0商城订单, statusFilter=1待发货
const shipmentResult = await pageShopOrder({
type: 0,
statusFilter: 1,
page: 1,
limit: 1
@@ -369,8 +390,9 @@ const loadData = async () => {
}
try {
// 获取退款/售后订单数(使用 statusFilter=6 对应退款/售后)
// 获取退款/售后订单数(type=0商城订单, statusFilter=6退款/售后)
const refundResult = await pageShopOrder({
type: 0,
statusFilter: 6,
page: 1,
limit: 1
@@ -391,11 +413,15 @@ onMounted(async () => {
// 开始自动刷新统计数据每5分钟
statisticsStore.startAutoRefresh();
// 运行天数每小时检查一次(跨天自动更新)
runDaysTimer = setInterval(() => { now.value = Date.now(); }, 60 * 60 * 1000);
});
onUnmounted(() => {
// 组件卸载时停止自动刷新
statisticsStore.stopAutoRefresh();
clearInterval(runDaysTimer);
});
</script>