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;
} }
/** /**
@@ -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,27 +10,40 @@
: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<{
// 弹窗是否打开 // 弹窗是否打开
@@ -40,8 +53,8 @@ const props = defineProps<{
}>(); }>();
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>({
@@ -51,7 +64,8 @@ const form = reactive<ThinkOrderRefundLog>({
sid: undefined, sid: undefined,
oid: undefined, oid: undefined,
status: 1, status: 1,
type: 0, type: undefined,
refundReason: undefined,
isAdmin: true isAdmin: true
}); });
@@ -60,19 +74,32 @@ 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)
return message.error('请输入退款金额');
loading.value = true; loading.value = true;
await addThinkOrderRefundLog(form); await addThinkOrderRefundLog(form);
loading.value = false; loading.value = false;
message.success("已提交"); message.success('已提交');
updateVisible(false); updateVisible(false);
emit("done"); emit('done');
}; };
// 表单验证规则
const rules = reactive({
name: [
{
required: true,
type: 'string',
message: '请填写名称',
trigger: 'blur'
}
]
});
watch( watch(
() => props.visible, () => props.visible,
(visible) => { (visible) => {
+176 -118
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
@@ -223,7 +236,13 @@
<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"
@@ -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,45 +305,50 @@
<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 * as InvoiceApi from '@/api/think/thinkInvoice';
import type { import type {
ThinkOrder, ThinkOrder,
ThinkOrderParam ThinkOrderParam
} from "@/api/think/thinkOrder/model"; } from '@/api/think/thinkOrder/model';
import { formatNumber } from "ele-admin-pro/es"; import { formatNumber } from 'ele-admin-pro/es';
import type { ThinkInvoice } from "@/api/think/thinkInvoice/model"; import type { ThinkInvoice } from '@/api/think/thinkInvoice/model';
import Refund from "@/views/think/thinkOrder/components/refund.vue"; import Refund from '@/views/think/thinkOrder/components/refund.vue';
import { hasPermission } from "@/utils/permission"; import { hasPermission } from '@/utils/permission';
import dayjs from "dayjs"; import dayjs from 'dayjs';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -344,106 +389,114 @@ const datasource: DatasourceFunction = ({
// 表格列配置 // 表格列配置
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: "订单号", title: '订单号',
dataIndex: "orderNum", dataIndex: 'orderNum',
key: "iod", key: 'iod',
width: 90 width: 104
}, },
{ {
title: "姓名", title: '姓名',
dataIndex: "name", dataIndex: 'name',
key: "name", key: 'name',
align: "center" align: 'center',
width: 120
},
// {
// title: '手机号',
// dataIndex: 'phone',
// key: 'phone',
// width: 120,
// align: 'center'
// },
{
title: '预约信息',
dataIndex: 'dateTime',
key: 'dateTime',
width: 260,
align: 'center'
}, },
{ {
title: "手机号", title: '订单总额',
dataIndex: "phone", dataIndex: 'totalPrice',
key: "phone", key: 'totalPrice',
width: 120, align: 'center',
align: "center"
},
{
title: "预约信息",
dataIndex: "dateTime",
key: "dateTime",
width: 120,
align: "center"
},
{
title: "总额",
dataIndex: "totalPrice",
key: "totalPrice",
align: "center",
sorter: true, sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}` customRender: ({ text }) => `¥${formatNumber(text)}`
}, },
{ {
title: "减少金额", title: '减少金额',
dataIndex: "reducePrice", dataIndex: 'reducePrice',
key: "reducePrice", key: 'reducePrice',
align: "center", align: 'center',
sorter: true, sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}` customRender: ({ text }) => `¥${formatNumber(text)}`
}, },
{ {
title: "实付金额", title: '实付金额',
dataIndex: "payPrice", dataIndex: 'payPrice',
key: "payPrice", key: 'payPrice',
align: "center", align: 'center',
sorter: true, sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}` customRender: ({ text }) => `¥${formatNumber(text)}`
}, },
{ {
title: "支付方式", title: '支付方式',
dataIndex: "payType", dataIndex: 'payType',
key: "payType", key: 'payType',
align: "center" align: 'center'
}, },
{ {
title: "IC卡号", title: 'IC卡号',
dataIndex: "code", dataIndex: 'code',
key: "code", key: 'code',
align: "center" align: 'center',
width: 120
}, },
{ {
title: "付款状态", title: '付款状态',
dataIndex: "payStatus", dataIndex: 'payStatus',
key: "payStatus", key: 'payStatus',
sorter: true, sorter: true,
align: "center" align: 'center'
}, },
{ {
title: "付款时间", title: '付款时间',
dataIndex: "payTime", dataIndex: 'payTime',
key: "payTime", key: 'payTime',
sorter: true, sorter: true,
align: "center", align: 'center',
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss") customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
{ {
title: "订单状态", title: '订单状态',
dataIndex: "orderStatus", dataIndex: 'orderStatus',
key: "orderStatus", key: 'orderStatus',
align: "center" align: 'center'
}, },
{ {
title: "优惠类型", title: '优惠类型',
dataIndex: "couponType", dataIndex: 'couponType',
key: "couponType", key: 'couponType',
align: "center" align: 'center'
}, },
{ {
title: "开票状态", title: '开票状态',
dataIndex: "isInvoice", dataIndex: 'isInvoice',
key: "isInvoice", key: 'isInvoice',
align: "center", align: 'center',
sorter: true sorter: true
}, },
{ {
title: "对账状态", title: '对账状态',
key: "checkBill", key: 'checkBill',
align: "center" align: 'center'
}, },
{
title: '退款原因',
key: 'refundReason',
align: 'center'
},
// { // {
// title: '类型', // title: '类型',
// dataIndex: 'type', // dataIndex: 'type',
@@ -466,11 +519,11 @@ const columns = ref<ColumnItem[]>([
// align: 'center' // align: 'center'
// }, // },
{ {
title: "操作", title: '操作',
key: "action", key: 'action',
width: 200, width: 180,
fixed: "right", fixed: 'right',
align: "center", align: 'center',
hideInSetting: true hideInSetting: true
} }
]); ]);
@@ -501,7 +554,7 @@ const openMove = () => {
/* 删除单个 */ /* 删除单个 */
const remove = (row: ThinkOrder) => { const remove = (row: ThinkOrder) => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
removeThinkOrder(row.id) removeThinkOrder(row.id)
.then((msg) => { .then((msg) => {
hide(); hide();
@@ -517,16 +570,16 @@ const remove = (row: ThinkOrder) => {
/* 批量删除 */ /* 批量删除 */
const removeBatch = () => { const removeBatch = () => {
if (!selection.value.length) { if (!selection.value.length) {
message.error("请至少选择一条数据"); message.error('请至少选择一条数据');
return; return;
} }
Modal.confirm({ Modal.confirm({
title: "提示", title: '提示',
content: "确定要删除选中的记录吗?", content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
maskClosable: true, maskClosable: true,
onOk: () => { onOk: () => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
removeBatchThinkOrder(selection.value.map((d) => d.id)) removeBatchThinkOrder(selection.value.map((d) => d.id))
.then((msg) => { .then((msg) => {
hide(); hide();
@@ -568,8 +621,13 @@ const query = () => {
const showInvoiceList = ref(false); const showInvoiceList = ref(false);
const openInvoiceByList = async () => { const openInvoiceByList = async () => {
const list = selection.value.filter(item => (item.isInvoice === 2 && item.payStatus === 1 && [1, 2].includes(item.orderStatus))); const list = selection.value.filter(
if (!list.length) return message.error("无可开票订单"); (item) =>
item.isInvoice === 2 &&
item.payStatus === 1 &&
[1, 2].includes(item.orderStatus)
);
if (!list.length) return message.error('无可开票订单');
current.value = { current.value = {
orderIdList: list.map((d) => d.id), orderIdList: list.map((d) => d.id),
price: list.reduce((count, item) => count + parseFloat(item.payPrice), 0) price: list.reduce((count, item) => count + parseFloat(item.payPrice), 0)
@@ -578,7 +636,7 @@ const openInvoiceByList = async () => {
}; };
const handleExport = async (params: ThinkOrderParam) => { const handleExport = async (params: ThinkOrderParam) => {
const hide = messageLoading("导出中...", 0); const hide = messageLoading('导出中...', 0);
const res = await thinkOrderExport(params); const res = await thinkOrderExport(params);
hide(); hide();
window.open(res.url); window.open(res.url);
@@ -601,10 +659,10 @@ 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>