feat(api): 优化订单模型并添加新字段

- 在 ThinkOrder 模型中添加 type、refundReason 和 isAdmin 字段
- 更新订单列表页面,增加退款原因显示
- 调整表格布局和样式,优化用户体验
This commit is contained in:
2025-08-25 17:08:07 +08:00
parent 1096c6f2de
commit 55e747e49a
4 changed files with 656 additions and 648 deletions
+146 -226
View File
@@ -1,266 +1,186 @@
<h1 style="text-align: center">websoft-uniapp 网宿软件uniapp端</h1> <div align="center">
<h1>🌐 WebSoftAdmin</h1>
<p><strong>基于 Vue 3 + Ant Design Vue 的企业级后台管理系统</strong></p>
#### 项目简介 <p>
websoft基于Spring、SpringBoot、SpringMVC、SpringSecurity、jjwt、MyBatis、Druid等搭建,前后端分离模式,适用于快递开发和打包为微信小程序、H5、安卓apk、苹果ios、抖音小程序、支付宝小程序等应用 <img src="https://img.shields.io/badge/Vue-3.x-4FC08D" alt="Vue">
<img src="https://img.shields.io/badge/Ant%20Design%20Vue-3.x-1890FF" alt="Ant Design Vue">
<img src="https://img.shields.io/badge/TypeScript-4.x-3178C6" alt="TypeScript">
<img src="https://img.shields.io/badge/Vite-4.x-646CFF" alt="Vite">
<img src="https://img.shields.io/badge/License-MIT-blue" alt="License">
</p>
</div>
## 📖 项目简介
WebSoftAdmin 是一个基于 **Vue 3 + Ant Design Vue** 构建的现代化企业级后台管理系统,采用最新的前端技术栈:
- **前端框架**:Vue 3 + TypeScript + Vite
- **UI 组件库**:Ant Design Vue 3.x
- **富文本编辑器**:TinyMCE(支持图片/视频上传、一键排版)
- **图表库**:ECharts + G2
- **工具库**:Lodash、Day.js、CryptoJS
# 官网体验地址(里面有演示地址与文档) ## 项目演示
| 官网文档地址 | https://www.gxwebsoft.com | | 后台管理系统 | https://mp.websoft.top |
|---|--------------------------------------------------------------------------------------------------------------------------------------| |--------|-------------------------------------------------------------------------------------------------------------------------------------|
| 管理后台演示地址: | http://10093.admin.gxwebsoft.com | | 账号密码 | [立即注册](https://mp.websoft.top/register/?inviteCode=github) |
| 关注公众号点体验小程序与H5 | ![输入图片说明](https://oss.wsdns.cn/20240327/f1175cc5aae741d3af05484747270bd5.jpeg?x-oss-process=image/resize,m_fixed,w_300/quality,Q_90) | | 关注公众号 | ![输入图片说明](https://oss.wsdns.cn/20240327/f1175cc5aae741d3af05484747270bd5.jpeg?x-oss-process=image/resize,m_fixed,w_150/quality,Q_90) |
#### 核心依赖
| 依赖 | 版本 | ## 🛠️ 技术栈
|-----------------|--------|
| Spring Boot | 2.7.x | ### 核心技术
| weixin-java | 4.4.0 | | 技术 | 版本 | 说明 |
| Spring Security | 2.7.10 | |------|------|------|
| Mybatis Plus | 3.5.2 | | Vue | 3.x | 渐进式 JavaScript 框架 |
| hutool | 5.8.16 | | TypeScript | 4.x | JavaScript 的超集 |
| swagger | 3.0.0 | | Vite | 4.x | 下一代前端构建工具 |
| Ant Design Vue | 3.2.11 | 企业级 UI 设计语言 |
| EleAdmin Pro | 1.10.1 | 企业级组件库 |
### 功能组件
- **TinyMCE** - 富文本编辑器,支持图片/视频上传
- **ECharts** - 数据可视化图表库
- **CropperJS** - 图片裁剪组件
- **ExcelJS** - Excel 文件处理
- **Ali OSS** - 阿里云对象存储
## 📋 环境要求
### 基础环境
- 🟢 **Node.js 16+**
- 📦 **npm 8+ / yarn 1.22+**
- 🌐 **现代浏览器**(Chrome 63+、Firefox、Safari、Edge)
# 本地安装
### 基本环境(必备)
- 1、JDK:8+
- 2、Redis 3.0+
- 3、Maven 3.0+
- 4、MYSQL 5.7+
- 5、Node v8+
### 开发工具 ### 开发工具
Idea、webstorm、vscode - **推荐**:VS Code / WebStorm
- **插件**:Vetur / Volar(Vue 3 支持)
### 前端系统工程(UNIAPP端) ## 🚀 快速开始
1、下载代码 ### 1. 克隆项目
``` ```bash
git clone https://gitee.com/gxwebsoft/websoft-uniapp.git git clone https://github.com/websoft-top/mp-vue.git
``` cd mp-vue
2、使用HBuiderX导入项目:
3、安装依赖:
```
npm install luch-request -S
``` ```
### 后台前端工程(JAVA端) ### 2. 安装依赖
1、请确保redis已经安装启动 ```bash
# 使用 npm
npm install
2、下载代码 # 或使用 yarn
``` yarn install
git clone https://gitee.com/gxwebsoft/websoft-java.git
```
3、使用HBuiderX导入项目:
4、安装依赖:
```
npm install luch-request -S
``` ```
### 后台前端工程(VUE端) ### 3. 配置环境变量
1、请确保本地已经安装node,建议node8或者node10 ```bash
# 复制环境变量示例文件
cp .env.example .env
2、下载代码 # 编辑 .env 文件,填入您的配置信息
``` # 注意:请不要将 .env 文件提交到版本控制系统
git clone https://gitee.com/gxwebsoft/websoft-vue.git
```
3、cnpm install或者yarn install,当前所有命令必须当前工程目录下进行:
![输入图片说明](https://images.gitee.com/uploads/images/2021/0811/163159_895e12de_477893.png "test8.png")
4、安装依赖失败
```
yarn
```
5、在控制台输入命令:npm run dev,控制台打印出如下画面,恭喜表示本项目启动成功拉。
5、打开浏览器输入地址如图:
默认超管账户密码:admin/123456
# nginx线上部署
### 后台系统(Java端)
1、mvn install 或者直接idea打成jar包
2、配置nginx 反向代理如下:
```
server{
listen 443 ssl;
server_name api.gxwebsoft.com;
#listen [::]:81 default_server ipv6only=on;
#ssl on;
ssl_certificate httpssl/gxwebsoft.cn.pem;
ssl_certificate_key httpssl/api.gxwebsoft.cn.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
#error_page 404 /404.html;
#include enable-php.conf;
location / {
proxy_pass http://127.0.0.1:9090;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
access_log /home/wwwlogs/websoftapi.log;
}
``` ```
我配置的了ssl证书,如果不需要证书配置如下即可: ### 4. 启动开发服务器
```bash
# 开发模式
npm run dev
``` # 或
server{ yarn dev
listen 80;
server_name api.gxwebsoft.com;
#listen [::]:81 default_server ipv6only=on;
#error_page 404 /404.html;
#include enable-php.conf;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
access_log /home/wwwlogs/websoftapi.log;
}
``` ```
访问 `http://localhost:3000` 即可看到管理后台。
### 5. 构建生产版本
```bash
# 生产构建
npm run build
### 后台前端工程(VUE端) # 预览构建结果
1、输入命令:npm run build:prod 编译打包 npm run serve
2、把打包后的dist目录代码上传到服务器
3、配置nginx如下:
```
server
{
listen 443 ssl;
#listen [::]:81 default_server ipv6only=on;
server_name www.gxwesboft.com;
#ssl on;
ssl_certificate httpssl/www.gxwebsoft.com.pem;
ssl_certificate_key httpssl/www.gxwebsoft.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
index index.html;
root /home/wwwroot/system/websoft;
location / {
try_files $uri $uri/ @router;
index index.html;
· }
location @router {
rewrite ^.*$ /index.html last;
}
location ~* \.(eot|ttf|woff)$ {
# add_header Access-Control-Allow-Origin *;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /home/wwwlogs/websoftapi.log;
}
``` ```
不需要证书如上面Java端配置一样去掉相关证书配置 改监听端口80即可 ## ⚙️ 环境变量配置
项目使用环境变量来管理敏感信息和配置。请按照以下步骤配置:
### 功能模块 ### 必需配置
```bash
# API 配置
VITE_API_URL=https://your-api.com/api # 后端 API 地址
VITE_SERVER_API_URL=https://your-server.com/api # 服务端 API 地址
VITE_FILE_SERVER=https://your-file-server.com # 文件服务器地址
* 一:商品模块:商品添加、规格设置,商品上下架等 # 应用配置
* 二:订单模块:下单、购物车、支付,发货、收货、评价、退款等 VITE_APP_SECRET=your_app_secret # 应用密钥
* 三:营销模块:积分、优惠券、分销、砍价、拼团、秒杀、多门店等 VITE_TENANT_ID=your_tenant_id # 租户 ID
* 四:微信模块:自定义菜单、自动回复、微信授权、图文管理、模板消息推送 ```
* 五:配置模块:各种配置
* 六:用户模块:登陆、注册、会员卡、充值等
* 七:其他模块:场地预定模块、办公协同模块等
### 可选配置
```bash
# 高德地图 (如需使用地图功能)
VITE_MAP_KEY=your_map_key # 高德地图 Key
VITE_MAP_CODE=your_map_security_code # 高德地图安全密钥
#### 项目结构 # WebSoftAdmin 授权 (商业版功能)
项目采用分模块开发方式 VITE_LICENSE_CODE=your_license_code # 授权码
- gxwebsoft-common 公共模块 ```
- gxwebsoft-cms 预定模块
- gxwebsoft-shop 商城模块
- gxwebsoft-booking 预定模块
- gxwebsoft-oa oa模块
- gxwebsoft-weixin 微信相关模块
- gxwebsoft-generator 代码生成模块
### 获取配置信息
- **高德地图密钥**:访问 [高德开放平台](https://lbs.amap.com/) 申请
- **WebSoftAdmin 授权码**:联系 [官方网站](https://websoft.top/) 获取
- **其他 API 配置**:根据您的后端服务配置
### 技术选型 ## 🎯 核心功能
* 1 后端使用技术
* 1.1 SpringBoot2
* 1.2 mybatis、MyBatis-Plus
* 1.3 SpringSecurity
* 1.5 Druid
* 1.6 Slf4j
* 1.7 Fastjson
* 1.8 JWT
* 1.9 Redis
* 1.10 eleadmin
* 1.11 Mysql
* 1.12 swagger
* 1.13 WxJava
* 1.14 Lombok
* 1.15 Hutool
* 前端使用技术 ### 📝 内容管理系统
* 2.1 Vue 全家桶 - **文章管理**:支持富文本编辑、图片/视频上传
* 2.2 Antdv - **一键排版**:智能文章格式优化,包含10种专业排版样式
* 2.3 uniapp - **媒体库**:图片/视频文件管理,支持分组和搜索
- **首行缩进**:中文段落格式智能切换
### 🛒 商城管理
- **商品管理**:商品信息编辑、规格设置
- **订单管理**:订单流程跟踪
- **库存管理**:商品库存监控
### 👥 用户权限
- **用户管理**:用户信息维护
- **角色权限**:基于角色的访问控制
- **菜单管理**:动态菜单配置
## 🎨 富文本编辑器特色功能
#### 反馈交流 ### 📸 媒体上传
- 喜欢这个系统的小伙伴留下你的小星星啦,star,star哦! - **图片上传**:支持拖拽、粘贴、文件选择
- **视频上传**:支持多种视频格式
- **媒体库**:统一的媒体文件管理
- **OSS 存储**:阿里云对象存储集成
#### 特别鸣谢 ### ✨ 智能排版
- mybaitsplus:https://github.com/baomidou/mybatis-plus - **一键排版**:10种专业排版优化
- hutool:https://github.com/looly/hutool - **首行缩进**:中文段落格式切换
- eleadmin:https://eleadmin.com/ - **样式优化**:标题、段落、列表、表格等元素美化
- wxjava:https://github.com/Wechat-Group/WxJava - **响应式**:适配不同屏幕尺寸
- vue:https://github.com/vuejs/vue
- antdv:https://3x.antdv.com/components/overview-cn ## 🏗️ 项目结构
```
src/
├── components/ # 公共组件
├── views/ # 页面组件
│ ├── cms/ # 内容管理
│ ├── shop/ # 商城管理
│ └── system/ # 系统管理
├── router/ # 路由配置
├── store/ # 状态管理
├── utils/ # 工具函数
└── assets/ # 静态资源
```
@@ -19,8 +19,11 @@ export interface ThinkOrderRefundLog {
source?: string; source?: string;
// 状态:1新增,2退款成功,3已全额退款,4退款失败 // 状态:1新增,2退款成功,3已全额退款,4退款失败
status?: number; status?: number;
type?: number;
refundReason?: string;
// 创建时间 // 创建时间
createTime?: string; createTime?: string;
isAdmin?: boolean;
} }
/** /**
+103 -76
View File
@@ -1,7 +1,7 @@
<!-- 用户编辑弹窗 --> <!-- 用户编辑弹窗 -->
<template> <template>
<ele-modal <ele-modal
:width="`60%`" :width="600"
:visible="visible" :visible="visible"
:confirm-loading="loading" :confirm-loading="loading"
title="退款" title="退款"
@@ -10,104 +10,131 @@
:maskClosable="false" :maskClosable="false"
@ok="save" @ok="save"
> >
<a-form> <a-form ref="formRef" :model="form" :rules="rules">
<a-form-item label="订单金额"> <a-form-item label="订单金额">
<span>{{ data.totalPrice }}元</span> <span>{{ data.totalPrice }}元</span>
</a-form-item> </a-form-item>
<a-form-item label="支付金额"> <a-form-item label="支付金额">
<span>{{ data.price }}元</span> <span>{{ data.price }}元</span>
</a-form-item> </a-form-item>
<a-form-item label="退款金额"> <a-form-item label="退款金额" name="refundAmount">
<a-input-number placeholder="请输入退款金额" style="width: 300px" v-model:value="form.refundAmount" <a-input-number
:max="data.price" /> placeholder="请输入退款金额"
style="width: 300px"
v-model:value="form.refundAmount"
:max="data.price"
/>
</a-form-item>
<a-form-item label="退款原因" name="refundReason">
<a-textarea
:rows="3"
style="width: 300px"
:maxlength="100"
placeholder="备注信息"
v-model:value="form.refundReason"
/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</ele-modal> </ele-modal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, watch } from "vue"; import { reactive, ref, watch } from 'vue';
import { ThinkOrder } from "@/api/think/thinkOrder/model"; import { ThinkOrder } from '@/api/think/thinkOrder/model';
import { ThinkOrderRefundLog } from "@/api/think/thinkOrderRefundLog/model"; import { ThinkOrderRefundLog } from '@/api/think/thinkOrderRefundLog/model';
import { message } from "ant-design-vue"; import { message } from 'ant-design-vue';
import { addThinkOrderRefundLog } from "@/api/think/thinkOrderRefundLog"; import { addThinkOrderRefundLog } from '@/api/think/thinkOrderRefundLog';
const props = defineProps<{ const props = defineProps<{
// 弹窗是否打开 // 弹窗是否打开
visible: boolean; visible: boolean;
// 修改回显的数据 // 修改回显的数据
data: ThinkOrder; data: ThinkOrder;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: "done"): void; (e: 'done'): void;
(e: "update:visible", visible: boolean): void; (e: 'update:visible', visible: boolean): void;
}>(); }>();
const form = reactive<ThinkOrderRefundLog>({ const form = reactive<ThinkOrderRefundLog>({
int: undefined, int: undefined,
uid: undefined, uid: undefined,
refundAmount: undefined, refundAmount: undefined,
sid: undefined, sid: undefined,
oid: undefined, oid: undefined,
status: 1, status: 1,
type: 0, type: undefined,
isAdmin: true refundReason: undefined,
}); isAdmin: true
});
// 请求状态 // 请求状态
const loading = ref(false); const loading = ref(false);
/* 更新visible */ /* 更新visible */
const updateVisible = (value: boolean) => { const updateVisible = (value: boolean) => {
emit("update:visible", value); emit('update:visible', value);
}; };
const save = async () => { const save = async () => {
if (!form.refundAmount && props.data.price > 0) return message.error("请输入退款金额"); if (!form.refundAmount && props.data.price > 0)
loading.value = true; return message.error('请输入退款金额');
await addThinkOrderRefundLog(form); loading.value = true;
loading.value = false; await addThinkOrderRefundLog(form);
message.success("已提交"); loading.value = false;
updateVisible(false); message.success('已提交');
emit("done"); updateVisible(false);
}; emit('done');
};
watch( // 表单验证规则
() => props.visible, const rules = reactive({
(visible) => { name: [
if (visible) { {
loading.value = false; required: true,
if (props.data) { type: 'string',
form.uid = props.data.uid; message: '请填写名称',
form.oid = props.data.id; trigger: 'blur'
form.sid = props.data.sid; }
form.refundAmount = 0; ]
});
watch(
() => props.visible,
(visible) => {
if (visible) {
loading.value = false;
if (props.data) {
form.uid = props.data.uid;
form.oid = props.data.id;
form.sid = props.data.sid;
form.refundAmount = 0;
}
} }
} }
} );
);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.order-card { .order-card {
margin-bottom: 20px; margin-bottom: 20px;
}
.ant-form-item {
margin-bottom: 5px;
}
.order-info {
display: flex;
.info {
padding-left: 5px;
display: flex;
flex-direction: column;
} }
}
.tag-icon { .ant-form-item {
padding-right: 6px; margin-bottom: 5px;
} }
.order-info {
display: flex;
.info {
padding-left: 5px;
display: flex;
flex-direction: column;
}
}
.tag-icon {
padding-right: 6px;
}
</style> </style>
+404 -346
View File
@@ -8,7 +8,7 @@
:columns="columns" :columns="columns"
:datasource="datasource" :datasource="datasource"
:customRow="customRow" :customRow="customRow"
:scroll="{ x: 800 }" :scroll="{ x: 2000 }"
tool-class="ele-toolbar-form" tool-class="ele-toolbar-form"
class="sys-org-table" class="sys-org-table"
v-model:selection="selection" v-model:selection="selection"
@@ -28,6 +28,10 @@
<template v-if="column.key === 'image'"> <template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" /> <a-image :src="record.image" :width="50" />
</template> </template>
<template v-if="column.key === 'name'">
<div class="text-gray-700">{{ record.name }}</div>
<div class="text-blue-500">{{ record.phone }}</div>
</template>
<template v-if="column.key === 'dateTime'"> <template v-if="column.key === 'dateTime'">
<div>{{ record.siteName }}</div> <div>{{ record.siteName }}</div>
<div>{{ record.dateTime }} ¥{{ record.totalPrice }}元</div> <div>{{ record.dateTime }} ¥{{ record.totalPrice }}元</div>
@@ -147,8 +151,7 @@
<IdcardOutlined class="tag-icon" /> <IdcardOutlined class="tag-icon" />
IC会员卡 IC会员卡
</a-tag> </a-tag>
<a-tag v-if="record.couponType == 11" color="blue" <a-tag v-if="record.couponType == 11" color="blue">
>
<IdcardOutlined class="tag-icon" /> <IdcardOutlined class="tag-icon" />
免费订单 免费订单
</a-tag> </a-tag>
@@ -180,7 +183,8 @@
</a-tag> </a-tag>
<a-tag <a-tag
v-if="record.payStatus == 3 || record.payStatus == 0" v-if="record.payStatus == 3 || record.payStatus == 0"
color="cyan"> color="cyan"
>
<CoffeeOutlined class="tag-icon" /> <CoffeeOutlined class="tag-icon" />
未付款,占场中 未付款,占场中
</a-tag> </a-tag>
@@ -190,20 +194,29 @@
</template> </template>
<template v-if="column.key === 'orderStatus'"> <template v-if="column.key === 'orderStatus'">
<span v-if="record.orderStatus == 1" class="ele-text-success" <span v-if="record.orderStatus == 1" class="ele-text-success"
>已完成</span> >已完成</span
>
<span v-if="record.orderStatus == 2" class="ele-text-placeholder" <span v-if="record.orderStatus == 2" class="ele-text-placeholder"
>未使用</span> >未使用</span
>
<span v-if="record.orderStatus == 3" class="ele-text-placeholder" <span v-if="record.orderStatus == 3" class="ele-text-placeholder"
>已取消</span> >已取消</span
>
<span v-if="record.orderStatus == 4" class="ele-text-warning" <span v-if="record.orderStatus == 4" class="ele-text-warning"
>退款申请中</span> >退款申请中</span
>
<span v-if="record.orderStatus == 5" class="ele-text-danger" <span v-if="record.orderStatus == 5" class="ele-text-danger"
>退款被拒绝</span> >退款被拒绝</span
<span v-if="record.orderStatus == 6" class="ele-text-heading">退款成功</span> >
<span v-if="record.orderStatus == 6" class="ele-text-heading"
>退款成功</span
>
<span v-if="record.orderStatus == 7" class="ele-text-warning" <span v-if="record.orderStatus == 7" class="ele-text-warning"
>客户端申请退款</span> >客户端申请退款</span
>
<span v-if="record.orderStatus == 9" class="ele-text-warning" <span v-if="record.orderStatus == 9" class="ele-text-warning"
>未完成</span> >未完成</span
>
</template> </template>
<template v-if="column.key === 'isInvoice'"> <template v-if="column.key === 'isInvoice'">
<a-tag <a-tag
@@ -211,30 +224,36 @@
color="green" color="green"
class="cursor-pointer" class="cursor-pointer"
@click="openInvoicePdf(record)" @click="openInvoicePdf(record)"
>已开票 >已开票
</a-tag> </a-tag>
<a-tag <a-tag
v-if="record.isInvoice == 2" v-if="record.isInvoice == 2"
color="red" color="red"
class="cursor-pointer" class="cursor-pointer"
@click="onInvoice(record)" @click="onInvoice(record)"
>未开票 >未开票
</a-tag> </a-tag>
<a-tag v-if="record.isInvoice == 3" color="purple">不能开</a-tag> <a-tag v-if="record.isInvoice == 3" color="purple">不能开</a-tag>
</template> </template>
<template v-if="column.key === 'checkBill'"> <template v-if="column.key === 'checkBill'">
<template v-if="record.payStatus === 1 && record.payType === 1 && !record.wechatOrder.includes('420000')"> <template
v-if="
record.payStatus === 1 &&
record.payType === 1 &&
!record.wechatOrder.includes('420000')
"
>
<a-tag <a-tag
v-if="record.checkBill == 1" v-if="record.checkBill == 1"
color="green" color="green"
class="cursor-pointer" class="cursor-pointer"
>已对账 >已对账
</a-tag> </a-tag>
<a-tag <a-tag
v-if="record.checkBill == 2" v-if="record.checkBill == 2"
color="red" color="red"
class="cursor-pointer" class="cursor-pointer"
>未对账 >未对账
</a-tag> </a-tag>
</template> </template>
</template> </template>
@@ -246,15 +265,36 @@
<a-space> <a-space>
<a @click="openEdit(record)">详情</a> <a @click="openEdit(record)">详情</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<template v-if="record.isInvoice == 2 && record.payStatus == 1 && [1, 2].includes(record.orderStatus)"> <template
v-if="
record.isInvoice == 2 &&
record.payStatus == 1 &&
[1, 2].includes(record.orderStatus)
"
>
<a @click="onInvoice(record)">开票</a> <a @click="onInvoice(record)">开票</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
</template> </template>
<template <template
v-if="record.payStatus === 1 && [1, 2].includes(record.orderStatus) && hasPermission('think:order:refund')"> v-if="
<a class="ele-text-danger" @click="openRefund(record)" record.payStatus === 1 &&
v-if="dayjs(record.thinkOrderInfos[0].startTime * 1000).isBefore(dayjs())">退款</a> [1, 2].includes(record.orderStatus) &&
<a class="ele-text-danger" @click="openRefund(record)" v-else>过期退款</a> hasPermission('think:order:refund')
"
>
<a
class="ele-text-danger"
@click="openRefund(record)"
v-if="
dayjs(
record.thinkOrderInfos[0].startTime * 1000
).isBefore(dayjs())
"
>退款</a
>
<a class="ele-text-danger" @click="openRefund(record)" v-else
>过期退款</a
>
</template> </template>
</a-space> </a-space>
</template> </template>
@@ -265,351 +305,369 @@
<OrderInfo v-model:visible="showEdit" :data="current" @done="reload" /> <OrderInfo v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 开具发票 --> <!-- 开具发票 -->
<Invoice v-model:visible="showInvoice" :data="current" @done="reload" /> <Invoice v-model:visible="showInvoice" :data="current" @done="reload" />
<InvoiceByList v-model:visible="showInvoiceList" :data="current" @done="reload" /> <InvoiceByList
v-model:visible="showInvoiceList"
:data="current"
@done="reload"
/>
<Refund v-model:visible="showRefund" :data="refundOrder" @done="reload" /> <Refund v-model:visible="showRefund" :data="refundOrder" @done="reload" />
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref } from "vue"; import { createVNode, ref } from 'vue';
import { message, Modal } from "ant-design-vue"; import { message, Modal } from 'ant-design-vue';
import { import {
ExclamationCircleOutlined, ExclamationCircleOutlined,
CheckOutlined, CheckOutlined,
CloseOutlined, CloseOutlined,
AlipayCircleOutlined AlipayCircleOutlined
} from "@ant-design/icons-vue"; } from '@ant-design/icons-vue';
import { EleProTable, messageLoading, toDateString } from "ele-admin-pro"; import { EleProTable, messageLoading, toDateString } from 'ele-admin-pro';
import type { import type {
DatasourceFunction, DatasourceFunction,
ColumnItem ColumnItem
} from "ele-admin-pro/es/ele-pro-table/types"; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from "./components/search.vue"; import Search from './components/search.vue';
import OrderInfo from "./components/orderInfo.vue"; import OrderInfo from './components/orderInfo.vue';
import Invoice from "./components/invoice.vue"; import Invoice from './components/invoice.vue';
import InvoiceByList from "./components/invoiceByList.vue"; import InvoiceByList from './components/invoiceByList.vue';
import { import {
pageThinkOrder, pageThinkOrder,
removeThinkOrder, removeThinkOrder,
removeBatchThinkOrder, thinkOrderExport removeBatchThinkOrder,
} from "@/api/think/thinkOrder"; thinkOrderExport
import * as InvoiceApi from "@/api/think/thinkInvoice"; } from '@/api/think/thinkOrder';
import type { import * as InvoiceApi from '@/api/think/thinkInvoice';
ThinkOrder, import type {
ThinkOrderParam ThinkOrder,
} from "@/api/think/thinkOrder/model"; ThinkOrderParam
import { formatNumber } from "ele-admin-pro/es"; } from '@/api/think/thinkOrder/model';
import type { ThinkInvoice } from "@/api/think/thinkInvoice/model"; import { formatNumber } from 'ele-admin-pro/es';
import Refund from "@/views/think/thinkOrder/components/refund.vue"; import type { ThinkInvoice } from '@/api/think/thinkInvoice/model';
import { hasPermission } from "@/utils/permission"; import Refund from '@/views/think/thinkOrder/components/refund.vue';
import dayjs from "dayjs"; import { hasPermission } from '@/utils/permission';
import dayjs from 'dayjs';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据 // 表格选中数据
const selection = ref<ThinkOrder[]>([]); const selection = ref<ThinkOrder[]>([]);
// 当前编辑数据 // 当前编辑数据
const current = ref<ThinkOrder | null>(null); const current = ref<ThinkOrder | null>(null);
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 开具发票弹窗 // 开具发票弹窗
const showInvoice = ref(false); const showInvoice = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
where.forAdmin = true;
return pageThinkOrder({
...where,
...orders,
page, page,
limit limit,
}); where,
}; orders,
filters
// 表格列配置 }) => {
const columns = ref<ColumnItem[]>([ if (filters) {
{ where.status = filters.status;
title: "订单号",
dataIndex: "orderNum",
key: "iod",
width: 90
},
{
title: "姓名",
dataIndex: "name",
key: "name",
align: "center"
},
{
title: "手机号",
dataIndex: "phone",
key: "phone",
width: 120,
align: "center"
},
{
title: "预约信息",
dataIndex: "dateTime",
key: "dateTime",
width: 120,
align: "center"
},
{
title: "总额",
dataIndex: "totalPrice",
key: "totalPrice",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "减少金额",
dataIndex: "reducePrice",
key: "reducePrice",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "实付金额",
dataIndex: "payPrice",
key: "payPrice",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "支付方式",
dataIndex: "payType",
key: "payType",
align: "center"
},
{
title: "IC卡号",
dataIndex: "code",
key: "code",
align: "center"
},
{
title: "付款状态",
dataIndex: "payStatus",
key: "payStatus",
sorter: true,
align: "center"
},
{
title: "付款时间",
dataIndex: "payTime",
key: "payTime",
sorter: true,
align: "center",
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
},
{
title: "订单状态",
dataIndex: "orderStatus",
key: "orderStatus",
align: "center"
},
{
title: "优惠类型",
dataIndex: "couponType",
key: "couponType",
align: "center"
},
{
title: "开票状态",
dataIndex: "isInvoice",
key: "isInvoice",
align: "center",
sorter: true
},
{
title: "对账状态",
key: "checkBill",
align: "center"
},
// {
// title: '类型',
// dataIndex: 'type',
// key: 'type',
// align: 'center',
// customRender: ({ text }) =>
// ['商城订单', '客户预定', '俱乐部训练场', '活动订场'][text]
// },
// {
// title: '申请退款时间',
// dataIndex: 'refundApplyTime',
// key: 'refundApplyTime',
// align: 'center',
// customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
// },
// {
// title: '备注',
// dataIndex: 'comments',
// key: 'comments',
// align: 'center'
// },
{
title: "操作",
key: "action",
width: 200,
fixed: "right",
align: "center",
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: ThinkOrderParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: ThinkOrder) => {
current.value = row ?? null;
showEdit.value = true;
};
const showRefund = ref(false);
const refundOrder = ref<ThinkOrder>();
const openRefund = (row: ThinkOrder) => {
refundOrder.value = row;
showRefund.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: ThinkOrder) => {
const hide = message.loading("请求中..", 0);
removeThinkOrder(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error("请至少选择一条数据");
return;
}
Modal.confirm({
title: "提示",
content: "确定要删除选中的记录吗?",
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading("请求中..", 0);
removeBatchThinkOrder(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
} }
}); where.forAdmin = true;
}; return pageThinkOrder({
...where,
/* 开具发票 */ ...orders,
const onInvoice = (row?: ThinkOrder) => { page,
console.log(row?.payStatus); limit
if (row?.payStatus != 1) {
return false;
}
current.value = row ?? null;
showInvoice.value = true;
};
const openInvoicePdf = (row?: ThinkInvoice) => {
if (row?.id) {
InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res);
const pdfUrl = parse[0].pdfUrl;
window.open(pdfUrl);
}); });
}
};
/* 查询 */
const query = () => {
loading.value = true;
};
const showInvoiceList = ref(false);
const openInvoiceByList = async () => {
const list = selection.value.filter(item => (item.isInvoice === 2 && item.payStatus === 1 && [1, 2].includes(item.orderStatus)));
if (!list.length) return message.error("无可开票订单");
current.value = {
orderIdList: list.map((d) => d.id),
price: list.reduce((count, item) => count + parseFloat(item.payPrice), 0)
}; };
showInvoiceList.value = true;
};
const handleExport = async (params: ThinkOrderParam) => { // 表格列配置
const hide = messageLoading("导出中...", 0); const columns = ref<ColumnItem[]>([
const res = await thinkOrderExport(params); {
hide(); title: '订单号',
window.open(res.url); dataIndex: 'orderNum',
}; key: 'iod',
width: 104
/* 自定义行属性 */
const customRow = (record: ThinkOrder) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
}, },
// 行双击事件 {
onDblclick: () => { title: '姓名',
openEdit(record); dataIndex: 'name',
key: 'name',
align: 'center',
width: 120
},
// {
// title: '手机号',
// dataIndex: 'phone',
// key: 'phone',
// width: 120,
// align: 'center'
// },
{
title: '预约信息',
dataIndex: 'dateTime',
key: 'dateTime',
width: 260,
align: 'center'
},
{
title: '订单总额',
dataIndex: 'totalPrice',
key: 'totalPrice',
align: 'center',
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: '减少金额',
dataIndex: 'reducePrice',
key: 'reducePrice',
align: 'center',
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: '实付金额',
dataIndex: 'payPrice',
key: 'payPrice',
align: 'center',
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: '支付方式',
dataIndex: 'payType',
key: 'payType',
align: 'center'
},
{
title: 'IC卡号',
dataIndex: 'code',
key: 'code',
align: 'center',
width: 120
},
{
title: '付款状态',
dataIndex: 'payStatus',
key: 'payStatus',
sorter: true,
align: 'center'
},
{
title: '付款时间',
dataIndex: 'payTime',
key: 'payTime',
sorter: true,
align: 'center',
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '订单状态',
dataIndex: 'orderStatus',
key: 'orderStatus',
align: 'center'
},
{
title: '优惠类型',
dataIndex: 'couponType',
key: 'couponType',
align: 'center'
},
{
title: '开票状态',
dataIndex: 'isInvoice',
key: 'isInvoice',
align: 'center',
sorter: true
},
{
title: '对账状态',
key: 'checkBill',
align: 'center'
},
{
title: '退款原因',
key: 'refundReason',
align: 'center'
},
// {
// title: '类型',
// dataIndex: 'type',
// key: 'type',
// align: 'center',
// customRender: ({ text }) =>
// ['商城订单', '客户预定', '俱乐部训练场', '活动订场'][text]
// },
// {
// title: '申请退款时间',
// dataIndex: 'refundApplyTime',
// key: 'refundApplyTime',
// align: 'center',
// customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
// },
// {
// title: '备注',
// dataIndex: 'comments',
// key: 'comments',
// align: 'center'
// },
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: ThinkOrderParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: ThinkOrder) => {
current.value = row ?? null;
showEdit.value = true;
};
const showRefund = ref(false);
const refundOrder = ref<ThinkOrder>();
const openRefund = (row: ThinkOrder) => {
refundOrder.value = row;
showRefund.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: ThinkOrder) => {
const hide = message.loading('请求中..', 0);
removeThinkOrder(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchThinkOrder(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 开具发票 */
const onInvoice = (row?: ThinkOrder) => {
console.log(row?.payStatus);
if (row?.payStatus != 1) {
return false;
}
current.value = row ?? null;
showInvoice.value = true;
};
const openInvoicePdf = (row?: ThinkInvoice) => {
if (row?.id) {
InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res);
const pdfUrl = parse[0].pdfUrl;
window.open(pdfUrl);
});
} }
}; };
};
query(); /* 查询 */
const query = () => {
loading.value = true;
};
const showInvoiceList = ref(false);
const openInvoiceByList = async () => {
const list = selection.value.filter(
(item) =>
item.isInvoice === 2 &&
item.payStatus === 1 &&
[1, 2].includes(item.orderStatus)
);
if (!list.length) return message.error('无可开票订单');
current.value = {
orderIdList: list.map((d) => d.id),
price: list.reduce((count, item) => count + parseFloat(item.payPrice), 0)
};
showInvoiceList.value = true;
};
const handleExport = async (params: ThinkOrderParam) => {
const hide = messageLoading('导出中...', 0);
const res = await thinkOrderExport(params);
hide();
window.open(res.url);
};
/* 自定义行属性 */
const customRow = (record: ThinkOrder) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
};
};
query();
</script> </script>
<script lang="ts"> <script lang="ts">
import * as MenuIcons from "@/layout/menu-icons"; import * as MenuIcons from '@/layout/menu-icons';
export default { export default {
name: "ThinkOrder", name: 'ThinkOrder',
components: MenuIcons components: MenuIcons
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.tag-icon { .tag-icon {
padding-right: 6px; padding-right: 6px;
} }
</style> </style>