261024
This commit is contained in:
+2
-2
@@ -2,8 +2,8 @@ VITE_APP_NAME=后台管理系统
|
|||||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
||||||
VITE_SERVER_URL=https://gxtyzx-server.websoft.top/api
|
VITE_SERVER_URL=https://gxtyzx-server.websoft.top/api
|
||||||
VITE_API_URL=https://gxtyzx-modules.websoft.top/api
|
VITE_API_URL=https://gxtyzx-modules.websoft.top/api
|
||||||
VITE_THINK_URL=https://gxtyzx-api2.websoft.top/api
|
#VITE_THINK_URL=https://gxtyzx-api2.websoft.top/api
|
||||||
#VITE_THINK_URL=http://127.0.0.1:9099/api
|
VITE_THINK_URL=http://127.0.0.1:9099/api
|
||||||
|
|
||||||
|
|
||||||
#VITE_SERVER_URL=http://127.0.0.1:30000/api
|
#VITE_SERVER_URL=http://127.0.0.1:30000/api
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { BalanceChargeLog, BalanceChargeLogParam } from './model';
|
||||||
|
import { THINK_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
export async function pageBalanceChargeLog(params: BalanceChargeLogParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<BalanceChargeLog>>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
export async function listBalanceChargeLog(params?: BalanceChargeLogParam) {
|
||||||
|
const res = await request.get<ApiResult<BalanceChargeLog[]>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
export async function addBalanceChargeLog(data: BalanceChargeLog) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
export async function updateBalanceChargeLog(data: BalanceChargeLog) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款
|
||||||
|
*/
|
||||||
|
export async function refundBalanceChargeLog(data: BalanceChargeLog) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log/refund',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
export async function removeBalanceChargeLog(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
export async function removeBatchBalanceChargeLog(
|
||||||
|
data: (number | undefined)[]
|
||||||
|
) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*/
|
||||||
|
export async function getBalanceChargeLog(id: number) {
|
||||||
|
const res = await request.get<ApiResult<BalanceChargeLog>>(
|
||||||
|
THINK_API_URL + '/shop/balance-charge-log/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export interface BalanceChargeLog {
|
||||||
|
//
|
||||||
|
id?: number;
|
||||||
|
//
|
||||||
|
amount?: string;
|
||||||
|
//
|
||||||
|
orderNo?: string;
|
||||||
|
// 0未支付,1已支付,2已退款
|
||||||
|
isPaid?: number;
|
||||||
|
//
|
||||||
|
paidNumber?: string;
|
||||||
|
//
|
||||||
|
userId?: number;
|
||||||
|
// 手机号
|
||||||
|
phone?: string;
|
||||||
|
// 商城ID
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
//
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索条件
|
||||||
|
*/
|
||||||
|
export interface BalanceChargeLogParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
phone?: string;
|
||||||
|
orderNo?: string;
|
||||||
|
isPaid?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { UserBalanceLog, UserBalanceLogParam } from './model';
|
||||||
|
import { THINK_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户余额变动明细表
|
||||||
|
*/
|
||||||
|
export async function pageUserBalanceLog(params: UserBalanceLogParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<UserBalanceLog>>>(
|
||||||
|
THINK_API_URL + '/shop/user-balance-log/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户余额变动明细表列表
|
||||||
|
*/
|
||||||
|
export async function listUserBalanceLog(params?: UserBalanceLogParam) {
|
||||||
|
const res = await request.get<ApiResult<UserBalanceLog[]>>(
|
||||||
|
THINK_API_URL + '/shop/user-balance-log',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户余额变动明细表
|
||||||
|
*/
|
||||||
|
export async function addUserBalanceLog(data: UserBalanceLog) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/user-balance-log',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户余额变动明细表
|
||||||
|
*/
|
||||||
|
export async function updateUserBalanceLog(data: UserBalanceLog) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/user-balance-log',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户余额变动明细表
|
||||||
|
*/
|
||||||
|
export async function removeUserBalanceLog(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/user-balance-log/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户余额变动明细表
|
||||||
|
*/
|
||||||
|
export async function removeBatchUserBalanceLog(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/shop/user-balance-log/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询用户余额变动明细表
|
||||||
|
*/
|
||||||
|
export async function getUserBalanceLog(id: number) {
|
||||||
|
const res = await request.get<ApiResult<UserBalanceLog>>(
|
||||||
|
THINK_API_URL + '/shop/user-balance-log/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户余额变动明细表
|
||||||
|
*/
|
||||||
|
export interface UserBalanceLog {
|
||||||
|
// 主键ID
|
||||||
|
logId?: number;
|
||||||
|
// 用户ID
|
||||||
|
userId?: number;
|
||||||
|
// 余额变动场景(0 用户充值 1用户消费 2管理员操作 3订单退款)
|
||||||
|
scene?: number;
|
||||||
|
// 变动金额
|
||||||
|
money?: string;
|
||||||
|
// 变动后余额
|
||||||
|
balance?: string;
|
||||||
|
// 管理员备注
|
||||||
|
remark?: string;
|
||||||
|
//
|
||||||
|
orderId?: number;
|
||||||
|
// 操作人ID
|
||||||
|
adminId?: number;
|
||||||
|
// 排序(数字越小越靠前)
|
||||||
|
sortNumber?: number;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 状态, 0正常, 1冻结
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 注册时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户余额变动明细表搜索条件
|
||||||
|
*/
|
||||||
|
export interface UserBalanceLogParam extends PageParam {
|
||||||
|
logId?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -74,6 +74,19 @@ export async function updateThinkCard(data: ThinkCard) {
|
|||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 修改卡片剩余金额/剩余次数(仅更新这两个字段) */
|
||||||
|
export async function updateThinkCardRemaining(data: {
|
||||||
|
id: number;
|
||||||
|
num?: number;
|
||||||
|
remainingMoney?: string;
|
||||||
|
}) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-card/remaining', data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) return res.data.message;
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { ThinkCardBalance, ThinkCardBalanceParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询卡余额记录
|
||||||
|
*/
|
||||||
|
export async function pageThinkCardBalance(params: ThinkCardBalanceParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ThinkCardBalance>>>(
|
||||||
|
MODULES_API_URL + '/think/think-card-balance/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询卡余额记录列表
|
||||||
|
*/
|
||||||
|
export async function listThinkCardBalance(params?: ThinkCardBalanceParam) {
|
||||||
|
const res = await request.get<ApiResult<ThinkCardBalance[]>>(
|
||||||
|
MODULES_API_URL + '/think/think-card-balance',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加卡余额记录
|
||||||
|
*/
|
||||||
|
export async function addThinkCardBalance(data: ThinkCardBalance) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-card-balance',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改卡余额记录
|
||||||
|
*/
|
||||||
|
export async function updateThinkCardBalance(data: ThinkCardBalance) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-card-balance',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除卡余额记录
|
||||||
|
*/
|
||||||
|
export async function removeThinkCardBalance(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-card-balance/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除卡余额记录
|
||||||
|
*/
|
||||||
|
export async function removeBatchThinkCardBalance(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-card-balance/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询卡余额记录
|
||||||
|
*/
|
||||||
|
export async function getThinkCardBalance(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ThinkCardBalance>>(
|
||||||
|
MODULES_API_URL + '/think/think-card-balance/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡余额记录
|
||||||
|
*/
|
||||||
|
export interface ThinkCardBalance {
|
||||||
|
//
|
||||||
|
id?: number;
|
||||||
|
//
|
||||||
|
cid?: number;
|
||||||
|
//
|
||||||
|
vid?: number;
|
||||||
|
//
|
||||||
|
uid?: number;
|
||||||
|
//
|
||||||
|
balance?: string;
|
||||||
|
// 每次减少金额
|
||||||
|
reduceEach?: string;
|
||||||
|
// 下单时间
|
||||||
|
createTime?: number;
|
||||||
|
//
|
||||||
|
updateTime?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡余额记录搜索条件
|
||||||
|
*/
|
||||||
|
export interface ThinkCardBalanceParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { ThinkFtpCheckBill, ThinkFtpCheckBillParam } from './model';
|
||||||
|
import { THINK_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
export async function pageThinkFtpCheckBill(params: ThinkFtpCheckBillParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ThinkFtpCheckBill>>>(
|
||||||
|
THINK_API_URL + '/think/think-ftp-check-bill/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
export async function listThinkFtpCheckBill(params?: ThinkFtpCheckBillParam) {
|
||||||
|
const res = await request.get<ApiResult<ThinkFtpCheckBill[]>>(
|
||||||
|
THINK_API_URL + '/think/think-ftp-check-bill',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
export async function addThinkFtpCheckBill(data: ThinkFtpCheckBill) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-ftp-check-bill',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
export async function updateThinkFtpCheckBill(data: ThinkFtpCheckBill) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-ftp-check-bill',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
export async function removeThinkFtpCheckBill(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-ftp-check-bill/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
export async function removeBatchThinkFtpCheckBill(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-ftp-check-bill/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*/
|
||||||
|
export async function getThinkFtpCheckBill(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ThinkFtpCheckBill>>(
|
||||||
|
THINK_API_URL + '/think/think-ftp-check-bill/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import type { PageParam } from "@/api";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export interface ThinkFtpCheckBill {
|
||||||
|
//
|
||||||
|
id?: number;
|
||||||
|
// 终端号
|
||||||
|
deviceNo?: string;
|
||||||
|
// 卡号
|
||||||
|
cardNo?: string;
|
||||||
|
//
|
||||||
|
amount?: string;
|
||||||
|
// 结算金额
|
||||||
|
settleAmount?: string;
|
||||||
|
// 手续费
|
||||||
|
feeAmount?: string;
|
||||||
|
// 实际支付金额
|
||||||
|
paidAmount?: string;
|
||||||
|
// 参考号
|
||||||
|
refNo?: string;
|
||||||
|
// 流水号
|
||||||
|
flowNo?: string;
|
||||||
|
// 卡类型
|
||||||
|
cardType?: string;
|
||||||
|
// 发卡行
|
||||||
|
postCardType?: string;
|
||||||
|
// 支付方式
|
||||||
|
payType?: string;
|
||||||
|
// 银商订单号
|
||||||
|
orderNo?: string;
|
||||||
|
//
|
||||||
|
payTime?: string;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 状态, 0已发布, 1待审核 2已驳回 3违规内容
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索条件
|
||||||
|
*/
|
||||||
|
export interface ThinkFtpCheckBillParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
payTimeStart?: string;
|
||||||
|
payTimeEnd?: string;
|
||||||
|
}
|
||||||
@@ -129,6 +129,20 @@ export async function doInvoice(data: ThinkInvoice) {
|
|||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新发票状态
|
||||||
|
*/
|
||||||
|
export async function getInvoiceRes(data: ThinkInvoice) {
|
||||||
|
const res = await request.post<ApiResult<string>>(
|
||||||
|
THINK_API_URL + "/think/think-invoice/getRes",
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
export async function doInvoiceByListReq(data: ThinkInvoice) {
|
export async function doInvoiceByListReq(data: ThinkInvoice) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
THINK_API_URL + "/think/think-invoice/doInvoiceByList",
|
THINK_API_URL + "/think/think-invoice/doInvoiceByList",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export interface ThinkInvoice {
|
|||||||
// 备注信息
|
// 备注信息
|
||||||
info?: string;
|
info?: string;
|
||||||
// 是否已开:1已开,2未开
|
// 是否已开:1已开,2未开
|
||||||
isOpen?: string;
|
isOpen?: number;
|
||||||
// 发票类型:1纸质发票,2电子发票
|
// 发票类型:1纸质发票,2电子发票
|
||||||
type?: number;
|
type?: number;
|
||||||
// 发票类型:1场地发票,2vip卡发票,3ic卡发票
|
// 发票类型:1场地发票,2vip卡发票,3ic卡发票
|
||||||
@@ -51,6 +51,9 @@ export interface ThinkInvoice {
|
|||||||
//
|
//
|
||||||
vid?: number;
|
vid?: number;
|
||||||
status?: number;
|
status?: number;
|
||||||
|
resJson?: string;
|
||||||
|
url?: string;
|
||||||
|
xmlUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import type { ApiResult, PageResult } from "@/api";
|
import type { ApiResult, PageResult } from "@/api";
|
||||||
import type { ThinkOrder, ThinkOrderParam } from "./model";
|
import type {
|
||||||
|
ThinkOrder,
|
||||||
|
ThinkOrderParam,
|
||||||
|
ThinkTrainingBusinessSection
|
||||||
|
} from "./model";
|
||||||
import { THINK_API_URL } from "@/config/setting";
|
import { THINK_API_URL } from "@/config/setting";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,6 +80,20 @@ export async function updateThinkOrder(data: ThinkOrder) {
|
|||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置已开票
|
||||||
|
*/
|
||||||
|
export async function setThinkOrderInvoice(ids: (number | undefined)[]) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + "/think/think-order/set-invoice",
|
||||||
|
ids
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
export async function updateBatchThinkOrder(data: ThinkOrder[]) {
|
export async function updateBatchThinkOrder(data: ThinkOrder[]) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
THINK_API_URL + "/think/think-order/batch",
|
THINK_API_URL + "/think/think-order/batch",
|
||||||
@@ -168,3 +186,29 @@ export async function getThinkOrderExcelDataForCard(params?: ThinkOrderParam) {
|
|||||||
}
|
}
|
||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getThinkOrderTrainingBusinessData(
|
||||||
|
params?: ThinkOrderParam
|
||||||
|
) {
|
||||||
|
const res = await request.post<ApiResult<ThinkTrainingBusinessSection[]>>(
|
||||||
|
THINK_API_URL + "/think/think-order/training-business-data",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function exportThinkOrderTrainingBusiness(
|
||||||
|
params?: ThinkOrderParam
|
||||||
|
) {
|
||||||
|
const res = await request.post<ApiResult<ThinkOrder>>(
|
||||||
|
THINK_API_URL + "/think/think-order/training-business-export",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|||||||
@@ -98,4 +98,25 @@ export interface ThinkOrderParam extends PageParam {
|
|||||||
siteName?: string;
|
siteName?: string;
|
||||||
keywords?: string;
|
keywords?: string;
|
||||||
wechatOrder?: string;
|
wechatOrder?: string;
|
||||||
|
createTimeStart?: number | string;
|
||||||
|
createTimeEnd?: number | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ThinkTrainingBusinessRow {
|
||||||
|
trainingInstitutionName?: string;
|
||||||
|
openCount?: number;
|
||||||
|
openAmount?: number | string;
|
||||||
|
verifyCount?: number;
|
||||||
|
verifyAmount?: number | string;
|
||||||
|
expiredCount?: number;
|
||||||
|
expiredAmount?: number | string;
|
||||||
|
unverifiedCount?: number;
|
||||||
|
remainingAmount?: number | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ThinkTrainingBusinessSection {
|
||||||
|
key?: string;
|
||||||
|
title?: string;
|
||||||
|
rows?: ThinkTrainingBusinessRow[];
|
||||||
|
total?: ThinkTrainingBusinessRow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { ThinkOrderOffCheck, ThinkOrderOffCheckParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询折扣审核
|
||||||
|
*/
|
||||||
|
export async function pageThinkOrderOffCheck(params: ThinkOrderOffCheckParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ThinkOrderOffCheck>>>(
|
||||||
|
MODULES_API_URL + '/think/think-order-off-check/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询折扣审核列表
|
||||||
|
*/
|
||||||
|
export async function listThinkOrderOffCheck(params?: ThinkOrderOffCheckParam) {
|
||||||
|
const res = await request.get<ApiResult<ThinkOrderOffCheck[]>>(
|
||||||
|
MODULES_API_URL + '/think/think-order-off-check',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加折扣审核
|
||||||
|
*/
|
||||||
|
export async function addThinkOrderOffCheck(data: ThinkOrderOffCheck) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-order-off-check',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改折扣审核
|
||||||
|
*/
|
||||||
|
export async function updateThinkOrderOffCheck(data: ThinkOrderOffCheck) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-order-off-check',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除折扣审核
|
||||||
|
*/
|
||||||
|
export async function removeThinkOrderOffCheck(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-order-off-check/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除折扣审核
|
||||||
|
*/
|
||||||
|
export async function removeBatchThinkOrderOffCheck(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-order-off-check/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询折扣审核
|
||||||
|
*/
|
||||||
|
export async function getThinkOrderOffCheck(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ThinkOrderOffCheck>>(
|
||||||
|
MODULES_API_URL + '/think/think-order-off-check/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣审核
|
||||||
|
*/
|
||||||
|
export interface ThinkOrderOffCheck {
|
||||||
|
//
|
||||||
|
id?: number;
|
||||||
|
//
|
||||||
|
oid?: number;
|
||||||
|
//
|
||||||
|
userId?: number;
|
||||||
|
// 原价
|
||||||
|
originAmount?: string;
|
||||||
|
// 折扣
|
||||||
|
rate?: string;
|
||||||
|
// 折后价
|
||||||
|
offAmount?: string;
|
||||||
|
// 申请原因
|
||||||
|
reqReason?: string;
|
||||||
|
// 拒绝原因
|
||||||
|
refuseReason?: string;
|
||||||
|
// 审核人
|
||||||
|
checkUid?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 状态, 0已发布, 1待审核 2已驳回 3违规内容
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣审核搜索条件
|
||||||
|
*/
|
||||||
|
export interface ThinkOrderOffCheckParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -47,6 +47,7 @@ export interface ThinkSite {
|
|||||||
// 周末活动订场开关:1开,0关
|
// 周末活动订场开关:1开,0关
|
||||||
weekendOpen?: number;
|
weekendOpen?: number;
|
||||||
dailyMaxNum?: number;
|
dailyMaxNum?: number;
|
||||||
|
isOn?: number;
|
||||||
album?: string;
|
album?: string;
|
||||||
key?: number;
|
key?: number;
|
||||||
value?: number;
|
value?: number;
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { ThinkSmallRecharge, ThinkSmallRechargeParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
export async function pageThinkSmallRecharge(params: ThinkSmallRechargeParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ThinkSmallRecharge>>>(
|
||||||
|
MODULES_API_URL + '/think/think-small-recharge/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
export async function listThinkSmallRecharge(params?: ThinkSmallRechargeParam) {
|
||||||
|
const res = await request.get<ApiResult<ThinkSmallRecharge[]>>(
|
||||||
|
MODULES_API_URL + '/think/think-small-recharge',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
export async function addThinkSmallRecharge(data: ThinkSmallRecharge) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-small-recharge',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
export async function updateThinkSmallRecharge(data: ThinkSmallRecharge) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-small-recharge',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
export async function removeThinkSmallRecharge(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-small-recharge/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
export async function removeBatchThinkSmallRecharge(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-small-recharge/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*/
|
||||||
|
export async function getThinkSmallRecharge(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ThinkSmallRecharge>>(
|
||||||
|
MODULES_API_URL + '/think/think-small-recharge/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export interface ThinkSmallRecharge {
|
||||||
|
//
|
||||||
|
id?: number;
|
||||||
|
//
|
||||||
|
cid?: number;
|
||||||
|
//
|
||||||
|
vid?: number;
|
||||||
|
//
|
||||||
|
uid?: number;
|
||||||
|
//
|
||||||
|
amount?: string;
|
||||||
|
// 下单时间
|
||||||
|
createTime?: number;
|
||||||
|
//
|
||||||
|
updateTime?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索条件
|
||||||
|
*/
|
||||||
|
export interface ThinkSmallRechargeParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type {
|
||||||
|
ThinkTrainingInstitution,
|
||||||
|
ThinkTrainingInstitutionParam
|
||||||
|
} from './model';
|
||||||
|
import { THINK_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询培训机构
|
||||||
|
*/
|
||||||
|
export async function pageThinkTrainingInstitution(
|
||||||
|
params: ThinkTrainingInstitutionParam
|
||||||
|
) {
|
||||||
|
const res = await request.get<
|
||||||
|
ApiResult<PageResult<ThinkTrainingInstitution>>
|
||||||
|
>(THINK_API_URL + '/think/think-training-institution/page', {
|
||||||
|
params
|
||||||
|
});
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询培训机构列表
|
||||||
|
*/
|
||||||
|
export async function listThinkTrainingInstitution(
|
||||||
|
params?: ThinkTrainingInstitutionParam
|
||||||
|
) {
|
||||||
|
const res = await request.get<ApiResult<ThinkTrainingInstitution[]>>(
|
||||||
|
THINK_API_URL + '/think/think-training-institution',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加培训机构
|
||||||
|
*/
|
||||||
|
export async function addThinkTrainingInstitution(
|
||||||
|
data: ThinkTrainingInstitution
|
||||||
|
) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-training-institution',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改培训机构
|
||||||
|
*/
|
||||||
|
export async function updateThinkTrainingInstitution(
|
||||||
|
data: ThinkTrainingInstitution
|
||||||
|
) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-training-institution',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除培训机构
|
||||||
|
*/
|
||||||
|
export async function removeThinkTrainingInstitution(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-training-institution/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除培训机构
|
||||||
|
*/
|
||||||
|
export async function removeBatchThinkTrainingInstitution(
|
||||||
|
data: (number | undefined)[]
|
||||||
|
) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-training-institution/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询培训机构
|
||||||
|
*/
|
||||||
|
export async function getThinkTrainingInstitution(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ThinkTrainingInstitution>>(
|
||||||
|
THINK_API_URL + '/think/think-training-institution/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 培训机构
|
||||||
|
*/
|
||||||
|
export interface ThinkTrainingInstitution {
|
||||||
|
// 主键ID
|
||||||
|
id?: number;
|
||||||
|
// 机构名称
|
||||||
|
name?: string;
|
||||||
|
// 联系人
|
||||||
|
contactName?: string;
|
||||||
|
// 联系方式
|
||||||
|
contactPhone?: string;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 培训机构搜索条件
|
||||||
|
*/
|
||||||
|
export interface ThinkTrainingInstitutionParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { ThinkUserInAccess, ThinkUserInAccessParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询能刷脸开闸的用户列表
|
||||||
|
*/
|
||||||
|
export async function pageThinkUserInAccess(params: ThinkUserInAccessParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ThinkUserInAccess>>>(
|
||||||
|
MODULES_API_URL + '/think/think-user-in-access/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询能刷脸开闸的用户列表列表
|
||||||
|
*/
|
||||||
|
export async function listThinkUserInAccess(params?: ThinkUserInAccessParam) {
|
||||||
|
const res = await request.get<ApiResult<ThinkUserInAccess[]>>(
|
||||||
|
MODULES_API_URL + '/think/think-user-in-access',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加能刷脸开闸的用户列表
|
||||||
|
*/
|
||||||
|
export async function addThinkUserInAccess(data: ThinkUserInAccess) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-user-in-access',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改能刷脸开闸的用户列表
|
||||||
|
*/
|
||||||
|
export async function updateThinkUserInAccess(data: ThinkUserInAccess) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-user-in-access',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除能刷脸开闸的用户列表
|
||||||
|
*/
|
||||||
|
export async function removeThinkUserInAccess(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-user-in-access/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除能刷脸开闸的用户列表
|
||||||
|
*/
|
||||||
|
export async function removeBatchThinkUserInAccess(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/think/think-user-in-access/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询能刷脸开闸的用户列表
|
||||||
|
*/
|
||||||
|
export async function getThinkUserInAccess(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ThinkUserInAccess>>(
|
||||||
|
MODULES_API_URL + '/think/think-user-in-access/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 能刷脸开闸的用户列表
|
||||||
|
*/
|
||||||
|
export interface ThinkUserInAccess {
|
||||||
|
//
|
||||||
|
id?: number;
|
||||||
|
//
|
||||||
|
uid?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 能刷脸开闸的用户列表搜索条件
|
||||||
|
*/
|
||||||
|
export interface ThinkUserInAccessParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { ThinkUsersBlack, ThinkUsersBlackParam } from './model';
|
||||||
|
import { THINK_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户黑名单
|
||||||
|
*/
|
||||||
|
export async function pageThinkUsersBlack(params: ThinkUsersBlackParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ThinkUsersBlack>>>(
|
||||||
|
THINK_API_URL + '/think/think-users-black/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户黑名单列表
|
||||||
|
*/
|
||||||
|
export async function listThinkUsersBlack(params?: ThinkUsersBlackParam) {
|
||||||
|
const res = await request.get<ApiResult<ThinkUsersBlack[]>>(
|
||||||
|
THINK_API_URL + '/think/think-users-black',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户黑名单
|
||||||
|
*/
|
||||||
|
export async function addThinkUsersBlack(data: ThinkUsersBlack) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-users-black',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户黑名单
|
||||||
|
*/
|
||||||
|
export async function updateThinkUsersBlack(data: ThinkUsersBlack) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-users-black',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户黑名单
|
||||||
|
*/
|
||||||
|
export async function removeThinkUsersBlack(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-users-black/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户黑名单
|
||||||
|
*/
|
||||||
|
export async function removeBatchThinkUsersBlack(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-users-black/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询用户黑名单
|
||||||
|
*/
|
||||||
|
export async function getThinkUsersBlack(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ThinkUsersBlack>>(
|
||||||
|
THINK_API_URL + '/think/think-users-black/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户黑名单
|
||||||
|
*/
|
||||||
|
export interface ThinkUsersBlack {
|
||||||
|
// 主键ID
|
||||||
|
id?: number;
|
||||||
|
// 用户ID
|
||||||
|
uid?: number;
|
||||||
|
// 姓名
|
||||||
|
truename?: string;
|
||||||
|
// 手机号
|
||||||
|
phone?: string;
|
||||||
|
// 状态:1生效;2失效
|
||||||
|
status?: number;
|
||||||
|
// 失效时间
|
||||||
|
expireTime?: string;
|
||||||
|
// 添加时间
|
||||||
|
createTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户黑名单搜索条件
|
||||||
|
*/
|
||||||
|
export interface ThinkUsersBlackParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
uid?: number;
|
||||||
|
status?: number;
|
||||||
|
expireTime?: string;
|
||||||
|
}
|
||||||
@@ -63,6 +63,22 @@ export async function updateThinkUsersVip(data: ThinkUsersVip) {
|
|||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 修改会员卡剩余金额/剩余次数(仅更新这两个字段) */
|
||||||
|
export async function updateThinkUsersVipRemaining(data: {
|
||||||
|
id: number;
|
||||||
|
num?: number;
|
||||||
|
remainingMoney?: string;
|
||||||
|
}) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
THINK_API_URL + '/think/think-users-vip/remaining',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ export interface ThinkVip {
|
|||||||
cardType?: number;
|
cardType?: number;
|
||||||
// vip卡等级类型:1特殊vip卡,2普通vip卡
|
// vip卡等级类型:1特殊vip卡,2普通vip卡
|
||||||
vipType?: number;
|
vipType?: number;
|
||||||
|
// 培训机构ID
|
||||||
|
trainingInstitutionId?: number;
|
||||||
|
// 培训机构名称
|
||||||
|
trainingInstitutionName?: string;
|
||||||
// 特殊卡开发凭证图
|
// 特殊卡开发凭证图
|
||||||
pic?: string;
|
pic?: string;
|
||||||
// VIP充值卡价格组
|
// VIP充值卡价格组
|
||||||
@@ -60,6 +64,7 @@ export interface ThinkVip {
|
|||||||
export interface ThinkVipParam{
|
export interface ThinkVipParam{
|
||||||
id?: number;
|
id?: number;
|
||||||
isSale?: number;
|
isSale?: number;
|
||||||
|
trainingInstitutionId?: number;
|
||||||
createTimeStart?: number;
|
createTimeStart?: number;
|
||||||
createTimeEnd?: number;
|
createTimeEnd?: number;
|
||||||
timeStart?: number;
|
timeStart?: number;
|
||||||
|
|||||||
@@ -25,15 +25,21 @@ import { ref, watch } from "vue";
|
|||||||
import { ThinkOrderInfoParam } from "@/api/think/thinkOrderInfo/model";
|
import { ThinkOrderInfoParam } from "@/api/think/thinkOrderInfo/model";
|
||||||
import { messageLoading } from "ele-admin-pro";
|
import { messageLoading } from "ele-admin-pro";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { thinkOrderExportData } from "@/api/think/thinkOrder";
|
import {
|
||||||
|
exportThinkOrderTrainingBusiness,
|
||||||
|
thinkOrderExportData
|
||||||
|
} from "@/api/think/thinkOrder";
|
||||||
import { ThinkOrder, ThinkOrderParam } from "@/api/think/thinkOrder/model";
|
import { ThinkOrder, ThinkOrderParam } from "@/api/think/thinkOrder/model";
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
// 选中的角色
|
// 选中的角色
|
||||||
selection?: [];
|
selection?: [];
|
||||||
|
type?: number;
|
||||||
}>(),
|
}>(),
|
||||||
{}
|
{
|
||||||
|
type: 0
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -85,7 +91,16 @@ const reload = () => {
|
|||||||
// 导出
|
// 导出
|
||||||
const handleExport = async () => {
|
const handleExport = async () => {
|
||||||
const hide = messageLoading("导出中...", 0);
|
const hide = messageLoading("导出中...", 0);
|
||||||
const res = await thinkOrderExportData(where);
|
const [d1, d2] = dateRange.value ?? [];
|
||||||
|
const params = {
|
||||||
|
...where,
|
||||||
|
createTimeStart: d1 ? dayjs(d1).unix() : undefined,
|
||||||
|
createTimeEnd: d2 ? dayjs(d2).unix() : undefined
|
||||||
|
};
|
||||||
|
const res =
|
||||||
|
props.type === 2
|
||||||
|
? await exportThinkOrderTrainingBusiness(params)
|
||||||
|
: await thinkOrderExportData(params);
|
||||||
hide();
|
hide();
|
||||||
window.open(res.url);
|
window.open(res.url);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
<template>
|
||||||
|
<div class="training-report">
|
||||||
|
<div
|
||||||
|
v-for="section in sections"
|
||||||
|
:key="section.key || section.title"
|
||||||
|
class="report-section"
|
||||||
|
>
|
||||||
|
<table class="report-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="9" class="section-title">
|
||||||
|
{{ section.title }}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th rowspan="2" class="institution-col">培训机构名称</th>
|
||||||
|
<th colspan="2">开卡统计</th>
|
||||||
|
<th colspan="2">核销次数</th>
|
||||||
|
<th colspan="2">过期次数</th>
|
||||||
|
<th colspan="2">未核销次数</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>次数</th>
|
||||||
|
<th>收款金额</th>
|
||||||
|
<th>次数</th>
|
||||||
|
<th>核销金额</th>
|
||||||
|
<th>次数</th>
|
||||||
|
<th>过期金额</th>
|
||||||
|
<th>次数</th>
|
||||||
|
<th>剩余金额</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="row in section.rows || []" :key="row.trainingInstitutionName">
|
||||||
|
<td>{{ row.trainingInstitutionName || "-" }}</td>
|
||||||
|
<td>{{ formatCount(row.openCount) }}</td>
|
||||||
|
<td>{{ formatAmount(row.openAmount) }}</td>
|
||||||
|
<td>{{ formatCount(row.verifyCount) }}</td>
|
||||||
|
<td>{{ formatAmount(row.verifyAmount) }}</td>
|
||||||
|
<td>{{ formatCount(row.expiredCount) }}</td>
|
||||||
|
<td>{{ formatAmount(row.expiredAmount) }}</td>
|
||||||
|
<td>{{ formatCount(row.unverifiedCount) }}</td>
|
||||||
|
<td>{{ formatAmount(row.remainingAmount) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="total-row">
|
||||||
|
<td>合计</td>
|
||||||
|
<td>{{ formatCount(section.total?.openCount) }}</td>
|
||||||
|
<td>{{ formatAmount(section.total?.openAmount) }}</td>
|
||||||
|
<td>{{ formatCount(section.total?.verifyCount) }}</td>
|
||||||
|
<td>{{ formatAmount(section.total?.verifyAmount) }}</td>
|
||||||
|
<td>{{ formatCount(section.total?.expiredCount) }}</td>
|
||||||
|
<td>{{ formatAmount(section.total?.expiredAmount) }}</td>
|
||||||
|
<td>{{ formatCount(section.total?.unverifiedCount) }}</td>
|
||||||
|
<td>{{ formatAmount(section.total?.remainingAmount) }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { ThinkTrainingBusinessSection } from "@/api/think/thinkOrder/model";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
sections: ThinkTrainingBusinessSection[];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const formatCount = (value?: number | string) => {
|
||||||
|
if (value === undefined || value === null || value === "") {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
return String(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatAmount = (value?: number | string) => {
|
||||||
|
if (value === undefined || value === null || value === "") {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
return String(value);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.training-report {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-section {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 1200px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
table-layout: fixed;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table th,
|
||||||
|
.report-table td {
|
||||||
|
padding: 12px 10px;
|
||||||
|
border: 1px solid #1f1f1f;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.45;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table th {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 1.4;
|
||||||
|
padding: 16px 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-col {
|
||||||
|
width: 240px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-row td {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,91 +3,118 @@
|
|||||||
<div class="ele-body">
|
<div class="ele-body">
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
<a-space style="margin-bottom: 1rem">
|
<a-space style="margin-bottom: 1rem">
|
||||||
<a-button @click="changeType(0)" :type="type === 0 ? 'primary' : ''">收款汇总表</a-button>
|
<a-button @click="changeType(0)" :type="type === 0 ? 'primary' : ''">
|
||||||
<a-button @click="changeType(1)" :type="type === 1 ? 'primary' : ''">收入日报表及汇总表</a-button>
|
收款汇总表
|
||||||
|
</a-button>
|
||||||
|
<a-button @click="changeType(1)" :type="type === 1 ? 'primary' : ''">
|
||||||
|
收入日报表及汇总表
|
||||||
|
</a-button>
|
||||||
|
<a-button @click="changeType(2)" :type="type === 2 ? 'primary' : ''">
|
||||||
|
培训业务报表
|
||||||
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
<a-spin :spinning="loading">
|
<a-spin :spinning="loading">
|
||||||
<search
|
<search @search="searchData" @reload="reload" :type="type" />
|
||||||
@search="searchData"
|
<a-table
|
||||||
@reload="reload"
|
v-if="type === 0"
|
||||||
/>
|
|
||||||
<a-table v-if="type === 0"
|
|
||||||
:scroll="{ y: tableHeight }"
|
:scroll="{ y: tableHeight }"
|
||||||
:data-source="list"
|
:data-source="incomeList"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
/>
|
/>
|
||||||
<a-table v-else
|
<a-table
|
||||||
|
v-else-if="type === 1"
|
||||||
:scroll="{ y: tableHeight }"
|
:scroll="{ y: tableHeight }"
|
||||||
:data-source="list"
|
:data-source="cardList"
|
||||||
:columns="columns1"
|
:columns="columns1"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
/>
|
/>
|
||||||
|
<training-business-report v-else :sections="trainingSections" />
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
<OrderList v-model:visible="showList" v-if="showList" :pay-type="payTypeList" :sid="sid"
|
<OrderList
|
||||||
:showType="showType" :showCardType="showCardType" :type="type" :isPayTime="type === 0"
|
v-model:visible="showList"
|
||||||
:create-time-start="createTimeStart" :wechat-order="wechatOrder"
|
v-if="showList"
|
||||||
:create-time-end="createTimeEnd" />
|
:pay-type="payTypeList"
|
||||||
|
:sid="sid"
|
||||||
|
:showType="showType"
|
||||||
|
:showCardType="showCardType"
|
||||||
|
:type="type"
|
||||||
|
:isPayTime="type === 0"
|
||||||
|
:create-time-start="createTimeStart"
|
||||||
|
:wechat-order="wechatOrder"
|
||||||
|
:create-time-end="createTimeEnd"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type {
|
import type { ColumnItem } from "ele-admin-pro/es/ele-pro-table/types";
|
||||||
ColumnItem
|
|
||||||
} from "ele-admin-pro/es/ele-pro-table/types";
|
|
||||||
import Search from "./components/search.vue";
|
import Search from "./components/search.vue";
|
||||||
|
import TrainingBusinessReport from "./components/trainingBusinessReport.vue";
|
||||||
import {
|
import {
|
||||||
getThinkOrderExcelData, getThinkOrderExcelDataForCard
|
getThinkOrderExcelData,
|
||||||
|
getThinkOrderExcelDataForCard,
|
||||||
|
getThinkOrderTrainingBusinessData
|
||||||
} from "@/api/think/thinkOrder";
|
} from "@/api/think/thinkOrder";
|
||||||
import type {
|
import type {
|
||||||
ThinkOrderParam
|
ThinkOrderParam,
|
||||||
|
ThinkTrainingBusinessSection
|
||||||
} from "@/api/think/thinkOrder/model";
|
} from "@/api/think/thinkOrder/model";
|
||||||
import OrderList from "./components/OrderList.vue";
|
import OrderList from "./components/OrderList.vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const showType = ref(false);
|
const showType = ref(false);
|
||||||
const showCardType = ref(false);
|
const showCardType = ref(false);
|
||||||
|
|
||||||
const type = ref<number>(0);
|
const type = ref<number>(0);
|
||||||
const changeType = (val) => {
|
|
||||||
type.value = val;
|
|
||||||
getList();
|
|
||||||
};
|
|
||||||
|
|
||||||
const tableHeight = document.body.clientHeight - 330;
|
const tableHeight = document.body.clientHeight - 330;
|
||||||
console.log(tableHeight);
|
|
||||||
|
|
||||||
const createTimeStart = ref();
|
const createTimeStart = ref();
|
||||||
const createTimeEnd = ref();
|
const createTimeEnd = ref();
|
||||||
const list = ref<any[]>([]);
|
const incomeList = ref<any[]>([]);
|
||||||
|
const cardList = ref<any[]>([]);
|
||||||
|
const trainingSections = ref<ThinkTrainingBusinessSection[]>([]);
|
||||||
|
|
||||||
|
const sid = ref<number>(0);
|
||||||
|
const wechatOrder = ref<string>("");
|
||||||
|
const payTypeList = ref<number[]>([]);
|
||||||
|
const showList = ref(false);
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
list.value = [];
|
incomeList.value = [];
|
||||||
|
cardList.value = [];
|
||||||
|
trainingSections.value = [];
|
||||||
|
const params = {
|
||||||
|
createTimeStart: createTimeStart.value
|
||||||
|
? dayjs(createTimeStart.value).unix()
|
||||||
|
: undefined,
|
||||||
|
createTimeEnd: createTimeEnd.value
|
||||||
|
? dayjs(createTimeEnd.value).unix()
|
||||||
|
: undefined
|
||||||
|
};
|
||||||
if (type.value === 0) {
|
if (type.value === 0) {
|
||||||
list.value = await getThinkOrderExcelData({
|
incomeList.value = await getThinkOrderExcelData(params);
|
||||||
createTimeStart: createTimeStart.value ? dayjs(createTimeStart.value).unix() : undefined,
|
} else if (type.value === 1) {
|
||||||
createTimeEnd: createTimeEnd.value ? dayjs(createTimeEnd.value).unix() : undefined
|
cardList.value = await getThinkOrderExcelDataForCard(params);
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
list.value = await getThinkOrderExcelDataForCard({
|
trainingSections.value = await getThinkOrderTrainingBusinessData(params);
|
||||||
createTimeStart: createTimeStart.value ? dayjs(createTimeStart.value).unix() : undefined,
|
|
||||||
createTimeEnd: createTimeEnd.value ? dayjs(createTimeEnd.value).unix() : undefined
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const changeType = (val: number) => {
|
||||||
|
type.value = val;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
createTimeStart.value = dayjs().format("YYYY-MM-DD");
|
createTimeStart.value = dayjs().format("YYYY-MM-DD");
|
||||||
createTimeEnd.value = dayjs().format("YYYY-MM-DD 23:59:59");
|
createTimeEnd.value = dayjs().format("YYYY-MM-DD 23:59:59");
|
||||||
getList();
|
getList();
|
||||||
|
|
||||||
const sid = ref<number>(0);
|
|
||||||
const wechatOrder = ref<string>("");
|
|
||||||
const columns1 = ref<ColumnItem[]>([
|
const columns1 = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: "场馆名称",
|
title: "场馆名称",
|
||||||
@@ -166,7 +193,6 @@ const columns1 = ref<ColumnItem[]>([
|
|||||||
customCell: (row) => {
|
customCell: (row) => {
|
||||||
return {
|
return {
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
console.log(row);
|
|
||||||
sid.value = row.sid;
|
sid.value = row.sid;
|
||||||
wechatOrder.value = "";
|
wechatOrder.value = "";
|
||||||
payTypeList.value = [2, 3, 12, 15];
|
payTypeList.value = [2, 3, 12, 15];
|
||||||
@@ -185,7 +211,6 @@ const columns1 = ref<ColumnItem[]>([
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: "场馆名称",
|
title: "场馆名称",
|
||||||
@@ -307,11 +332,9 @@ const columns = ref<ColumnItem[]>([
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const searchData = (param: ThinkOrderParam) => {
|
const searchData = (param: ThinkOrderParam) => {
|
||||||
createTimeStart.value = param.createTimeStart;
|
createTimeStart.value = param.createTimeStart;
|
||||||
createTimeEnd.value = param.createTimeEnd;
|
createTimeEnd.value = param.createTimeEnd;
|
||||||
console.log(createTimeEnd.value);
|
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -320,11 +343,6 @@ const reload = () => {
|
|||||||
createTimeEnd.value = dayjs().format("YYYY-MM-DD");
|
createTimeEnd.value = dayjs().format("YYYY-MM-DD");
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
const payTypeList = ref<number[]>([]);
|
|
||||||
const showList = ref(false);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -335,6 +353,7 @@ export default {
|
|||||||
components: MenuIcons
|
components: MenuIcons
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.tag-icon {
|
.tag-icon {
|
||||||
padding-right: 6px;
|
padding-right: 6px;
|
||||||
|
|||||||
@@ -0,0 +1,218 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑' : '添加'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="" name="amount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.amount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="orderNo">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.orderNo"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="isPaid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.isPaid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="paidNumber">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.paidNumber"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="userId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.userId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="修改时间" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入修改时间"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="remark">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.remark"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addBalanceChargeLog, updateBalanceChargeLog } from '@/api/shop/balanceChargeLog';
|
||||||
|
import { BalanceChargeLog } from '@/api/shop/balanceChargeLog/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: BalanceChargeLog | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<BalanceChargeLog>({
|
||||||
|
id: undefined,
|
||||||
|
amount: undefined,
|
||||||
|
orderNo: undefined,
|
||||||
|
isPaid: undefined,
|
||||||
|
paidNumber: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
balanceChargeLogId: undefined,
|
||||||
|
balanceChargeLogName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
balanceChargeLogName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateBalanceChargeLog : addBalanceChargeLog;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-input-search
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
v-model:value="where.phone"
|
||||||
|
@pressEnter="reload"
|
||||||
|
@search="reload"
|
||||||
|
/>
|
||||||
|
<a-input-search
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入订单号"
|
||||||
|
v-model:value="where.orderNo"
|
||||||
|
@pressEnter="reload"
|
||||||
|
@search="reload"
|
||||||
|
/>
|
||||||
|
<a-select
|
||||||
|
allow-clear
|
||||||
|
placeholder="请选择状态"
|
||||||
|
v-model:value="where.isPaid"
|
||||||
|
style="width: 140px"
|
||||||
|
@change="reload"
|
||||||
|
>
|
||||||
|
<a-select-option :value="0">未支付</a-select-option>
|
||||||
|
<a-select-option :value="1">已支付</a-select-option>
|
||||||
|
<a-select-option :value="2">已退款</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
<a-button @click="reset">重置</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import useSearch from '@/utils/use-search';
|
||||||
|
import type { BalanceChargeLogParam } from '@/api/shop/balanceChargeLog/model';
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: BalanceChargeLogParam): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const { where, resetFields } = useSearch<BalanceChargeLogParam>({
|
||||||
|
phone: undefined,
|
||||||
|
orderNo: undefined,
|
||||||
|
isPaid: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const reload = () => {
|
||||||
|
emit('search', where);
|
||||||
|
};
|
||||||
|
|
||||||
|
const reset = () => {
|
||||||
|
resetFields();
|
||||||
|
reload();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="id"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search @search="reload" />
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'isPaid'">
|
||||||
|
<a-tag v-if="record.isPaid === 0">未支付</a-tag>
|
||||||
|
<a-tag v-if="record.isPaid === 1" color="green">已支付</a-tag>
|
||||||
|
<a-tag v-if="record.isPaid === 2" color="red">已退款</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a-popconfirm
|
||||||
|
v-if="record.isPaid === 1"
|
||||||
|
title="确定要退款吗?"
|
||||||
|
@confirm="refund(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">退款</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import {
|
||||||
|
pageBalanceChargeLog,
|
||||||
|
refundBalanceChargeLog
|
||||||
|
} from '@/api/shop/balanceChargeLog';
|
||||||
|
import type {
|
||||||
|
BalanceChargeLog,
|
||||||
|
BalanceChargeLogParam
|
||||||
|
} from '@/api/shop/balanceChargeLog/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<BalanceChargeLog[]>([]);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageBalanceChargeLog({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 90,
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '金额',
|
||||||
|
dataIndex: 'amount',
|
||||||
|
key: 'amount',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '手机号',
|
||||||
|
dataIndex: 'phone',
|
||||||
|
key: 'phone',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '订单号',
|
||||||
|
dataIndex: 'orderNo',
|
||||||
|
key: 'orderNo',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否已支付',
|
||||||
|
dataIndex: 'isPaid',
|
||||||
|
key: 'isPaid',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: BalanceChargeLogParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 退款 */
|
||||||
|
const refund = (row: BalanceChargeLog) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
refundBalanceChargeLog(row)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: BalanceChargeLog) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'BalanceChargeLog'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<!-- <a-button type="primary" class="ele-btn-icon" @click="add">-->
|
||||||
|
<!-- <template #icon>-->
|
||||||
|
<!-- <PlusOutlined />-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- <span>添加</span>-->
|
||||||
|
<!-- </a-button>-->
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑用户余额变动明细表' : '添加用户余额变动明细表'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="用户ID" name="userId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入用户ID"
|
||||||
|
v-model:value="form.userId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="余额变动场景(0 用户充值 1用户消费 2管理员操作 3订单退款)" name="scene">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入余额变动场景(0 用户充值 1用户消费 2管理员操作 3订单退款)"
|
||||||
|
v-model:value="form.scene"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="变动金额" name="money">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入变动金额"
|
||||||
|
v-model:value="form.money"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="变动后余额" name="balance">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入变动后余额"
|
||||||
|
v-model:value="form.balance"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="管理员备注" name="remark">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入管理员备注"
|
||||||
|
v-model:value="form.remark"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="orderId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.orderId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="操作人ID" name="adminId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入操作人ID"
|
||||||
|
v-model:value="form.adminId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
||||||
|
<a-input-number
|
||||||
|
:min="0"
|
||||||
|
:max="9999"
|
||||||
|
class="ele-fluid"
|
||||||
|
placeholder="请输入排序号"
|
||||||
|
v-model:value="form.sortNumber"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="备注" name="comments">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
v-model:value="form.comments"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="状态, 0正常, 1冻结" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="0">显示</a-radio>
|
||||||
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入是否删除, 0否, 1是"
|
||||||
|
v-model:value="form.deleted"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="修改时间" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入修改时间"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addUserBalanceLog, updateUserBalanceLog } from '@/api/shop/userBalanceLog';
|
||||||
|
import { UserBalanceLog } from '@/api/shop/userBalanceLog/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: UserBalanceLog | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<UserBalanceLog>({
|
||||||
|
logId: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
scene: undefined,
|
||||||
|
money: undefined,
|
||||||
|
balance: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
orderId: undefined,
|
||||||
|
adminId: undefined,
|
||||||
|
sortNumber: undefined,
|
||||||
|
comments: undefined,
|
||||||
|
status: undefined,
|
||||||
|
deleted: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
userBalanceLogId: undefined,
|
||||||
|
userBalanceLogName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
userBalanceLogName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写用户余额变动明细表名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateUserBalanceLog : addUserBalanceLog;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="userBalanceLogId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<UserBalanceLogEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import UserBalanceLogEdit from './components/userBalanceLogEdit.vue';
|
||||||
|
import { pageUserBalanceLog, removeUserBalanceLog, removeBatchUserBalanceLog } from '@/api/shop/userBalanceLog';
|
||||||
|
import type { UserBalanceLog, UserBalanceLogParam } from '@/api/shop/userBalanceLog/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<UserBalanceLog[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<UserBalanceLog | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageUserBalanceLog({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'logId',
|
||||||
|
key: 'logId',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户ID',
|
||||||
|
dataIndex: 'userId',
|
||||||
|
key: 'userId',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '余额变动场景',
|
||||||
|
dataIndex: 'scene',
|
||||||
|
key: 'scene',
|
||||||
|
align: 'center',
|
||||||
|
customRender: ({ text }) => ['用户充值', '用户消费', '管理员操作', '订单退款'][text]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '变动金额',
|
||||||
|
dataIndex: 'money',
|
||||||
|
key: 'money',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '变动后余额',
|
||||||
|
dataIndex: 'balance',
|
||||||
|
key: 'balance',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
dataIndex: 'remark',
|
||||||
|
key: 'remark',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: UserBalanceLogParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: UserBalanceLog) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: UserBalanceLog) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeUserBalanceLog(row.logId)
|
||||||
|
.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);
|
||||||
|
removeBatchUserBalanceLog(selection.value.map((d) => d.logId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: UserBalanceLog) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'UserBalanceLog'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -82,12 +82,12 @@
|
|||||||
v-model:value="form.email"
|
v-model:value="form.email"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="备注信息" name="info">
|
<a-form-item label="备注信息" name="remark">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
:rows="4"
|
:rows="4"
|
||||||
:maxlength="200"
|
:maxlength="200"
|
||||||
placeholder="请输入备注信息"
|
placeholder="请输入备注信息"
|
||||||
v-model:value="form.info"
|
v-model:value="form.remark"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="发票类型" name="type">
|
<a-form-item label="发票类型" name="type">
|
||||||
@@ -97,14 +97,14 @@
|
|||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="发票类型" name="itype">
|
<a-form-item label="发票类型" name="itype">
|
||||||
<a-radio-group v-model:value="form.itype" :disabled="true">
|
<a-radio-group v-model:value="form.itype">
|
||||||
<a-radio :value="1">场地发票</a-radio>
|
<a-radio :value="1">场地发票</a-radio>
|
||||||
<a-radio :value="2">vip卡发票</a-radio>
|
<a-radio :value="2">vip卡发票</a-radio>
|
||||||
<a-radio :value="3">IC卡发票</a-radio>
|
<a-radio :value="3">IC卡发票</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="发票类型" name="invoicetype">
|
<a-form-item label="发票类型" name="invoicetype">
|
||||||
<a-radio-group v-model:value="form.invoicetype" :disabled="true">
|
<a-radio-group v-model:value="form.invoicetype">
|
||||||
<a-radio :value="1">普票</a-radio>
|
<a-radio :value="1">普票</a-radio>
|
||||||
<a-radio :value="2">专票</a-radio>
|
<a-radio :value="2">专票</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
@@ -118,10 +118,8 @@
|
|||||||
import { Form, message } from 'ant-design-vue';
|
import { Form, message } from 'ant-design-vue';
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
import {
|
import {
|
||||||
addThinkInvoice,
|
|
||||||
doInvoice,
|
doInvoice,
|
||||||
pageThinkInvoice,
|
pageThinkInvoice,
|
||||||
updateThinkInvoice
|
|
||||||
} from '@/api/think/thinkInvoice';
|
} from '@/api/think/thinkInvoice';
|
||||||
import { ThinkInvoice } from '@/api/think/thinkInvoice/model';
|
import { ThinkInvoice } from '@/api/think/thinkInvoice/model';
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
@@ -191,7 +189,6 @@
|
|||||||
price: [
|
price: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
type: 'number',
|
|
||||||
message: '请填写发票金额',
|
message: '请填写发票金额',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
@@ -214,10 +211,6 @@
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const onChangeInvoice = (data: ThinkInvoice) => {
|
|
||||||
console.log(data);
|
|
||||||
console.log(form);
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
@@ -255,14 +248,17 @@
|
|||||||
() => props.visible,
|
() => props.visible,
|
||||||
(visible) => {
|
(visible) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
const random = uuid();
|
||||||
|
const random1 = uuid();
|
||||||
// 第一次开票
|
// 第一次开票
|
||||||
isUpdate.value = false;
|
isUpdate.value = false;
|
||||||
form.oid = props.data?.id;
|
form.oid = props.data?.id;
|
||||||
form.price = props.data?.price;
|
form.price = props.data?.price;
|
||||||
form.incoiveNum = props.data?.code;
|
form.incoiveNum = random1;
|
||||||
form.orderNum = props.data?.code;
|
form.orderNum = random;
|
||||||
form.vid = props.data?.vid;
|
form.vid = props.data?.vid;
|
||||||
form.phone = props.data?.phone;
|
form.phone = props.data?.phone;
|
||||||
|
form.uid = props.data?.uid;
|
||||||
form.itype = 3;
|
form.itype = 3;
|
||||||
|
|
||||||
// 开过票
|
// 开过票
|
||||||
@@ -272,7 +268,7 @@
|
|||||||
isUpdate.value = true;
|
isUpdate.value = true;
|
||||||
form.oid = props.data?.id;
|
form.oid = props.data?.id;
|
||||||
form.price = props.data?.price;
|
form.price = props.data?.price;
|
||||||
form.incoiveNum = props.data?.code;
|
form.incoiveNum = random1;
|
||||||
form.vid = props.data?.vid;
|
form.vid = props.data?.vid;
|
||||||
form.phone = props.data?.phone;
|
form.phone = props.data?.phone;
|
||||||
}
|
}
|
||||||
|
|||||||
+369
-248
@@ -7,7 +7,6 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:customRow="customRow"
|
|
||||||
:selection="selection"
|
:selection="selection"
|
||||||
:scroll="{ x: 3800 }"
|
:scroll="{ x: 3800 }"
|
||||||
tool-class="ele-toolbar-form"
|
tool-class="ele-toolbar-form"
|
||||||
@@ -46,11 +45,13 @@
|
|||||||
<a class="ele-text-danger">注销</a>
|
<a class="ele-text-danger">注销</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a @click="onInvoice(record)" v-if="record.isInvoice === 2">开票</a>
|
<a @click="onInvoice(record)" v-if="record.isInvoice === 2"
|
||||||
|
>开票</a
|
||||||
|
>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'sid'">
|
<template v-if="column.key === 'sid'">
|
||||||
<span>{{ record.siteList.map(item => item.name).join() }}</span>
|
<span>{{ record.siteList.map((item) => item.name).join() }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'type'">
|
<template v-if="column.key === 'type'">
|
||||||
<a-tag>{{ types[record.type] }}</a-tag>
|
<a-tag>{{ types[record.type] }}</a-tag>
|
||||||
@@ -66,7 +67,61 @@
|
|||||||
<a-tag v-if="record.status === 2" color="red">未付款</a-tag>
|
<a-tag v-if="record.status === 2" color="red">未付款</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'expireTime'">
|
<template v-if="column.key === 'expireTime'">
|
||||||
{{ toDateString(record.expireTime) }}
|
<a-date-picker
|
||||||
|
show-time
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
:value="formatExpireTime(record.expireTime)"
|
||||||
|
:disabled="expireTimeLoading[record.id || 0]"
|
||||||
|
style="width: 180px"
|
||||||
|
placeholder="请选择到期时间"
|
||||||
|
:allow-clear="false"
|
||||||
|
@change="(value) => changeExpireTime(value, record)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'num'">
|
||||||
|
<a-space>
|
||||||
|
<template v-if="isRemainingEditing(record, 'num')">
|
||||||
|
<a-input
|
||||||
|
type="number"
|
||||||
|
:value="getRemainingDraft(record, 'num')"
|
||||||
|
:disabled="isRemainingLoading(record.id, 'num')"
|
||||||
|
style="width: 90px"
|
||||||
|
@update:value="(value) => setRemainingDraft(record, 'num', value)"
|
||||||
|
/>
|
||||||
|
<a-button type="link" size="small" :loading="isRemainingLoading(record.id, 'num')" @click="saveRemaining(record, 'num')">确认</a-button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>{{ record.num ?? '-' }}</span>
|
||||||
|
<a-button
|
||||||
|
v-if="hasPermission('think:thinkCard:changeRemain')"
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
@click="editRemaining(record, 'num')"
|
||||||
|
>修改</a-button>
|
||||||
|
</template>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'remainingMoney'">
|
||||||
|
<a-space>
|
||||||
|
<template v-if="isRemainingEditing(record, 'remainingMoney')">
|
||||||
|
<a-input
|
||||||
|
:value="getRemainingDraft(record, 'remainingMoney')"
|
||||||
|
:disabled="isRemainingLoading(record.id, 'remainingMoney')"
|
||||||
|
style="width: 100px"
|
||||||
|
@update:value="(value) => setRemainingDraft(record, 'remainingMoney', value)"
|
||||||
|
/>
|
||||||
|
<a-button type="link" size="small" :loading="isRemainingLoading(record.id, 'remainingMoney')" @click="saveRemaining(record, 'remainingMoney')">确认</a-button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>{{ record.remainingMoney ?? '-' }}</span>
|
||||||
|
<a-button
|
||||||
|
v-if="hasPermission('think:thinkCard:changeRemain')"
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
@click="editRemaining(record, 'remainingMoney')"
|
||||||
|
>修改</a-button>
|
||||||
|
</template>
|
||||||
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'isInvoice'">
|
<template v-if="column.key === 'isInvoice'">
|
||||||
<a-tag v-if="record.isInvoice === 1" color="green">已开票</a-tag>
|
<a-tag v-if="record.isInvoice === 1" color="green">已开票</a-tag>
|
||||||
@@ -102,63 +157,66 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { createVNode, ref } from "vue";
|
import { createVNode, reactive, ref } from 'vue';
|
||||||
import { message, Modal } from "ant-design-vue";
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import type { EleProTable } from "ele-admin-pro";
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import { toDateString } from "ele-admin-pro";
|
import { toDateString } from 'ele-admin-pro';
|
||||||
import type {
|
import dayjs from 'dayjs';
|
||||||
|
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 ThinkCardEdit from "./components/thinkCardEdit.vue";
|
import ThinkCardEdit from './components/thinkCardEdit.vue';
|
||||||
import {
|
import {
|
||||||
pageThinkCard,
|
pageThinkCard,
|
||||||
removeThinkCard,
|
removeThinkCard,
|
||||||
removeBatchThinkCard,
|
removeBatchThinkCard,
|
||||||
updateThinkCard
|
updateThinkCard,
|
||||||
} from "@/api/think/thinkCard";
|
updateThinkCardRemaining
|
||||||
import type { ThinkCard, ThinkCardParam } from "@/api/think/thinkCard/model";
|
} from '@/api/think/thinkCard';
|
||||||
import MakeICCard from "@/views/think/thinkCard/components/makeICCard.vue";
|
import type { ThinkCard, ThinkCardParam } from '@/api/think/thinkCard/model';
|
||||||
import ThinkCardLog from "./components/thinkCardLog.vue";
|
import MakeICCard from '@/views/think/thinkCard/components/makeICCard.vue';
|
||||||
import Invoice from "./components/invoice.vue";
|
import ThinkCardLog from './components/thinkCardLog.vue';
|
||||||
|
import Invoice from './components/invoice.vue';
|
||||||
|
import { hasPermission } from '@/utils/permission';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const selection = ref<ThinkCard[]>([]);
|
const selection = ref<ThinkCard[]>([]);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<ThinkCard | null>(null);
|
const current = ref<ThinkCard | null>(null);
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
// 是否显示批量移动弹窗
|
// 是否显示批量移动弹窗
|
||||||
const showMove = ref(false);
|
const showMove = ref(false);
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const types = ref<string[]>([
|
const types = ref<string[]>([
|
||||||
"",
|
'',
|
||||||
"年卡",
|
'年卡',
|
||||||
"次卡",
|
'次卡',
|
||||||
"月卡",
|
'月卡',
|
||||||
"会员IC卡",
|
'会员IC卡',
|
||||||
"充值卡"
|
'充值卡'
|
||||||
]);
|
]);
|
||||||
const payTypes = ref<string[]>([
|
const payTypes = ref<string[]>([
|
||||||
"",
|
'',
|
||||||
"微信支付",
|
'微信支付',
|
||||||
"支付宝支付",
|
'支付宝支付',
|
||||||
"现金",
|
'现金',
|
||||||
"POS机刷卡",
|
'POS机刷卡',
|
||||||
"平安健康卡",
|
'平安健康卡',
|
||||||
"免费",
|
'免费',
|
||||||
"抖音支付",
|
'抖音支付'
|
||||||
]);
|
]);
|
||||||
const isIntegral = ref<string[]>(["", "赠送", "不赠送"]);
|
const isIntegral = ref<string[]>(['', '赠送', '不赠送']);
|
||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({
|
const datasource: DatasourceFunction = ({
|
||||||
page,
|
page,
|
||||||
limit,
|
limit,
|
||||||
where,
|
where,
|
||||||
@@ -174,235 +232,311 @@ const datasource: DatasourceFunction = ({
|
|||||||
page,
|
page,
|
||||||
limit
|
limit
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: '操作',
|
||||||
dataIndex: "username",
|
dataIndex: 'username',
|
||||||
key: "username",
|
key: 'username',
|
||||||
align: "center",
|
align: 'center',
|
||||||
fixed: "left",
|
fixed: 'left',
|
||||||
width: 400
|
width: 400
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "卡号",
|
title: '卡号',
|
||||||
dataIndex: "code",
|
dataIndex: 'code',
|
||||||
key: "code",
|
key: 'code',
|
||||||
align: "center",
|
align: 'center',
|
||||||
fixed: "left",
|
fixed: 'left',
|
||||||
width: 140
|
width: 140
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "手机号",
|
title: '手机号',
|
||||||
dataIndex: "phone",
|
dataIndex: 'phone',
|
||||||
key: "phone",
|
key: 'phone',
|
||||||
align: "center",
|
align: 'center',
|
||||||
fixed: "left",
|
fixed: 'left',
|
||||||
width: 140
|
width: 140
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "会员卡名称",
|
title: '会员卡名称',
|
||||||
dataIndex: "name",
|
dataIndex: 'name',
|
||||||
key: "name",
|
key: 'name',
|
||||||
align: "center",
|
align: 'center',
|
||||||
width: 140,
|
width: 140,
|
||||||
fixed: "left"
|
fixed: 'left'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "IC卡数字",
|
title: 'IC卡数字',
|
||||||
dataIndex: "cardNum",
|
dataIndex: 'cardNum',
|
||||||
key: "cardNum",
|
key: 'cardNum',
|
||||||
width: 140,
|
width: 140,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "紧急联系人",
|
title: '可用场馆',
|
||||||
dataIndex: "urgentName",
|
dataIndex: 'sid',
|
||||||
key: "urgentName",
|
key: 'sid',
|
||||||
width: 140,
|
width: 140,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "紧急联系人号码",
|
title: 'vip购卡价格',
|
||||||
dataIndex: "urgentPhone",
|
dataIndex: 'price',
|
||||||
key: "urgentPhone",
|
key: 'price',
|
||||||
width: 140,
|
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "可用场馆",
|
|
||||||
dataIndex: "sid",
|
|
||||||
key: "sid",
|
|
||||||
width: 140,
|
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "vip购卡价格",
|
|
||||||
dataIndex: "price",
|
|
||||||
key: "price",
|
|
||||||
width: 140,
|
width: 140,
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "vip卡折扣率",
|
title: 'vip卡折扣率',
|
||||||
dataIndex: "discount",
|
dataIndex: 'discount',
|
||||||
key: "discount",
|
key: 'discount',
|
||||||
width: 140,
|
width: 140,
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "使用次数",
|
title: '使用次数',
|
||||||
dataIndex: "count",
|
dataIndex: 'count',
|
||||||
key: "count",
|
key: 'count',
|
||||||
width: 140,
|
width: 140,
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "剩余次数",
|
title: '剩余次数',
|
||||||
dataIndex: "num",
|
dataIndex: 'num',
|
||||||
key: "num",
|
key: 'num',
|
||||||
width: 140,
|
width: 140,
|
||||||
sorter: true,
|
align: 'center'
|
||||||
align: "center"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "每使用一次减少的金额",
|
title: '剩余金额',
|
||||||
dataIndex: "eachMoney",
|
dataIndex: 'remainingMoney',
|
||||||
key: "eachMoney",
|
key: 'remainingMoney',
|
||||||
width: 140,
|
width: 140,
|
||||||
sorter: true,
|
align: 'center'
|
||||||
align: "center"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "剩余金额",
|
title: 'IC卡类型',
|
||||||
dataIndex: "remainingMoney",
|
dataIndex: 'type',
|
||||||
key: "remainingMoney",
|
key: 'type',
|
||||||
width: 140,
|
width: 140,
|
||||||
sorter: true,
|
align: 'center'
|
||||||
align: "center"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "月限",
|
title: '支付状态',
|
||||||
dataIndex: "month",
|
dataIndex: 'status',
|
||||||
key: "month",
|
key: 'status',
|
||||||
width: 140,
|
width: 140,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "年限",
|
title: '付款方式',
|
||||||
dataIndex: "term",
|
dataIndex: 'payType',
|
||||||
key: "term",
|
key: 'payType',
|
||||||
width: 140,
|
width: 140,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "IC卡类型",
|
title: '购卡时间',
|
||||||
dataIndex: "type",
|
dataIndex: 'createTime',
|
||||||
key: "type",
|
key: 'createTime',
|
||||||
width: 140,
|
align: 'center',
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "到期时间",
|
|
||||||
dataIndex: "expireTime",
|
|
||||||
key: "expireTime",
|
|
||||||
width: 140,
|
|
||||||
sorter: true,
|
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "支付状态",
|
|
||||||
dataIndex: "status",
|
|
||||||
key: "status",
|
|
||||||
width: 140,
|
|
||||||
sorter: true,
|
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "付款方式",
|
|
||||||
dataIndex: "payType",
|
|
||||||
key: "payType",
|
|
||||||
width: 140,
|
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "是否赠送积分",
|
|
||||||
dataIndex: "isIntegral",
|
|
||||||
key: "isIntegral",
|
|
||||||
width: 140,
|
|
||||||
sorter: true,
|
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "是否已开具发票",
|
|
||||||
dataIndex: "isInvoice",
|
|
||||||
key: "isInvoice",
|
|
||||||
width: 140,
|
|
||||||
sorter: true,
|
|
||||||
align: "center"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "购卡时间",
|
|
||||||
dataIndex: "createTime",
|
|
||||||
key: "createTime",
|
|
||||||
align: "center",
|
|
||||||
sorter: true,
|
sorter: true,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
width: 180,
|
width: 220,
|
||||||
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||||
}
|
},
|
||||||
]);
|
{
|
||||||
|
title: '到期时间',
|
||||||
|
dataIndex: 'expireTime',
|
||||||
|
key: 'expireTime',
|
||||||
|
width: 280,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
|
||||||
/* 搜索 */
|
{
|
||||||
const reload = (where?: ThinkCardParam) => {
|
title: '每使用一次减少的金额',
|
||||||
|
dataIndex: 'eachMoney',
|
||||||
|
key: 'eachMoney',
|
||||||
|
width: 140,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '年限',
|
||||||
|
dataIndex: 'term',
|
||||||
|
key: 'term',
|
||||||
|
width: 140,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '月限',
|
||||||
|
dataIndex: 'month',
|
||||||
|
key: 'month',
|
||||||
|
width: 140,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '紧急联系人',
|
||||||
|
dataIndex: 'urgentName',
|
||||||
|
key: 'urgentName',
|
||||||
|
width: 140,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '紧急联系人号码',
|
||||||
|
dataIndex: 'urgentPhone',
|
||||||
|
key: 'urgentPhone',
|
||||||
|
width: 140,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '是否赠送积分',
|
||||||
|
dataIndex: 'isIntegral',
|
||||||
|
key: 'isIntegral',
|
||||||
|
width: 140,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否已开具发票',
|
||||||
|
dataIndex: 'isInvoice',
|
||||||
|
key: 'isInvoice',
|
||||||
|
width: 140,
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const expireTimeLoading = reactive<Record<number, boolean>>({});
|
||||||
|
const remainingDrafts = reactive<Record<string, string | number | null>>({});
|
||||||
|
const remainingLoadingKey = ref<string | null>(null);
|
||||||
|
const remainingEditing = reactive<Record<string, boolean>>({});
|
||||||
|
const remainingKey = (row: ThinkCard, field: 'num' | 'remainingMoney') => `${row.id ?? ''}-${field}`;
|
||||||
|
const getRemainingDraft = (row: ThinkCard, field: 'num' | 'remainingMoney') => {
|
||||||
|
const key = remainingKey(row, field);
|
||||||
|
if (!(key in remainingDrafts)) remainingDrafts[key] = field === 'num' ? (row.num ?? 0) : (row.remainingMoney ?? '');
|
||||||
|
return remainingDrafts[key];
|
||||||
|
};
|
||||||
|
const setRemainingDraft = (row: ThinkCard, field: 'num' | 'remainingMoney', value: string | number | null) => {
|
||||||
|
remainingDrafts[remainingKey(row, field)] = value;
|
||||||
|
};
|
||||||
|
const isRemainingEditing = (row: ThinkCard, field: 'num' | 'remainingMoney') =>
|
||||||
|
!!remainingEditing[remainingKey(row, field)];
|
||||||
|
const editRemaining = (row: ThinkCard, field: 'num' | 'remainingMoney') => {
|
||||||
|
if (!hasPermission('think:thinkCard:changeRemain')) return;
|
||||||
|
getRemainingDraft(row, field);
|
||||||
|
remainingEditing[remainingKey(row, field)] = true;
|
||||||
|
};
|
||||||
|
const isRemainingLoading = (id: number | undefined, field: string) =>
|
||||||
|
remainingLoadingKey.value === `${id ?? ''}-${field}`;
|
||||||
|
const saveRemaining = async (row: ThinkCard, field: 'num' | 'remainingMoney') => {
|
||||||
|
if (!row.id) return;
|
||||||
|
const value = getRemainingDraft(row, field);
|
||||||
|
if (value === null || value === '' || value === undefined || (field === 'num' && (!Number.isInteger(Number(value)) || Number(value) < 0))) {
|
||||||
|
message.error(field === 'num' ? '剩余次数必须是非负整数' : '请输入剩余金额');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const key = remainingKey(row, field);
|
||||||
|
remainingLoadingKey.value = key;
|
||||||
|
try {
|
||||||
|
await updateThinkCardRemaining({ id: row.id, ...(field === 'num' ? { num: Number(value) } : { remainingMoney: String(value) }) });
|
||||||
|
if (field === 'num') row.num = Number(value); else row.remainingMoney = String(value);
|
||||||
|
remainingEditing[key] = false;
|
||||||
|
message.success('保存成功');
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(e.message || '保存失败');
|
||||||
|
} finally {
|
||||||
|
remainingLoadingKey.value = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatExpireTime = (value?: number) => {
|
||||||
|
return value
|
||||||
|
? dayjs(value * 1000).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
: undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeExpireTime = async (value: string, row: ThinkCard) => {
|
||||||
|
if (!row.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!value) {
|
||||||
|
message.error('请选择到期时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const expireTime = dayjs(value).unix();
|
||||||
|
if (row.expireTime === expireTime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
expireTimeLoading[row.id] = true;
|
||||||
|
try {
|
||||||
|
await updateThinkCard({
|
||||||
|
id: row.id,
|
||||||
|
expireTime
|
||||||
|
});
|
||||||
|
row.expireTime = expireTime;
|
||||||
|
message.success('到期时间修改成功');
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(e.message || '到期时间修改失败');
|
||||||
|
} finally {
|
||||||
|
expireTimeLoading[row.id] = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ThinkCardParam) => {
|
||||||
selection.value = [];
|
selection.value = [];
|
||||||
tableRef?.value?.reload({ where: where });
|
tableRef?.value?.reload({ where: where });
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
const openEdit = (row?: ThinkCard) => {
|
const openEdit = (row?: ThinkCard) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showEdit.value = true;
|
showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
/* 打开批量移动弹窗 */
|
||||||
const openMove = () => {
|
const openMove = () => {
|
||||||
showMove.value = true;
|
showMove.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const showMakeCard = ref(false);
|
const showMakeCard = ref(false);
|
||||||
const openMakeCard = () => {
|
const openMakeCard = () => {
|
||||||
showMakeCard.value = true;
|
showMakeCard.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const unBindCard = (row: ThinkCard) => {
|
const unBindCard = (row: ThinkCard) => {
|
||||||
updateThinkCard({ id: row.id, uid: 0, username: "", phone: "" }).then(() => {
|
updateThinkCard({ id: row.id, uid: 0, username: '', phone: '' }).then(
|
||||||
message.success("操作成功");
|
() => {
|
||||||
|
message.success('操作成功');
|
||||||
reload();
|
reload();
|
||||||
});
|
}
|
||||||
};
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const changeBindCard = (row: any, id: number) => {
|
const changeBindCard = (row: any, id: number) => {
|
||||||
// console.log(row, id);
|
// console.log(row, id);
|
||||||
updateThinkCard({
|
updateThinkCard({
|
||||||
id, uid: row.id,
|
id,
|
||||||
|
uid: row.id,
|
||||||
username: row.truename ?? row.phone,
|
username: row.truename ?? row.phone,
|
||||||
phone: row.phone
|
phone: row.phone
|
||||||
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
message.success("操作成功");
|
message.success('操作成功');
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 删除单个 */
|
/* 删除单个 */
|
||||||
const remove = (row: ThinkCard) => {
|
const remove = (row: ThinkCard) => {
|
||||||
const hide = message.loading("请求中..", 0);
|
const hide = message.loading('请求中..', 0);
|
||||||
removeThinkCard(row.id)
|
removeThinkCard(row.id)
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
@@ -413,21 +547,21 @@ const remove = (row: ThinkCard) => {
|
|||||||
hide();
|
hide();
|
||||||
message.error(e.message);
|
message.error(e.message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 批量删除 */
|
/* 批量删除 */
|
||||||
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);
|
||||||
removeBatchThinkCard(selection.value.map((d) => d.id))
|
removeBatchThinkCard(selection.value.map((d) => d.id))
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
@@ -440,45 +574,32 @@ const removeBatch = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 查询 */
|
/* 查询 */
|
||||||
const query = () => {
|
const query = () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const showLog = ref(false)
|
const showLog = ref(false);
|
||||||
const openLog = (row: ThinkCard) => {
|
const openLog = (row: ThinkCard) => {
|
||||||
showLog.value = true
|
showLog.value = true;
|
||||||
current.value = row
|
current.value = row;
|
||||||
}
|
};
|
||||||
|
|
||||||
const showInvoice = ref(false)
|
const showInvoice = ref(false);
|
||||||
const onInvoice = (row?: ThinkCard) => {
|
const onInvoice = (row?: ThinkCard) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showInvoice.value = true;
|
showInvoice.value = true;
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ThinkCard) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
query();
|
query();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "ThinkCard"
|
name: 'ThinkCard'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
<style lang="less" scoped></style>
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑卡余额记录' : '添加卡余额记录'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="" name="cid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.cid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="vid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.vid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="uid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.uid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="balance">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.balance"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="每次减少金额" name="reduceEach">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入每次减少金额"
|
||||||
|
v-model:value="form.reduceEach"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addThinkCardBalance, updateThinkCardBalance } from '@/api/think/thinkCardBalance';
|
||||||
|
import { ThinkCardBalance } from '@/api/think/thinkCardBalance/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: ThinkCardBalance | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<ThinkCardBalance>({
|
||||||
|
id: undefined,
|
||||||
|
cid: undefined,
|
||||||
|
vid: undefined,
|
||||||
|
uid: undefined,
|
||||||
|
balance: undefined,
|
||||||
|
reduceEach: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
thinkCardBalanceId: undefined,
|
||||||
|
thinkCardBalanceName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
thinkCardBalanceName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写卡余额记录名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateThinkCardBalance : addThinkCardBalance;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="thinkCardBalanceId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<ThinkCardBalanceEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ThinkCardBalanceEdit from './components/thinkCardBalanceEdit.vue';
|
||||||
|
import { pageThinkCardBalance, removeThinkCardBalance, removeBatchThinkCardBalance } from '@/api/think/thinkCardBalance';
|
||||||
|
import type { ThinkCardBalance, ThinkCardBalanceParam } from '@/api/think/thinkCardBalance/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<ThinkCardBalance[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<ThinkCardBalance | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageThinkCardBalance({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'cid',
|
||||||
|
key: 'cid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'vid',
|
||||||
|
key: 'vid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'uid',
|
||||||
|
key: 'uid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'balance',
|
||||||
|
key: 'balance',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '每次减少金额',
|
||||||
|
dataIndex: 'reduceEach',
|
||||||
|
key: 'reduceEach',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '下单时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
key: 'updateTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ThinkCardBalanceParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: ThinkCardBalance) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: ThinkCardBalance) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeThinkCardBalance(row.thinkCardBalanceId)
|
||||||
|
.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);
|
||||||
|
removeBatchThinkCardBalance(selection.value.map((d) => d.thinkCardBalanceId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: ThinkCardBalance) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'ThinkCardBalance'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -129,23 +129,28 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<a-button @click="showCal = false">关闭</a-button>
|
<a-button @click="showCal = false">关闭</a-button>
|
||||||
</template>
|
</template>
|
||||||
<a-date-picker v-model:value="month" value-format="YYYY-MM" picker="month"/>
|
<a-date-picker
|
||||||
<div v-for="(item, index) in prices" :key="index">
|
v-model:value="month"
|
||||||
|
value-format="YYYY-MM"
|
||||||
|
picker="month"
|
||||||
|
@change="onMonthChange"
|
||||||
|
/>
|
||||||
|
<div v-for="(item, index) in prices" :key="`${month}-${index}`">
|
||||||
<div style="padding: 1rem 0">
|
<div style="padding: 1rem 0">
|
||||||
<div class="flex justify-start items-center">
|
<div class="flex justify-start items-center">
|
||||||
<span style="width: 120px">{{ index + 1 }}号价格</span>
|
<span style="width: 120px">{{ index + 1 }}号价格</span>
|
||||||
<a-input-number v-model:value="prices[index]" style="width: 300px;" />
|
<a-input-number v-model:value="prices[index]" style="width: 300px;" />
|
||||||
</div>
|
</div>
|
||||||
<p style="color: #999; font-size: 0.8rem"> {{ dayjs(`${month}-${(index + 1)}`).format("YYYY-MM-DD") }}
|
<p style="color: #999; font-size: 0.8rem"> {{ dayjs(`${month}-${String(index + 1).padStart(2, '0')}`).format("YYYY-MM-DD") }}
|
||||||
{{ weekStr[dayjs(`${month}-${(index + 1)}`).format("d")] }}的价格,温馨提示:如价格填写0则代表当日免费。</p>
|
{{ weekStr[dayjs(`${month}-${String(index + 1).padStart(2, '0')}`).format("d")] }}的价格,温馨提示:如价格填写0则代表当日免费。</p>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 1rem">
|
<div style="margin-bottom: 1rem">
|
||||||
<div class="flex justify-start items-center">
|
<div class="flex justify-start items-center">
|
||||||
<span style="width: 120px">{{ index + 1 }}号半场价格</span>
|
<span style="width: 120px">{{ index + 1 }}号半场价格</span>
|
||||||
<a-input-number v-model:value="halfPrices[index]" style="width: 300px;" />
|
<a-input-number v-model:value="halfPrices[index]" style="width: 300px;" />
|
||||||
</div>
|
</div>
|
||||||
<p style="color: #999; font-size: 0.8rem"> {{ dayjs(`${month}-${(index + 1)}`).format("YYYY-MM-DD") }}
|
<p style="color: #999; font-size: 0.8rem"> {{ dayjs(`${month}-${String(index + 1).padStart(2, '0')}`).format("YYYY-MM-DD") }}
|
||||||
{{ weekStr[dayjs(`${month}-${(index + 1)}`).format("d")]
|
{{ weekStr[dayjs(`${month}-${String(index + 1).padStart(2, '0')}`).format("d")]
|
||||||
}}的半场价格,温馨提示:如价格填写0则代表当日免费。</p>
|
}}的半场价格,温馨提示:如价格填写0则代表当日免费。</p>
|
||||||
</div>
|
</div>
|
||||||
<a-divider />
|
<a-divider />
|
||||||
@@ -275,12 +280,23 @@ const save = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formData.week = JSON.stringify(formData.week);
|
formData.week = JSON.stringify(formData.week);
|
||||||
formData.prices = JSON.stringify({
|
// 只保留当前选中月份的价格数据
|
||||||
[month.value]: prices.value.map(item => item ? item.toString() : '')
|
const dayPrices = normalizeDayPrices(prices.value, month.value).map(
|
||||||
});
|
(item) =>
|
||||||
formData.halfPrices = JSON.stringify({
|
item !== "" && item !== null && item !== undefined
|
||||||
[month.value]: halfPrices.value.map(item => item ? item.toString() : '')
|
? String(item)
|
||||||
});
|
: ""
|
||||||
|
);
|
||||||
|
const dayHalfPrices = normalizeDayPrices(
|
||||||
|
halfPrices.value,
|
||||||
|
month.value
|
||||||
|
).map((item) =>
|
||||||
|
item !== "" && item !== null && item !== undefined ? String(item) : ""
|
||||||
|
);
|
||||||
|
formData.prices = JSON.stringify({ [month.value]: dayPrices });
|
||||||
|
formData.halfPrices = JSON.stringify({ [month.value]: dayHalfPrices });
|
||||||
|
form.prices = formData.prices;
|
||||||
|
form.halfPrices = formData.halfPrices;
|
||||||
formData.timePeriod = `${formData.timePeriod1} - ${formData.timePeriod2}`;
|
formData.timePeriod = `${formData.timePeriod1} - ${formData.timePeriod2}`;
|
||||||
formData.startTime = `${formData.timePeriod1?.replace(":", "")}`;
|
formData.startTime = `${formData.timePeriod1?.replace(":", "")}`;
|
||||||
console.log(formData)
|
console.log(formData)
|
||||||
@@ -308,6 +324,19 @@ const prices = ref<any[]>([]);
|
|||||||
const halfPrices = ref<any[]>([]);
|
const halfPrices = ref<any[]>([]);
|
||||||
const showCal = ref(false);
|
const showCal = ref(false);
|
||||||
const openCal = () => {
|
const openCal = () => {
|
||||||
|
// 打开日历前先按当前月份校正数据结构,避免脏数据导致表格无法渲染
|
||||||
|
const priceMap = parsePriceMap(form.prices);
|
||||||
|
const halfPriceMap = parsePriceMap(form.halfPrices);
|
||||||
|
// 仅使用当前月份的数据;若 form 中是其他月份则重建空结构
|
||||||
|
if (priceMap[month.value]) {
|
||||||
|
prices.value = normalizeDayPrices(priceMap[month.value], month.value);
|
||||||
|
halfPrices.value = normalizeDayPrices(
|
||||||
|
halfPriceMap[month.value],
|
||||||
|
month.value
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
resetMonthPrices(month.value);
|
||||||
|
}
|
||||||
showCal.value = true;
|
showCal.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -321,21 +350,52 @@ const weekStr = ref([
|
|||||||
"星期六"
|
"星期六"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const makePrices = () => {
|
/** 安全解析价格 JSON */
|
||||||
const dayNum = dayjs().daysInMonth();
|
const parsePriceMap = (value?: string | null): Record<string, any[]> => {
|
||||||
prices.value = [];
|
if (!value || value === "0") return {};
|
||||||
for (let i = 0; i < dayNum; i++) {
|
try {
|
||||||
prices.value.push("");
|
const parsed = JSON.parse(value);
|
||||||
|
return parsed && typeof parsed === "object" ? parsed : {};
|
||||||
|
} catch {
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
// console.log(prices.value);
|
};
|
||||||
|
|
||||||
|
/** 按指定月份天数生成/校正价格数组 */
|
||||||
|
const normalizeDayPrices = (source?: any[] | null, targetMonth?: string) => {
|
||||||
|
const dayNum = dayjs(`${targetMonth || month.value}-01`).daysInMonth();
|
||||||
|
const result: any[] = [];
|
||||||
|
for (let i = 0; i < dayNum; i++) {
|
||||||
|
const val = source?.[i];
|
||||||
|
result.push(val !== undefined && val !== null ? val : "");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
const makePrices = () => {
|
||||||
|
prices.value = normalizeDayPrices(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const makeHalfPrices = () => {
|
const makeHalfPrices = () => {
|
||||||
const dayNum = dayjs().daysInMonth();
|
halfPrices.value = normalizeDayPrices(null);
|
||||||
halfPrices.value = [];
|
};
|
||||||
for (let i = 0; i < dayNum; i++) {
|
|
||||||
halfPrices.value.push("");
|
/** 按目标月天数重置为空的 prices / halfPrices */
|
||||||
}
|
const resetMonthPrices = (targetMonth: string) => {
|
||||||
|
if (!targetMonth) return;
|
||||||
|
prices.value = normalizeDayPrices(null, targetMonth);
|
||||||
|
halfPrices.value = normalizeDayPrices(null, targetMonth);
|
||||||
|
// 同步 form:只保留当前这一个月份
|
||||||
|
form.prices = JSON.stringify({ [targetMonth]: prices.value });
|
||||||
|
form.halfPrices = JSON.stringify({ [targetMonth]: halfPrices.value });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 切换月份:丢弃旧月份,按新月份天数重建价格结构 */
|
||||||
|
const onMonthChange = (value: string | null) => {
|
||||||
|
const nextMonth = value || month.value;
|
||||||
|
if (!nextMonth) return;
|
||||||
|
month.value = nextMonth;
|
||||||
|
resetMonthPrices(nextMonth);
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -354,26 +414,24 @@ watch(
|
|||||||
form.week = JSON.parse(props.data.week);
|
form.week = JSON.parse(props.data.week);
|
||||||
}
|
}
|
||||||
isUpdate.value = true;
|
isUpdate.value = true;
|
||||||
if (props.data?.prices === "0") {
|
const priceMap = parsePriceMap(props.data?.prices);
|
||||||
makePrices();
|
const halfPriceMap = parsePriceMap(props.data?.halfPrices);
|
||||||
} else {
|
const keys = Object.keys(priceMap);
|
||||||
const keys = Object.keys(JSON.parse(props.data?.prices))
|
if (keys.length) month.value = keys[0];
|
||||||
month.value = keys[0]
|
else month.value = dayjs().format("YYYY-MM");
|
||||||
const pricesItem = JSON.parse(props.data?.prices)[month.value];
|
// 回显时校正结构,且 form 只保留这一个月份
|
||||||
if (pricesItem) prices.value = pricesItem;
|
prices.value = normalizeDayPrices(priceMap[month.value], month.value);
|
||||||
else makePrices();
|
halfPrices.value = normalizeDayPrices(
|
||||||
}
|
halfPriceMap[month.value],
|
||||||
if (props.data?.halfPrices === "0") {
|
month.value
|
||||||
makeHalfPrices();
|
);
|
||||||
} else {
|
form.prices = JSON.stringify({ [month.value]: prices.value });
|
||||||
const keys = Object.keys(JSON.parse(props.data?.prices))
|
form.halfPrices = JSON.stringify({ [month.value]: halfPrices.value });
|
||||||
month.value = keys[0]
|
|
||||||
const halfPricesItem = JSON.parse(props.data?.halfPrices)[month.value];
|
|
||||||
if (halfPricesItem) halfPrices.value = halfPricesItem;
|
|
||||||
else makeHalfPrices();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
isUpdate.value = false;
|
isUpdate.value = false;
|
||||||
|
month.value = dayjs().format("YYYY-MM");
|
||||||
|
makePrices();
|
||||||
|
makeHalfPrices();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetFields();
|
resetFields();
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-input allow-clear v-model:value="keyword" placeholder="流水号搜索" @change="search" />
|
||||||
|
<a-range-picker
|
||||||
|
allow-clear
|
||||||
|
v-model:value="dateRange"
|
||||||
|
@change="search"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
class="ele-fluid"
|
||||||
|
/>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
import { ThinkFtpCheckBillParam } from "@/api/think/thinkFtpCheckBill/model";
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const dateRange = ref<[string, string] | null>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: "search", where?: ThinkFtpCheckBillParam): void;
|
||||||
|
(e: "add"): void;
|
||||||
|
(e: "remove"): void;
|
||||||
|
(e: "batchMove"): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const keyword = ref<string>("");
|
||||||
|
const search = () => {
|
||||||
|
let payTimeStart: string = undefined, payTimeEnd: string = undefined;
|
||||||
|
if (dateRange.value && dateRange.value?.length > 0 && dateRange.value[0]) {
|
||||||
|
[payTimeStart, payTimeEnd] = dateRange.value;
|
||||||
|
payTimeEnd = `${payTimeEnd} 23:59:59`
|
||||||
|
}
|
||||||
|
emit("search", { keywords: keyword.value, payTimeStart, payTimeEnd });
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑' : '添加'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="终端号" name="deviceNo">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入终端号"
|
||||||
|
v-model:value="form.deviceNo"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="卡号" name="cardNo">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入卡号"
|
||||||
|
v-model:value="form.cardNo"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="amount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.amount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="结算金额" name="settleAmount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入结算金额"
|
||||||
|
v-model:value="form.settleAmount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="手续费" name="feeAmount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入手续费"
|
||||||
|
v-model:value="form.feeAmount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="实际支付金额" name="paidAmount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入实际支付金额"
|
||||||
|
v-model:value="form.paidAmount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="参考号" name="refNo">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入参考号"
|
||||||
|
v-model:value="form.refNo"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="流水号" name="flowNo">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入流水号"
|
||||||
|
v-model:value="form.flowNo"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="卡类型" name="cardType">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入卡类型"
|
||||||
|
v-model:value="form.cardType"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="发卡行" name="postCardType">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入发卡行"
|
||||||
|
v-model:value="form.postCardType"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="支付方式" name="payType">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入支付方式"
|
||||||
|
v-model:value="form.payType"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="银商订单号" name="orderNo">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入银商订单号"
|
||||||
|
v-model:value="form.orderNo"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="payTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.payTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="状态, 0已发布, 1待审核 2已驳回 3违规内容" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="0">显示</a-radio>
|
||||||
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入是否删除, 0否, 1是"
|
||||||
|
v-model:value="form.deleted"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="修改时间" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入修改时间"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addThinkFtpCheckBill, updateThinkFtpCheckBill } from '@/api/think/thinkFtpCheckBill';
|
||||||
|
import { ThinkFtpCheckBill } from '@/api/think/thinkFtpCheckBill/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: ThinkFtpCheckBill | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<ThinkFtpCheckBill>({
|
||||||
|
id: undefined,
|
||||||
|
deviceNo: undefined,
|
||||||
|
cardNo: undefined,
|
||||||
|
amount: undefined,
|
||||||
|
settleAmount: undefined,
|
||||||
|
feeAmount: undefined,
|
||||||
|
paidAmount: undefined,
|
||||||
|
refNo: undefined,
|
||||||
|
flowNo: undefined,
|
||||||
|
cardType: undefined,
|
||||||
|
postCardType: undefined,
|
||||||
|
payType: undefined,
|
||||||
|
orderNo: undefined,
|
||||||
|
payTime: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
status: undefined,
|
||||||
|
deleted: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
thinkFtpCheckBillId: undefined,
|
||||||
|
thinkFtpCheckBillName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
thinkFtpCheckBillName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateThinkFtpCheckBill : addThinkFtpCheckBill;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="thinkFtpCheckBillId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'payTime'">
|
||||||
|
<span>{{ dayjs(record.payTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<ThinkFtpCheckBillEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ThinkFtpCheckBillEdit from './components/thinkFtpCheckBillEdit.vue';
|
||||||
|
import { pageThinkFtpCheckBill, removeThinkFtpCheckBill, removeBatchThinkFtpCheckBill } from '@/api/think/thinkFtpCheckBill';
|
||||||
|
import type { ThinkFtpCheckBill, ThinkFtpCheckBillParam } from '@/api/think/thinkFtpCheckBill/model';
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<ThinkFtpCheckBill[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<ThinkFtpCheckBill | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageThinkFtpCheckBill({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: '终端号',
|
||||||
|
dataIndex: 'deviceNo',
|
||||||
|
key: 'deviceNo',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '卡号',
|
||||||
|
dataIndex: 'cardNo',
|
||||||
|
key: 'cardNo',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '金额',
|
||||||
|
dataIndex: 'amount',
|
||||||
|
key: 'amount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结算金额',
|
||||||
|
dataIndex: 'settleAmount',
|
||||||
|
key: 'settleAmount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '手续费',
|
||||||
|
dataIndex: 'feeAmount',
|
||||||
|
key: 'feeAmount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际支付金额',
|
||||||
|
dataIndex: 'paidAmount',
|
||||||
|
key: 'paidAmount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '参考号',
|
||||||
|
dataIndex: 'refNo',
|
||||||
|
key: 'refNo',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '流水号',
|
||||||
|
dataIndex: 'flowNo',
|
||||||
|
key: 'flowNo',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '卡类型',
|
||||||
|
dataIndex: 'cardType',
|
||||||
|
key: 'cardType',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发卡行',
|
||||||
|
dataIndex: 'postCardType',
|
||||||
|
key: 'postCardType',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '支付方式',
|
||||||
|
dataIndex: 'payType',
|
||||||
|
key: 'payType',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '银商订单号',
|
||||||
|
dataIndex: 'orderNo',
|
||||||
|
key: 'orderNo',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '支付时间',
|
||||||
|
dataIndex: 'payTime',
|
||||||
|
key: 'payTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ThinkFtpCheckBillParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: ThinkFtpCheckBill) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: ThinkFtpCheckBill) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeThinkFtpCheckBill(row.thinkFtpCheckBillId)
|
||||||
|
.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);
|
||||||
|
removeBatchThinkFtpCheckBill(selection.value.map((d) => d.thinkFtpCheckBillId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: ThinkFtpCheckBill) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'ThinkFtpCheckBill'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -117,11 +117,11 @@
|
|||||||
v-model:value="form.email"
|
v-model:value="form.email"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="备注信息" name="info">
|
<a-form-item label="备注信息" name="remark">
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
allow-clear
|
||||||
placeholder="请输入备注信息"
|
placeholder="请输入备注信息"
|
||||||
v-model:value="form.info"
|
v-model:value="form.remark"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="是否已开:1已开,2未开" name="isOpen">
|
<a-form-item label="是否已开:1已开,2未开" name="isOpen">
|
||||||
|
|||||||
@@ -58,10 +58,14 @@
|
|||||||
发票额度已不够使用
|
发票额度已不够使用
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
<a-space v-if="record.isOpen === 2 && record.status === 0">
|
<a-space v-if="record.isOpen === 2">
|
||||||
|
<a @click="updateInvoiceStatus(record)">更新状态</a>
|
||||||
|
<template v-if="record.status === 0">
|
||||||
|
<a-divider type="vertical" />
|
||||||
<a @click="openInvoice(record)">开票</a>
|
<a @click="openInvoice(record)">开票</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a class="ele-text-danger" @click="refuse(record)">拒绝</a>
|
<a class="ele-text-danger" @click="refuse(record)">拒绝</a>
|
||||||
|
</template>
|
||||||
</a-space>
|
</a-space>
|
||||||
<span v-if="record.status === 2" class="ele-text-danger">已拒绝</span>
|
<span v-if="record.status === 2" class="ele-text-danger">已拒绝</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -94,7 +98,7 @@ import ThinkInvoiceEdit from "./components/thinkInvoiceEdit.vue";
|
|||||||
import {
|
import {
|
||||||
pageThinkInvoice,
|
pageThinkInvoice,
|
||||||
removeThinkInvoice,
|
removeThinkInvoice,
|
||||||
removeBatchThinkInvoice, updateThinkInvoice, doInvoice, thinkInvoiceData
|
removeBatchThinkInvoice, updateThinkInvoice, doInvoice, thinkInvoiceData, getInvoiceRes
|
||||||
} from "@/api/think/thinkInvoice";
|
} from "@/api/think/thinkInvoice";
|
||||||
import type {
|
import type {
|
||||||
ThinkInvoice,
|
ThinkInvoice,
|
||||||
@@ -147,7 +151,7 @@ const columns = ref<ColumnItem[]>([
|
|||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
key: "action",
|
key: "action",
|
||||||
width: 180,
|
width: 220,
|
||||||
fixed: "left",
|
fixed: "left",
|
||||||
align: "center",
|
align: "center",
|
||||||
hideInSetting: true
|
hideInSetting: true
|
||||||
@@ -312,6 +316,19 @@ const openInvoice = async (row: ThinkInvoice) => {
|
|||||||
reload();
|
reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateInvoiceStatus = async (row: ThinkInvoice) => {
|
||||||
|
const hide = message.loading("请求中..", 0);
|
||||||
|
try {
|
||||||
|
await getInvoiceRes({ id: row.id });
|
||||||
|
hide();
|
||||||
|
message.success("状态已更新");
|
||||||
|
reload();
|
||||||
|
} catch (e) {
|
||||||
|
hide();
|
||||||
|
message.error((e as Error).message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const refuse = async (row: ThinkInvoice) => {
|
const refuse = async (row: ThinkInvoice) => {
|
||||||
await updateThinkInvoice({
|
await updateThinkInvoice({
|
||||||
id: row.id,
|
id: row.id,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:visible="visible"
|
:visible="visible"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:maxable="maxable"
|
:maxable="maxable"
|
||||||
:title="isUpdate ? '开具发票2' : '开具发票'"
|
:title="isUpdate ? '开具发票' : '开具发票'"
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
@update:visible="updateVisible"
|
@update:visible="updateVisible"
|
||||||
@ok="save"
|
@ok="save"
|
||||||
@@ -103,12 +103,12 @@
|
|||||||
v-model:value="form.email"
|
v-model:value="form.email"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="备注信息" name="info">
|
<a-form-item label="备注信息" name="remark">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
:rows="4"
|
:rows="4"
|
||||||
:maxlength="200"
|
:maxlength="200"
|
||||||
placeholder="请输入备注信息"
|
placeholder="请输入备注信息"
|
||||||
v-model:value="form.info"
|
v-model:value="form.remark"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="发票类型" name="type">
|
<a-form-item label="发票类型" name="type">
|
||||||
@@ -212,7 +212,6 @@
|
|||||||
price: [
|
price: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
type: 'number',
|
|
||||||
message: '请填写发票金额',
|
message: '请填写发票金额',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,12 +82,12 @@
|
|||||||
v-model:value="form.email"
|
v-model:value="form.email"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="备注信息" name="info">
|
<a-form-item label="备注信息" name="remark">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
:rows="4"
|
:rows="4"
|
||||||
:maxlength="200"
|
:maxlength="200"
|
||||||
placeholder="请输入备注信息"
|
placeholder="请输入备注信息"
|
||||||
v-model:value="form.info"
|
v-model:value="form.remark"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="发票类型" name="type">
|
<a-form-item label="发票类型" name="type">
|
||||||
|
|||||||
@@ -86,17 +86,19 @@
|
|||||||
<a-tag v-if="form.payType == 4">现金</a-tag>
|
<a-tag v-if="form.payType == 4">现金</a-tag>
|
||||||
<a-tag v-if="form.payType == 5">POS机</a-tag>
|
<a-tag v-if="form.payType == 5">POS机</a-tag>
|
||||||
<a-tag v-if="form.payType == 6">VIP月卡</a-tag>
|
<a-tag v-if="form.payType == 6">VIP月卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 7">formVIP年卡</a-tag>
|
<a-tag v-if="form.payType == 7">VIP年卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 8">formVIP次卡</a-tag>
|
<a-tag v-if="form.payType == 8">VIP次卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 9">formIC月卡</a-tag>
|
<a-tag v-if="form.payType == 9">IC月卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 10">formIC年卡</a-tag>
|
<a-tag v-if="form.payType == 10">IC年卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 11">formIC次卡</a-tag>
|
<a-tag v-if="form.payType == 11">IC次卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 12">form免费</a-tag>
|
<a-tag v-if="form.payType == 12">免费</a-tag>
|
||||||
<a-tag v-if="form.payType == 13">formVIP充值卡</a-tag>
|
<a-tag v-if="form.payType == 13">VIP充值卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 14">formIC充值卡</a-tag>
|
<a-tag v-if="form.payType == 14">IC充值卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 15">form积分支付</a-tag>
|
<a-tag v-if="form.payType == 15">积分支付</a-tag>
|
||||||
<a-tag v-if="form.payType == 16">formVIP季卡</a-tag>
|
<a-tag v-if="form.payType == 16">VIP季卡</a-tag>
|
||||||
<a-tag v-if="form.payType == 17">formIC季卡</a-tag>
|
<a-tag v-if="form.payType == 17">IC季卡</a-tag>
|
||||||
|
<a-tag v-if="form.payType == 18">对公</a-tag>
|
||||||
|
<a-tag v-if="form.payType == 19">余额</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span></span>
|
<span></span>
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
<a-select-option :value="15">积分支付</a-select-option>
|
<a-select-option :value="15">积分支付</a-select-option>
|
||||||
<a-select-option :value="16">VIP季卡</a-select-option>
|
<a-select-option :value="16">VIP季卡</a-select-option>
|
||||||
<a-select-option :value="17">IC季卡</a-select-option>
|
<a-select-option :value="17">IC季卡</a-select-option>
|
||||||
|
<a-select-option :value="18">对公</a-select-option>
|
||||||
|
<a-select-option :value="19">余额</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
<span class="text-gray-400">开票状态</span>
|
<span class="text-gray-400">开票状态</span>
|
||||||
<a-select v-model:value="where.isInvoice" style="width: 150px" placeholder="开票状态筛选" @change="search">
|
<a-select v-model:value="where.isInvoice" style="width: 150px" placeholder="开票状态筛选" @change="search">
|
||||||
@@ -102,7 +104,7 @@ import { utils, writeFile } from "xlsx";
|
|||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { toDateString } from "ele-admin-pro";
|
import { toDateString } from "ele-admin-pro";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { listThinkOrder, updateThinkOrder } from "@/api/think/thinkOrder";
|
import { listThinkOrder, setThinkOrderInvoice } from "@/api/think/thinkOrder";
|
||||||
import { ThinkOrder, ThinkOrderParam } from "@/api/think/thinkOrder/model";
|
import { ThinkOrder, ThinkOrderParam } from "@/api/think/thinkOrder/model";
|
||||||
import { ThinkSite } from "@/api/think/thinkSite/model";
|
import { ThinkSite } from "@/api/think/thinkSite/model";
|
||||||
|
|
||||||
@@ -256,16 +258,28 @@ const handleExport2 = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setHasInvoice = async () => {
|
const setHasInvoice = async () => {
|
||||||
const hide = message.loading("请求中..", 0);
|
if (!props.selection?.length) {
|
||||||
if (props.selection) {
|
message.warning("请选择订单");
|
||||||
props.selection.filter(item => item.isInvoice === 2).map(async item => {
|
return;
|
||||||
item.isInvoice = 1;
|
|
||||||
await updateThinkOrder(item);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
hide();
|
const ids = props.selection
|
||||||
|
.filter((item) => item.isInvoice === 2)
|
||||||
|
.map((item) => item.id)
|
||||||
|
.filter((id): id is number => id != null);
|
||||||
|
if (!ids.length) {
|
||||||
|
message.warning("请选择未开票的订单");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const hide = message.loading("请求中..", 0);
|
||||||
|
try {
|
||||||
|
await setThinkOrderInvoice(ids);
|
||||||
message.success("设置成功");
|
message.success("设置成功");
|
||||||
|
search();
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(e?.message || "设置失败");
|
||||||
|
} finally {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const openInvoiceByList = async () => {
|
const openInvoiceByList = async () => {
|
||||||
|
|||||||
@@ -104,6 +104,12 @@
|
|||||||
<IdcardOutlined class="tag-icon" />
|
<IdcardOutlined class="tag-icon" />
|
||||||
IC季卡
|
IC季卡
|
||||||
</a-tag>
|
</a-tag>
|
||||||
|
<a-tag v-if="record.payType == 18">
|
||||||
|
对公
|
||||||
|
</a-tag>
|
||||||
|
<a-tag v-if="record.payType == 19">
|
||||||
|
余额
|
||||||
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span></span>
|
<span></span>
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,249 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑折扣审核' : '添加折扣审核'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="" name="oid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.oid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="userId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.userId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="原价" name="originAmount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入原价"
|
||||||
|
v-model:value="form.originAmount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="折扣" name="rate">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入折扣"
|
||||||
|
v-model:value="form.rate"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="折后价" name="offAmount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入折后价"
|
||||||
|
v-model:value="form.offAmount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="申请原因" name="reqReason">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入申请原因"
|
||||||
|
v-model:value="form.reqReason"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="拒绝原因" name="refuseReason">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入拒绝原因"
|
||||||
|
v-model:value="form.refuseReason"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="审核人" name="checkUid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入审核人"
|
||||||
|
v-model:value="form.checkUid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="状态, 0已发布, 1待审核 2已驳回 3违规内容" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="0">显示</a-radio>
|
||||||
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入是否删除, 0否, 1是"
|
||||||
|
v-model:value="form.deleted"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="修改时间" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入修改时间"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addThinkOrderOffCheck, updateThinkOrderOffCheck } from '@/api/think/thinkOrderOffCheck';
|
||||||
|
import { ThinkOrderOffCheck } from '@/api/think/thinkOrderOffCheck/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: ThinkOrderOffCheck | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<ThinkOrderOffCheck>({
|
||||||
|
id: undefined,
|
||||||
|
oid: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
originAmount: undefined,
|
||||||
|
rate: undefined,
|
||||||
|
offAmount: undefined,
|
||||||
|
reqReason: undefined,
|
||||||
|
refuseReason: undefined,
|
||||||
|
checkUid: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
status: undefined,
|
||||||
|
deleted: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
thinkOrderOffCheckId: undefined,
|
||||||
|
thinkOrderOffCheckName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
thinkOrderOffCheckName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写折扣审核名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateThinkOrderOffCheck : addThinkOrderOffCheck;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,281 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="thinkOrderOffCheckId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<ThinkOrderOffCheckEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ThinkOrderOffCheckEdit from './components/thinkOrderOffCheckEdit.vue';
|
||||||
|
import { pageThinkOrderOffCheck, removeThinkOrderOffCheck, removeBatchThinkOrderOffCheck } from '@/api/think/thinkOrderOffCheck';
|
||||||
|
import type { ThinkOrderOffCheck, ThinkOrderOffCheckParam } from '@/api/think/thinkOrderOffCheck/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<ThinkOrderOffCheck[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<ThinkOrderOffCheck | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageThinkOrderOffCheck({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'oid',
|
||||||
|
key: 'oid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'userId',
|
||||||
|
key: 'userId',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '原价',
|
||||||
|
dataIndex: 'originAmount',
|
||||||
|
key: 'originAmount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '折扣',
|
||||||
|
dataIndex: 'rate',
|
||||||
|
key: 'rate',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '折后价',
|
||||||
|
dataIndex: 'offAmount',
|
||||||
|
key: 'offAmount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '申请原因',
|
||||||
|
dataIndex: 'reqReason',
|
||||||
|
key: 'reqReason',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '拒绝原因',
|
||||||
|
dataIndex: 'refuseReason',
|
||||||
|
key: 'refuseReason',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '审核人',
|
||||||
|
dataIndex: 'checkUid',
|
||||||
|
key: 'checkUid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态, 0已发布, 1待审核 2已驳回 3违规内容',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否删除, 0否, 1是',
|
||||||
|
dataIndex: 'deleted',
|
||||||
|
key: 'deleted',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
key: 'updateTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ThinkOrderOffCheckParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: ThinkOrderOffCheck) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: ThinkOrderOffCheck) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeThinkOrderOffCheck(row.thinkOrderOffCheckId)
|
||||||
|
.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);
|
||||||
|
removeBatchThinkOrderOffCheck(selection.value.map((d) => d.thinkOrderOffCheckId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: ThinkOrderOffCheck) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'ThinkOrderOffCheck'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -173,14 +173,17 @@
|
|||||||
<a-switch v-model:checked="form.childFree" :checked-value="1" :un-checked-value="0"/>
|
<a-switch v-model:checked="form.childFree" :checked-value="1" :un-checked-value="0"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
<a-form-item label="是否开启">
|
||||||
|
<a-switch v-model:checked="form.isOn" :checked-value="1" :un-checked-value="0"/>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item label="每天人数上限" extra="-1为不限制">
|
<a-form-item label="每天人数上限" extra="-1为不限制">
|
||||||
<a-input-number v-model:value="form.dailyMaxNum" />
|
<a-input-number v-model:value="form.dailyMaxNum" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="排序" name="sortNumber">
|
<a-form-item label="排序" name="sort">
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
allow-clear
|
||||||
placeholder="请输入排序"
|
placeholder="请输入排序"
|
||||||
v-model:value="form.sortNumber"
|
v-model:value="form.sort"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
@@ -253,6 +256,7 @@ const form = reactive<ThinkSite>({
|
|||||||
info: undefined,
|
info: undefined,
|
||||||
tel: undefined,
|
tel: undefined,
|
||||||
sortNumber: undefined,
|
sortNumber: undefined,
|
||||||
|
sort: undefined,
|
||||||
type: undefined,
|
type: undefined,
|
||||||
num: undefined,
|
num: undefined,
|
||||||
proportion: undefined,
|
proportion: undefined,
|
||||||
@@ -261,6 +265,7 @@ const form = reactive<ThinkSite>({
|
|||||||
updateTime: undefined,
|
updateTime: undefined,
|
||||||
weekendOpen: undefined,
|
weekendOpen: undefined,
|
||||||
dailyMaxNum: -1,
|
dailyMaxNum: -1,
|
||||||
|
isOn: 1,
|
||||||
album: '',
|
album: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,9 @@
|
|||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = () => {
|
const datasource: DatasourceFunction = () => {
|
||||||
return listThinkSite();
|
return listThinkSite({
|
||||||
|
isAdmin: true
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑' : '添加'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="" name="cid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.cid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="vid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.vid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="uid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.uid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="amount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.amount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addThinkSmallRecharge, updateThinkSmallRecharge } from '@/api/think/thinkSmallRecharge';
|
||||||
|
import { ThinkSmallRecharge } from '@/api/think/thinkSmallRecharge/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: ThinkSmallRecharge | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<ThinkSmallRecharge>({
|
||||||
|
id: undefined,
|
||||||
|
cid: undefined,
|
||||||
|
vid: undefined,
|
||||||
|
uid: undefined,
|
||||||
|
amount: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
thinkSmallRechargeId: undefined,
|
||||||
|
thinkSmallRechargeName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
thinkSmallRechargeName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateThinkSmallRecharge : addThinkSmallRecharge;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="thinkSmallRechargeId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<ThinkSmallRechargeEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ThinkSmallRechargeEdit from './components/thinkSmallRechargeEdit.vue';
|
||||||
|
import { pageThinkSmallRecharge, removeThinkSmallRecharge, removeBatchThinkSmallRecharge } from '@/api/think/thinkSmallRecharge';
|
||||||
|
import type { ThinkSmallRecharge, ThinkSmallRechargeParam } from '@/api/think/thinkSmallRecharge/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<ThinkSmallRecharge[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<ThinkSmallRecharge | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageThinkSmallRecharge({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'cid',
|
||||||
|
key: 'cid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'vid',
|
||||||
|
key: 'vid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'uid',
|
||||||
|
key: 'uid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'amount',
|
||||||
|
key: 'amount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '下单时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
key: 'updateTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ThinkSmallRechargeParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: ThinkSmallRecharge) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: ThinkSmallRecharge) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeThinkSmallRecharge(row.thinkSmallRechargeId)
|
||||||
|
.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);
|
||||||
|
removeBatchThinkSmallRecharge(selection.value.map((d) => d.thinkSmallRechargeId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: ThinkSmallRecharge) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'ThinkSmallRecharge'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-input-search
|
||||||
|
v-model:value="where.keywords"
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入机构名称/联系人/联系方式"
|
||||||
|
style="width: 320px"
|
||||||
|
@pressEnter="search"
|
||||||
|
@search="search"
|
||||||
|
/>
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
<a-button @click="reset">重置</a-button>
|
||||||
|
<a-button danger :disabled="!selection?.length" @click="remove">
|
||||||
|
批量删除
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import useSearch from '@/utils/use-search';
|
||||||
|
import type { ThinkTrainingInstitutionParam } from '@/api/think/thinkTrainingInstitution/model';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
selection?: unknown[];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: ThinkTrainingInstitutionParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const { where, resetFields } = useSearch<ThinkTrainingInstitutionParam>({
|
||||||
|
id: undefined,
|
||||||
|
keywords: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const search = () => {
|
||||||
|
emit('search', {
|
||||||
|
...where
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
const remove = () => {
|
||||||
|
emit('remove');
|
||||||
|
};
|
||||||
|
|
||||||
|
const reset = () => {
|
||||||
|
resetFields();
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="640"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑培训机构' : '添加培训机构'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 18, sm: 18, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="机构名称" name="name">
|
||||||
|
<a-input
|
||||||
|
v-model:value="form.name"
|
||||||
|
allow-clear
|
||||||
|
maxlength="50"
|
||||||
|
placeholder="请输入机构名称"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="联系人" name="contactName">
|
||||||
|
<a-input
|
||||||
|
v-model:value="form.contactName"
|
||||||
|
allow-clear
|
||||||
|
maxlength="20"
|
||||||
|
placeholder="请输入联系人"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="联系方式" name="contactPhone">
|
||||||
|
<a-input
|
||||||
|
v-model:value="form.contactPhone"
|
||||||
|
allow-clear
|
||||||
|
maxlength="20"
|
||||||
|
placeholder="请输入联系方式"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, ref, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject } from 'ele-admin-pro';
|
||||||
|
import { phoneReg } from 'ele-admin-pro/es';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import type { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import {
|
||||||
|
addThinkTrainingInstitution,
|
||||||
|
updateThinkTrainingInstitution
|
||||||
|
} from '@/api/think/thinkTrainingInstitution';
|
||||||
|
import type { ThinkTrainingInstitution } from '@/api/think/thinkTrainingInstitution/model';
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean;
|
||||||
|
data?: ThinkTrainingInstitution | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const maxable = ref(true);
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
|
||||||
|
const form = reactive<ThinkTrainingInstitution>({
|
||||||
|
id: undefined,
|
||||||
|
name: undefined,
|
||||||
|
contactName: undefined,
|
||||||
|
contactPhone: undefined,
|
||||||
|
createTime: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请输入机构名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
contactName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请输入联系人',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
contactPhone: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请输入联系方式',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: phoneReg,
|
||||||
|
message: '请输入正确的手机号',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value || loading.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const request = isUpdate.value
|
||||||
|
? updateThinkTrainingInstitution
|
||||||
|
: addThinkTrainingInstitution;
|
||||||
|
request({ ...form })
|
||||||
|
.then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="id"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
:selection="selection"
|
||||||
|
@search="reload"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm title="确定要删除此记录吗?" @confirm="remove(record)">
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<ThinkTrainingInstitutionEdit
|
||||||
|
v-model:visible="showEdit"
|
||||||
|
:data="current"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
ColumnItem,
|
||||||
|
DatasourceFunction
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ThinkTrainingInstitutionEdit from './components/thinkTrainingInstitutionEdit.vue';
|
||||||
|
import {
|
||||||
|
pageThinkTrainingInstitution,
|
||||||
|
removeBatchThinkTrainingInstitution,
|
||||||
|
removeThinkTrainingInstitution
|
||||||
|
} from '@/api/think/thinkTrainingInstitution';
|
||||||
|
import type {
|
||||||
|
ThinkTrainingInstitution,
|
||||||
|
ThinkTrainingInstitutionParam
|
||||||
|
} from '@/api/think/thinkTrainingInstitution/model';
|
||||||
|
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
const selection = ref<ThinkTrainingInstitution[]>([]);
|
||||||
|
const current = ref<ThinkTrainingInstitution | null>(null);
|
||||||
|
const showEdit = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||||
|
return pageThinkTrainingInstitution({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
width: 90,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '机构名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '联系人',
|
||||||
|
dataIndex: 'contactName',
|
||||||
|
key: 'contactName',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '联系方式',
|
||||||
|
dataIndex: 'contactPhone',
|
||||||
|
key: 'contactPhone',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const reload = (where?: ThinkTrainingInstitutionParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where });
|
||||||
|
};
|
||||||
|
|
||||||
|
const openEdit = (row?: ThinkTrainingInstitution) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const remove = (row: ThinkTrainingInstitution) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeThinkTrainingInstitution(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);
|
||||||
|
removeBatchThinkTrainingInstitution(selection.value.map((d) => d.id))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const customRow = (record: ThinkTrainingInstitution) => {
|
||||||
|
return {
|
||||||
|
onClick: () => {
|
||||||
|
selection.value = selection.value;
|
||||||
|
},
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'ThinkTrainingInstitution'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑能刷脸开闸的用户列表' : '添加能刷脸开闸的用户列表'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="" name="uid">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="form.uid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addThinkUserInAccess, updateThinkUserInAccess } from '@/api/think/thinkUserInAccess';
|
||||||
|
import { ThinkUserInAccess } from '@/api/think/thinkUserInAccess/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: ThinkUserInAccess | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<ThinkUserInAccess>({
|
||||||
|
id: undefined,
|
||||||
|
uid: undefined,
|
||||||
|
thinkUserInAccessId: undefined,
|
||||||
|
thinkUserInAccessName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
thinkUserInAccessName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写能刷脸开闸的用户列表名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateThinkUserInAccess : addThinkUserInAccess;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="thinkUserInAccessId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<ThinkUserInAccessEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ThinkUserInAccessEdit from './components/thinkUserInAccessEdit.vue';
|
||||||
|
import { pageThinkUserInAccess, removeThinkUserInAccess, removeBatchThinkUserInAccess } from '@/api/think/thinkUserInAccess';
|
||||||
|
import type { ThinkUserInAccess, ThinkUserInAccessParam } from '@/api/think/thinkUserInAccess/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<ThinkUserInAccess[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<ThinkUserInAccess | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageThinkUserInAccess({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
dataIndex: 'uid',
|
||||||
|
key: 'uid',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ThinkUserInAccessParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: ThinkUserInAccess) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: ThinkUserInAccess) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeThinkUserInAccess(row.thinkUserInAccessId)
|
||||||
|
.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);
|
||||||
|
removeBatchThinkUserInAccess(selection.value.map((d) => d.thinkUserInAccessId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: ThinkUserInAccess) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'ThinkUserInAccess'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="500"
|
||||||
|
:visible="visible"
|
||||||
|
:confirm-loading="loading"
|
||||||
|
title="余额充值"
|
||||||
|
:body-style="{ paddingBottom: '8px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 7, sm: 4, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 17, sm: 20, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="充值金额" name="money">
|
||||||
|
<a-input-number
|
||||||
|
v-model:value="form.money"
|
||||||
|
:min="0.01"
|
||||||
|
:precision="2"
|
||||||
|
placeholder="请输入金额"
|
||||||
|
style="width: 280px"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="备注" name="remark">
|
||||||
|
<a-textarea
|
||||||
|
v-model:value="form.remark"
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
style="width: 280px"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, ref, watch } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue/es';
|
||||||
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import useFormData from '@/utils/use-form-data';
|
||||||
|
import { addUserBalanceLog } from '@/api/shop/userBalanceLog';
|
||||||
|
import type { ThinkUsers } from '@/api/think/thinkUsers/model';
|
||||||
|
|
||||||
|
interface RechargeForm {
|
||||||
|
money?: number;
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean;
|
||||||
|
data?: ThinkUsers | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const { form, resetFields } = useFormData<RechargeForm>({
|
||||||
|
money: undefined,
|
||||||
|
remark: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = reactive<Record<string, Rule[]>>({
|
||||||
|
money: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'number',
|
||||||
|
message: '请输入充值金额',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
remark: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请输入备注',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getCurrentBalance = () => {
|
||||||
|
const balance = Number((props.data as ThinkUsers & { balance?: string })?.balance);
|
||||||
|
if (!Number.isNaN(balance)) {
|
||||||
|
return balance;
|
||||||
|
}
|
||||||
|
return Number(props.data?.money ?? 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value || !props.data?.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
const amount = Number(form.money ?? 0);
|
||||||
|
const currentBalance = getCurrentBalance();
|
||||||
|
loading.value = true;
|
||||||
|
addUserBalanceLog({
|
||||||
|
userId: props.data?.userId,
|
||||||
|
scene: 2,
|
||||||
|
money: String(amount),
|
||||||
|
balance: String(Number((currentBalance + amount).toFixed(2))),
|
||||||
|
remark: form.remark,
|
||||||
|
comments: form.remark,
|
||||||
|
status: 0,
|
||||||
|
deleted: 0
|
||||||
|
})
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (!visible) {
|
||||||
|
resetFields();
|
||||||
|
formRef.value?.clearValidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a>积分充值</a>
|
<a @click="openRecharge(record)" v-if="!!record.userId">余额充值</a>
|
||||||
<!-- <a @click="openEdit(record)">修改</a>-->
|
<!-- <a @click="openEdit(record)">修改</a>-->
|
||||||
<!-- <a-divider type="vertical" />-->
|
<!-- <a-divider type="vertical" />-->
|
||||||
<!-- <a-popconfirm-->
|
<!-- <a-popconfirm-->
|
||||||
@@ -66,6 +66,11 @@
|
|||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<Edit v-model:visible="showEdit" :data="current" @done="reload" />
|
<Edit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
<BalanceRecharge
|
||||||
|
v-model:visible="showRecharge"
|
||||||
|
:data="rechargeCurrent"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -83,6 +88,7 @@
|
|||||||
} 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 Edit from './components/thinkUsersEdit.vue';
|
import Edit from './components/thinkUsersEdit.vue';
|
||||||
|
import BalanceRecharge from './components/balanceRecharge.vue';
|
||||||
import {
|
import {
|
||||||
pageThinkUsers,
|
pageThinkUsers,
|
||||||
removeThinkUsers,
|
removeThinkUsers,
|
||||||
@@ -101,8 +107,12 @@
|
|||||||
const selection = ref<ThinkUsers[]>([]);
|
const selection = ref<ThinkUsers[]>([]);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<ThinkUsers | null>(null);
|
const current = ref<ThinkUsers | null>(null);
|
||||||
|
// 当前充值数据
|
||||||
|
const rechargeCurrent = ref<ThinkUsers | null>(null);
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
|
// 是否显示充值弹窗
|
||||||
|
const showRecharge = ref(false);
|
||||||
// 是否显示批量移动弹窗
|
// 是否显示批量移动弹窗
|
||||||
const showMove = ref(false);
|
const showMove = ref(false);
|
||||||
// 加载状态
|
// 加载状态
|
||||||
@@ -183,8 +193,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '余额',
|
title: '余额',
|
||||||
dataIndex: 'money',
|
dataIndex: 'balance',
|
||||||
key: 'money',
|
key: 'balance',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
sorter: true
|
sorter: true
|
||||||
},
|
},
|
||||||
@@ -254,6 +264,12 @@
|
|||||||
showEdit.value = true;
|
showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 打开充值弹窗 */
|
||||||
|
const openRecharge = (row: ThinkUsers) => {
|
||||||
|
rechargeCurrent.value = row;
|
||||||
|
showRecharge.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
/* 打开批量移动弹窗 */
|
||||||
const openMove = () => {
|
const openMove = () => {
|
||||||
showMove.value = true;
|
showMove.value = true;
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-input
|
||||||
|
v-model:value="where.uid"
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入用户ID"
|
||||||
|
style="width: 180px"
|
||||||
|
@pressEnter="search"
|
||||||
|
/>
|
||||||
|
<a-select
|
||||||
|
v-model:value="where.status"
|
||||||
|
allow-clear
|
||||||
|
placeholder="请选择状态"
|
||||||
|
style="width: 160px"
|
||||||
|
@change="search"
|
||||||
|
>
|
||||||
|
<a-select-option :value="1">生效中</a-select-option>
|
||||||
|
<a-select-option :value="2">已失效</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="search">
|
||||||
|
查询
|
||||||
|
</a-button>
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
<a-button @click="reset">重置</a-button>
|
||||||
|
<a-button danger :disabled="!selection?.length" @click="remove">
|
||||||
|
批量删除
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import useSearch from '@/utils/use-search';
|
||||||
|
import type { ThinkUsersBlackParam } from '@/api/think/thinkUsersBlack/model';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
selection?: unknown[];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: ThinkUsersBlackParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const { where, resetFields } = useSearch<ThinkUsersBlackParam>({
|
||||||
|
id: undefined,
|
||||||
|
uid: undefined,
|
||||||
|
status: undefined,
|
||||||
|
expireTime: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const search = () => {
|
||||||
|
emit('search', {
|
||||||
|
...where
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
const remove = () => {
|
||||||
|
emit('remove');
|
||||||
|
};
|
||||||
|
|
||||||
|
const reset = () => {
|
||||||
|
resetFields();
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="640"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑黑名单' : '添加黑名单'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="
|
||||||
|
styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '100px' }
|
||||||
|
"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 18, sm: 18, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="选择用户" name="uid">
|
||||||
|
<a-space direction="vertical" class="ele-fluid" :size="8">
|
||||||
|
<a-space v-if="selectedUser">
|
||||||
|
<a-tag color="blue">UID:{{ form.uid }}</a-tag>
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
selectedUser.truename || selectedUser.username || '未命名用户'
|
||||||
|
}}
|
||||||
|
/ {{ selectedUser.phone || '未绑定手机号' }}
|
||||||
|
</span>
|
||||||
|
<a-button type="link" @click="clearSelectedUser">清空</a-button>
|
||||||
|
</a-space>
|
||||||
|
<a-button class="ele-fluid" @click="showUserSelect = true">
|
||||||
|
{{ selectedUser ? '重新选择用户' : '按手机号/姓名搜索并选择用户' }}
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="1">生效中</a-radio>
|
||||||
|
<a-radio :value="2">已失效</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="失效时间" name="expireTime">
|
||||||
|
<a-date-picker
|
||||||
|
v-model:value="form.expireTime"
|
||||||
|
show-time
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
placeholder="请选择失效时间"
|
||||||
|
class="ele-fluid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
|
||||||
|
<SelectUserData
|
||||||
|
v-model:visible="showUserSelect"
|
||||||
|
title="按手机号/姓名搜索用户"
|
||||||
|
@done="selectUser"
|
||||||
|
/>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, ref, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject } from 'ele-admin-pro';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import type { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import {
|
||||||
|
addThinkUsersBlack,
|
||||||
|
updateThinkUsersBlack
|
||||||
|
} from '@/api/think/thinkUsersBlack';
|
||||||
|
import { listThinkUsers } from '@/api/think/thinkUsers';
|
||||||
|
import type { ThinkUsersBlack } from '@/api/think/thinkUsersBlack/model';
|
||||||
|
import type { ThinkUsers } from '@/api/think/thinkUsers/model';
|
||||||
|
import SelectUserData from '@/components/ThinkSelectUsers/components/select-data.vue';
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean;
|
||||||
|
data?: ThinkUsersBlack | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const userLoading = ref(false);
|
||||||
|
const maxable = ref(true);
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const showUserSelect = ref(false);
|
||||||
|
const selectedUser = ref<ThinkUsers | null>(null);
|
||||||
|
|
||||||
|
const form = reactive<ThinkUsersBlack>({
|
||||||
|
id: undefined,
|
||||||
|
uid: undefined,
|
||||||
|
status: 1,
|
||||||
|
expireTime: undefined,
|
||||||
|
createTime: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
uid: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'number',
|
||||||
|
message: '请选择用户',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
status: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'number',
|
||||||
|
message: '请选择状态',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectUser = (user: ThinkUsers) => {
|
||||||
|
form.uid = user.id;
|
||||||
|
selectedUser.value = user;
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearSelectedUser = () => {
|
||||||
|
form.uid = undefined;
|
||||||
|
selectedUser.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadSelectedUser = async (uid?: number) => {
|
||||||
|
if (!uid) {
|
||||||
|
selectedUser.value = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
userLoading.value = true;
|
||||||
|
try {
|
||||||
|
const users = await listThinkUsers({
|
||||||
|
id: uid
|
||||||
|
});
|
||||||
|
selectedUser.value = users?.[0] ?? null;
|
||||||
|
} catch (e) {
|
||||||
|
selectedUser.value = null;
|
||||||
|
} finally {
|
||||||
|
userLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value || loading.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const request = isUpdate.value
|
||||||
|
? updateThinkUsersBlack
|
||||||
|
: addThinkUsersBlack;
|
||||||
|
request({ ...form })
|
||||||
|
.then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
async (visible) => {
|
||||||
|
if (visible) {
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
isUpdate.value = true;
|
||||||
|
await loadSelectedUser(props.data.uid);
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
form.status = 1;
|
||||||
|
clearSelectedUser();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
clearSelectedUser();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="id"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
:selection="selection"
|
||||||
|
@search="reload"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 1" color="red">生效中</a-tag>
|
||||||
|
<a-tag v-else-if="record.status === 2" color="green"
|
||||||
|
>已失效</a-tag
|
||||||
|
>
|
||||||
|
<a-tag v-else>未知</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'expireTime'">
|
||||||
|
{{
|
||||||
|
record.expireTime
|
||||||
|
? toDateString(record.expireTime, 'yyyy-MM-dd HH:mm')
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'createTime'">
|
||||||
|
{{
|
||||||
|
record.createTime
|
||||||
|
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm')
|
||||||
|
: '-'
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<ThinkUsersBlackEdit
|
||||||
|
v-model:visible="showEdit"
|
||||||
|
:data="current"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
ColumnItem,
|
||||||
|
DatasourceFunction
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ThinkUsersBlackEdit from './components/thinkUsersBlackEdit.vue';
|
||||||
|
import {
|
||||||
|
pageThinkUsersBlack,
|
||||||
|
removeBatchThinkUsersBlack,
|
||||||
|
removeThinkUsersBlack
|
||||||
|
} from '@/api/think/thinkUsersBlack';
|
||||||
|
import type {
|
||||||
|
ThinkUsersBlack,
|
||||||
|
ThinkUsersBlackParam
|
||||||
|
} from '@/api/think/thinkUsersBlack/model';
|
||||||
|
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
const selection = ref<ThinkUsersBlack[]>([]);
|
||||||
|
const current = ref<ThinkUsersBlack | null>(null);
|
||||||
|
const showEdit = ref(false);
|
||||||
|
|
||||||
|
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||||
|
return pageThinkUsersBlack({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
width: 90,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '姓名',
|
||||||
|
dataIndex: 'truename',
|
||||||
|
key: 'truename',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '手机号',
|
||||||
|
dataIndex: 'phone',
|
||||||
|
key: 'phone',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '失效时间',
|
||||||
|
dataIndex: 'expireTime',
|
||||||
|
key: 'expireTime',
|
||||||
|
align: 'center',
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const reload = (where?: ThinkUsersBlackParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where });
|
||||||
|
};
|
||||||
|
|
||||||
|
const openEdit = (row?: ThinkUsersBlack) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const remove = (row: ThinkUsersBlack) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeThinkUsersBlack(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);
|
||||||
|
removeBatchThinkUsersBlack(selection.value.map((d) => d.id))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const customRow = (record: ThinkUsersBlack) => {
|
||||||
|
return {
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'ThinkUsersBlack'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -4,10 +4,9 @@
|
|||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
row-key="thinkUsersVipId"
|
row-key="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:customRow="customRow"
|
|
||||||
:scroll="{ x: 3000 }"
|
:scroll="{ x: 3000 }"
|
||||||
tool-class="ele-toolbar-form"
|
tool-class="ele-toolbar-form"
|
||||||
class="sys-org-table"
|
class="sys-org-table"
|
||||||
@@ -42,6 +41,82 @@
|
|||||||
</a-tag>
|
</a-tag>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="column.key === 'expireTime'">
|
||||||
|
<a-date-picker
|
||||||
|
show-time
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
:value="formatExpireTime(record.expireTime)"
|
||||||
|
:disabled="expireTimeLoading[record.id || 0]"
|
||||||
|
style="width: 200px"
|
||||||
|
placeholder="请选择到期时间"
|
||||||
|
:allow-clear="false"
|
||||||
|
@change="(value) => changeExpireTime(value, record)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'num'">
|
||||||
|
<a-space>
|
||||||
|
<template v-if="isRemainingEditing(record, 'num')">
|
||||||
|
<a-input
|
||||||
|
type="number"
|
||||||
|
:value="getRemainingDraft(record, 'num')"
|
||||||
|
:disabled="isRemainingLoading(record.id, 'num')"
|
||||||
|
style="width: 90px"
|
||||||
|
@update:value="
|
||||||
|
(value) => setRemainingDraft(record, 'num', value)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<a-button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
:loading="isRemainingLoading(record.id, 'num')"
|
||||||
|
@click="saveRemaining(record, 'num')"
|
||||||
|
>确认</a-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>{{ record.num ?? '-' }}</span>
|
||||||
|
<a-button
|
||||||
|
v-if="hasPermission('think:thinkUsersVip:changeRemain')"
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
@click="editRemaining(record, 'num')"
|
||||||
|
>修改</a-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'remainingMoney'">
|
||||||
|
<a-space>
|
||||||
|
<template v-if="isRemainingEditing(record, 'remainingMoney')">
|
||||||
|
<a-input
|
||||||
|
:value="getRemainingDraft(record, 'remainingMoney')"
|
||||||
|
:disabled="isRemainingLoading(record.id, 'remainingMoney')"
|
||||||
|
style="width: 100px"
|
||||||
|
@update:value="
|
||||||
|
(value) =>
|
||||||
|
setRemainingDraft(record, 'remainingMoney', value)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<a-button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
:loading="isRemainingLoading(record.id, 'remainingMoney')"
|
||||||
|
@click="saveRemaining(record, 'remainingMoney')"
|
||||||
|
>确认</a-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>{{ record.remainingMoney ?? '-' }}</span>
|
||||||
|
<a-button
|
||||||
|
v-if="hasPermission('think:thinkUsersVip:changeRemain')"
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
@click="editRemaining(record, 'remainingMoney')"
|
||||||
|
>修改</a-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a-space v-if="record.status === 1">
|
<a-space v-if="record.status === 1">
|
||||||
<ThinkSelectUsers :id="record.id" @done="changeBindCard" />
|
<ThinkSelectUsers :id="record.id" @done="changeBindCard" />
|
||||||
@@ -70,7 +145,8 @@
|
|||||||
:data="current"
|
:data="current"
|
||||||
@done="reload"
|
@done="reload"
|
||||||
/>
|
/>
|
||||||
<ThinkUsersVipLog v-if="showLog"
|
<ThinkUsersVipLog
|
||||||
|
v-if="showLog"
|
||||||
v-model:visible="showLog"
|
v-model:visible="showLog"
|
||||||
:data="current"
|
:data="current"
|
||||||
@done="reload"
|
@done="reload"
|
||||||
@@ -80,45 +156,49 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { createVNode, ref } from "vue";
|
import { createVNode, reactive, ref } from 'vue';
|
||||||
import { message, Modal } from "ant-design-vue";
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import type { EleProTable } from "ele-admin-pro";
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import { toDateString } from "ele-admin-pro";
|
import { toDateString } from 'ele-admin-pro';
|
||||||
import type {
|
import dayjs from 'dayjs';
|
||||||
|
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 ThinkUsersVipEdit from "./components/thinkUsersVipEdit.vue";
|
import ThinkUsersVipEdit from './components/thinkUsersVipEdit.vue';
|
||||||
import {
|
import {
|
||||||
pageThinkUsersVip,
|
pageThinkUsersVip,
|
||||||
removeThinkUsersVip,
|
removeThinkUsersVip,
|
||||||
removeBatchThinkUsersVip, updateThinkUsersVip
|
removeBatchThinkUsersVip,
|
||||||
} from "@/api/think/thinkUsersVip";
|
updateThinkUsersVip,
|
||||||
import type {
|
updateThinkUsersVipRemaining
|
||||||
|
} from '@/api/think/thinkUsersVip';
|
||||||
|
import type {
|
||||||
ThinkUsersVip,
|
ThinkUsersVip,
|
||||||
ThinkUsersVipParam
|
ThinkUsersVipParam
|
||||||
} from "@/api/think/thinkUsersVip/model";
|
} from '@/api/think/thinkUsersVip/model';
|
||||||
import ThinkUsersVipLog from "@/views/think/thinkUsersVip/components/thinkUsersVipLog.vue";
|
import ThinkUsersVipLog from '@/views/think/thinkUsersVip/components/thinkUsersVipLog.vue';
|
||||||
import { ThinkUsers } from "@/api/think/thinkUsers/model";
|
import { ThinkUsers } from '@/api/think/thinkUsers/model';
|
||||||
|
import { hasPermission } from '@/utils/permission';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const selection = ref<ThinkUsersVip[]>([]);
|
const selection = ref<ThinkUsersVip[]>([]);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<ThinkUsersVip | null>(null);
|
const current = ref<ThinkUsersVip | null>(null);
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = 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,
|
page,
|
||||||
limit,
|
limit,
|
||||||
where,
|
where,
|
||||||
@@ -135,213 +215,332 @@ const datasource: DatasourceFunction = ({
|
|||||||
page,
|
page,
|
||||||
limit
|
limit
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: '操作',
|
||||||
key: "action",
|
key: 'action',
|
||||||
width: 250,
|
width: 250,
|
||||||
fixed: "left",
|
fixed: 'left',
|
||||||
align: "center",
|
align: 'center',
|
||||||
hideInSetting: true
|
hideInSetting: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "手机号码",
|
title: '手机号码',
|
||||||
dataIndex: "phone",
|
dataIndex: 'phone',
|
||||||
key: "phone",
|
key: 'phone',
|
||||||
fixed: "left",
|
fixed: 'left',
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "真实姓名",
|
title: '真实姓名',
|
||||||
dataIndex: "realName",
|
dataIndex: 'realName',
|
||||||
key: "realName",
|
key: 'realName',
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "订单号",
|
title: '订单号',
|
||||||
dataIndex: "wechatOrder",
|
dataIndex: 'wechatOrder',
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "卡号",
|
title: '卡号',
|
||||||
dataIndex: "code",
|
dataIndex: 'code',
|
||||||
key: "code",
|
key: 'code',
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "VIP卡名称",
|
title: 'VIP卡名称',
|
||||||
dataIndex: "name",
|
dataIndex: 'name',
|
||||||
key: "name",
|
key: 'name',
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "可用场馆",
|
title: '可用场馆',
|
||||||
dataIndex: "siteNames",
|
dataIndex: 'siteNames',
|
||||||
key: "siteNames",
|
key: 'siteNames',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "购卡价格",
|
title: '购卡价格',
|
||||||
dataIndex: "price",
|
dataIndex: 'price',
|
||||||
key: "price",
|
key: 'price',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "支付状态",
|
title: '支付状态',
|
||||||
dataIndex: "status",
|
dataIndex: 'status',
|
||||||
key: "status",
|
key: 'status',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
width: 180,
|
width: 180,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "折扣率",
|
title: '购卡时间',
|
||||||
dataIndex: "discount",
|
dataIndex: 'createTime',
|
||||||
key: "discount",
|
key: 'createTime',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center',
|
||||||
|
width: 240,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "可使用次数",
|
title: '到期时间',
|
||||||
dataIndex: "count",
|
dataIndex: 'expireTime',
|
||||||
key: "count",
|
key: 'expireTime',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
width: 240,
|
||||||
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "剩余次数",
|
title: '折扣率',
|
||||||
dataIndex: "num",
|
dataIndex: 'discount',
|
||||||
key: "num",
|
key: 'discount',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "每使用一次减少的金额",
|
title: '可使用次数',
|
||||||
dataIndex: "eachMoney",
|
dataIndex: 'count',
|
||||||
key: "eachMoney",
|
key: 'count',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "剩余金额",
|
title: '剩余次数',
|
||||||
dataIndex: "remainingMoney",
|
dataIndex: 'num',
|
||||||
key: "remainingMoney",
|
key: 'num',
|
||||||
|
width: 190,
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "月限",
|
title: '每使用一次减少的金额',
|
||||||
dataIndex: "month",
|
dataIndex: 'eachMoney',
|
||||||
key: "month",
|
key: 'eachMoney',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "年限",
|
title: '剩余金额',
|
||||||
dataIndex: "term",
|
dataIndex: 'remainingMoney',
|
||||||
key: "term",
|
key: 'remainingMoney',
|
||||||
|
width: 200,
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center"
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "会员卡类型",
|
title: '月限',
|
||||||
dataIndex: "vipType",
|
dataIndex: 'month',
|
||||||
key: "vipType",
|
key: 'month',
|
||||||
align: "center",
|
|
||||||
sorter: true,
|
sorter: true,
|
||||||
customRender: ({ text }) => ["", "特殊VIP卡", "普通VIP卡"][text]
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "卡类型",
|
title: '年限',
|
||||||
dataIndex: "cardType",
|
dataIndex: 'term',
|
||||||
key: "cardType",
|
key: 'term',
|
||||||
align: "center",
|
|
||||||
sorter: true,
|
sorter: true,
|
||||||
customRender: ({ text }) => ["", "成人卡", "儿童卡", "不限"][text]
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "会员卡类型",
|
title: '会员卡类型',
|
||||||
dataIndex: "type",
|
dataIndex: 'vipType',
|
||||||
key: "type",
|
key: 'vipType',
|
||||||
align: "center",
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
customRender: ({ text }) => ['', '特殊VIP卡', '普通VIP卡'][text]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '卡类型',
|
||||||
|
dataIndex: 'cardType',
|
||||||
|
key: 'cardType',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
customRender: ({ text }) => ['', '成人卡', '儿童卡', '不限'][text]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '会员卡类型',
|
||||||
|
dataIndex: 'type',
|
||||||
|
key: 'type',
|
||||||
|
align: 'center',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
customRender: ({ text }) =>
|
customRender: ({ text }) =>
|
||||||
["", "年卡", "次卡", "月卡", "会员VIP", "VIP充值卡"][text]
|
['', '年卡', '次卡', '月卡', '会员VIP', 'VIP充值卡'][text]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "是否赠送积分",
|
title: '是否赠送积分',
|
||||||
dataIndex: "isIntegral",
|
dataIndex: 'isIntegral',
|
||||||
key: "isIntegral",
|
key: 'isIntegral',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center",
|
align: 'center',
|
||||||
customRender: ({ text }) => ["", "赠送", "不赠送"][text]
|
customRender: ({ text }) => ['', '赠送', '不赠送'][text]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "是否已开具发票",
|
title: '是否已开具发票',
|
||||||
dataIndex: "isInvoice",
|
dataIndex: 'isInvoice',
|
||||||
key: "isInvoice",
|
key: 'isInvoice',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: "center",
|
align: 'center',
|
||||||
customRender: ({ text }) => ["", "已开票", "未开票"][text]
|
customRender: ({ text }) => ['', '已开票', '未开票'][text]
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "到期时间",
|
|
||||||
dataIndex: "expireTime",
|
|
||||||
key: "expireTime",
|
|
||||||
sorter: true,
|
|
||||||
align: "center",
|
|
||||||
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "购卡时间",
|
|
||||||
dataIndex: "createTime",
|
|
||||||
key: "createTime",
|
|
||||||
sorter: true,
|
|
||||||
align: "center",
|
|
||||||
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/* 搜索 */
|
const expireTimeLoading = reactive<Record<number, boolean>>({});
|
||||||
const reload = (where?: ThinkUsersVipParam) => {
|
const remainingDrafts = reactive<Record<string, string | number | null>>({});
|
||||||
|
const remainingLoadingKey = ref<string | null>(null);
|
||||||
|
const remainingEditing = reactive<Record<string, boolean>>({});
|
||||||
|
|
||||||
|
const remainingKey = (row: ThinkUsersVip, field: 'num' | 'remainingMoney') =>
|
||||||
|
`${row.id ?? ''}-${field}`;
|
||||||
|
|
||||||
|
const getRemainingDraft = (
|
||||||
|
row: ThinkUsersVip,
|
||||||
|
field: 'num' | 'remainingMoney'
|
||||||
|
) => {
|
||||||
|
const key = remainingKey(row, field);
|
||||||
|
if (!(key in remainingDrafts)) {
|
||||||
|
remainingDrafts[key] =
|
||||||
|
field === 'num' ? row.num ?? 0 : row.remainingMoney ?? '';
|
||||||
|
}
|
||||||
|
return remainingDrafts[key];
|
||||||
|
};
|
||||||
|
|
||||||
|
const setRemainingDraft = (
|
||||||
|
row: ThinkUsersVip,
|
||||||
|
field: 'num' | 'remainingMoney',
|
||||||
|
value: string | number | null
|
||||||
|
) => {
|
||||||
|
remainingDrafts[remainingKey(row, field)] = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const isRemainingEditing = (
|
||||||
|
row: ThinkUsersVip,
|
||||||
|
field: 'num' | 'remainingMoney'
|
||||||
|
) => !!remainingEditing[remainingKey(row, field)];
|
||||||
|
|
||||||
|
const editRemaining = (
|
||||||
|
row: ThinkUsersVip,
|
||||||
|
field: 'num' | 'remainingMoney'
|
||||||
|
) => {
|
||||||
|
if (!hasPermission('think:thinkUsersVip:changeRemain')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getRemainingDraft(row, field);
|
||||||
|
remainingEditing[remainingKey(row, field)] = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const isRemainingLoading = (
|
||||||
|
id: number | undefined,
|
||||||
|
field: 'num' | 'remainingMoney'
|
||||||
|
) => remainingLoadingKey.value === `${id ?? ''}-${field}`;
|
||||||
|
|
||||||
|
const saveRemaining = async (
|
||||||
|
row: ThinkUsersVip,
|
||||||
|
field: 'num' | 'remainingMoney'
|
||||||
|
) => {
|
||||||
|
if (!row.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const value = getRemainingDraft(row, field);
|
||||||
|
if (
|
||||||
|
value === null ||
|
||||||
|
value === '' ||
|
||||||
|
value === undefined ||
|
||||||
|
(field === 'num' &&
|
||||||
|
(!Number.isInteger(Number(value)) || Number(value) < 0))
|
||||||
|
) {
|
||||||
|
message.error(
|
||||||
|
field === 'num' ? '剩余次数必须是非负整数' : '请输入剩余金额'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const key = remainingKey(row, field);
|
||||||
|
remainingLoadingKey.value = key;
|
||||||
|
try {
|
||||||
|
await updateThinkUsersVipRemaining({
|
||||||
|
id: row.id,
|
||||||
|
...(field === 'num'
|
||||||
|
? { num: Number(value) }
|
||||||
|
: { remainingMoney: String(value) })
|
||||||
|
});
|
||||||
|
if (field === 'num') {
|
||||||
|
row.num = Number(value);
|
||||||
|
} else {
|
||||||
|
row.remainingMoney = String(value);
|
||||||
|
}
|
||||||
|
remainingEditing[key] = false;
|
||||||
|
message.success('保存成功');
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(e.message || '保存失败');
|
||||||
|
} finally {
|
||||||
|
remainingLoadingKey.value = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatExpireTime = (value?: number) => {
|
||||||
|
return value
|
||||||
|
? dayjs(value * 1000).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
: undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeExpireTime = async (value: string, row: ThinkUsersVip) => {
|
||||||
|
if (!row.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!value) {
|
||||||
|
message.error('请选择到期时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const expireTime = dayjs(value).unix();
|
||||||
|
if (row.expireTime === expireTime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
expireTimeLoading[row.id] = true;
|
||||||
|
try {
|
||||||
|
await updateThinkUsersVip({
|
||||||
|
id: row.id,
|
||||||
|
expireTime
|
||||||
|
});
|
||||||
|
row.expireTime = expireTime;
|
||||||
|
message.success('到期时间修改成功');
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(e.message || '到期时间修改失败');
|
||||||
|
} finally {
|
||||||
|
expireTimeLoading[row.id] = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ThinkUsersVipParam) => {
|
||||||
selection.value = [];
|
selection.value = [];
|
||||||
tableRef?.value?.reload({ where: where });
|
tableRef?.value?.reload({ where: where });
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
const openEdit = (row?: ThinkUsersVip) => {
|
const openEdit = (row?: ThinkUsersVip) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showEdit.value = true;
|
showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const release = async (row?: ThinkUsersVip) => {
|
const showLog = ref(false);
|
||||||
await updateThinkUsersVip({
|
const openLog = (row?: ThinkUsersVip) => {
|
||||||
id: row?.id,
|
|
||||||
uid: 0
|
|
||||||
});
|
|
||||||
message.success("解绑成功");
|
|
||||||
reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
const showLog = ref(false);
|
|
||||||
const openLog = (row?: ThinkUsersVip) => {
|
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showLog.value = true;
|
showLog.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
/* 打开批量移动弹窗 */
|
||||||
const openMove = () => {
|
const openMove = () => {
|
||||||
showMove.value = true;
|
showMove.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 删除单个 */
|
/* 删除单个 */
|
||||||
const remove = (row: ThinkUsersVip) => {
|
const remove = (row: ThinkUsersVip) => {
|
||||||
const hide = message.loading("请求中..", 0);
|
const hide = message.loading('请求中..', 0);
|
||||||
removeThinkUsersVip(row.id)
|
removeThinkUsersVip(row.id)
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
@@ -352,21 +551,21 @@ const remove = (row: ThinkUsersVip) => {
|
|||||||
hide();
|
hide();
|
||||||
message.error(e.message);
|
message.error(e.message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 批量删除 */
|
/* 批量删除 */
|
||||||
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);
|
||||||
removeBatchThinkUsersVip(selection.value.map((d) => d.id))
|
removeBatchThinkUsersVip(selection.value.map((d) => d.id))
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
@@ -379,45 +578,32 @@ const removeBatch = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 查询 */
|
/* 查询 */
|
||||||
const query = () => {
|
const query = () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeBindCard = (row: ThinkUsers, id: number) => {
|
const changeBindCard = (row: ThinkUsers, id: number) => {
|
||||||
updateThinkUsersVip({
|
updateThinkUsersVip({
|
||||||
id,
|
id,
|
||||||
uid: row.id,
|
uid: row.id,
|
||||||
username: row.truename ?? row.username,
|
username: row.truename ?? row.username,
|
||||||
phone: row.phone
|
phone: row.phone
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
message.success("操作成功");
|
message.success('操作成功');
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ThinkUsersVip) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
query();
|
query();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "ThinkUsersVip"
|
name: 'ThinkUsersVip'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
<style lang="less" scoped></style>
|
||||||
|
|||||||
@@ -30,8 +30,32 @@
|
|||||||
<a-radio-group v-model:value="form.vipType">
|
<a-radio-group v-model:value="form.vipType">
|
||||||
<a-radio :value="1">特殊vip卡</a-radio>
|
<a-radio :value="1">特殊vip卡</a-radio>
|
||||||
<a-radio :value="2">普通vip卡</a-radio>
|
<a-radio :value="2">普通vip卡</a-radio>
|
||||||
|
<a-radio :value="3">培训卡</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item
|
||||||
|
v-if="form.vipType === 3"
|
||||||
|
label="培训机构"
|
||||||
|
name="trainingInstitutionId"
|
||||||
|
>
|
||||||
|
<a-select
|
||||||
|
v-model:value="form.trainingInstitutionId"
|
||||||
|
allow-clear
|
||||||
|
show-search
|
||||||
|
filter-option
|
||||||
|
option-filter-prop="label"
|
||||||
|
placeholder="请选择培训机构"
|
||||||
|
>
|
||||||
|
<a-select-option
|
||||||
|
v-for="item in trainingInstitutionList"
|
||||||
|
:key="item.id"
|
||||||
|
:value="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
>
|
||||||
|
{{ item.name }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item label="卡类型" name="cardType">
|
<a-form-item label="卡类型" name="cardType">
|
||||||
<a-radio-group v-model:value="form.cardType">
|
<a-radio-group v-model:value="form.cardType">
|
||||||
<a-radio :value="1">成人卡</a-radio>
|
<a-radio :value="1">成人卡</a-radio>
|
||||||
@@ -63,8 +87,17 @@
|
|||||||
<ThinkSelectSiteMultiple v-model:value="sites" />
|
<ThinkSelectSiteMultiple v-model:value="sites" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="报表归属场馆" name="reportSid">
|
<a-form-item label="报表归属场馆" name="reportSid">
|
||||||
<a-select v-model:value="form.reportSid" filter-option="label" show-search>
|
<a-select
|
||||||
<a-select-option v-for="item in siteList" :key="item.id" :value="item.id" :label="item.name">
|
v-model:value="form.reportSid"
|
||||||
|
filter-option="label"
|
||||||
|
show-search
|
||||||
|
>
|
||||||
|
<a-select-option
|
||||||
|
v-for="item in siteList"
|
||||||
|
:key="item.id"
|
||||||
|
:value="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
>
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
@@ -142,8 +175,11 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<a-form-item v-else label="过期时间" name="expiredTime">
|
<a-form-item v-else label="过期时间" name="expiredTime">
|
||||||
<a-date-picker v-model:value="form.expiredTime" value-format="YYYY-MM-DD"
|
<a-date-picker
|
||||||
placeholder="请选择过期时间"></a-date-picker>
|
v-model:value="form.expiredTime"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择过期时间"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="排序" name="sort">
|
<a-form-item label="排序" name="sort">
|
||||||
<a-input-number
|
<a-input-number
|
||||||
@@ -157,9 +193,9 @@
|
|||||||
<a-form-item label="特殊卡开发凭证图" name="pic">
|
<a-form-item label="特殊卡开发凭证图" name="pic">
|
||||||
<a-avatar :src="`${IMG_URL}${form.pic}`" :size="120" />
|
<a-avatar :src="`${IMG_URL}${form.pic}`" :size="120" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<!-- <a-form-item label="VIP充值卡价格组" name="prices">-->
|
<!-- <a-form-item label="VIP充值卡价格组" name="prices">-->
|
||||||
<!-- {{ form.prices }}-->
|
<!-- {{ form.prices }}-->
|
||||||
<!-- </a-form-item>-->
|
<!-- </a-form-item>-->
|
||||||
<a-form-item label="是否有效" name="isUse">
|
<a-form-item label="是否有效" name="isUse">
|
||||||
<a-radio-group v-model:value="form.isUse">
|
<a-radio-group v-model:value="form.isUse">
|
||||||
<a-radio :value="1">是</a-radio>
|
<a-radio :value="1">是</a-radio>
|
||||||
@@ -177,50 +213,51 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, watch } from "vue";
|
import { ref, reactive, watch } from 'vue';
|
||||||
import { Form, message } from "ant-design-vue";
|
import { Form, message } from 'ant-design-vue';
|
||||||
import { assignObject, uuid } from "ele-admin-pro";
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
import { addThinkVip, updateThinkVip } from "@/api/think/thinkVip";
|
import { addThinkVip, updateThinkVip } from '@/api/think/thinkVip';
|
||||||
import { ThinkVip } from "@/api/think/thinkVip/model";
|
import { ThinkVip } from '@/api/think/thinkVip/model';
|
||||||
import { useThemeStore } from "@/store/modules/theme";
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from 'pinia';
|
||||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
import { FormInstance } from "ant-design-vue/es/form";
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
import { FileRecord } from "@/api/system/file/model";
|
import { ThinkSite } from '@/api/think/thinkSite/model';
|
||||||
import { ThinkSite } from "@/api/think/thinkSite/model";
|
import { IMG_URL } from '@/config/setting';
|
||||||
import { IMG_URL } from "@/config/setting";
|
import { listThinkSite } from '@/api/think/thinkSite';
|
||||||
import { listThinkSite } from "@/api/think/thinkSite";
|
import { listThinkTrainingInstitution } from '@/api/think/thinkTrainingInstitution';
|
||||||
|
import type { ThinkTrainingInstitution } from '@/api/think/thinkTrainingInstitution/model';
|
||||||
|
|
||||||
// 是否是修改
|
// 是否是修改
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
const useForm = Form.useForm;
|
const useForm = Form.useForm;
|
||||||
// 是否开启响应式布局
|
// 是否开启响应式布局
|
||||||
const themeStore = useThemeStore();
|
const themeStore = useThemeStore();
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
// 弹窗是否打开
|
// 弹窗是否打开
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
// 修改回显的数据
|
// 修改回显的数据
|
||||||
data?: ThinkVip | null;
|
data?: ThinkVip | null;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
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 loading = ref(false);
|
const loading = ref(false);
|
||||||
// 是否显示最大化切换按钮
|
// 是否显示最大化切换按钮
|
||||||
const maxable = ref(true);
|
const maxable = ref(true);
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const formRef = ref<FormInstance | null>(null);
|
const formRef = ref<FormInstance | null>(null);
|
||||||
const images = ref<ItemType[]>([]);
|
const images = ref<ItemType[]>([]);
|
||||||
const sites = ref<ThinkSite[]>([]);
|
const sites = ref<ThinkSite[]>([]);
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const form = reactive<ThinkVip>({
|
const form = reactive<ThinkVip>({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
sid: undefined,
|
sid: undefined,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@@ -238,6 +275,7 @@ const form = reactive<ThinkVip>({
|
|||||||
type: 1,
|
type: 1,
|
||||||
cardType: 1,
|
cardType: 1,
|
||||||
vipType: 2,
|
vipType: 2,
|
||||||
|
trainingInstitutionId: undefined,
|
||||||
pic: undefined,
|
pic: undefined,
|
||||||
prices: undefined,
|
prices: undefined,
|
||||||
isIntegral: 2,
|
isIntegral: 2,
|
||||||
@@ -245,52 +283,122 @@ const form = reactive<ThinkVip>({
|
|||||||
sort: 0,
|
sort: 0,
|
||||||
isSale: 1,
|
isSale: 1,
|
||||||
isUse: undefined,
|
isUse: undefined,
|
||||||
expiredTime: undefined,
|
expiredTime: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 更新visible */
|
/* 更新visible */
|
||||||
const updateVisible = (value: boolean) => {
|
const updateVisible = (value: boolean) => {
|
||||||
emit("update:visible", value);
|
emit('update:visible', value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表单验证规则
|
const isEmptyOrZero = (value: number | string | null | undefined) => {
|
||||||
const rules = reactive({
|
return (
|
||||||
|
value === undefined ||
|
||||||
|
value === null ||
|
||||||
|
value === '' ||
|
||||||
|
Number(value) === 0
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
name: [
|
name: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
type: "string",
|
type: 'string',
|
||||||
message: "请填写名称",
|
message: '请填写名称',
|
||||||
trigger: "blur"
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
price: [
|
price: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请填写价格",
|
message: '请填写价格',
|
||||||
trigger: "blur"
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
renewPrice: [
|
renewPrice: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请填写续卡价格",
|
message: '请填写续卡价格',
|
||||||
trigger: "blur"
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
reportSid: [
|
reportSid: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请选择报表归属场馆",
|
message: '请选择报表归属场馆',
|
||||||
trigger: "blur"
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
term: [
|
||||||
|
{
|
||||||
|
validator: async (
|
||||||
|
_rule: unknown,
|
||||||
|
value: number | string | undefined
|
||||||
|
) => {
|
||||||
|
if (form.mode !== 0) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
if (form.type === 1 && isEmptyOrZero(value)) {
|
||||||
|
return Promise.reject('年卡年限不能为0');
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
month: [
|
||||||
|
{
|
||||||
|
validator: async (
|
||||||
|
_rule: unknown,
|
||||||
|
value: number | string | undefined
|
||||||
|
) => {
|
||||||
|
if (form.mode !== 0) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
if ((form.type === 3 || form.type === 4) && isEmptyOrZero(value)) {
|
||||||
|
return Promise.reject('月卡/季卡月限不能为0');
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
trainingInstitutionId: [
|
||||||
|
{
|
||||||
|
validator: async (_rule: unknown, value: number | undefined) => {
|
||||||
|
if (form.vipType === 3 && !value) {
|
||||||
|
return Promise.reject('请选择培训机构');
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
count: [
|
||||||
|
{
|
||||||
|
validator: async (
|
||||||
|
_rule: unknown,
|
||||||
|
value: number | string | undefined
|
||||||
|
) => {
|
||||||
|
if (
|
||||||
|
form.vipType === 3 &&
|
||||||
|
(value === undefined || value === null || value === '')
|
||||||
|
) {
|
||||||
|
return Promise.reject('培训卡请填写使用次数');
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
});
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
if (!formRef.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -299,13 +407,50 @@ const save = () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
// 字符串数组用逗号相连
|
// 字符串数组用逗号相连
|
||||||
const join = sites.value.map((d) => d.id).join(",");
|
const join = sites.value.map((d) => d.id).join(',');
|
||||||
const formData = {
|
const formData = {
|
||||||
...form,
|
...form,
|
||||||
sid: join
|
sid: join
|
||||||
};
|
};
|
||||||
|
if (formData.vipType !== 3) {
|
||||||
|
formData.trainingInstitutionId = undefined;
|
||||||
|
}
|
||||||
if (formData.mode === 1 && !formData.expiredTime) {
|
if (formData.mode === 1 && !formData.expiredTime) {
|
||||||
message.error("请选择过期时间");
|
loading.value = false;
|
||||||
|
message.error('请选择过期时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
formData.mode === 0 &&
|
||||||
|
formData.type === 1 &&
|
||||||
|
isEmptyOrZero(formData.term)
|
||||||
|
) {
|
||||||
|
loading.value = false;
|
||||||
|
message.error('年卡年限不能为0');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
formData.mode === 0 &&
|
||||||
|
(formData.type === 3 || formData.type === 4) &&
|
||||||
|
isEmptyOrZero(formData.month)
|
||||||
|
) {
|
||||||
|
loading.value = false;
|
||||||
|
message.error('月卡/季卡月限不能为0');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (formData.vipType === 3 && !formData.trainingInstitutionId) {
|
||||||
|
loading.value = false;
|
||||||
|
message.error('请选择培训机构');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
formData.vipType === 3 &&
|
||||||
|
(formData.count === undefined ||
|
||||||
|
formData.count === null ||
|
||||||
|
formData.count === '')
|
||||||
|
) {
|
||||||
|
loading.value = false;
|
||||||
|
message.error('培训卡请填写使用次数');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const saveOrUpdate = isUpdate.value ? updateThinkVip : addThinkVip;
|
const saveOrUpdate = isUpdate.value ? updateThinkVip : addThinkVip;
|
||||||
@@ -314,24 +459,29 @@ const save = () => {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
message.success(msg);
|
message.success(msg);
|
||||||
updateVisible(false);
|
updateVisible(false);
|
||||||
emit("done");
|
emit('done');
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
message.error(e.message);
|
message.error(e.message);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {});
|
||||||
});
|
};
|
||||||
};
|
|
||||||
|
|
||||||
const siteList = ref<ThinkSite[]>([])
|
const siteList = ref<ThinkSite[]>([]);
|
||||||
const getSiteList = async () => {
|
const trainingInstitutionList = ref<ThinkTrainingInstitution[]>([]);
|
||||||
siteList.value = await listThinkSite()
|
const getSiteList = async () => {
|
||||||
};
|
siteList.value = await listThinkSite();
|
||||||
getSiteList()
|
};
|
||||||
|
getSiteList();
|
||||||
|
|
||||||
watch(
|
const getTrainingInstitutionList = async () => {
|
||||||
|
trainingInstitutionList.value = await listThinkTrainingInstitution();
|
||||||
|
};
|
||||||
|
getTrainingInstitutionList();
|
||||||
|
|
||||||
|
watch(
|
||||||
() => props.visible,
|
() => props.visible,
|
||||||
(visible) => {
|
(visible) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@@ -343,11 +493,11 @@ watch(
|
|||||||
images.value.push({
|
images.value.push({
|
||||||
uid: uuid(),
|
uid: uuid(),
|
||||||
url: props.data.image,
|
url: props.data.image,
|
||||||
status: "done"
|
status: 'done'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (props.data.sid) {
|
if (props.data.sid) {
|
||||||
const split = props.data.sid.split(",");
|
const split = props.data.sid.split(',');
|
||||||
split.map((id) => {
|
split.map((id) => {
|
||||||
sites.value.push({
|
sites.value.push({
|
||||||
id: Number(id)
|
id: Number(id)
|
||||||
@@ -363,5 +513,24 @@ watch(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form.vipType,
|
||||||
|
(vipType) => {
|
||||||
|
if (vipType !== 3) {
|
||||||
|
form.trainingInstitutionId = undefined;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
?.validateFields(['trainingInstitutionId', 'count'])
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form.type,
|
||||||
|
() => {
|
||||||
|
formRef.value?.validateFields(['term', 'month']).catch(() => {});
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -230,7 +230,14 @@
|
|||||||
key: 'vipType',
|
key: 'vipType',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ text }) => ['', '特殊VIP卡', '普通VIP卡'][text]
|
customRender: ({ text }) => ['', '特殊VIP卡', '普通VIP卡', '培训卡'][text]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '培训机构',
|
||||||
|
dataIndex: 'trainingInstitutionName',
|
||||||
|
key: 'trainingInstitutionName',
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '卡类型',
|
title: '卡类型',
|
||||||
|
|||||||
Reference in New Issue
Block a user