6 Commits

Author SHA1 Message Date
08b697556b feat(cms): 更新系统名称并优化租户信息获取逻辑
- 将系统名称由“小程序开发”修改为“小程序商城”
- 修改多处组件中系统名称的引用,统一使用系统信息对象
- 调整快捷入口路由,更新优惠券和会员管理的跳转路径
- 使用 tenantStore 替代原有的接口调用,统一获取租户公司信息
- 优化租户创建时间的计算方式,直接从 store 获取数据
- 移除不再使用的 getTenantInfo 方法,改为通过 pinia 状态管理获取
- 调整部分模板数据绑定,修正创建时间显示逻辑
2026-07-15 12:00:14 +08:00
b0ff82599a feat(shop): 新增Dashboard待付款订单统计及支持
- Dashboard待处理事项新增“待付款订单”项,使用statusFilter=0查询
- 点击待付款订单跳转至/shop/shopOrder?tab=unpaid页面
- shopOrder页面恢复“待付款”标签页,validTabs列表包含unpaid
- shopOrder页面根据路由query初始化活动标签,支持unpaid选项
- 新增dot-gold样式用于待付款订单高亮显示
- 订单数量接口新增待付款订单数获取及异常处理逻辑
- 调整组件中待处理事项列表,支持待付款订单数据响应式更新
2026-07-15 03:46:23 +08:00
57b584df1b feat(shop): 支持Dashboard订单总数点击跳转指定tab
- 修改Dashboard中订单总数和总营业额跳转链接,默认携带tab参数
- 订单总数点击跳转至/shop/shopOrder?tab=all页面
- 待发货订单跳转至/shop/shopOrder?tab=undelivered,退款申请跳转至?tab=refunded
- shopOrder页面根据路由查询参数初始化激活tab,确保页面首次加载可正确显示对应订单列表
- 为无效或缺省tab参数设置默认值undelivered
- 简化订单页面tab切换逻辑复用公共状态映射函数
2026-07-15 02:35:01 +08:00
6350a9b5a9 fix(shopOrder): 调整商品头像显示尺寸并优化图片压缩
- 修改订单商品头像大小,从80调整为50
- 调整图片压缩函数调用,设置压缩宽度为100
- 修正商品信息组件中头像图片的压缩调用,统一宽度参数
- 引入图片压缩工具方法以支持新参数调用
2026-07-15 01:40:12 +08:00
614e843673 fix(shopOrder): 修复初次加载订单状态筛选问题
- 提取 getStatusFilterByTab 函数实现 tab key 与 statusFilter 的映射
- datasource 函数中当 statusFilter 未设置时,自动根据 activeKey 推导赋值
- onTabs 函数简化为复用 getStatusFilterByTab 函数,减少重复代码
- 确保初次加载时待发货等状态的 tab 能正确筛选订单数据
2026-07-15 01:29:44 +08:00
894592c290 feat(shop): 新增线下付款支持及优化Dashboard数据统计
- 新增线下付款(payType=9)支付方式,支持订单中标识和确认收款操作
- 实现商家确认线下付款后订单进入待发货状态功能
- 更新支付方式组件和订单列表及详情页的支付状态显示
- 优化shop/dashboard快捷操作按钮为商城常用功能,修正快速入口路由路径
- 修复Dashboard待发货订单数统计时未过滤商城订单导致数据不准的问题
- 修复Dashboard运行天数为0的异常,将租户信息请求独立处理,避免某些请求失败影响
- 修复statisticsStore中couponUsedCount与getter同名冲突,改名为safeCouponUsedCount并同步更新引用
2026-07-14 22:17:39 +08:00
14 changed files with 297 additions and 107 deletions

View File

@@ -6,3 +6,27 @@
-`src/views/shop/dashboard/index.vue` 的欢迎横幅右侧添加新订单提醒开关栏(开关 + 测试按钮),检测到新订单后自动调用 loadData() 刷新 Dashboard 数据。
-`src/views/cms/dashboard/index.vue` 的概况卡片标题栏添加新订单提醒控件,同样检测到新订单后刷新数据。
- 提取了 CMS Dashboard 的 loadData 函数使其可复用。
## 更新 shop/dashboard 快捷操作按钮为商城常用功能
- 快捷操作按钮从原来的通用功能(参数配置/用户管理/站点管理/登录日志)改为商城系统常用功能:订单管理、商品管理、商品分类、优惠券管理、会员管理、商城设置、清除缓存。
- 路由路径统一使用 `/shop/shopXxx` 格式(与 `/shop/shopOrder` 等已确认路径一致),修复了快速入口中 `/shopGoods``/shop/shopGoods` 的路径不一致问题。
- 快速入口九宫格也同步改为商城相关入口。
- 图标导入更新:移除 UngroupOutlined/CalendarOutlined/UserOutlined/FileTextOutlined新增 ShoppingCartOutlined/AppstoreOutlined/GiftOutlined/TeamOutlined/SettingOutlined。
## 修复 shop/dashboard 待发货订单数量统计不准确
- 根因:订单列表页 datasource 中 `where.type = 0`(只查商城订单),但 Dashboard 统计未传 `type: 0`,导致把预定订单/外卖(type=1)和会员卡订单(type=2)也计入。
- 修复:为 pendingShipmentCount 和 pendingRefundCount 查询都加上 `type: 0`
## 修复 Dashboard 运行天数为 0 的问题
- 根因:`getTenantInfo()` 被放在 `await Promise.all([...])` 之后,如果 `statisticsStore.fetchStatistics()` 抛异常(`couponUsedCount` 错误),`Promise.all` reject 后直接跳到 `catch``getTenantInfo` 根本不会执行,`tenantCreateTime` 永远是空值。
- 修复:在 `shop/dashboard/index.vue``cms/dashboard/index.vue``loadData` 中,把 `getTenantInfo()` 放到 `Promise.all` 外面,用 `.then` 独立执行,不受其他请求失败影响。
- 运行天数计算基于 `getTenantInfo()` 返回的 `Company.createTime`(租户创建时间)。
## 修复 statisticsStore couponUsedCount 冲突
- 根因:`couponUsedCount` 同时被定义成 state 属性和 getterPinia 中同名冲突导致 action 里 `this.couponUsedCount = ...` 报错:`'set' on proxy: trap returned falsish`
- 修复:将 getter 改名为 `safeCouponUsedCount``shop/dashboard/index.vue` 中同步更新引用(该引用当前被注释,但保持一致性)。

View File

@@ -0,0 +1,20 @@
# 2026-07-15
## 修复 shopOrder 页面默认待发货tab数据不正确
- 根因:`activeKey` 默认为 `'undelivered'`,但 `datasource` 函数只设了 `where.type = 0`,没有设 `statusFilter``statusFilter` 只在用户点击 tab 触发 `onTabs` 时才设置。所以页面初次加载时查的是全部订单而非待发货订单。
- 修复:提取 `getStatusFilterByTab(key)` 公共映射函数,在 `datasource` 中当 `where.statusFilter` 未设置时从 `activeKey` 自动推导。`onTabs` 也简化为复用同一函数。
- 文件:`src/views/shop/shopOrder/index.vue`
## Dashboard 订单总数点击跳转支持指定 tab
- Dashboard 中"订单总数"/"总营业额"跳转链接改为 `/shop/shopOrder?tab=all`"待发货订单"改为 `?tab=undelivered`"退款申请"改为 `?tab=refunded`
- shopOrder 页面读取 `route.query.tab` 初始化 `activeKey`,无效值回退到 `'undelivered'`
- 文件:`src/views/shop/dashboard/index.vue``src/views/shop/shopOrder/index.vue`
## Dashboard 待处理事项新增"待付款订单"
- 在待发货订单上方新增"待付款订单"统计项,使用 `statusFilter=0` 查询,点击跳转 `/shop/shopOrder?tab=unpaid`
- shopOrder 页面取消注释"待付款"tab`validTabs` 加入 `unpaid`
- 新增 `dot-gold` 样式。
- 文件:`src/views/shop/dashboard/index.vue``src/views/shop/shopOrder/index.vue`

View File

@@ -150,3 +150,19 @@ export async function refundShopOrder(data: ShopOrder) {
}
return Promise.reject(new Error(res.data.message));
}
/**
* 确认线下付款收款
* 商家确认已收到线下转账(微信转账/银行汇款等),确认后订单进入待发货状态
*/
export async function confirmOfflinePayment(id: number, remarks?: string) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/shop/shop-order/confirm-offline-payment/' + id,
null,
{ params: { remarks } }
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -85,9 +85,9 @@ export interface ShopOrder {
coachId?: number;
// 支付的用户id
payUserId?: number;
// 0余额支付, 1微信支付, 2支付宝, 3银联支付, 4现金支付, 5POS机支付, 6免费, 7积分支付, 8货到付款, 9~18 已废弃
// 0余额支付, 1微信支付, 2支付宝, 3银联支付, 4现金支付, 5POS机支付, 6免费, 7积分支付, 8货到付款, 9线下付款, 10~18 已废弃
payType?: number;
// 代付支付方式, 0余额支付, 1微信支付, 2支付宝, 3银联支付, 4现金支付, 5POS机支付, 6免费, 7积分支付, 8货到付款, 9~18 已废弃
// 代付支付方式, 0余额支付, 1微信支付, 2支付宝, 3银联支付, 4现金支付, 5POS机支付, 6免费, 7积分支付, 8货到付款, 9线下付款, 10~18 已废弃
friendPayType?: number;
// 0未付款1已付款
payStatus?: number;

View File

@@ -84,6 +84,12 @@
label: '货到付款',
key: 'codPay',
icon: 'IdcardOutlined'
},
{
value: 9,
label: '线下付款',
key: 'offlinePay',
icon: 'IdcardOutlined'
}
]);

View File

@@ -1,7 +1,7 @@
const storeName = localStorage.getItem('StoreName') || 'WebSoft Inc';
/* 主框架 */
export default {
system: '小程序开发',
system: '小程序商城',
home: '主页',
header: {
profile: '个人资料',

View File

@@ -90,9 +90,9 @@ export const useStatisticsStore = defineStore('statistics', {
},
/**
* 获取今日使用优惠券数量
* 获取今日使用优惠券数量(安全取值)
*/
couponUsedCount: (state): number => {
safeCouponUsedCount: (state): number => {
return safeNumber(state.couponUsedCount);
},

View File

@@ -36,6 +36,10 @@ export function getPayType(index?: number): any {
{
value: 8,
label: '货到付款'
},
{
value: 9,
label: '线下付款'
}
];
if (index != null) {

View File

@@ -87,7 +87,7 @@
// 系统信息
const systemInfo = ref({
name: '小程序开发',
name: '小程序商城',
description:
'基于Spring、SpringBoot、SpringMVC等技术栈构建的前后端分离开发平台',
version: '2.0.0',

View File

@@ -213,11 +213,14 @@
import { openNew } from '@/utils/common';
import { useSiteStore } from '@/store/modules/site';
import { useStatisticsStore } from '@/store/modules/statistics';
import { useUserStore } from '@/store/modules/user';
import { getTenantInfo } from '@/api/layout';
import { storeToRefs } from 'pinia';
// 使用状态管理
const siteStore = useSiteStore();
const statisticsStore = useStatisticsStore();
const userStore = useUserStore();
// 从 store 中获取响应式数据
const { siteInfo, loading: siteLoading } = storeToRefs(siteStore);
@@ -225,7 +228,7 @@
// 系统信息
const systemInfo = ref({
name: '小程序开发',
name: '小程序商城',
description:
'基于Spring、SpringBoot、SpringMVC等技术栈构建的前后端分离开发平台',
version: '2.0.0',
@@ -238,7 +241,13 @@
});
// 计算属性
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);
@@ -248,6 +257,15 @@
// 加载数据
const loadData = async () => {
// 独立请求租户信息,不受其他请求失败影响
getTenantInfo()
.then((res) => {
tenantCreateTime.value = res?.createTime || '';
})
.catch((e) => {
console.warn('获取租户信息失败:', e);
});
try {
await Promise.all([
siteStore.fetchSiteInfo(),
@@ -267,11 +285,14 @@
await loadData();
// 开始自动刷新统计数据每5分钟
statisticsStore.startAutoRefresh();
// 运行天数每小时检查一次(跨天自动更新)
runDaysTimer = setInterval(() => { now.value = Date.now(); }, 60 * 60 * 1000);
});
onUnmounted(() => {
// 组件卸载时停止自动刷新
statisticsStore.stopAutoRefresh();
clearInterval(runDaysTimer);
});
</script>

View File

@@ -147,7 +147,7 @@
<div style="padding: 16px 18px;">
<a-descriptions :column="1" size="small">
<a-descriptions-item label="系统名称">
{{ siteStore.appName }}
{{ systemInfo.name }}
</a-descriptions-item>
<a-descriptions-item label="版本号">
{{ systemInfo.version }}
@@ -156,7 +156,7 @@
{{ siteStore.statusText || '正常' }}
</a-descriptions-item>
<a-descriptions-item label="创建时间">
{{ siteInfo?.createTime }}
{{ tenantStore.company?.createTime || '-' }}
</a-descriptions-item>
<a-descriptions-item label="到期时间">
{{ siteInfo?.expirationTime }}
@@ -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('/market/coupon')">
<GiftOutlined />
优惠券管理
</a-button>
<a-button block @click="navigateTo('/system/user')">
<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';
@@ -233,6 +237,7 @@ import { message } from 'ant-design-vue/es';
import { useSiteStore } from '@/store/modules/site';
import { useStatisticsStore } from '@/store/modules/statistics';
import { useUserStore } from '@/store/modules/user';
import { useTenantStore } from '@/store/modules/tenant';
import { pageShopOrder } from '@/api/shop/shopOrder';
import { storeToRefs } from 'pinia';
import { removeSiteInfoCache } from '@/api/cms/cmsWebsite';
@@ -241,6 +246,7 @@ import { removeSiteInfoCache } from '@/api/cms/cmsWebsite';
const siteStore = useSiteStore();
const statisticsStore = useStatisticsStore();
const userStore = useUserStore();
const tenantStore = useTenantStore();
const router = useRouter();
// 从 store 中获取响应式数据
@@ -257,7 +263,13 @@ const systemInfo = reactive({
});
// 计算属性
const runDays = computed(() => siteStore.runDays);
const now = ref(Date.now());
let runDaysTimer: ReturnType<typeof setInterval>;
const runDays = computed(() => {
const createTime = tenantStore.company?.createTime;
if (!createTime) return 0;
return Math.floor((now.value - new Date(createTime).getTime()) / (24 * 60 * 60 * 1000));
});
const userCount = computed(() => statisticsStore.userCount);
const orderCount = computed(() => statisticsStore.orderCount);
const totalSales = computed(() => statisticsStore.totalSales);
@@ -271,20 +283,22 @@ const loading = computed(() => siteLoading.value || statisticsLoading.value);
// 核心统计数据使用computed确保响应式更新
const coreStats = computed(() => [
{ icon: '🏸', label: '用户总数', value: userCount.value || 0, desc: '注册用户', color: 'blue', to: '/system/user' },
{ icon: '📦', label: '订单总数', value: orderCount.value || 0, desc: '全部订单', color: 'orange', to: '/shop/shopOrder' },
{ icon: '💰', label: '总营业额', value: totalSales.value || 0, desc: '元', color: 'purple', to: '/shop/shopOrder' },
{ icon: '📦', label: '订单总数', value: orderCount.value || 0, desc: '全部订单', color: 'orange', to: '/shop/shopOrder?tab=all' },
{ icon: '💰', label: '总营业额', value: totalSales.value || 0, desc: '元', color: 'purple', to: '/shop/shopOrder?tab=all' },
{ icon: '⏱️', label: '运行天数', value: runDays.value || 0, desc: '系统运行', color: 'green', to: '' },
]);
// 待处理事项数据
const pendingPaymentCount = ref(0);
const pendingShipmentCount = ref(0);
const pendingRefundCount = ref(0);
const couponUsedCount = computed(() => statisticsStore.couponUsedCount);
const couponUsedCount = computed(() => statisticsStore.safeCouponUsedCount);
// 待处理事项使用computed确保响应式更新
const todoItems = computed(() => [
{ label: '待发货订单', value: pendingShipmentCount.value, to: '/shop/shopOrder', tagColor: 'blue', dotColor: 'dot-blue', urgent: pendingShipmentCount.value > 0 },
{ label: '退款申请', value: pendingRefundCount.value, to: '/shop/shopOrder', tagColor: 'orange', dotColor: 'dot-orange', urgent: pendingRefundCount.value > 0 },
{ label: '待付款订单', value: pendingPaymentCount.value, to: '/shop/shopOrder?tab=unpaid', tagColor: 'gold', dotColor: 'dot-gold', urgent: pendingPaymentCount.value > 0 },
{ label: '待发货订单', value: pendingShipmentCount.value, to: '/shop/shopOrder?tab=undelivered', tagColor: 'blue', dotColor: 'dot-blue', urgent: pendingShipmentCount.value > 0 },
// { label: '退款申请', value: pendingRefundCount.value, to: '/shop/shopOrder?tab=refunded', tagColor: 'orange', dotColor: 'dot-orange', urgent: pendingRefundCount.value > 0 },
// { label: '优惠券使用', value: couponUsedCount.value, to: '/market/coupon', tagColor: 'cyan', dotColor: 'dot-cyan', urgent: false },
]);
@@ -298,12 +312,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/shopOrder?tab=all', icon: '📦', label: '订单管理', bg: '#f0fdf4' },
{ to: '/shop/shopGoods', icon: '🏸', label: '商品管理', bg: '#ecfdf5' },
{ to: '/shop/shopGoodsCategory', icon: '🗂️', label: '商品分类', bg: '#eff6ff' },
{ to: '/market/coupon', icon: '🎁', label: '优惠券', bg: '#fff7ed' },
{ to: '/system/user', icon: '👥', label: '会员管理', bg: '#faf5ff' },
{ to: '/shop/shopSetting', icon: '⚙️', label: '商城设置', bg: '#fefce8' },
];
// 导航跳转
@@ -348,6 +362,11 @@ const refreshStatistics = async () => {
// 加载数据
const loadData = async () => {
// 独立请求租户信息,不受其他请求失败影响
tenantStore.fetchTenantInfo().catch((e) => {
console.warn('获取租户信息失败:', e);
});
try {
await Promise.all([
siteStore.fetchSiteInfo(),
@@ -356,8 +375,23 @@ const loadData = async () => {
// 获取待处理事项数据
try {
// 获取待发货订单数(使用 statusFilter=1 对应待发货
// 获取待付款订单数(type=0商城订单, statusFilter=0待付款
const paymentResult = await pageShopOrder({
type: 0,
statusFilter: 0,
page: 1,
limit: 1
});
pendingPaymentCount.value = paymentResult?.count || 0;
} catch (e) {
console.warn('获取待付款订单数失败:', e);
pendingPaymentCount.value = 0;
}
try {
// 获取待发货订单数type=0商城订单, statusFilter=1待发货
const shipmentResult = await pageShopOrder({
type: 0,
statusFilter: 1,
page: 1,
limit: 1
@@ -369,8 +403,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 +426,15 @@ onMounted(async () => {
// 开始自动刷新统计数据每5分钟
statisticsStore.startAutoRefresh();
// 运行天数每小时检查一次(跨天自动更新)
runDaysTimer = setInterval(() => { now.value = Date.now(); }, 60 * 60 * 1000);
});
onUnmounted(() => {
// 组件卸载时停止自动刷新
statisticsStore.stopAutoRefresh();
clearInterval(runDaysTimer);
});
</script>
@@ -485,6 +524,7 @@ onUnmounted(() => {
.todo-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-orange { background: #f97316; }
.dot-blue { background: #3b82f6; }
.dot-gold { background: #faad14; }
.dot-cyan { background: #06b6d4; }
.dot-purple { background: #a855f7; }
.todo-content { flex: 1; display: flex; align-items: center; }

View File

@@ -71,9 +71,11 @@
label="支付状态"
:labelStyle="{ width: '90px', color: '#808080' }"
>
<a-tag v-if="form.payStatus == 1 && form.payType !== 8" color="green">已付款</a-tag>
<a-tag v-if="form.payStatus == 1 && form.payType !== 8 && form.payType !== 9" color="green">已付款</a-tag>
<a-tag v-if="form.payStatus == 1 && form.payType === 8" color="blue">待收货付款</a-tag>
<a-tag v-if="form.payStatus == 0">未付</a-tag>
<a-tag v-if="form.payStatus == 1 && form.payType === 9" color="green">已确认收</a-tag>
<a-tag v-if="form.payStatus == 0 && form.payType === 9" color="orange">待确认收款</a-tag>
<a-tag v-if="form.payStatus == 0 && form.payType !== 9">未付款</a-tag>
<a-tag v-if="form.payStatus == 3">未付款,占场中</a-tag>
</a-descriptions-item>
<!-- 第四排-->
@@ -147,7 +149,7 @@
</a-tag>
<a-tag v-if="form.payType == 9">
<IdcardOutlined class="tag-icon" />
IC月卡
线下付款
</a-tag>
<a-tag v-if="form.payType == 10">
<IdcardOutlined class="tag-icon" />
@@ -187,7 +189,16 @@
</a-tag>
</template>
<template v-else>
<span class="text-gray-400">未支付</span>
<!-- 线下付款未确认时也显示支付方式 -->
<a-tag v-if="form.payType == 9">
<IdcardOutlined class="tag-icon" />
线下付款
</a-tag>
<a-tag v-if="form.payType == 8">
<IdcardOutlined class="tag-icon" />
货到付款
</a-tag>
<span v-if="form.payType !== 9 && form.payType !== 8" class="text-gray-400">未支付</span>
</template>
</a-tooltip>
</a-descriptions-item>
@@ -235,7 +246,7 @@
<template v-if="column.key === 'goodsName'">
<div style="display: flex; align-items: center; gap: 12px">
<a-avatar
:src="record.image || record.goodsImage"
:src="getCompressedImageUrl(record.image, { width: 100 })"
shape="square"
:size="50"
style="flex-shrink: 0"
@@ -414,6 +425,7 @@
import { updateShopOrder, removeShopOrder, refundShopOrder } from '@/api/shop/shopOrder';
import { message, Modal } from 'ant-design-vue';
import DeliveryModal from './deliveryModal.vue';
import {getCompressedImageUrl} from "@/utils/image";
const useForm = Form.useForm;

View File

@@ -36,10 +36,10 @@
</div>
<a-tabs type="card" v-model:activeKey="activeKey" @change="onTabs">
<a-tab-pane key="all" tab="全部" />
<a-tab-pane key="unpaid" tab="待付款" />
<a-tab-pane key="undelivered" tab="待发货" />
<a-tab-pane key="unreceived" tab="待收货" />
<a-tab-pane key="completed" tab="已完成" />
<!-- <a-tab-pane key="unpaid" tab="待付款" />-->
<a-tab-pane key="refunded" tab="退货/售后" />
<a-tab-pane key="cancelled" tab="已关闭" />
</a-tabs>
@@ -93,10 +93,15 @@
v-if="record.payType === 8"
color="blue"
>货到付款</a-tag>
<!-- 线下付款标识 -->
<a-tag
v-if="record.payType === 9"
color="orange"
>线下付款</a-tag>
<!-- 支付状态 -->
<a-tag
v-if="record.payStatus == 1 && record.payType !== 8"
v-if="record.payStatus == 1 && record.payType !== 8 && record.payType !== 9"
color="green"
@click.stop="updatePayStatus(record)"
class="cursor-pointer"
@@ -109,6 +114,20 @@
class="cursor-pointer"
>待收货付款</a-tag
>
<a-tag
v-else-if="record.payStatus == 1 && record.payType === 9"
color="green"
@click.stop="updatePayStatus(record)"
class="cursor-pointer"
>已确认收款</a-tag
>
<a-tag
v-else-if="record.payStatus == 0 && record.payType === 9"
color="orange"
@click.stop="updatePayStatus(record)"
class="cursor-pointer"
>待确认收款</a-tag
>
<a-tag
v-else-if="record.payStatus == 0 || record.payStatus == null"
@click.stop="updatePayStatus(record)"
@@ -174,7 +193,7 @@
<template v-for="(item, index) in record.orderGoods" :key="index">
<div class="item py-1">
<a-space :id="`g-${index}`">
<a-avatar :src="getCompressedImageUrl(item.image)" shape="square" :size="80" />
<a-avatar :src="getCompressedImageUrl(item.image,{ width: 100 })" shape="square" :size="50" />
<span>{{ item.goodsName }}</span>
</a-space>
</div>
@@ -185,6 +204,10 @@
<template v-if="record.payType === 8">
<a-tag color="blue">货到付款</a-tag>
</template>
<!-- 线下付款特殊标识 -->
<template v-else-if="record.payType === 9">
<a-tag color="orange">线下付款</a-tag>
</template>
<template v-else>
<template v-for="item in getPayType()">
<template v-if="record.payStatus == 1">
@@ -230,8 +253,8 @@
<!-- 查看详情 - 所有状态都可以查看 -->
<a @click.stop="openEdit(record)"> <EyeOutlined /> 详情 </a>
<!-- 未付款状态的操作 -->
<template v-if="!record.payStatus && record.orderStatus === 0">
<!-- 未付款状态的操作排除线下付款 -->
<template v-if="!record.payStatus && record.orderStatus === 0 && record.payType !== 9">
<a @click.stop="handleEditOrder(record)">
<EditOutlined /> 修改
</a>
@@ -240,6 +263,16 @@
</a>
</template>
<!-- 线下付款·待确认收款状态的操作 -->
<template v-if="!record.payStatus && record.orderStatus === 0 && record.payType === 9">
<a @click.stop="handleConfirmOfflinePayment(record)" class="ele-text-success">
<CheckCircleOutlined /> 确认收款
</a>
<a @click.stop="handleCancelOrder(record)">
<span class="ele-text-warning"> <CloseOutlined /> 关闭 </span>
</a>
</template>
<!-- 已付款未发货状态的操作 -->
<template
v-if="
@@ -341,6 +374,7 @@
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { useRoute } from 'vue-router';
import type { EleProTable } from 'ele-admin-pro';
import type {
DatasourceFunction,
@@ -371,7 +405,8 @@
repairOrder,
removeShopOrder,
removeBatchShopOrder,
updateShopOrder, refundShopOrder
updateShopOrder, refundShopOrder,
confirmOfflinePayment
} from '@/api/shop/shopOrder';
import { updateUser } from '@/api/system/user';
import { getPayType } from '@/utils/shop';
@@ -394,13 +429,35 @@
const showDelivery = ref(false);
// 加载状态
const loading = ref(true);
// 激活的标签
const activeKey = ref<string>('undelivered');
// 激活的标签(支持从路由参数初始化,如 /shop/shopOrder?tab=all
const route = useRoute();
const validTabs = ['all', 'unpaid', 'undelivered', 'unreceived', 'completed', 'refunded', 'cancelled'];
const tabFromQuery = route.query.tab as string;
const activeKey = ref<string>(
validTabs.includes(tabFromQuery) ? tabFromQuery : 'undelivered'
);
// ============ 新订单提醒 ============
const { enabled: notifyEnabled, toggle: onNotifyToggle, testNotify: onTestNotify } = useOrderNotify({
onNewOrder: () => reload()
});
// 根据tab key获取对应的statusFilter值
// undefined全部0待付款1待发货2待核销3待收货4待评价5已完成6已退款7已删除8已关闭
const getStatusFilterByTab = (key: string): number | undefined => {
const filterMap: Record<string, number> = {
unpaid: 0,
undelivered: 1,
unverified: 2,
unreceived: 3,
unevaluated: 4,
completed: 5,
refunded: 6,
deleted: 7,
cancelled: 8
};
return filterMap[key];
};
// 表格数据源
const datasource: DatasourceFunction = ({
page,
@@ -413,6 +470,10 @@
where.status = filters.status;
}
where.type = 0;
// 确保初次加载时也按当前tab筛选statusFilter未设置时从activeKey推导
if (where.statusFilter === undefined) {
where.statusFilter = getStatusFilterByTab(activeKey.value);
}
return pageShopOrder({
...where,
...orders,
@@ -493,54 +554,11 @@
};
const onTabs = () => {
// 使用statusFilter进行筛选这是后端专门为订单状态筛选设计的字段
const filterParams: Record<string, any> = {};
// 根据后端 statusFilter 的值对应:
// undefined全部0待付款1待发货2待核销3待收货4待评价5已完成6已退款7已删除
switch (activeKey.value) {
case 'all':
// 全部订单不传statusFilter参数
// filterParams.statusFilter = undefined; // 不设置该字段
break;
case 'unpaid':
// 待付款pay_status = false
filterParams.statusFilter = 0;
break;
case 'undelivered':
// 待发货pay_status = true AND delivery_status = 10
filterParams.statusFilter = 1;
break;
case 'unverified':
// 待核销pay_status = true AND delivery_status = 10 (与待发货相同)
filterParams.statusFilter = 2;
break;
case 'unreceived':
// 待收货pay_status = true AND delivery_status = 20
filterParams.statusFilter = 3;
break;
case 'unevaluated':
// 待评价order_status = 1 (与已完成相同)
filterParams.statusFilter = 4;
break;
case 'completed':
// 已完成order_status = 1
filterParams.statusFilter = 5;
break;
case 'cancelled':
// 已关闭order_status = 2
filterParams.statusFilter = 8;
break;
case 'refunded':
// 退款/售后order_status = 6
filterParams.statusFilter = 6;
break;
case 'deleted':
// 已删除deleted = 1
filterParams.statusFilter = 7;
break;
const sf = getStatusFilterByTab(activeKey.value);
if (sf !== undefined) {
filterParams.statusFilter = sf;
}
reload(filterParams);
};
@@ -627,6 +645,35 @@
});
};
// 确认线下付款收款
const handleConfirmOfflinePayment = (record: ShopOrder) => {
let remarksValue = '';
Modal.confirm({
title: '确认线下收款',
content: createVNode('div', null, [
createVNode('p', { style: 'margin-bottom: 8px' }, '确认已收到该订单的线下付款(微信转账/银行汇款等)?'),
createVNode('p', { style: 'margin-bottom: 8px; color: #999; font-size: 12px' }, `订单号:${record.orderNo}`),
createVNode('input', {
id: 'offline-remarks-input',
placeholder: '可填写备注(如:微信转账已收到)',
style: 'width: 100%; padding: 4px 8px; border: 1px solid #d9d9d9; border-radius: 4px;',
onInput: (e: any) => { remarksValue = e.target.value; }
})
]),
okText: '确认收款',
okType: 'success',
onOk: async () => {
try {
await confirmOfflinePayment(record.orderId!, remarksValue || undefined);
message.success('确认收款成功,订单已进入待发货状态');
reload();
} catch (error: any) {
message.error(error.message || '确认收款失败');
}
}
});
};
// 发货处理
const handleDelivery = (record: ShopOrder) => {
current.value = record;

View File

@@ -17,9 +17,9 @@
<a-tab-pane tab="分销设置" key="dealer">
<Dealer />
</a-tab-pane>
<a-tab-pane tab="支付设置" key="payment">
<Payment />
</a-tab-pane>
<!-- <a-tab-pane tab="支付设置" key="payment">-->
<!-- <Payment />-->
<!-- </a-tab-pane>-->
<a-tab-pane tab="通知设置" key="notify">
<Notify />
</a-tab-pane>
@@ -43,7 +43,7 @@ import Basic from './components/basic.vue';
import Order from './components/order.vue';
import Points from './components/points.vue';
import Dealer from './components/dealer.vue';
import Payment from './components/payment.vue';
// import Payment from './components/payment.vue';
import Notify from './components/notify.vue';
import Upload from './components/upload.vue';
import Sms from './components/sms.vue';