Compare commits
52 Commits
fad67cdbad
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 50e358cbff | |||
| abfa08a6eb | |||
| a547f9aea7 | |||
| f60b6fb3bf | |||
| 8fdb06162a | |||
| d1b7943e5d | |||
| 061f1cbe48 | |||
| 0dc0941673 | |||
| b108849a10 | |||
| 520fc2bc49 | |||
| ac16fd5329 | |||
| 74068508c0 | |||
| 353916a081 | |||
| ca85df386b | |||
| 0b89185331 | |||
| b38b62b972 | |||
| c7fe19f33c | |||
| d738784730 | |||
| e2f7bfb3c7 | |||
| 2e6004e2ad | |||
| f1d023e7e6 | |||
| ebed9edb64 | |||
| d28226bbf0 | |||
| 7643153d78 | |||
| a6de72d509 | |||
| 743afa8dcd | |||
| 0785373691 | |||
| b933020bf8 | |||
| 633109e67e | |||
| 4b93b4db48 | |||
| e1467999d7 | |||
| 57882b560d | |||
| 040f48759d | |||
| 355eada582 | |||
| 73af733309 | |||
| ce02c6b12e | |||
| e015eaef9e | |||
| 2e81564b92 | |||
| 1d8da2c5be | |||
| a95fa6d95d | |||
| 846e5ba791 | |||
| 513059380b | |||
| dde5f20402 | |||
| f1c3bd199c | |||
| 5090dd1d44 | |||
| 8bc99512fc | |||
| fee67ad271 | |||
| 47288a444c | |||
| c6805c1154 | |||
| 14f90c22c5 | |||
| 4b04b6a670 | |||
| 055e53e06e |
@@ -1,6 +1,6 @@
|
||||
VITE_APP_NAME=后台管理(开发环境)
|
||||
VITE_API_URL=http://127.0.0.1:9200/api
|
||||
#VITE_API_URL=http://127.0.0.1:9200/api
|
||||
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
||||
|
||||
|
||||
#VITE_API_URL=https://cms-api.s209.websoft.top/api
|
||||
#VITE_API_URL=https://glt-api.websoft.top/api
|
||||
|
||||
105
src/api/glt/gltTicketOrder/index.ts
Normal file
105
src/api/glt/gltTicketOrder/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { GltTicketOrder, GltTicketOrderParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询送水订单
|
||||
*/
|
||||
export async function pageGltTicketOrder(params: GltTicketOrderParam) {
|
||||
const res = await request.get<ApiResult<PageResult<GltTicketOrder>>>(
|
||||
'/glt/glt-ticket-order/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询送水订单列表
|
||||
*/
|
||||
export async function listGltTicketOrder(params?: GltTicketOrderParam) {
|
||||
const res = await request.get<ApiResult<GltTicketOrder[]>>(
|
||||
'/glt/glt-ticket-order',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加送水订单
|
||||
*/
|
||||
export async function addGltTicketOrder(data: GltTicketOrder) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-order',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改送水订单
|
||||
*/
|
||||
export async function updateGltTicketOrder(data: GltTicketOrder) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-order',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除送水订单
|
||||
*/
|
||||
export async function removeGltTicketOrder(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-order/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除送水订单
|
||||
*/
|
||||
export async function removeBatchGltTicketOrder(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-order/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询送水订单
|
||||
*/
|
||||
export async function getGltTicketOrder(id: number) {
|
||||
const res = await request.get<ApiResult<GltTicketOrder>>(
|
||||
'/glt/glt-ticket-order/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
80
src/api/glt/gltTicketOrder/model/index.ts
Normal file
80
src/api/glt/gltTicketOrder/model/index.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 送水订单
|
||||
*/
|
||||
export interface GltTicketOrder {
|
||||
//
|
||||
id?: number;
|
||||
// 用户水票ID
|
||||
userTicketId?: number;
|
||||
// 门店ID
|
||||
storeId?: number;
|
||||
// 配送员
|
||||
riderId?: number;
|
||||
// 配送员名称
|
||||
riderName?: string;
|
||||
// 配送员手机号
|
||||
riderPhone?: string;
|
||||
// 仓库ID
|
||||
warehouseId?: number;
|
||||
// 仓库名称
|
||||
warehouseName?: string;
|
||||
// 关联收货地址
|
||||
addressId?: number;
|
||||
// 收货地址
|
||||
address?: string;
|
||||
// 买家留言
|
||||
buyerRemarks?: string;
|
||||
// 用于统计
|
||||
price?: string;
|
||||
// 购买数量
|
||||
totalNum?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 用户昵称
|
||||
nickname?: string;
|
||||
// 用户头像
|
||||
avatar?: string;
|
||||
// 用户手机号
|
||||
phone?: string;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 配送状态:10待配送、20配送中、30待客户确认、40已完成
|
||||
deliveryStatus?: number;
|
||||
// 派送时间(后端可能返回该字段用于派单/出库时间)
|
||||
sendTime?: string;
|
||||
// 送达时间
|
||||
arriveTime?: string;
|
||||
// 签收时间
|
||||
signTime?: string;
|
||||
// 派送完成图片
|
||||
sendEndImg?: string;
|
||||
// 收货确认图片
|
||||
receiveConfirmTime?: string;
|
||||
// 收货确认类型(10手动、20照片、30超时)
|
||||
receiveConfirmType?: number;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
// 订单编号
|
||||
orderNo?: string;
|
||||
orderStatus?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 送水订单搜索条件
|
||||
*/
|
||||
export interface GltTicketOrderParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/glt/gltTicketTemplate/index.ts
Normal file
105
src/api/glt/gltTicketTemplate/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { GltTicketTemplate, GltTicketTemplateParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询水票
|
||||
*/
|
||||
export async function pageGltTicketTemplate(params: GltTicketTemplateParam) {
|
||||
const res = await request.get<ApiResult<PageResult<GltTicketTemplate>>>(
|
||||
'/glt/glt-ticket-template/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询水票列表
|
||||
*/
|
||||
export async function listGltTicketTemplate(params?: GltTicketTemplateParam) {
|
||||
const res = await request.get<ApiResult<GltTicketTemplate[]>>(
|
||||
'/glt/glt-ticket-template',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加水票
|
||||
*/
|
||||
export async function addGltTicketTemplate(data: GltTicketTemplate) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-template',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改水票
|
||||
*/
|
||||
export async function updateGltTicketTemplate(data: GltTicketTemplate) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-template',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除水票
|
||||
*/
|
||||
export async function removeGltTicketTemplate(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-template/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除水票
|
||||
*/
|
||||
export async function removeBatchGltTicketTemplate(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-ticket-template/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询水票
|
||||
*/
|
||||
export async function getGltTicketTemplate(id: number) {
|
||||
const res = await request.get<ApiResult<GltTicketTemplate>>(
|
||||
'/glt/glt-ticket-template/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
55
src/api/glt/gltTicketTemplate/model/index.ts
Normal file
55
src/api/glt/gltTicketTemplate/model/index.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 水票
|
||||
*/
|
||||
export interface GltTicketTemplate {
|
||||
//
|
||||
id?: number;
|
||||
// 关联商品ID
|
||||
goodsId?: number;
|
||||
// 名称
|
||||
name?: string;
|
||||
// 启用
|
||||
enabled?: boolean;
|
||||
// 单位名称
|
||||
unitName?: string;
|
||||
// 最小购买数量
|
||||
minBuyQty?: number;
|
||||
// 起始发送数量
|
||||
startSendQty?: number;
|
||||
// 买赠:买1送4 => gift_multiplier=4
|
||||
giftMultiplier?: number;
|
||||
// 是否把购买量也计入套票总量(默认仅计入赠送量)
|
||||
includeBuyQty?: boolean;
|
||||
// 每期释放数量(默认每月释放10)
|
||||
monthlyReleaseQty?: number;
|
||||
// 总共释放多少期(若配置>0,则按期数平均分摊)
|
||||
releasePeriods?: number;
|
||||
// 首期释放时机:0=支付成功当刻;1=下个月同日
|
||||
firstReleaseMode?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 水票搜索条件
|
||||
*/
|
||||
export interface GltTicketTemplateParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/glt/gltUserTicket/index.ts
Normal file
105
src/api/glt/gltUserTicket/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { GltUserTicket, GltUserTicketParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询我的水票
|
||||
*/
|
||||
export async function pageGltUserTicket(params: GltUserTicketParam) {
|
||||
const res = await request.get<ApiResult<PageResult<GltUserTicket>>>(
|
||||
'/glt/glt-user-ticket/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的水票列表
|
||||
*/
|
||||
export async function listGltUserTicket(params?: GltUserTicketParam) {
|
||||
const res = await request.get<ApiResult<GltUserTicket[]>>(
|
||||
'/glt/glt-user-ticket',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加我的水票
|
||||
*/
|
||||
export async function addGltUserTicket(data: GltUserTicket) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改我的水票
|
||||
*/
|
||||
export async function updateGltUserTicket(data: GltUserTicket) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除我的水票
|
||||
*/
|
||||
export async function removeGltUserTicket(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除我的水票
|
||||
*/
|
||||
export async function removeBatchGltUserTicket(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询我的水票
|
||||
*/
|
||||
export async function getGltUserTicket(id: number) {
|
||||
const res = await request.get<ApiResult<GltUserTicket>>(
|
||||
'/glt/glt-user-ticket/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
55
src/api/glt/gltUserTicket/model/index.ts
Normal file
55
src/api/glt/gltUserTicket/model/index.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 我的水票
|
||||
*/
|
||||
export interface GltUserTicket {
|
||||
//
|
||||
id?: number;
|
||||
// 模板ID
|
||||
templateId?: number;
|
||||
// 商品ID
|
||||
goodsId?: number;
|
||||
// 订单ID
|
||||
orderId?: number;
|
||||
// 订单编号
|
||||
orderNo?: string;
|
||||
// 订单状态
|
||||
orderStatus?: number;
|
||||
// 订单商品ID
|
||||
orderGoodsId?: number;
|
||||
// 总数量
|
||||
totalQty?: number;
|
||||
// 可用数量
|
||||
availableQty?: number;
|
||||
// 冻结数量
|
||||
frozenQty?: number;
|
||||
// 已使用数量
|
||||
usedQty?: number;
|
||||
// 已释放数量
|
||||
releasedQty?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的水票搜索条件
|
||||
*/
|
||||
export interface GltUserTicketParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/glt/gltUserTicketLog/index.ts
Normal file
105
src/api/glt/gltUserTicketLog/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { GltUserTicketLog, GltUserTicketLogParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询消费日志
|
||||
*/
|
||||
export async function pageGltUserTicketLog(params: GltUserTicketLogParam) {
|
||||
const res = await request.get<ApiResult<PageResult<GltUserTicketLog>>>(
|
||||
'/glt/glt-user-ticket-log/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询消费日志列表
|
||||
*/
|
||||
export async function listGltUserTicketLog(params?: GltUserTicketLogParam) {
|
||||
const res = await request.get<ApiResult<GltUserTicketLog[]>>(
|
||||
'/glt/glt-user-ticket-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 addGltUserTicketLog(data: GltUserTicketLog) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-log',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消费日志
|
||||
*/
|
||||
export async function updateGltUserTicketLog(data: GltUserTicketLog) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-log',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消费日志
|
||||
*/
|
||||
export async function removeGltUserTicketLog(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-log/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除消费日志
|
||||
*/
|
||||
export async function removeBatchGltUserTicketLog(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-log/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询消费日志
|
||||
*/
|
||||
export async function getGltUserTicketLog(id: number) {
|
||||
const res = await request.get<ApiResult<GltUserTicketLog>>(
|
||||
'/glt/glt-user-ticket-log/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
53
src/api/glt/gltUserTicketLog/model/index.ts
Normal file
53
src/api/glt/gltUserTicketLog/model/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 消费日志
|
||||
*/
|
||||
export interface GltUserTicketLog {
|
||||
//
|
||||
id?: number;
|
||||
// 用户水票ID
|
||||
userTicketId?: number;
|
||||
// 变更类型
|
||||
changeType?: number;
|
||||
// 可更改
|
||||
changeAvailable?: number;
|
||||
// 更改冻结状态
|
||||
changeFrozen?: number;
|
||||
// 已使用更改
|
||||
changeUsed?: number;
|
||||
// 可用后
|
||||
availableAfter?: number;
|
||||
// 冻结后
|
||||
frozenAfter?: number;
|
||||
// 使用后
|
||||
usedAfter?: number;
|
||||
// 订单ID
|
||||
orderId?: number;
|
||||
// 订单编号
|
||||
orderNo?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费日志搜索条件
|
||||
*/
|
||||
export interface GltUserTicketLogParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/glt/gltUserTicketRelease/index.ts
Normal file
105
src/api/glt/gltUserTicketRelease/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { GltUserTicketRelease, GltUserTicketReleaseParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询水票释放
|
||||
*/
|
||||
export async function pageGltUserTicketRelease(params: GltUserTicketReleaseParam) {
|
||||
const res = await request.get<ApiResult<PageResult<GltUserTicketRelease>>>(
|
||||
'/glt/glt-user-ticket-release/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询水票释放列表
|
||||
*/
|
||||
export async function listGltUserTicketRelease(params?: GltUserTicketReleaseParam) {
|
||||
const res = await request.get<ApiResult<GltUserTicketRelease[]>>(
|
||||
'/glt/glt-user-ticket-release',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加水票释放
|
||||
*/
|
||||
export async function addGltUserTicketRelease(data: GltUserTicketRelease) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-release',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改水票释放
|
||||
*/
|
||||
export async function updateGltUserTicketRelease(data: GltUserTicketRelease) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-release',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除水票释放
|
||||
*/
|
||||
export async function removeGltUserTicketRelease(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-release/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除水票释放
|
||||
*/
|
||||
export async function removeBatchGltUserTicketRelease(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/glt/glt-user-ticket-release/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询水票释放
|
||||
*/
|
||||
export async function getGltUserTicketRelease(id: number) {
|
||||
const res = await request.get<ApiResult<GltUserTicketRelease>>(
|
||||
'/glt/glt-user-ticket-release/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
38
src/api/glt/gltUserTicketRelease/model/index.ts
Normal file
38
src/api/glt/gltUserTicketRelease/model/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 水票释放
|
||||
*/
|
||||
export interface GltUserTicketRelease {
|
||||
//
|
||||
id?: string;
|
||||
// 水票ID
|
||||
userTicketId?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 周期编号
|
||||
periodNo?: number;
|
||||
// 释放数量
|
||||
releaseQty?: number;
|
||||
// 释放时间
|
||||
releaseTime?: string;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 水票释放搜索条件
|
||||
*/
|
||||
export interface GltUserTicketReleaseParam extends PageParam {
|
||||
id?: number;
|
||||
userId?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/shop/shopCommunity/index.ts
Normal file
105
src/api/shop/shopCommunity/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopCommunity, ShopCommunityParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询小区
|
||||
*/
|
||||
export async function pageShopCommunity(params: ShopCommunityParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopCommunity>>>(
|
||||
'/shop/shop-community/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小区列表
|
||||
*/
|
||||
export async function listShopCommunity(params?: ShopCommunityParam) {
|
||||
const res = await request.get<ApiResult<ShopCommunity[]>>(
|
||||
'/shop/shop-community',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小区
|
||||
*/
|
||||
export async function addShopCommunity(data: ShopCommunity) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-community',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小区
|
||||
*/
|
||||
export async function updateShopCommunity(data: ShopCommunity) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-community',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除小区
|
||||
*/
|
||||
export async function removeShopCommunity(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-community/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除小区
|
||||
*/
|
||||
export async function removeBatchShopCommunity(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-community/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询小区
|
||||
*/
|
||||
export async function getShopCommunity(id: number) {
|
||||
const res = await request.get<ApiResult<ShopCommunity>>(
|
||||
'/shop/shop-community/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
35
src/api/shop/shopCommunity/model/index.ts
Normal file
35
src/api/shop/shopCommunity/model/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 小区
|
||||
*/
|
||||
export interface ShopCommunity {
|
||||
// ID
|
||||
id?: number;
|
||||
// 小区名称
|
||||
name?: string;
|
||||
// 小区编号
|
||||
code?: string;
|
||||
// 详细地址
|
||||
address?: string;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小区搜索条件
|
||||
*/
|
||||
export interface ShopCommunityParam extends PageParam {
|
||||
id?: number;
|
||||
name?: string;
|
||||
code?: string;
|
||||
keywords?: string;
|
||||
}
|
||||
@@ -54,6 +54,10 @@ export interface ShopDealerOrder {
|
||||
isSettled?: number;
|
||||
// 结算时间
|
||||
settleTime?: number;
|
||||
// 是否解冻(0否 1是)
|
||||
isUnfreeze?: number;
|
||||
// 解冻时间
|
||||
unfreezeTime?: number;
|
||||
// 订单备注
|
||||
comments?: string;
|
||||
// 商城ID
|
||||
|
||||
@@ -42,6 +42,8 @@ export interface ShopDealerUser {
|
||||
thirdNum?: number;
|
||||
// 专属二维码
|
||||
qrcode?: string;
|
||||
// 配送员所属门店
|
||||
shopName?: string;
|
||||
// 是否删除
|
||||
isDelete?: number;
|
||||
// 租户id
|
||||
|
||||
@@ -44,7 +44,7 @@ export interface ShopGoods {
|
||||
commissionRole?: number;
|
||||
// 货架
|
||||
position?: string;
|
||||
// 进货价
|
||||
// 套餐价格
|
||||
buyingPrice?: string;
|
||||
// 商品价格
|
||||
price?: string;
|
||||
@@ -134,9 +134,11 @@ export interface ShopGoods {
|
||||
firstMoney?: number;
|
||||
secondMoney?: number;
|
||||
thirdMoney?: number;
|
||||
// 一级/二级分红(单位以服务端为准)
|
||||
// 一级/二级分润(单位以服务端为准)
|
||||
firstDividend?: number;
|
||||
secondDividend?: number;
|
||||
// 配送奖金
|
||||
deliveryMoney?: number;
|
||||
}
|
||||
|
||||
export interface BathSet {
|
||||
|
||||
@@ -135,3 +135,18 @@ export async function shopOrderTotal(params?: ShopOrderParam) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请|同意退款
|
||||
*/
|
||||
export async function refundShopOrder(data: ShopOrder) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-order/refund',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ export interface ShopOrder {
|
||||
icCard?: string;
|
||||
// 头像
|
||||
avatar?: string;
|
||||
// 昵称(部分接口会返回)
|
||||
nickname?: string;
|
||||
// 兼容字段:部分接口可能返回 name
|
||||
name?: string;
|
||||
// 真实姓名
|
||||
realName?: string;
|
||||
// 手机号码
|
||||
@@ -99,6 +103,8 @@ export interface ShopOrder {
|
||||
expressId?: number;
|
||||
// 快递公司名称
|
||||
expressName?: string;
|
||||
// 物流单号
|
||||
expressNo?: string;
|
||||
// 发货人
|
||||
sendName?: string;
|
||||
// 发货人联系方式
|
||||
|
||||
105
src/api/shop/shopStore/index.ts
Normal file
105
src/api/shop/shopStore/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopStore, ShopStoreParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询门店
|
||||
*/
|
||||
export async function pageShopStore(params: ShopStoreParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopStore>>>(
|
||||
'/shop/shop-store/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门店列表
|
||||
*/
|
||||
export async function listShopStore(params?: ShopStoreParam) {
|
||||
const res = await request.get<ApiResult<ShopStore[]>>(
|
||||
'/shop/shop-store',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加门店
|
||||
*/
|
||||
export async function addShopStore(data: ShopStore) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-store',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店
|
||||
*/
|
||||
export async function updateShopStore(data: ShopStore) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-store',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除门店
|
||||
*/
|
||||
export async function removeShopStore(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除门店
|
||||
*/
|
||||
export async function removeBatchShopStore(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询门店
|
||||
*/
|
||||
export async function getShopStore(id: number) {
|
||||
const res = await request.get<ApiResult<ShopStore>>(
|
||||
'/shop/shop-store/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
59
src/api/shop/shopStore/model/index.ts
Normal file
59
src/api/shop/shopStore/model/index.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 门店
|
||||
*/
|
||||
export interface ShopStore {
|
||||
// 自增ID
|
||||
id?: number;
|
||||
// 店铺名称
|
||||
name?: string;
|
||||
// 门店地址
|
||||
address?: string;
|
||||
// 手机号码
|
||||
phone?: string;
|
||||
// 邮箱
|
||||
email?: string;
|
||||
// 门店经理
|
||||
managerName?: string;
|
||||
// 门店banner
|
||||
shopBanner?: string;
|
||||
// 所在省份
|
||||
province?: string;
|
||||
// 所在城市
|
||||
city?: string;
|
||||
// 所在辖区
|
||||
region?: string;
|
||||
// 经度和纬度
|
||||
lngAndLat?: string;
|
||||
// 位置
|
||||
location?:string;
|
||||
// 区域
|
||||
district?: string;
|
||||
// 轮廓
|
||||
points?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 是否删除
|
||||
isDelete?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店搜索条件
|
||||
*/
|
||||
export interface ShopStoreParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/shop/shopStoreFence/index.ts
Normal file
105
src/api/shop/shopStoreFence/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopStoreFence, ShopStoreFenceParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询黄家明_电子围栏
|
||||
*/
|
||||
export async function pageShopStoreFence(params: ShopStoreFenceParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopStoreFence>>>(
|
||||
'/shop/shop-store-fence/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询黄家明_电子围栏列表
|
||||
*/
|
||||
export async function listShopStoreFence(params?: ShopStoreFenceParam) {
|
||||
const res = await request.get<ApiResult<ShopStoreFence[]>>(
|
||||
'/shop/shop-store-fence',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加黄家明_电子围栏
|
||||
*/
|
||||
export async function addShopStoreFence(data: ShopStoreFence) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-store-fence',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改黄家明_电子围栏
|
||||
*/
|
||||
export async function updateShopStoreFence(data: ShopStoreFence) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-store-fence',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除黄家明_电子围栏
|
||||
*/
|
||||
export async function removeShopStoreFence(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-fence/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除黄家明_电子围栏
|
||||
*/
|
||||
export async function removeBatchShopStoreFence(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-fence/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询黄家明_电子围栏
|
||||
*/
|
||||
export async function getShopStoreFence(id: number) {
|
||||
const res = await request.get<ApiResult<ShopStoreFence>>(
|
||||
'/shop/shop-store-fence/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
43
src/api/shop/shopStoreFence/model/index.ts
Normal file
43
src/api/shop/shopStoreFence/model/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 黄家明_电子围栏
|
||||
*/
|
||||
export interface ShopStoreFence {
|
||||
// 自增ID
|
||||
id?: number;
|
||||
// 围栏名称
|
||||
name?: string;
|
||||
// 类型 0圆形 1方形
|
||||
type?: number;
|
||||
// 定位
|
||||
location?: string;
|
||||
// 经度
|
||||
longitude?: string;
|
||||
// 纬度
|
||||
latitude?: string;
|
||||
// 区域
|
||||
district?: string;
|
||||
// 电子围栏轮廓
|
||||
points?: string;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 黄家明_电子围栏搜索条件
|
||||
*/
|
||||
export interface ShopStoreFenceParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/shop/shopStoreRider/index.ts
Normal file
105
src/api/shop/shopStoreRider/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopStoreRider, ShopStoreRiderParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询配送员
|
||||
*/
|
||||
export async function pageShopStoreRider(params: ShopStoreRiderParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopStoreRider>>>(
|
||||
'/shop/shop-store-rider/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询配送员列表
|
||||
*/
|
||||
export async function listShopStoreRider(params?: ShopStoreRiderParam) {
|
||||
const res = await request.get<ApiResult<ShopStoreRider[]>>(
|
||||
'/shop/shop-store-rider',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加配送员
|
||||
*/
|
||||
export async function addShopStoreRider(data: ShopStoreRider) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-store-rider',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改配送员
|
||||
*/
|
||||
export async function updateShopStoreRider(data: ShopStoreRider) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-store-rider',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配送员
|
||||
*/
|
||||
export async function removeShopStoreRider(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-rider/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除配送员
|
||||
*/
|
||||
export async function removeBatchShopStoreRider(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-rider/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询配送员
|
||||
*/
|
||||
export async function getShopStoreRider(id: number) {
|
||||
const res = await request.get<ApiResult<ShopStoreRider>>(
|
||||
'/shop/shop-store-rider/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
65
src/api/shop/shopStoreRider/model/index.ts
Normal file
65
src/api/shop/shopStoreRider/model/index.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 配送员
|
||||
*/
|
||||
export interface ShopStoreRider {
|
||||
// 主键ID
|
||||
id?: string;
|
||||
// 门店ID(shop_store.id)
|
||||
storeId?: number;
|
||||
// 门店名称(后端联表返回,提交时可不传)
|
||||
storeName?: string;
|
||||
// 配送点ID(shop_dealer.id)
|
||||
dealerId?: number;
|
||||
// 骑手编号(可选)
|
||||
riderNo?: string;
|
||||
// 姓名
|
||||
realName?: string;
|
||||
// 手机号
|
||||
mobile?: string;
|
||||
// 头像
|
||||
avatar?: string;
|
||||
// 身份证号(可选)
|
||||
idCardNo?: string;
|
||||
// 状态:1启用;0禁用
|
||||
status?: number;
|
||||
// 接单状态:0休息/下线;1在线;2忙碌
|
||||
workStatus?: number;
|
||||
// 是否开启自动派单:1是;0否
|
||||
autoDispatchEnabled?: number;
|
||||
// 派单优先级(同小区多骑手时可用,值越大越优先)
|
||||
dispatchPriority?: number;
|
||||
// 最大同时配送单数(0表示不限制)
|
||||
maxOnhandOrders?: number;
|
||||
// 是否计算工资(提成):1计算;0不计算(如三方配送点可设0)
|
||||
commissionCalcEnabled?: number;
|
||||
// 水每桶提成金额(元/桶)
|
||||
waterBucketUnitFee?: string;
|
||||
// 其他商品提成方式:1按订单固定金额;2按订单金额比例;3按商品规则(另表)
|
||||
otherGoodsCommissionType?: number;
|
||||
// 其他商品提成值:固定金额(元)或比例(%)
|
||||
otherGoodsCommissionValue?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 是否删除
|
||||
isDelete?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配送员搜索条件
|
||||
*/
|
||||
export interface ShopStoreRiderParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/shop/shopStoreUser/index.ts
Normal file
105
src/api/shop/shopStoreUser/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopStoreUser, ShopStoreUserParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询店员
|
||||
*/
|
||||
export async function pageShopStoreUser(params: ShopStoreUserParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopStoreUser>>>(
|
||||
'/shop/shop-store-user/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
*/
|
||||
export async function listShopStoreUser(params?: ShopStoreUserParam) {
|
||||
const res = await request.get<ApiResult<ShopStoreUser[]>>(
|
||||
'/shop/shop-store-user',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加店员
|
||||
*/
|
||||
export async function addShopStoreUser(data: ShopStoreUser) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-store-user',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员
|
||||
*/
|
||||
export async function updateShopStoreUser(data: ShopStoreUser) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-store-user',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店员
|
||||
*/
|
||||
export async function removeShopStoreUser(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-user/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除店员
|
||||
*/
|
||||
export async function removeBatchShopStoreUser(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-user/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询店员
|
||||
*/
|
||||
export async function getShopStoreUser(id: number) {
|
||||
const res = await request.get<ApiResult<ShopStoreUser>>(
|
||||
'/shop/shop-store-user/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
33
src/api/shop/shopStoreUser/model/index.ts
Normal file
33
src/api/shop/shopStoreUser/model/index.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 店员
|
||||
*/
|
||||
export interface ShopStoreUser {
|
||||
// 主键ID
|
||||
id?: number;
|
||||
// 配送点ID(shop_dealer.id)
|
||||
storeId?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 是否删除
|
||||
isDelete?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店员搜索条件
|
||||
*/
|
||||
export interface ShopStoreUserParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
105
src/api/shop/shopStoreWarehouse/index.ts
Normal file
105
src/api/shop/shopStoreWarehouse/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopStoreWarehouse, ShopStoreWarehouseParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询仓库
|
||||
*/
|
||||
export async function pageShopStoreWarehouse(params: ShopStoreWarehouseParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopStoreWarehouse>>>(
|
||||
'/shop/shop-store-warehouse/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仓库列表
|
||||
*/
|
||||
export async function listShopStoreWarehouse(params?: ShopStoreWarehouseParam) {
|
||||
const res = await request.get<ApiResult<ShopStoreWarehouse[]>>(
|
||||
'/shop/shop-store-warehouse',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加仓库
|
||||
*/
|
||||
export async function addShopStoreWarehouse(data: ShopStoreWarehouse) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-store-warehouse',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仓库
|
||||
*/
|
||||
export async function updateShopStoreWarehouse(data: ShopStoreWarehouse) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-store-warehouse',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除仓库
|
||||
*/
|
||||
export async function removeShopStoreWarehouse(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-warehouse/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除仓库
|
||||
*/
|
||||
export async function removeBatchShopStoreWarehouse(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-store-warehouse/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询仓库
|
||||
*/
|
||||
export async function getShopStoreWarehouse(id: number) {
|
||||
const res = await request.get<ApiResult<ShopStoreWarehouse>>(
|
||||
'/shop/shop-store-warehouse/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
51
src/api/shop/shopStoreWarehouse/model/index.ts
Normal file
51
src/api/shop/shopStoreWarehouse/model/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
export interface ShopStoreWarehouse {
|
||||
// 自增ID
|
||||
id?: number;
|
||||
// 仓库名称
|
||||
name?: string;
|
||||
// 唯一标识
|
||||
code?: string;
|
||||
// 类型 中心仓,区域仓,门店仓
|
||||
type?: string;
|
||||
// 仓库地址
|
||||
address?: string;
|
||||
// 真实姓名
|
||||
realName?: string;
|
||||
// 联系电话
|
||||
phone?: string;
|
||||
// 所在省份
|
||||
province?: string;
|
||||
// 所在城市
|
||||
city?: string;
|
||||
// 所在辖区
|
||||
region?: string;
|
||||
// 经纬度
|
||||
lngAndLat?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 是否删除
|
||||
isDelete?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 仓库搜索条件
|
||||
*/
|
||||
export interface ShopStoreWarehouseParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
@@ -30,6 +30,10 @@ export interface UserVerify {
|
||||
sfz2?: string;
|
||||
// 机构名称
|
||||
organizationName?: string;
|
||||
// 操作员
|
||||
adminId?: number;
|
||||
// 操作员名称
|
||||
adminName?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0在线, 1离线
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
showSearch?: boolean;
|
||||
}>(),
|
||||
{
|
||||
showSearch: true
|
||||
showSearch: false
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
126
src/components/SelectCommunity/components/select-data.vue
Normal file
126
src/components/SelectCommunity/components/select-data.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="750"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="title"
|
||||
:footer="null"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="userId"
|
||||
:datasource="datasource"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-space>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="where.keywords"
|
||||
placeholder="请输入搜索关键词"
|
||||
style="width: 200px"
|
||||
@search="reload"
|
||||
@pressEnter="reload"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'roles'">
|
||||
<a-tag v-for="(item, index) in record.roles" :key="index">{{
|
||||
item.roleName
|
||||
}}</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="done(record)">选择</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import {
|
||||
ColumnItem,
|
||||
DatasourceFunction
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { EleProTable } from 'ele-admin-pro';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { pageShopCommunity } from "@/api/shop/shopCommunity";
|
||||
import { ShopDealerUser } from "@/api/shop/shopDealerUser/model";
|
||||
import {ShopCommunityParam} from "@/api/shop/shopCommunity/model";
|
||||
|
||||
defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
title?: string;
|
||||
// 修改回显的数据
|
||||
data?: ShopDealerUser | null;
|
||||
type?: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', data: ShopDealerUser): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<ShopCommunityParam>({
|
||||
userId: undefined,
|
||||
name: undefined,
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'id'
|
||||
},
|
||||
{
|
||||
title: '小区名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
where.type = 1;
|
||||
return pageShopCommunity({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = () => {
|
||||
tableRef?.value?.reload({ page: 1, where });
|
||||
};
|
||||
|
||||
const done = (record: ShopDealerUser) => {
|
||||
updateVisible(false);
|
||||
emit('done', record);
|
||||
};
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
71
src/components/SelectCommunity/index.vue
Normal file
71
src/components/SelectCommunity/index.vue
Normal file
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-input-group compact>
|
||||
<a-input
|
||||
disabled
|
||||
style="width: calc(100% - 32px)"
|
||||
v-model:value="content"
|
||||
:placeholder="placeholder"
|
||||
/>
|
||||
<a-button @click="openEdit">
|
||||
<template #icon><BulbOutlined class="ele-text-warning" /></template>
|
||||
</a-button>
|
||||
</a-input-group>
|
||||
<!-- 选择弹窗 -->
|
||||
<select-data
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:title="placeholder"
|
||||
:type="type"
|
||||
@done="onChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BulbOutlined } from '@ant-design/icons-vue';
|
||||
import { ref } from 'vue';
|
||||
import SelectData from './components/select-data.vue';
|
||||
import { User } from '@/api/system/user/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: any;
|
||||
placeholder?: string;
|
||||
index?: number;
|
||||
type?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择'
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', User): void;
|
||||
(e: 'clear'): void;
|
||||
}>();
|
||||
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<User | null>(null);
|
||||
const content = ref<any>();
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: User) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const onChange = (row) => {
|
||||
console.log(row,'sdfsd111')
|
||||
row.index = Number(props.index);
|
||||
emit('done', row);
|
||||
};
|
||||
|
||||
if (props.value) {
|
||||
content.value = props.value;
|
||||
}
|
||||
// 查询租户列表
|
||||
// const appList = ref<App[] | undefined>([]);
|
||||
</script>
|
||||
106
src/components/SelectShopStore/components/select-data.vue
Normal file
106
src/components/SelectShopStore/components/select-data.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="title"
|
||||
:footer="null"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:datasource="datasource"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-space>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="where.keywords"
|
||||
placeholder="请输入门店关键词"
|
||||
style="width: 240px"
|
||||
@search="reload"
|
||||
@pressEnter="reload"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="done(record)">选择</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import type {
|
||||
ColumnItem,
|
||||
DatasourceFunction
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { EleProTable } from 'ele-admin-pro';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { pageShopStore } from '@/api/shop/shopStore';
|
||||
import type { ShopStoreParam } from '@/api/shop/shopStore/model';
|
||||
import type { ShopStore } from '@/api/shop/shopStore/model';
|
||||
|
||||
defineProps<{
|
||||
visible: boolean;
|
||||
title?: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', data: ShopStore): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
const { where } = useSearch<ShopStoreParam>({
|
||||
id: undefined,
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{ title: 'ID', dataIndex: 'id', width: 90 },
|
||||
{ title: '门店名称', dataIndex: 'name' },
|
||||
{ title: '电话', dataIndex: 'phone', width: 160 },
|
||||
{ title: '地址', dataIndex: 'address' },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
return pageShopStore({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
tableRef?.value?.reload({ page: 1, where: where as ShopStoreParam });
|
||||
};
|
||||
|
||||
const done = (record: ShopStore) => {
|
||||
updateVisible(false);
|
||||
emit('done', record);
|
||||
};
|
||||
</script>
|
||||
|
||||
63
src/components/SelectShopStore/index.vue
Normal file
63
src/components/SelectShopStore/index.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-input-group compact>
|
||||
<a-input
|
||||
disabled
|
||||
style="width: calc(100% - 32px)"
|
||||
v-model:value="content"
|
||||
:placeholder="placeholder"
|
||||
/>
|
||||
<a-button @click="openEdit">
|
||||
<template #icon><BulbOutlined class="ele-text-warning" /></template>
|
||||
</a-button>
|
||||
</a-input-group>
|
||||
<!-- 选择弹窗 -->
|
||||
<SelectData
|
||||
v-model:visible="showEdit"
|
||||
:title="placeholder"
|
||||
@done="onChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BulbOutlined } from '@ant-design/icons-vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import SelectData from './components/select-data.vue';
|
||||
import type { ShopStore } from '@/api/shop/shopStore/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '选择门店'
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', data?: ShopStore): void;
|
||||
(e: 'clear'): void;
|
||||
}>();
|
||||
|
||||
const showEdit = ref(false);
|
||||
const content = ref<string>(props.value ?? '');
|
||||
|
||||
const openEdit = () => {
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const onChange = (row?: ShopStore) => {
|
||||
showEdit.value = false;
|
||||
emit('done', row);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
(v) => {
|
||||
content.value = v ?? '';
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from '@/api/system/chat';
|
||||
import { emitter } from '@/utils/common';
|
||||
|
||||
const SOCKET_URL = 'wss://server.websoft.top';
|
||||
const SOCKET_URL = 'wss://glt-server.websoft.top';
|
||||
|
||||
interface ConnectionOptions {
|
||||
token: string;
|
||||
|
||||
@@ -654,14 +654,12 @@
|
||||
hasTakeGift: undefined,
|
||||
checkBill: undefined,
|
||||
isSettled: undefined,
|
||||
version: undefined,
|
||||
userId: undefined,
|
||||
comments: undefined,
|
||||
sortNumber: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
updateTime: undefined,
|
||||
createTime: undefined,
|
||||
version: undefined,
|
||||
userId: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
updateTime: undefined,
|
||||
createTime: undefined,
|
||||
cmsOrderId: undefined,
|
||||
cmsOrderName: '',
|
||||
status: 0,
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'pdfUrl'">
|
||||
<a-button type="primary" @click="openUrl(record.pdfUrl)">立即下载</a-button>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
@@ -76,7 +79,7 @@
|
||||
import router from '@/router';
|
||||
import { toTreeData } from 'ele-admin-pro';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import { detail, getPageTitle } from '@/utils/common';
|
||||
import {detail, getPageTitle, openUrl} from '@/utils/common';
|
||||
import { listCmsNavigation } from '@/api/cms/cmsNavigation';
|
||||
import { CmsNavigation } from '@/api/cms/cmsNavigation/model';
|
||||
import { CmsArticleCategory } from '@/api/cms/cmsArticleCategory/model';
|
||||
@@ -138,10 +141,15 @@
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '文章标题',
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
key: 'title'
|
||||
},
|
||||
{
|
||||
title: '立即下载',
|
||||
dataIndex: 'pdfUrl',
|
||||
key: 'pdfUrl'
|
||||
},
|
||||
// {
|
||||
// title: '栏目名称',
|
||||
// dataIndex: 'categoryName',
|
||||
@@ -201,9 +209,7 @@
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd'),
|
||||
sorter: true
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
}
|
||||
// {
|
||||
// title: '操作',
|
||||
@@ -309,7 +315,7 @@
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
openEdit(record);
|
||||
// openEdit(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
|
||||
252
src/views/glt/gltTicketOrder/components/gltTicketOrderEdit.vue
Normal file
252
src/views/glt/gltTicketOrder/components/gltTicketOrderEdit.vue
Normal file
@@ -0,0 +1,252 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="userTicketId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用户水票ID"
|
||||
v-model:value="form.userTicketId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="门店ID" name="storeId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入门店ID"
|
||||
v-model:value="form.storeId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="配送员" name="riderId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入配送员"
|
||||
v-model:value="form.riderId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="仓库ID" name="warehouseId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入仓库ID"
|
||||
v-model:value="form.warehouseId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="关联收货地址" name="addressId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入关联收货地址"
|
||||
v-model:value="form.addressId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="收货地址" name="address">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入收货地址"
|
||||
v-model:value="form.address"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="买家留言" name="buyerRemarks">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入买家留言"
|
||||
v-model:value="form.buyerRemarks"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="用于统计" name="price">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用于统计"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="购买数量" name="totalNum">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入购买数量"
|
||||
v-model:value="form.totalNum"
|
||||
/>
|
||||
</a-form-item>
|
||||
<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="订单编号" name="orderNo">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单编号"
|
||||
v-model:value="form.orderNo"
|
||||
/>
|
||||
</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="状态" 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>
|
||||
</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 { addGltTicketOrder, updateGltTicketOrder } from '@/api/glt/gltTicketOrder';
|
||||
import { GltTicketOrder } from '@/api/glt/gltTicketOrder/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?: GltTicketOrder | 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<GltTicketOrder>({
|
||||
id: undefined,
|
||||
userTicketId: undefined,
|
||||
storeId: undefined,
|
||||
riderId: undefined,
|
||||
warehouseId: undefined,
|
||||
addressId: undefined,
|
||||
address: undefined,
|
||||
buyerRemarks: undefined,
|
||||
price: undefined,
|
||||
totalNum: undefined,
|
||||
userId: undefined,
|
||||
status: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
orderNo: undefined,
|
||||
orderCode: undefined,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
gltTicketOrderName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写送水订单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form,
|
||||
orderCode: form.orderNo
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateGltTicketOrder : addGltTicketOrder;
|
||||
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>
|
||||
51
src/views/glt/gltTicketOrder/components/search.vue
Normal file
51
src/views/glt/gltTicketOrder/components/search.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="用户ID|订单编号"
|
||||
style="width: 240px"
|
||||
v-model:value="where.keywords"
|
||||
@search="reload"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {watch} from 'vue';
|
||||
import useSearch from "@/utils/use-search";
|
||||
import {GltUserTicketParam} from "@/api/glt/gltUserTicket/model";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GltUserTicketParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const {where} = useSearch<GltUserTicketParam>({
|
||||
keywords: '',
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {
|
||||
}
|
||||
);
|
||||
</script>
|
||||
540
src/views/glt/gltTicketOrder/index.vue
Normal file
540
src/views/glt/gltTicketOrder/index.vue
Normal file
@@ -0,0 +1,540 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key ==='nickname'">
|
||||
<a-space>
|
||||
<a-avatar :src="record.avatar" />
|
||||
<div class="flex flex-col">
|
||||
<div class="font-bold">{{ record.nickname }}</div>
|
||||
<div class="text-gray-400">订单编号:{{ record.orderNo }}</div>
|
||||
<div class="text-gray-400">送货地址:{{ record.address }}</div>
|
||||
<div class="text-blue-400">联系电话:{{ record.phone }}</div>
|
||||
<div class="text-gray-400">买家留言:{{ record.buyerRemarks }}</div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'storeName'">
|
||||
<a-space>
|
||||
<div class="flex flex-col">
|
||||
<div class="font-bold">{{ record.storeName }}</div>
|
||||
<div class="text-gray-400">门店地址:{{ record.storeAddress }}</div>
|
||||
<div class="text-blue-400">门店电话:{{ record.storePhone }}</div>
|
||||
<div class="text-gray-400">仓库地址:{{ record.warehouseAddress }}</div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'riderName'">
|
||||
<a-space>
|
||||
<div class="flex flex-col">
|
||||
<div class="text-gray-400">配送时间:{{ formatDay(record.sendTime) || '-'}}</div>
|
||||
<div class="text-gray-400 flex justify-between" style="min-width: 224px">
|
||||
配送人员:{{ record.riderName || '-' }}
|
||||
<a-tag
|
||||
color="blue"
|
||||
class="cursor-pointer"
|
||||
@click.stop="openAssign(record)"
|
||||
>
|
||||
指派
|
||||
</a-tag>
|
||||
</div>
|
||||
<div class="text-blue-400">联系电话:{{ record.riderPhone || '-' }}</div>
|
||||
<div class="text-gray-400">留档图片:<a-image :src="record.sendEndImg" v-if="record.sendEndImg" :width="50" /></div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag :color="getOrderStatus(record).color">
|
||||
{{ getOrderStatus(record).label }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderStatus'">
|
||||
<a-space :size="6" wrap>
|
||||
<!-- 订单状态 -->
|
||||
<a-tag v-if="record.orderStatus === 0">未完成</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 1" color="green"
|
||||
>已完成</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 2">已关闭</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 3" color="red"
|
||||
>关闭中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 4" color="red"
|
||||
>退款申请中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 5" color="red"
|
||||
>退款被拒绝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 6" color="orange"
|
||||
>已退款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 7" color="pink"
|
||||
>客户端申请退款</a-tag
|
||||
>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'totalNum'">
|
||||
<div class="text-gray-800 text-3xl">{{ record.totalNum }}</div>
|
||||
</template>
|
||||
<template v-if="column.key ==='times'">
|
||||
<a-space>
|
||||
<div class="flex flex-col">
|
||||
<div class="text-gray-400">
|
||||
下单时间:{{ formatTime(getOrderTimes(record).orderTime) }}
|
||||
</div>
|
||||
<div class="text-gray-400">
|
||||
派送时间:{{ formatTime(getOrderTimes(record).sendTime) }}
|
||||
</div>
|
||||
<div class="text-gray-400">
|
||||
送达时间:{{ formatTime(getOrderTimes(record).arriveTime) }}
|
||||
</div>
|
||||
<div class="text-gray-400">
|
||||
签收时间:{{ formatTime(getOrderTimes(record).signTime) }}
|
||||
</div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<!-- <a @click="openEdit(record)">修改</a>-->
|
||||
<!-- <a-divider type="vertical" />-->
|
||||
<a-popconfirm
|
||||
v-if="record.orderStatus == 6"
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 指派弹窗 -->
|
||||
<a-modal
|
||||
v-model:visible="assignVisible"
|
||||
title="指派配送人员"
|
||||
:confirm-loading="assignConfirmLoading"
|
||||
:maskClosable="false"
|
||||
width="520px"
|
||||
@ok="submitAssign"
|
||||
@cancel="closeAssign"
|
||||
>
|
||||
<a-form
|
||||
ref="assignFormRef"
|
||||
:model="assignForm"
|
||||
:rules="assignRules"
|
||||
:label-col="{ span: 6 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<a-form-item label="当前配送员">
|
||||
<span>
|
||||
{{ assignRow?.riderName || '-' }}
|
||||
<span v-if="assignRow?.riderPhone" class="text-gray-400">
|
||||
({{ assignRow?.riderPhone }})
|
||||
</span>
|
||||
</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="新配送员" name="riderId">
|
||||
<a-select
|
||||
v-model:value="assignForm.riderId"
|
||||
placeholder="请选择配送人员"
|
||||
show-search
|
||||
allow-clear
|
||||
:loading="riderLoading"
|
||||
option-filter-prop="label"
|
||||
:filter-option="filterRiderOption"
|
||||
:options="riderOptions"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<GltTicketOrderEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, createVNode, reactive, 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 {getPageTitle} from '@/utils/common';
|
||||
import GltTicketOrderEdit from './components/gltTicketOrderEdit.vue';
|
||||
import { pageGltTicketOrder, removeGltTicketOrder, removeBatchGltTicketOrder, getGltTicketOrder, updateGltTicketOrder } from '@/api/glt/gltTicketOrder';
|
||||
import type { GltTicketOrder, GltTicketOrderParam } from '@/api/glt/gltTicketOrder/model';
|
||||
import { listShopStoreRider } from '@/api/shop/shopStoreRider';
|
||||
import type { ShopStoreRider } from '@/api/shop/shopStoreRider/model';
|
||||
import type { FormInstance } from 'ant-design-vue/es/form';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<GltTicketOrder[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<GltTicketOrder | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
|
||||
/* 指派配送员 */
|
||||
const assignVisible = ref(false);
|
||||
const assignConfirmLoading = ref(false);
|
||||
const riderLoading = ref(false);
|
||||
const riderList = ref<ShopStoreRider[]>([]);
|
||||
const assignRow = ref<GltTicketOrder | null>(null);
|
||||
const assignFormRef = ref<FormInstance | null>(null);
|
||||
const assignForm = reactive<{ riderId: string | number | undefined }>({
|
||||
riderId: undefined
|
||||
});
|
||||
const assignRules = reactive({
|
||||
riderId: [{ required: true, message: '请选择配送人员', trigger: 'change' }]
|
||||
});
|
||||
|
||||
const filterRiderOption = (input: string, option: any) => {
|
||||
const label = String(option?.label ?? '');
|
||||
return label.toLowerCase().includes(input.toLowerCase());
|
||||
};
|
||||
|
||||
const riderOptions = computed(() => {
|
||||
const currentRiderId = assignRow.value?.riderId;
|
||||
return (riderList.value || []).map((r) => {
|
||||
const label = `${r.realName || '-'}${r.mobile ? `(${r.mobile})` : ''}`;
|
||||
return {
|
||||
value: r.userId,
|
||||
label,
|
||||
disabled:
|
||||
r.status === 0 ||
|
||||
(currentRiderId != null && String(r.userId ?? '') === String(currentRiderId))
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
const loadRiders = async (row: GltTicketOrder) => {
|
||||
riderLoading.value = true;
|
||||
try {
|
||||
// 优先按配送点/门店过滤;若后端不支持或字段不匹配,可回退到全量列表
|
||||
const dealerId = (row as any).dealerId ?? row.storeId;
|
||||
const data = await listShopStoreRider(
|
||||
dealerId != null ? ({ dealerId } as any) : undefined
|
||||
);
|
||||
riderList.value = data || [];
|
||||
if (!riderList.value.length) {
|
||||
riderList.value = (await listShopStoreRider()) || [];
|
||||
}
|
||||
} catch (e: any) {
|
||||
message.error(e.message);
|
||||
riderList.value = [];
|
||||
} finally {
|
||||
riderLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const openAssign = (row: GltTicketOrder) => {
|
||||
assignRow.value = row;
|
||||
assignForm.riderId = undefined;
|
||||
assignVisible.value = true;
|
||||
loadRiders(row);
|
||||
};
|
||||
|
||||
const closeAssign = () => {
|
||||
assignVisible.value = false;
|
||||
assignRow.value = null;
|
||||
assignForm.riderId = undefined;
|
||||
};
|
||||
|
||||
const submitAssign = async () => {
|
||||
if (!assignFormRef.value || !assignRow.value?.id) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await assignFormRef.value.validate();
|
||||
const nextRiderId = assignForm.riderId;
|
||||
if (nextRiderId == null) {
|
||||
return;
|
||||
}
|
||||
if (String(nextRiderId) === String(assignRow.value.riderId ?? '')) {
|
||||
message.error('请选择其他配送人员');
|
||||
return;
|
||||
}
|
||||
assignConfirmLoading.value = true;
|
||||
|
||||
// 先取详情再更新,避免后端 PUT 语义为“全量覆盖”导致字段被清空
|
||||
const detail = await getGltTicketOrder(assignRow.value.id);
|
||||
const normalizedRiderId =
|
||||
typeof nextRiderId === 'string'
|
||||
? Number.isNaN(Number(nextRiderId))
|
||||
? nextRiderId
|
||||
: Number(nextRiderId)
|
||||
: nextRiderId;
|
||||
const payload: GltTicketOrder = {
|
||||
...(detail as any),
|
||||
id: assignRow.value.id,
|
||||
riderId: normalizedRiderId as any
|
||||
};
|
||||
const msg = await updateGltTicketOrder(payload);
|
||||
message.success(msg);
|
||||
closeAssign();
|
||||
reload();
|
||||
} catch (e: any) {
|
||||
// 表单校验失败时 e 可能不是 Error
|
||||
if (e?.message) {
|
||||
message.error(e.message);
|
||||
}
|
||||
} finally {
|
||||
assignConfirmLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/* 状态&时间:按你的规则派生(配送时间不为空=已派送、送达时间不为空=已送达、签收时间不为空=已签收) */
|
||||
const pickTime = (record: any, keys: string[]) => {
|
||||
for (const k of keys) {
|
||||
const v = record?.[k];
|
||||
if (v) return v as string;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const getOrderTimes = (record: any) => {
|
||||
return {
|
||||
orderTime: pickTime(record, ['createTime', 'orderTime']),
|
||||
sendTime: pickTime(record, ['sendTime', 'dispatchTime']),
|
||||
arriveTime: pickTime(record, ['arriveTime', 'deliveredTime']),
|
||||
signTime: pickTime(record, ['signTime', 'signedTime', 'receiveTime'])
|
||||
};
|
||||
};
|
||||
|
||||
const formatTime = (value?: string) => {
|
||||
return value ? toDateString(value, 'yyyy-MM-dd HH:mm:ss') : '-';
|
||||
};
|
||||
|
||||
const formatDay = (value?: string) => {
|
||||
return value ? toDateString(value, 'yyyy-MM-dd') : '-';
|
||||
};
|
||||
|
||||
const getOrderStatus = (record: any) => {
|
||||
const { sendTime, arriveTime, signTime } = getOrderTimes(record);
|
||||
if (signTime) return { value: 3, label: '已签收', color: 'red' };
|
||||
if (arriveTime) return { value: 2, label: '已送达', color: 'orange' };
|
||||
if (sendTime) return { value: 1, label: '已派送', color: 'blue' };
|
||||
// 兼容后端只返回 status、不返回时间的情况
|
||||
if (record?.status === 3) return { value: 3, label: '已签收', color: 'red' };
|
||||
if (record?.status === 2) return { value: 2, label: '已送达', color: 'orange' };
|
||||
if (record?.status === 1) return { value: 1, label: '已派送', color: 'blue' };
|
||||
return { value: 0, label: '待配送', color: 'green' };
|
||||
};
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageGltTicketOrder({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '票号',
|
||||
dataIndex: 'userTicketId',
|
||||
key: 'userTicketId',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '订水用户',
|
||||
dataIndex: 'nickname',
|
||||
key: 'nickname'
|
||||
},
|
||||
// {
|
||||
// title: '送货地址',
|
||||
// dataIndex: 'address',
|
||||
// key: 'address'
|
||||
// },
|
||||
{
|
||||
title: '下单门店',
|
||||
dataIndex: 'storeName',
|
||||
key: 'storeName'
|
||||
},
|
||||
{
|
||||
title: '配送信息',
|
||||
dataIndex: 'riderName',
|
||||
key: 'riderName'
|
||||
},
|
||||
{
|
||||
title: '送水数量(桶)',
|
||||
dataIndex: 'totalNum',
|
||||
key: 'totalNum',
|
||||
align: 'center',
|
||||
width: 120
|
||||
},
|
||||
// {
|
||||
// title: '买家留言',
|
||||
// dataIndex: 'buyerRemarks',
|
||||
// key: 'buyerRemarks'
|
||||
// },
|
||||
// {
|
||||
// title: '用于统计',
|
||||
// dataIndex: 'price',
|
||||
// key: 'price'
|
||||
// },
|
||||
// {
|
||||
// title: '备注',
|
||||
// dataIndex: 'comments',
|
||||
// key: 'comments',
|
||||
// ellipsis: true
|
||||
// },
|
||||
{
|
||||
title: '时间节点',
|
||||
dataIndex: 'createTime',
|
||||
key: 'times',
|
||||
width: 260,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
dataIndex: 'orderStatus',
|
||||
key: 'orderStatus',
|
||||
align: 'center',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 90,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: GltTicketOrderParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: GltTicketOrder) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: GltTicketOrder) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeGltTicketOrder(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);
|
||||
removeBatchGltTicketOrder(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: GltTicketOrder) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
// openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'GltTicketOrder'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -0,0 +1,461 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="70%"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:confirm-loading="loading"
|
||||
:title="isUpdate ? '规则设置' : '添加水票'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 6, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-divider orientation="left">
|
||||
<span style="color: #1890ff; font-weight: 600">基本信息</span>
|
||||
</a-divider>
|
||||
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="关联商品" name="goodsId">
|
||||
<a-select
|
||||
v-model:value="form.goodsId"
|
||||
placeholder="请选择关联商品"
|
||||
show-search
|
||||
:filter-option="false"
|
||||
:loading="goodsLoading"
|
||||
@search="searchGoods"
|
||||
@change="onGoodsChange"
|
||||
@dropdown-visible-change="onDropdownVisibleChange"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="goods in goodsList"
|
||||
:key="goods.goodsId"
|
||||
:value="goods.goodsId"
|
||||
>
|
||||
<div class="goods-option">
|
||||
<span>{{ goods.name }}</span>
|
||||
<a-tag color="blue" style="margin-left: 8px"
|
||||
>¥{{ goods.price || 0 }}</a-tag
|
||||
>
|
||||
</div>
|
||||
</a-select-option>
|
||||
<a-select-option v-if="goodsList.length === 0" disabled>
|
||||
<div style="text-align: center; color: #999">
|
||||
{{ goodsLoading ? '加载中...' : '暂无商品数据' }}
|
||||
</div>
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="水票名称" name="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="50"
|
||||
placeholder="请输入水票名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="启用" name="enabled">
|
||||
<a-switch
|
||||
v-model:checked="form.enabled"
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="单位名称" name="unitName">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="如:桶/张/次"
|
||||
v-model:value="form.unitName"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24" v-if="selectedGoods">
|
||||
<a-form-item label="已选商品">
|
||||
<a-space>
|
||||
<span>{{ selectedGoods.name }}</span>
|
||||
<a-tag color="blue">¥{{ selectedGoods.price || 0 }}</a-tag>
|
||||
<a-tag v-if="selectedGoods.goodsId" color="default"
|
||||
>ID: {{ selectedGoods.goodsId }}</a-tag
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-divider orientation="left">
|
||||
<span style="color: #1890ff; font-weight: 600">发放规则</span>
|
||||
</a-divider>
|
||||
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="最小购买数量" name="minBuyQty">
|
||||
<a-input-number
|
||||
:min="1"
|
||||
:max="999999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入最小购买数量"
|
||||
v-model:value="form.minBuyQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="起始发送数量" name="startSendQty">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="999999"
|
||||
class="ele-fluid"
|
||||
placeholder="支付成功后起始发放数量"
|
||||
v-model:value="form.startSendQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="买赠倍率" name="giftMultiplier">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="999999"
|
||||
class="ele-fluid"
|
||||
placeholder="买1送4 => 4"
|
||||
v-model:value="form.giftMultiplier"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="购买数量是否算赠送" name="includeBuyQty">
|
||||
<a-switch
|
||||
v-model:checked="form.includeBuyQty"
|
||||
checked-children="是"
|
||||
un-checked-children="否"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="释放期数(高优先级)" name="releasePeriods">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="999999"
|
||||
class="ele-fluid"
|
||||
placeholder=">0则按期数平均分摊"
|
||||
v-model:value="form.releasePeriods"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="每期释放数量(低优先级)" name="monthlyReleaseQty">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="999999"
|
||||
class="ele-fluid"
|
||||
placeholder="默认每月释放10"
|
||||
v-model:value="form.monthlyReleaseQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="首期释放时机" name="firstReleaseMode">
|
||||
<a-radio-group v-model:value="form.firstReleaseMode">
|
||||
<a-radio :value="0">支付成功当刻</a-radio>
|
||||
<a-radio :value="1">下个月同日</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<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-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入备注"
|
||||
v-model:value="form.comments"
|
||||
show-count
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import {
|
||||
addGltTicketTemplate,
|
||||
updateGltTicketTemplate
|
||||
} from '@/api/glt/gltTicketTemplate';
|
||||
import type { GltTicketTemplate } from '@/api/glt/gltTicketTemplate/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { listShopGoods, getShopGoods } from '@/api/shop/shopGoods';
|
||||
import type { ShopGoods } from '@/api/shop/shopGoods/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: GltTicketTemplate | 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 defaultForm: GltTicketTemplate = {
|
||||
id: undefined,
|
||||
goodsId: undefined,
|
||||
name: '',
|
||||
enabled: true,
|
||||
unitName: '',
|
||||
minBuyQty: 1,
|
||||
startSendQty: 0,
|
||||
giftMultiplier: 0,
|
||||
includeBuyQty: false,
|
||||
monthlyReleaseQty: 10,
|
||||
releasePeriods: 0,
|
||||
firstReleaseMode: 0,
|
||||
userId: undefined,
|
||||
sortNumber: 100,
|
||||
comments: '',
|
||||
status: 0,
|
||||
deleted: 0,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
|
||||
// 表单数据
|
||||
const form = reactive<GltTicketTemplate>({ ...defaultForm });
|
||||
|
||||
// 商品列表/选中商品(参考 shopGiftEdit.vue 的关联商品功能)
|
||||
const goodsList = ref<ShopGoods[]>([]);
|
||||
const goodsLoading = ref(false);
|
||||
const selectedGoods = ref<ShopGoods | null>(null);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
goodsId: [{ required: true, message: '请选择关联商品', trigger: 'change' }],
|
||||
name: [
|
||||
{ required: true, message: '请输入水票名称', trigger: 'blur' },
|
||||
{ min: 2, max: 50, message: '名称长度应在2-50个字符之间', trigger: 'blur' }
|
||||
]
|
||||
});
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
const normalizeBoolean = (v: any, fallback = false): boolean => {
|
||||
if (v === true || v === false) return v;
|
||||
// Spring/Jackson Boolean only accepts true/false; never send "1"/"0".
|
||||
if (v === 1 || v === '1' || v === 'true') return true;
|
||||
if (v === 0 || v === '0' || v === 'false') return false;
|
||||
return fallback;
|
||||
};
|
||||
|
||||
const normalizeNumber = (v: any): number | undefined => {
|
||||
if (v === undefined || v === null || v === '') return undefined;
|
||||
const n = Number(v);
|
||||
return Number.isFinite(n) ? n : undefined;
|
||||
};
|
||||
|
||||
const normalizeFormTypes = () => {
|
||||
form.goodsId = normalizeNumber(form.goodsId);
|
||||
form.enabled = normalizeBoolean(form.enabled, true);
|
||||
form.includeBuyQty = normalizeBoolean(form.includeBuyQty, false);
|
||||
form.minBuyQty = normalizeNumber(form.minBuyQty) ?? 1;
|
||||
form.startSendQty = normalizeNumber(form.startSendQty) ?? 0;
|
||||
form.giftMultiplier = normalizeNumber(form.giftMultiplier) ?? 0;
|
||||
form.monthlyReleaseQty = normalizeNumber(form.monthlyReleaseQty) ?? 10;
|
||||
form.releasePeriods = normalizeNumber(form.releasePeriods) ?? 0;
|
||||
form.firstReleaseMode = normalizeNumber(form.firstReleaseMode) ?? 0;
|
||||
form.sortNumber = normalizeNumber(form.sortNumber) ?? 100;
|
||||
};
|
||||
|
||||
const ensureSelectedGoodsLoaded = async (goodsId?: number) => {
|
||||
if (!goodsId) {
|
||||
selectedGoods.value = null;
|
||||
return;
|
||||
}
|
||||
const hit = goodsList.value.find((g) => g.goodsId === goodsId);
|
||||
if (hit) {
|
||||
selectedGoods.value = hit;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const goods = await getShopGoods(goodsId);
|
||||
if (goods) {
|
||||
goodsList.value = [goods, ...goodsList.value];
|
||||
selectedGoods.value = goods;
|
||||
}
|
||||
} catch {
|
||||
selectedGoods.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
const getGoodsList = async () => {
|
||||
if (goodsLoading.value) return;
|
||||
goodsLoading.value = true;
|
||||
try {
|
||||
const res = await listShopGoods({ limit: 50 });
|
||||
goodsList.value = res || [];
|
||||
} catch {
|
||||
goodsList.value = [];
|
||||
} finally {
|
||||
goodsLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/* 搜索商品 */
|
||||
const searchGoods = async (value: string) => {
|
||||
const keywords = value?.trim();
|
||||
if (!keywords) return;
|
||||
|
||||
goodsLoading.value = true;
|
||||
try {
|
||||
const res = await listShopGoods({ keywords, limit: 50 });
|
||||
goodsList.value = res || [];
|
||||
} catch {
|
||||
goodsList.value = [];
|
||||
} finally {
|
||||
goodsLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/* 下拉框显示状态改变 */
|
||||
const onDropdownVisibleChange = (open: boolean) => {
|
||||
if (open && goodsList.value.length === 0) {
|
||||
getGoodsList();
|
||||
}
|
||||
};
|
||||
|
||||
/* 商品选择改变 */
|
||||
const onGoodsChange = (goodsId: number) => {
|
||||
const hit = goodsList.value.find((g) => g.goodsId === goodsId) || null;
|
||||
selectedGoods.value = hit;
|
||||
if (!hit) {
|
||||
ensureSelectedGoodsLoaded(goodsId);
|
||||
}
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) return;
|
||||
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
normalizeFormTypes();
|
||||
loading.value = true;
|
||||
const formData: GltTicketTemplate = { ...form };
|
||||
const saveOrUpdate = isUpdate.value
|
||||
? updateGltTicketTemplate
|
||||
: addGltTicketTemplate;
|
||||
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,
|
||||
async (visible) => {
|
||||
if (visible) {
|
||||
await getGoodsList();
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
normalizeFormTypes();
|
||||
await ensureSelectedGoodsLoaded(form.goodsId);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
Object.assign(form, { ...defaultForm });
|
||||
selectedGoods.value = null;
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
selectedGoods.value = null;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.goods-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
span {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
42
src/views/glt/gltTicketTemplate/components/search.vue
Normal file
42
src/views/glt/gltTicketTemplate/components/search.vue
Normal file
@@ -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>
|
||||
281
src/views/glt/gltTicketTemplate/index.vue
Normal file
281
src/views/glt/gltTicketTemplate/index.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
: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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<GltTicketTemplateEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, computed } 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 {getPageTitle} from '@/utils/common';
|
||||
import GltTicketTemplateEdit from './components/gltTicketTemplateEdit.vue';
|
||||
import { pageGltTicketTemplate, removeGltTicketTemplate, removeBatchGltTicketTemplate } from '@/api/glt/gltTicketTemplate';
|
||||
import type { GltTicketTemplate, GltTicketTemplateParam } from '@/api/glt/gltTicketTemplate/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<GltTicketTemplate[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<GltTicketTemplate | 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 pageGltTicketTemplate({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '关联商品',
|
||||
dataIndex: 'goodsId',
|
||||
key: 'goodsId'
|
||||
},
|
||||
{
|
||||
title: '模板',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '单位名称',
|
||||
dataIndex: 'unitName',
|
||||
key: 'unitName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '最小购买数',
|
||||
dataIndex: 'minBuyQty',
|
||||
key: 'minBuyQty',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '起始发送数',
|
||||
// dataIndex: 'startSendQty',
|
||||
// key: 'startSendQty',
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '买赠',
|
||||
dataIndex: 'giftMultiplier',
|
||||
key: 'giftMultiplier',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '是否把购买量也计入套票总量',
|
||||
// dataIndex: 'includeBuyQty',
|
||||
// key: 'includeBuyQty',
|
||||
// width: 120
|
||||
// },
|
||||
{
|
||||
title: '每期释放量',
|
||||
dataIndex: 'monthlyReleaseQty',
|
||||
key: 'monthlyReleaseQty',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '总释期数',
|
||||
dataIndex: 'releasePeriods',
|
||||
key: 'releasePeriods',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '首期释放',
|
||||
// dataIndex: 'firstReleaseMode',
|
||||
// key: 'firstReleaseMode',
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'enabled',
|
||||
key: 'enabled',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => (text === 1 ? '禁用' : '启用')
|
||||
},
|
||||
// {
|
||||
// title: '备注',
|
||||
// dataIndex: 'comments',
|
||||
// key: 'comments',
|
||||
// ellipsis: true
|
||||
// },
|
||||
// {
|
||||
// title: '创建时间',
|
||||
// dataIndex: 'createTime',
|
||||
// key: 'createTime',
|
||||
// width: 200,
|
||||
// align: 'center',
|
||||
// sorter: true,
|
||||
// ellipsis: true,
|
||||
// customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
// },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: GltTicketTemplateParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: GltTicketTemplate) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: GltTicketTemplate) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeGltTicketTemplate(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);
|
||||
removeBatchGltTicketTemplate(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: GltTicketTemplate) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'GltTicketTemplate'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
262
src/views/glt/gltUserTicket/components/gltUserTicketEdit.vue
Normal file
262
src/views/glt/gltUserTicket/components/gltUserTicketEdit.vue
Normal file
@@ -0,0 +1,262 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="templateId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入模板ID"
|
||||
v-model:value="form.templateId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="商品ID" name="goodsId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入商品ID"
|
||||
v-model:value="form.goodsId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="订单ID" name="orderId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单ID"
|
||||
v-model:value="form.orderId"
|
||||
/>
|
||||
</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="订单商品ID" name="orderGoodsId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单商品ID"
|
||||
v-model:value="form.orderGoodsId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="总数量" name="totalQty">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入总数量"
|
||||
v-model:value="form.totalQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="可用数量" name="availableQty">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入可用数量"
|
||||
v-model:value="form.availableQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="冻结数量" name="frozenQty">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入冻结数量"
|
||||
v-model:value="form.frozenQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="已使用数量" name="usedQty">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入已使用数量"
|
||||
v-model:value="form.usedQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="已释放数量" name="releasedQty">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入已释放数量"
|
||||
v-model:value="form.releasedQty"
|
||||
/>
|
||||
</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="状态" 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>
|
||||
</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 { addGltUserTicket, updateGltUserTicket } from '@/api/glt/gltUserTicket';
|
||||
import { GltUserTicket } from '@/api/glt/gltUserTicket/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?: GltUserTicket | 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<GltUserTicket>({
|
||||
id: undefined,
|
||||
templateId: undefined,
|
||||
goodsId: undefined,
|
||||
orderId: undefined,
|
||||
orderNo: undefined,
|
||||
orderGoodsId: undefined,
|
||||
totalQty: undefined,
|
||||
availableQty: undefined,
|
||||
frozenQty: undefined,
|
||||
usedQty: undefined,
|
||||
releasedQty: undefined,
|
||||
userId: undefined,
|
||||
sortNumber: undefined,
|
||||
comments: undefined,
|
||||
status: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
gltUserTicketId: undefined,
|
||||
gltUserTicketName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
gltUserTicketName: [
|
||||
{
|
||||
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 ? updateGltUserTicket : addGltUserTicket;
|
||||
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>
|
||||
50
src/views/glt/gltUserTicket/components/search.vue
Normal file
50
src/views/glt/gltUserTicket/components/search.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="用户ID|订单编号"
|
||||
style="width: 240px"
|
||||
v-model:value="where.keywords"
|
||||
@search="reload"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import useSearch from "@/utils/use-search";
|
||||
import {GltUserTicketParam} from "@/api/glt/gltUserTicket/model";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GltUserTicketParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<GltUserTicketParam>({
|
||||
keywords: '',
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
326
src/views/glt/gltUserTicket/index.vue
Normal file
326
src/views/glt/gltUserTicket/index.vue
Normal file
@@ -0,0 +1,326 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
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 === 'nickname'">
|
||||
<a-space>
|
||||
<a-avatar :src="record.avatar" />
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<span>{{ record.nickname }}</span>
|
||||
<span class="text-gray-400">(ID:{{ record.userId }})</span>
|
||||
</div>
|
||||
<div><span class="text-gray-400">{{ record.phone }}</span></div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderGoodsQty'">
|
||||
{{ record.orderGoodsQty }}
|
||||
</template>
|
||||
<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 === 'orderStatus'">
|
||||
<a-space :size="6" wrap>
|
||||
<!-- 订单状态 -->
|
||||
<a-tag v-if="record.orderStatus === 0">未完成</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 1" color="green"
|
||||
>已完成</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 2">已关闭</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 3" color="red"
|
||||
>关闭中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 4" color="red"
|
||||
>退款申请中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 5" color="red"
|
||||
>退款被拒绝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 6" color="orange"
|
||||
>已退款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 7" color="pink"
|
||||
>客户端申请退款</a-tag
|
||||
>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<!-- <a @click="openEdit(record)">修改</a>-->
|
||||
<!-- <a-divider type="vertical" />-->
|
||||
<a-popconfirm
|
||||
v-if="record.orderStatus == 6"
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<GltUserTicketEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</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 {getPageTitle} from '@/utils/common';
|
||||
import GltUserTicketEdit from './components/gltUserTicketEdit.vue';
|
||||
import { pageGltUserTicket, removeGltUserTicket, removeBatchGltUserTicket } from '@/api/glt/gltUserTicket';
|
||||
import type { GltUserTicket, GltUserTicketParam } from '@/api/glt/gltUserTicket/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<GltUserTicket[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<GltUserTicket | 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 pageGltUserTicket({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '票号',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '用户信息',
|
||||
dataIndex: 'nickname',
|
||||
key: 'nickname',
|
||||
width: 280
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'templateName',
|
||||
key: 'templateName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '订单号',
|
||||
dataIndex: 'orderNo',
|
||||
key: 'orderNo',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '金额',
|
||||
dataIndex: 'payPrice',
|
||||
key: 'payPrice',
|
||||
align: 'center',
|
||||
customRender: ({ text }) => `¥${text.toFixed(2)}`
|
||||
},
|
||||
{
|
||||
title: '购买数量',
|
||||
dataIndex: 'orderGoodsQty',
|
||||
key: 'orderGoodsQty',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '总数量',
|
||||
dataIndex: 'totalQty',
|
||||
key: 'totalQty',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '可配送',
|
||||
dataIndex: 'availableQty',
|
||||
key: 'availableQty',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '待赠送',
|
||||
dataIndex: 'frozenQty',
|
||||
key: 'frozenQty',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '已使用',
|
||||
dataIndex: 'usedQty',
|
||||
key: 'usedQty',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '已释放',
|
||||
dataIndex: 'releasedQty',
|
||||
key: 'releasedQty',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '排序',
|
||||
// dataIndex: 'sortNumber',
|
||||
// key: 'sortNumber',
|
||||
// },
|
||||
{
|
||||
title: '订单状态',
|
||||
dataIndex: 'orderStatus',
|
||||
key: 'orderStatus',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 90,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: GltUserTicketParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: GltUserTicket) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: GltUserTicket) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeGltUserTicket(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);
|
||||
removeBatchGltUserTicket(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: GltUserTicket) => {
|
||||
// return {
|
||||
// // 行点击事件
|
||||
// onClick: () => {
|
||||
// // console.log(record);
|
||||
// },
|
||||
// // 行双击事件
|
||||
// onDblclick: () => {
|
||||
// openEdit(record);
|
||||
// }
|
||||
// };
|
||||
// };
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'GltUserTicket'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -0,0 +1,292 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="userTicketId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用户水票ID"
|
||||
v-model:value="form.userTicketId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="变更类型" name="changeType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入变更类型"
|
||||
v-model:value="form.changeType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="可更改" name="changeAvailable">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入可更改"
|
||||
v-model:value="form.changeAvailable"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="更改冻结状态" name="changeFrozen">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入更改冻结状态"
|
||||
v-model:value="form.changeFrozen"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="已使用更改" name="changeUsed">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入已使用更改"
|
||||
v-model:value="form.changeUsed"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="可用后" name="availableAfter">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入可用后"
|
||||
v-model:value="form.availableAfter"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="冻结后" name="frozenAfter">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入冻结后"
|
||||
v-model:value="form.frozenAfter"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="使用后" name="usedAfter">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入使用后"
|
||||
v-model:value="form.usedAfter"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="订单ID" name="orderId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单ID"
|
||||
v-model:value="form.orderId"
|
||||
/>
|
||||
</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="用户ID" name="userId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用户ID"
|
||||
v-model:value="form.userId"
|
||||
/>
|
||||
</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 { addGltUserTicketLog, updateGltUserTicketLog } from '@/api/glt/gltUserTicketLog';
|
||||
import { GltUserTicketLog } from '@/api/glt/gltUserTicketLog/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?: GltUserTicketLog | 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<GltUserTicketLog>({
|
||||
id: undefined,
|
||||
userTicketId: undefined,
|
||||
changeType: undefined,
|
||||
changeAvailable: undefined,
|
||||
changeFrozen: undefined,
|
||||
changeUsed: undefined,
|
||||
availableAfter: undefined,
|
||||
frozenAfter: undefined,
|
||||
usedAfter: undefined,
|
||||
orderId: undefined,
|
||||
orderNo: undefined,
|
||||
userId: undefined,
|
||||
sortNumber: undefined,
|
||||
comments: undefined,
|
||||
status: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
gltUserTicketLogId: undefined,
|
||||
gltUserTicketLogName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
gltUserTicketLogName: [
|
||||
{
|
||||
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 ? updateGltUserTicketLog : addGltUserTicketLog;
|
||||
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>
|
||||
48
src/views/glt/gltUserTicketLog/components/search.vue
Normal file
48
src/views/glt/gltUserTicketLog/components/search.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="用户ID|订单编号"
|
||||
style="width: 240px"
|
||||
v-model:value="where.keywords"
|
||||
@search="reload"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import useSearch from "@/utils/use-search";
|
||||
import {GltUserTicketLogParam} from "@/api/glt/gltUserTicketLog/model";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GltUserTicketLogParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<GltUserTicketLogParam>({
|
||||
keywords: '',
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
280
src/views/glt/gltUserTicketLog/index.vue
Normal file
280
src/views/glt/gltUserTicketLog/index.vue
Normal file
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<a-space>
|
||||
<a-avatar :src="record.avatar" />
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<span>{{ record.nickname }}</span>
|
||||
<span class="text-gray-400">(ID:{{ record.userId }})</span>
|
||||
</div>
|
||||
<div><span class="text-gray-400">{{ record.phone }}</span></div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<GltUserTicketLogEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</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 {getPageTitle} from '@/utils/common';
|
||||
import GltUserTicketLogEdit from './components/gltUserTicketLogEdit.vue';
|
||||
import { pageGltUserTicketLog, removeGltUserTicketLog, removeBatchGltUserTicketLog } from '@/api/glt/gltUserTicketLog';
|
||||
import type { GltUserTicketLog, GltUserTicketLogParam } from '@/api/glt/gltUserTicketLog/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<GltUserTicketLog[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<GltUserTicketLog | 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 pageGltUserTicketLog({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '票号',
|
||||
dataIndex: 'userTicketId',
|
||||
key: 'userTicketId',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '用户信息',
|
||||
dataIndex: 'nickname',
|
||||
key: 'nickname',
|
||||
width: 280
|
||||
},
|
||||
// {
|
||||
// title: '名称',
|
||||
// dataIndex: 'templateName',
|
||||
// key: 'templateName',
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '变更类型',
|
||||
dataIndex: 'changeType',
|
||||
key: 'changeType',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '可更改',
|
||||
dataIndex: 'changeAvailable',
|
||||
key: 'changeAvailable',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '更改冻结状态',
|
||||
dataIndex: 'changeFrozen',
|
||||
key: 'changeFrozen',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '已使用更改',
|
||||
dataIndex: 'changeUsed',
|
||||
key: 'changeUsed',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '可用后',
|
||||
dataIndex: 'availableAfter',
|
||||
key: 'availableAfter',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '冻结后',
|
||||
dataIndex: 'frozenAfter',
|
||||
key: 'frozenAfter',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '使用后',
|
||||
dataIndex: 'usedAfter',
|
||||
key: 'usedAfter',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '核销时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
// {
|
||||
// title: '操作',
|
||||
// key: 'action',
|
||||
// width: 180,
|
||||
// fixed: 'right',
|
||||
// align: 'center',
|
||||
// hideInSetting: true
|
||||
// }
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: GltUserTicketLogParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: GltUserTicketLog) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: GltUserTicketLog) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeGltUserTicketLog(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);
|
||||
removeBatchGltUserTicketLog(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: GltUserTicketLog) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'GltUserTicketLog'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -0,0 +1,225 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="userTicketId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入水票ID"
|
||||
v-model:value="form.userTicketId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<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="周期编号" name="periodNo">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入周期编号"
|
||||
v-model:value="form.periodNo"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="释放数量" name="releaseQty">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入释放数量"
|
||||
v-model:value="form.releaseQty"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="释放时间" name="releaseTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入释放时间"
|
||||
v-model:value="form.releaseTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="状态" 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 { addGltUserTicketRelease, updateGltUserTicketRelease } from '@/api/glt/gltUserTicketRelease';
|
||||
import { GltUserTicketRelease } from '@/api/glt/gltUserTicketRelease/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?: GltUserTicketRelease | 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<GltUserTicketRelease>({
|
||||
id: undefined,
|
||||
userTicketId: undefined,
|
||||
userId: undefined,
|
||||
periodNo: undefined,
|
||||
releaseQty: undefined,
|
||||
releaseTime: undefined,
|
||||
status: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
gltUserTicketReleaseId: undefined,
|
||||
gltUserTicketReleaseName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
gltUserTicketReleaseName: [
|
||||
{
|
||||
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 ? updateGltUserTicketRelease : addGltUserTicketRelease;
|
||||
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>
|
||||
49
src/views/glt/gltUserTicketRelease/components/search.vue
Normal file
49
src/views/glt/gltUserTicketRelease/components/search.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="用户ID|订单编号"
|
||||
style="width: 240px"
|
||||
v-model:value="where.keywords"
|
||||
@search="reload"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import useSearch from "@/utils/use-search";
|
||||
import {GltUserTicketReleaseParam} from "@/api/glt/gltUserTicketRelease/model";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GltUserTicketReleaseParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<GltUserTicketReleaseParam>({
|
||||
keywords: '',
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
258
src/views/glt/gltUserTicketRelease/index.vue
Normal file
258
src/views/glt/gltUserTicketRelease/index.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<a-space>
|
||||
<a-avatar :src="record.avatar" />
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<span>{{ record.nickname }}</span>
|
||||
<span class="text-gray-400">(ID:{{ record.userId }})</span>
|
||||
</div>
|
||||
<div><span class="text-gray-400">{{ record.phone }}</span></div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<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">未释放</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="green">已完成</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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<GltUserTicketReleaseEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, computed } 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 {getPageTitle} from '@/utils/common';
|
||||
import GltUserTicketReleaseEdit from './components/gltUserTicketReleaseEdit.vue';
|
||||
import { pageGltUserTicketRelease, removeGltUserTicketRelease, removeBatchGltUserTicketRelease } from '@/api/glt/gltUserTicketRelease';
|
||||
import type { GltUserTicketRelease, GltUserTicketReleaseParam } from '@/api/glt/gltUserTicketRelease/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<GltUserTicketRelease[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<GltUserTicketRelease | 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 pageGltUserTicketRelease({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '票号',
|
||||
dataIndex: 'userTicketId',
|
||||
key: 'userTicketId',
|
||||
width: 90
|
||||
},
|
||||
|
||||
{
|
||||
title: '用户信息',
|
||||
dataIndex: 'nickname',
|
||||
key: 'nickname',
|
||||
width: 280
|
||||
},
|
||||
{
|
||||
title: '周期',
|
||||
dataIndex: 'periodNo',
|
||||
key: 'periodNo',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '释放数量(桶)',
|
||||
dataIndex: 'releaseQty',
|
||||
key: 'releaseQty',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '释放时间',
|
||||
dataIndex: 'releaseTime',
|
||||
key: 'releaseTime',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
// {
|
||||
// title: '操作',
|
||||
// key: 'action',
|
||||
// width: 180,
|
||||
// fixed: 'right',
|
||||
// align: 'center',
|
||||
// hideInSetting: true
|
||||
// }
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: GltUserTicketReleaseParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: GltUserTicketRelease) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: GltUserTicketRelease) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeGltUserTicketRelease(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);
|
||||
removeBatchGltUserTicketRelease(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: GltUserTicketRelease) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'GltUserTicketRelease'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -213,7 +213,6 @@
|
||||
MoneyCollectOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { openNew } from '@/utils/common';
|
||||
import { useSiteStore } from '@/store/modules/site';
|
||||
import { useStatisticsStore } from '@/store/modules/statistics';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
@@ -232,12 +232,12 @@
|
||||
align: 'center',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '所属部门',
|
||||
dataIndex: 'organizationName',
|
||||
key: 'organizationName',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '所属部门',
|
||||
// dataIndex: 'organizationName',
|
||||
// key: 'organizationName',
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '角色',
|
||||
dataIndex: 'roles',
|
||||
|
||||
62
src/views/shop/shopCommunity/components/search.vue
Normal file
62
src/views/shop/shopCommunity/components/search.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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-input-search
|
||||
allow-clear
|
||||
placeholder="小区名称"
|
||||
style="width: 240px"
|
||||
v-model:value="where.keywords"
|
||||
@search="reload"
|
||||
/>
|
||||
</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 {ShopCommunityParam} from "@/api/shop/shopCommunity/model";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: ShopCommunityParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<ShopCommunityParam>({
|
||||
keywords: '',
|
||||
name: undefined,
|
||||
code: undefined
|
||||
});
|
||||
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
209
src/views/shop/shopCommunity/components/shopCommunityEdit.vue
Normal file
209
src/views/shop/shopCommunity/components/shopCommunityEdit.vue
Normal file
@@ -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="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入小区名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="小区编号" name="code">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入小区编号"
|
||||
v-model:value="form.code"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="详细地址" name="address">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入详细地址"
|
||||
v-model:value="form.address"
|
||||
/>
|
||||
</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="状态" 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>
|
||||
</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 { addShopCommunity, updateShopCommunity } from '@/api/shop/shopCommunity';
|
||||
import { ShopCommunity } from '@/api/shop/shopCommunity/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?: ShopCommunity | 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<ShopCommunity>({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
address: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
shopCommunityId: undefined,
|
||||
shopCommunityName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
shopCommunityName: [
|
||||
{
|
||||
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 ? updateShopCommunity : addShopCommunity;
|
||||
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>
|
||||
252
src/views/shop/shopCommunity/index.vue
Normal file
252
src/views/shop/shopCommunity/index.vue
Normal file
@@ -0,0 +1,252 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
: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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ShopCommunityEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, computed } 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 {getPageTitle} from '@/utils/common';
|
||||
import ShopCommunityEdit from './components/shopCommunityEdit.vue';
|
||||
import { pageShopCommunity, removeShopCommunity, removeBatchShopCommunity } from '@/api/shop/shopCommunity';
|
||||
import type { ShopCommunity, ShopCommunityParam } from '@/api/shop/shopCommunity/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<ShopCommunity[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<ShopCommunity | 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 pageShopCommunity({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '小区名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '小区编号',
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '详细地址',
|
||||
dataIndex: 'address',
|
||||
key: 'address',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center',
|
||||
width: 120
|
||||
},
|
||||
// {
|
||||
// title: '备注',
|
||||
// dataIndex: 'comments',
|
||||
// key: 'comments',
|
||||
// ellipsis: true
|
||||
// },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ShopCommunityParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: ShopCommunity) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: ShopCommunity) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeShopCommunity(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);
|
||||
removeBatchShopCommunity(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: ShopCommunity) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopCommunity'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -145,7 +145,7 @@
|
||||
20: { text: '提现支出', color: 'warning' },
|
||||
30: { text: '转账支出', color: 'error' },
|
||||
40: { text: '转账收入', color: 'processing' },
|
||||
50: { text: '新人注册奖', color: 'processing' }
|
||||
50: { text: '佣金解冻', color: 'processing' }
|
||||
};
|
||||
const type = typeMap[text] || { text: '未知', color: 'default' };
|
||||
return {
|
||||
|
||||
@@ -96,8 +96,11 @@
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'isSettled'">
|
||||
<a-tag v-if="record.isSettled === 0" color="orange">未结算</a-tag>
|
||||
<a-tag v-if="record.isSettled === 1" color="success">已结算</a-tag>
|
||||
<div class="flex flex-col">
|
||||
<a-tag v-if="record.isSettled === 0" color="orange">未结算</a-tag>
|
||||
<a-tag v-if="record.isSettled === 1" color="purple">已结算</a-tag>
|
||||
<a-tag v-if="record.isUnfreeze === 1" color="success">已解冻</a-tag>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'createTime'">
|
||||
@@ -108,6 +111,9 @@
|
||||
<a-tooltip title="结算时间">
|
||||
<span class="text-purple-500">{{ record.settleTime }}</span>
|
||||
</a-tooltip>
|
||||
<a-tooltip title="解冻时间">
|
||||
<span class="text-green-500">{{ record.unfreezeTime }}</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<a-radio-group v-model:value="basicSettings.distributionLevel">
|
||||
<a-radio :value="1">一级</a-radio>
|
||||
<a-radio :value="2">二级</a-radio>
|
||||
<a-radio :value="3">三级</a-radio>
|
||||
<!-- <a-radio :value="3">三级</a-radio>-->
|
||||
</a-radio-group>
|
||||
<div class="setting-desc">设置分销商推荐层级关系</div>
|
||||
</a-form-item>
|
||||
@@ -235,14 +235,26 @@
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
import {
|
||||
addShopDealerSetting,
|
||||
updateShopDealerSetting,
|
||||
getShopDealerSetting
|
||||
listShopDealerSetting
|
||||
} from '@/api/shop/shopDealerSetting';
|
||||
import type { ShopDealerSetting } from '@/api/shop/shopDealerSetting/model';
|
||||
|
||||
// 当前激活的标签页
|
||||
const activeTab = ref('basic');
|
||||
// 保存状态
|
||||
const saving = ref(false);
|
||||
const settingMap = ref<Record<string, ShopDealerSetting>>({});
|
||||
const settingValuesMap = ref<Record<string, any>>({});
|
||||
const settingMeta = {
|
||||
basic: '基础设置',
|
||||
condition: '分销商条件',
|
||||
settlement: '结算',
|
||||
license: '申请协议',
|
||||
words: '自定义文字',
|
||||
background: '页面背景图'
|
||||
};
|
||||
|
||||
// 基础设置
|
||||
const basicSettings = reactive({
|
||||
@@ -283,6 +295,63 @@
|
||||
backgroundImages: []
|
||||
});
|
||||
|
||||
const getBooleanFlag = (value: any) => value === 1 || value === true;
|
||||
const getNumberFlag = (value: any) => (value ? 1 : 0);
|
||||
const pickEnumValue = (value: any, options: number[], fallback: number) =>
|
||||
options.includes(value) ? value : fallback;
|
||||
|
||||
const ensurePath = (root: Record<string, any>, path: string[]) => {
|
||||
let current = root;
|
||||
path.forEach((key) => {
|
||||
if (!current[key] || typeof current[key] !== 'object') {
|
||||
current[key] = {};
|
||||
}
|
||||
current = current[key];
|
||||
});
|
||||
return current;
|
||||
};
|
||||
|
||||
const setWordValue = (
|
||||
root: Record<string, any>,
|
||||
path: string[],
|
||||
value: string
|
||||
) => {
|
||||
const node = ensurePath(root, path);
|
||||
if (typeof node.default !== 'string') {
|
||||
node.default = value;
|
||||
}
|
||||
node.value = value;
|
||||
};
|
||||
|
||||
const getUploadUrl = (fileList: any[]) => {
|
||||
if (!Array.isArray(fileList) || fileList.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const file = fileList[0];
|
||||
return (
|
||||
file?.url ||
|
||||
file?.thumbUrl ||
|
||||
file?.response?.url ||
|
||||
file?.response?.data?.url ||
|
||||
file?.response?.data?.path ||
|
||||
''
|
||||
);
|
||||
};
|
||||
|
||||
const toUploadFileList = (url?: string) => {
|
||||
if (!url) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
{
|
||||
uid: 'background-0',
|
||||
name: '背景图',
|
||||
status: 'done',
|
||||
url
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
/* 图片预览 */
|
||||
const handlePreview = (file: any) => {
|
||||
console.log('预览图片:', file);
|
||||
@@ -291,37 +360,178 @@
|
||||
/* 加载设置 */
|
||||
const loadSettings = async () => {
|
||||
try {
|
||||
// 这里应该调用API获取设置数据
|
||||
// const settings = await getShopDealerSetting();
|
||||
// 然后将数据分配到各个设置对象中
|
||||
console.log('加载设置数据');
|
||||
const list = await listShopDealerSetting();
|
||||
const nextMap: Record<string, ShopDealerSetting> = {};
|
||||
const nextValues: Record<string, any> = {};
|
||||
list.forEach((item) => {
|
||||
if (!item.key) {
|
||||
return;
|
||||
}
|
||||
nextMap[item.key] = item;
|
||||
if (item.values) {
|
||||
try {
|
||||
nextValues[item.key] = JSON.parse(item.values);
|
||||
} catch (error) {
|
||||
console.warn('解析设置失败:', item.key, error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
settingMap.value = nextMap;
|
||||
settingValuesMap.value = nextValues;
|
||||
|
||||
const basicValue = nextValues.basic || {};
|
||||
basicSettings.enableDistribution = getBooleanFlag(basicValue.is_open);
|
||||
basicSettings.distributionLevel = basicValue.level ?? 3;
|
||||
basicSettings.dealerSelfBuy = getBooleanFlag(basicValue.self_buy);
|
||||
|
||||
const conditionValue = nextValues.condition || {};
|
||||
commissionSettings.applyType = pickEnumValue(
|
||||
conditionValue.become,
|
||||
[10, 20],
|
||||
commissionSettings.applyType
|
||||
);
|
||||
|
||||
const settlementValue = nextValues.settlement || {};
|
||||
commissionSettings.settlementType = pickEnumValue(
|
||||
settlementValue.settle_days ?? settlementValue.settlement_type,
|
||||
[10, 20],
|
||||
commissionSettings.settlementType
|
||||
);
|
||||
commissionSettings.minWithdrawAmount =
|
||||
settlementValue.min_money ?? commissionSettings.minWithdrawAmount;
|
||||
|
||||
withdrawSettings.withdrawMethods = Array.isArray(settlementValue.pay_type)
|
||||
? settlementValue.pay_type
|
||||
: withdrawSettings.withdrawMethods;
|
||||
withdrawSettings.withdrawFeeRate =
|
||||
typeof settlementValue.fee_rate === 'number'
|
||||
? settlementValue.fee_rate
|
||||
: withdrawSettings.withdrawFeeRate;
|
||||
withdrawSettings.withdrawAudit =
|
||||
settlementValue.audit === undefined
|
||||
? withdrawSettings.withdrawAudit
|
||||
: getBooleanFlag(settlementValue.audit);
|
||||
|
||||
const licenseValue = nextValues.license || {};
|
||||
if (licenseValue.license) {
|
||||
agreementSettings.dealerAgreement = licenseValue.license;
|
||||
}
|
||||
|
||||
const wordsValue = nextValues.words || {};
|
||||
if (wordsValue.index?.title?.value) {
|
||||
pageSettings.centerTitle = wordsValue.index.title.value;
|
||||
}
|
||||
if (wordsValue.apply?.words?.wait_audit?.value) {
|
||||
notificationSettings.applySuccessText =
|
||||
wordsValue.apply.words.wait_audit.value;
|
||||
}
|
||||
if (wordsValue.apply?.words?.fail?.value) {
|
||||
notificationSettings.applyFailText = wordsValue.apply.words.fail.value;
|
||||
}
|
||||
if (wordsValue.withdraw_apply?.words?.success?.value) {
|
||||
notificationSettings.withdrawSuccessText =
|
||||
wordsValue.withdraw_apply.words.success.value;
|
||||
}
|
||||
|
||||
const backgroundValue = nextValues.background || {};
|
||||
const backgroundUrl =
|
||||
backgroundValue.index ||
|
||||
backgroundValue.apply ||
|
||||
backgroundValue.withdraw_apply;
|
||||
pageSettings.backgroundImages = toUploadFileList(backgroundUrl);
|
||||
} catch (error) {
|
||||
console.error('加载设置失败:', error);
|
||||
message.error('加载设置失败');
|
||||
}
|
||||
};
|
||||
|
||||
const saveSettingItem = async (
|
||||
key: keyof typeof settingMeta,
|
||||
values: Record<string, any>
|
||||
) => {
|
||||
const existSetting = settingMap.value[key];
|
||||
const payload: ShopDealerSetting = {
|
||||
...(existSetting || {}),
|
||||
key,
|
||||
describe: existSetting?.describe ?? settingMeta[key],
|
||||
values: JSON.stringify(values),
|
||||
updateTime: Date.now()
|
||||
};
|
||||
|
||||
const saveOrUpdate = existSetting
|
||||
? updateShopDealerSetting
|
||||
: addShopDealerSetting;
|
||||
await saveOrUpdate(payload);
|
||||
settingMap.value[key] = payload;
|
||||
settingValuesMap.value[key] = values;
|
||||
};
|
||||
|
||||
/* 保存设置 */
|
||||
const saveSettings = async () => {
|
||||
saving.value = true;
|
||||
try {
|
||||
// 收集所有设置数据
|
||||
const allSettings = {
|
||||
basic: basicSettings,
|
||||
commission: commissionSettings,
|
||||
withdraw: withdrawSettings,
|
||||
agreement: agreementSettings,
|
||||
notification: notificationSettings,
|
||||
page: pageSettings
|
||||
const basicValues = {
|
||||
is_open: getNumberFlag(basicSettings.enableDistribution),
|
||||
level: basicSettings.distributionLevel,
|
||||
self_buy: getNumberFlag(basicSettings.dealerSelfBuy)
|
||||
};
|
||||
|
||||
console.log('保存设置:', allSettings);
|
||||
const conditionValues = {
|
||||
...(settingValuesMap.value.condition || {}),
|
||||
become: commissionSettings.applyType
|
||||
};
|
||||
|
||||
// 这里应该调用API保存设置
|
||||
// await updateShopDealerSetting(allSettings);
|
||||
const settlementValues = {
|
||||
...(settingValuesMap.value.settlement || {}),
|
||||
pay_type: [...withdrawSettings.withdrawMethods],
|
||||
min_money: commissionSettings.minWithdrawAmount,
|
||||
settle_days: commissionSettings.settlementType,
|
||||
fee_rate: withdrawSettings.withdrawFeeRate,
|
||||
audit: getNumberFlag(withdrawSettings.withdrawAudit)
|
||||
};
|
||||
|
||||
// 模拟保存
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
const licenseValues = {
|
||||
license: agreementSettings.dealerAgreement
|
||||
};
|
||||
|
||||
const wordsValues = {
|
||||
...(settingValuesMap.value.words || {})
|
||||
};
|
||||
setWordValue(wordsValues, ['index', 'title'], pageSettings.centerTitle);
|
||||
setWordValue(
|
||||
wordsValues,
|
||||
['apply', 'words', 'wait_audit'],
|
||||
notificationSettings.applySuccessText
|
||||
);
|
||||
setWordValue(
|
||||
wordsValues,
|
||||
['apply', 'words', 'fail'],
|
||||
notificationSettings.applyFailText
|
||||
);
|
||||
setWordValue(
|
||||
wordsValues,
|
||||
['withdraw_apply', 'words', 'success'],
|
||||
notificationSettings.withdrawSuccessText
|
||||
);
|
||||
|
||||
const backgroundUrl = getUploadUrl(pageSettings.backgroundImages);
|
||||
const backgroundValues = {
|
||||
...(settingValuesMap.value.background || {}),
|
||||
index: backgroundUrl || settingValuesMap.value.background?.index || '',
|
||||
apply: backgroundUrl || settingValuesMap.value.background?.apply || '',
|
||||
withdraw_apply:
|
||||
backgroundUrl || settingValuesMap.value.background?.withdraw_apply || ''
|
||||
};
|
||||
|
||||
await saveSettingItem('basic', basicValues);
|
||||
await saveSettingItem('condition', conditionValues);
|
||||
await saveSettingItem('settlement', settlementValues);
|
||||
await saveSettingItem('license', licenseValues);
|
||||
await saveSettingItem('words', wordsValues);
|
||||
await saveSettingItem('background', backgroundValues);
|
||||
|
||||
await loadSettings();
|
||||
|
||||
message.success('设置保存成功');
|
||||
} catch (error) {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<a-select v-model:value="form.type" placeholder="请选择类型">
|
||||
<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-option :value="2">总分销商</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -136,7 +136,7 @@
|
||||
class="ele-fluid"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:precision="4"
|
||||
:precision="3"
|
||||
stringMode
|
||||
:disabled="true"
|
||||
placeholder="例如 0.007"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<template v-if="column.key === 'type'">
|
||||
<a-tag v-if="record.type === 0">分销商</a-tag>
|
||||
<a-tag v-if="record.type === 1" color="orange">门店</a-tag>
|
||||
<a-tag v-if="record.type === 2" color="purple">配送员</a-tag>
|
||||
<a-tag v-if="record.type === 2" color="purple">总分销商</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'qrcode'">
|
||||
<QrcodeOutlined :style="{fontSize: '24px'}" @click="openQrCode(record)" />
|
||||
@@ -111,7 +111,7 @@
|
||||
const loading = ref(true);
|
||||
|
||||
const getQrCodeUrl = (userId?: number) => {
|
||||
return `https://mp-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${userId ?? ''}`;
|
||||
return `https://glt-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${userId ?? ''}`;
|
||||
};
|
||||
|
||||
const openQrCode = (row: ShopDealerUser) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="900"
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
@@ -22,24 +22,25 @@
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="店铺名称" name="dealerName">
|
||||
<a-form-item label="绑定门店" name="shopName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="店铺名称"
|
||||
v-model:value="form.dealerName"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="小区名称" name="community">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入小区名称"
|
||||
v-model:value="form.community"
|
||||
:disabled="true"
|
||||
v-model:value="form.shopName"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- <a-col :span="12">-->
|
||||
<!-- <a-form-item label="小区名称" name="community">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- :maxlength="20"-->
|
||||
<!-- placeholder="请输入小区名称"-->
|
||||
<!-- v-model:value="form.community"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-col>-->
|
||||
</a-row>
|
||||
|
||||
<a-divider orientation="left">
|
||||
@@ -267,6 +268,7 @@
|
||||
firstNum: undefined,
|
||||
secondNum: undefined,
|
||||
thirdNum: undefined,
|
||||
shopName: undefined,
|
||||
qrcode: undefined,
|
||||
isDelete: undefined,
|
||||
tenantId: undefined,
|
||||
@@ -313,7 +315,7 @@
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
realName: [
|
||||
dealerName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'shopName'">
|
||||
<div class="text-purple-500">{{ record.shopName || '-' }}</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'type'">
|
||||
<a-tag v-if="record.type === 0">分销商</a-tag>
|
||||
<a-tag v-if="record.type === 1" color="orange">门店</a-tag>
|
||||
@@ -111,7 +114,7 @@
|
||||
const loading = ref(true);
|
||||
|
||||
const getQrCodeUrl = (userId?: number) => {
|
||||
return `https://mp-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${userId ?? ''}`;
|
||||
return `https://glt-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${userId ?? ''}`;
|
||||
};
|
||||
|
||||
const openQrCode = (row: ShopDealerUser) => {
|
||||
@@ -178,6 +181,11 @@
|
||||
align: 'center',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '所属门店',
|
||||
dataIndex: 'shopName',
|
||||
key: 'shopName'
|
||||
},
|
||||
{
|
||||
title: '真实姓名',
|
||||
dataIndex: 'realName',
|
||||
@@ -188,20 +196,20 @@
|
||||
dataIndex: 'mobile',
|
||||
key: 'mobile'
|
||||
},
|
||||
// {
|
||||
// title: '工资',
|
||||
// dataIndex: 'money',
|
||||
// key: 'money',
|
||||
// width: 120
|
||||
// },
|
||||
// {
|
||||
// title: '已冻结',
|
||||
// dataIndex: 'freezeMoney',
|
||||
// key: 'freezeMoney',
|
||||
// width: 120
|
||||
// },
|
||||
{
|
||||
title: '可提现',
|
||||
dataIndex: 'money',
|
||||
key: 'money',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '已冻结',
|
||||
dataIndex: 'freezeMoney',
|
||||
key: 'freezeMoney',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '累积提现',
|
||||
title: '工资统计',
|
||||
dataIndex: 'totalMoney',
|
||||
key: 'totalMoney',
|
||||
width: 120
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="900"
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
@@ -36,11 +36,11 @@
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="小区名称" name="community">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入小区名称"
|
||||
v-model:value="form.community"
|
||||
<SelectCommunity
|
||||
:key="`community`"
|
||||
:value="form.community"
|
||||
:placeholder="`选择小区`"
|
||||
@done="onCommunity"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -223,8 +223,9 @@
|
||||
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';
|
||||
import type { User } from '@/api/system/user/model';
|
||||
import SelectCommunity from '@/components/SelectCommunity/index.vue';
|
||||
import {ShopCommunity} from "@/api/shop/shopCommunity/model";
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
@@ -288,14 +289,6 @@
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
const createTimeText = computed(() => {
|
||||
return form.createTime ? toDateString(form.createTime, 'yyyy-MM-dd HH:mm:ss') : '';
|
||||
});
|
||||
|
||||
const updateTimeText = computed(() => {
|
||||
return form.updateTime ? toDateString(form.updateTime, 'yyyy-MM-dd HH:mm:ss') : '';
|
||||
});
|
||||
|
||||
const selectedUserText = ref<string>('');
|
||||
|
||||
// 表单验证规则
|
||||
@@ -319,11 +312,19 @@
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
realName: [
|
||||
dealerName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写真实姓名',
|
||||
message: '请填写店铺名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
community: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择所在小区',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
@@ -372,19 +373,9 @@
|
||||
selectedUserText.value = phone ? `${name}(${phone})` : name;
|
||||
};
|
||||
|
||||
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 onCommunity = (data: ShopCommunity) => {
|
||||
form.community = data.name;
|
||||
}
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
const loading = ref(true);
|
||||
|
||||
const getQrCodeUrl = (userId?: number) => {
|
||||
return `https://mp-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${userId ?? ''}`;
|
||||
return `https://glt-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${userId ?? ''}`;
|
||||
};
|
||||
|
||||
const openQrCode = (row: ShopDealerUser) => {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
v-model:value="where.keywords"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
<a-button type="dashed" @click="handleExport">导出xls</a-button>
|
||||
<a-button @click="resetSearch"> 重置 </a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
@@ -46,9 +47,16 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { DeleteOutlined } from '@ant-design/icons-vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
import Import from './Import.vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { ShopDealerWithdrawParam } from '@/api/shop/shopDealerWithdraw/model';
|
||||
import { getTenantId } from '@/utils/domain';
|
||||
import { pageShopDealerWithdraw } from '@/api/shop/shopDealerWithdraw';
|
||||
import type {
|
||||
ShopDealerWithdraw,
|
||||
ShopDealerWithdrawParam
|
||||
} from '@/api/shop/shopDealerWithdraw/model';
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
@@ -73,9 +81,13 @@
|
||||
|
||||
// 搜索表单
|
||||
const { where, resetFields } = useSearch<ShopDealerWithdrawParam>({
|
||||
keywords: ''
|
||||
keywords: '',
|
||||
page: 1,
|
||||
limit: 5000
|
||||
});
|
||||
|
||||
const list = ref<ShopDealerWithdraw[]>([]);
|
||||
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
const searchParams = { ...where };
|
||||
@@ -88,6 +100,102 @@
|
||||
emit('search', searchParams);
|
||||
};
|
||||
|
||||
const toMoney = (val: unknown) => {
|
||||
const n = Number.parseFloat(String(val ?? '0'));
|
||||
return Number.isFinite(n) ? n.toFixed(2) : '0.00';
|
||||
};
|
||||
|
||||
const toApplyStatus = (val: unknown) => {
|
||||
const n = Number(val);
|
||||
if (n === 10) return '待审核';
|
||||
if (n === 20) return '审核通过';
|
||||
if (n === 30) return '驳回/取消';
|
||||
if (n === 40) return '已打款';
|
||||
return '';
|
||||
};
|
||||
|
||||
const toPayType = (val: unknown) => {
|
||||
const n = Number(val);
|
||||
if (n === 10) return '微信/商家转账';
|
||||
if (n === 20) return '支付宝';
|
||||
if (n === 30) return '银行卡';
|
||||
return '';
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'订单号',
|
||||
'用户',
|
||||
'手机号',
|
||||
'提现金额',
|
||||
'打款方式',
|
||||
'申请状态',
|
||||
'审核/打款时间',
|
||||
'创建时间',
|
||||
'备注',
|
||||
'租户ID'
|
||||
]
|
||||
];
|
||||
|
||||
const params = { ...where };
|
||||
// 清除空值,避免把空字符串传给后端
|
||||
Object.keys(params).forEach((key) => {
|
||||
if (params[key] === '' || params[key] === undefined) {
|
||||
delete params[key];
|
||||
}
|
||||
});
|
||||
params.page = 1;
|
||||
params.limit = 5000;
|
||||
|
||||
await pageShopDealerWithdraw(params)
|
||||
.then((data) => {
|
||||
list.value = data?.list || [];
|
||||
list.value.forEach((d: ShopDealerWithdraw) => {
|
||||
array.push([
|
||||
d.id ?? '',
|
||||
`${d.realName || d.nickname || '-'}(${d.userId ?? '-'})`,
|
||||
d.phone ?? '',
|
||||
toMoney(d.money),
|
||||
toPayType(d.payType),
|
||||
toApplyStatus(d.applyStatus),
|
||||
d.auditTime ?? '',
|
||||
d.createTime ?? '',
|
||||
d.comments ?? '',
|
||||
d.tenantId ?? ''
|
||||
]);
|
||||
});
|
||||
|
||||
const sheetName = `bak_shop_dealer_withdraw_${getTenantId()}`;
|
||||
const workbook = { SheetNames: [sheetName], Sheets: {} as any };
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 },
|
||||
{ wch: 20 },
|
||||
{ wch: 14 },
|
||||
{ wch: 12 },
|
||||
{ wch: 14 },
|
||||
{ wch: 12 },
|
||||
{ wch: 20 },
|
||||
{ wch: 20 },
|
||||
{ wch: 24 },
|
||||
{ wch: 10 }
|
||||
];
|
||||
|
||||
message.loading('正在导出...', 0);
|
||||
setTimeout(() => {
|
||||
writeFile(workbook, `${sheetName}.xlsx`);
|
||||
message.destroy();
|
||||
}, 1000);
|
||||
})
|
||||
.catch((e: any) => {
|
||||
message.destroy();
|
||||
message.error(e?.message ?? String(e));
|
||||
});
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const resetSearch = () => {
|
||||
resetFields();
|
||||
|
||||
@@ -29,37 +29,24 @@
|
||||
>
|
||||
<a-tag v-if="record.applyStatus === 30" color="error">已驳回</a-tag>
|
||||
<a-tag v-if="record.applyStatus === 40">已打款</a-tag>
|
||||
<a-tag v-if="record.applyStatus === 50" color="error">已取消</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'userInfo'">
|
||||
<a-space>
|
||||
<a-avatar :src="record.avatar" />
|
||||
<div class="flex flex-col">
|
||||
<span>{{ record.realName || '未实名认证' }}</span>
|
||||
<span class="text-gray-400">{{ record.phone }}</span>
|
||||
<div>
|
||||
<span>{{ record.realName || '未实名认证' }}</span>
|
||||
<span class="text-gray-400">(ID:{{ record.userId }})</span>
|
||||
</div>
|
||||
<div><span class="text-gray-400">{{ record.phone }}</span></div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'paymentInfo'">
|
||||
<template v-if="record.payType === 10">
|
||||
<a-space direction="vertical">
|
||||
<a-tag color="blue">微信</a-tag>
|
||||
<span>{{ record.wechatName }}</span>
|
||||
<span>{{ record.wechatName }}</span>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="record.payType === 20">
|
||||
<a-space direction="vertical">
|
||||
<a-tag color="blue">支付宝</a-tag>
|
||||
<span>{{ record.alipayName }}</span>
|
||||
<span>{{ record.alipayAccount }}</span>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="record.payType === 30">
|
||||
<a-space direction="vertical">
|
||||
<a-tag color="blue">银行卡</a-tag>
|
||||
<span>{{ record.bankName }}</span>
|
||||
<span>{{ record.bankAccount }}</span>
|
||||
<span>{{ record.bankCard }}</span>
|
||||
<a-tag color="blue">商家转账</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
@@ -186,26 +173,27 @@
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
title: '订单号',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
fixed: 'left'
|
||||
},
|
||||
// {
|
||||
// title: '用户ID',
|
||||
// dataIndex: 'userId',
|
||||
// key: 'userId',
|
||||
// align: 'center',
|
||||
// width: 90,
|
||||
// fixed: 'left'
|
||||
// },
|
||||
{
|
||||
title: '提现金额',
|
||||
dataIndex: 'money',
|
||||
key: 'money',
|
||||
title: '收款方式',
|
||||
dataIndex: 'paymentInfo',
|
||||
key: 'paymentInfo',
|
||||
align: 'center',
|
||||
width: 150,
|
||||
customRender: ({ text }) => {
|
||||
const amount = parseFloat(text || '0').toFixed(2);
|
||||
return {
|
||||
type: 'span',
|
||||
children: `¥${amount}`
|
||||
};
|
||||
}
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
title: '用户信息',
|
||||
@@ -213,9 +201,17 @@
|
||||
key: 'userInfo'
|
||||
},
|
||||
{
|
||||
title: '收款信息',
|
||||
dataIndex: 'paymentInfo',
|
||||
key: 'paymentInfo'
|
||||
title: '转账金额',
|
||||
dataIndex: 'money',
|
||||
key: 'money',
|
||||
align: 'center',
|
||||
customRender: ({ text }) => {
|
||||
const amount = parseFloat(text || '0').toFixed(2);
|
||||
return {
|
||||
type: 'span',
|
||||
children: `¥${amount}`
|
||||
};
|
||||
}
|
||||
},
|
||||
// {
|
||||
// title: '审核时间',
|
||||
@@ -247,7 +243,7 @@
|
||||
key: 'comments'
|
||||
},
|
||||
{
|
||||
title: '申请状态',
|
||||
title: '状态',
|
||||
dataIndex: 'applyStatus',
|
||||
key: 'applyStatus',
|
||||
align: 'center',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:width="700"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
@@ -14,7 +14,7 @@
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:label-col="styleResponsive ? { md: 6, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
@@ -56,20 +56,6 @@
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</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>
|
||||
|
||||
@@ -123,24 +123,24 @@
|
||||
key: 'expressName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '物流公司编码 (微信)',
|
||||
dataIndex: 'wxCode',
|
||||
key: 'wxCode',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '物流公司编码 (快递100)',
|
||||
dataIndex: 'kuaidi100Code',
|
||||
key: 'kuaidi100Code',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '物流公司编码 (快递鸟)',
|
||||
dataIndex: 'kdniaoCode',
|
||||
key: 'kdniaoCode',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '物流公司编码 (微信)',
|
||||
// dataIndex: 'wxCode',
|
||||
// key: 'wxCode',
|
||||
// align: 'center'
|
||||
// },
|
||||
// {
|
||||
// title: '物流公司编码 (快递100)',
|
||||
// dataIndex: 'kuaidi100Code',
|
||||
// key: 'kuaidi100Code',
|
||||
// align: 'center'
|
||||
// },
|
||||
// {
|
||||
// title: '物流公司编码 (快递鸟)',
|
||||
// dataIndex: 'kdniaoCode',
|
||||
// key: 'kdniaoCode',
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="礼品卡" name="name">
|
||||
<a-form-item label="礼品劵" name="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入礼品卡名称"
|
||||
|
||||
@@ -93,9 +93,9 @@
|
||||
v-model:value="form.dealerPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="进货价" name="originPrice">
|
||||
<a-form-item label="套餐价格" name="originPrice">
|
||||
<a-input-number
|
||||
:placeholder="`进货价`"
|
||||
:placeholder="`套餐价格`"
|
||||
style="width: 240px"
|
||||
:min="0.01"
|
||||
v-model:value="form.buyingPrice"
|
||||
@@ -550,14 +550,14 @@
|
||||
<!-- }}</template>-->
|
||||
<!-- </a-input-number>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="一级分红" name="firstDividend">
|
||||
<a-form-item label="一级分润" name="firstDividend">
|
||||
<a-input-number
|
||||
v-model:value="form.firstDividend"
|
||||
:min="0"
|
||||
:max="form.commissionType === 20 ? 100 : undefined"
|
||||
:precision="2"
|
||||
style="width: 250px"
|
||||
placeholder="请输入一级分红"
|
||||
placeholder="请输入一级分润"
|
||||
>
|
||||
<template #addonAfter>{{
|
||||
form.commissionType === 20 ? '%' : '元'
|
||||
@@ -565,14 +565,14 @@
|
||||
</template>
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
<a-form-item label="二级分红" name="secondDividend">
|
||||
<a-form-item label="二级分润" name="secondDividend">
|
||||
<a-input-number
|
||||
v-model:value="form.secondDividend"
|
||||
:min="0"
|
||||
:max="form.commissionType === 20 ? 100 : undefined"
|
||||
:precision="2"
|
||||
style="width: 250px"
|
||||
placeholder="请输入二级分红"
|
||||
placeholder="请输入二级分润"
|
||||
>
|
||||
<template #addonAfter>{{
|
||||
form.commissionType === 20 ? '%' : '元'
|
||||
@@ -580,6 +580,19 @@
|
||||
</template>
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
<a-form-item label="配送费奖金" name="deliveryMoney">
|
||||
<a-input-number
|
||||
v-model:value="form.deliveryMoney"
|
||||
:min="0"
|
||||
:max="0.2"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
style="width: 250px"
|
||||
placeholder="请输入配送费奖金"
|
||||
>
|
||||
<template #addonAfter>元</template>
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
</template>
|
||||
<template v-if="form.type === 1 || merchantId">
|
||||
<a-form-item label="可用日期">
|
||||
@@ -750,7 +763,7 @@ const columns = [
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '进货价',
|
||||
title: '套餐价格',
|
||||
dataIndex: 'buyingPrice',
|
||||
key: 'buyingPrice',
|
||||
align: 'center'
|
||||
@@ -1109,6 +1122,7 @@ const form = reactive<ShopGoods>({
|
||||
thirdMoney: 0,
|
||||
firstDividend: 0,
|
||||
secondDividend: 0,
|
||||
deliveryMoney: 0,
|
||||
position: undefined,
|
||||
price: undefined,
|
||||
originPrice: undefined,
|
||||
@@ -1880,6 +1894,7 @@ const save = () => {
|
||||
form.thirdMoney = 0;
|
||||
form.firstDividend = 0;
|
||||
form.secondDividend = 0;
|
||||
form.deliveryMoney = 0;
|
||||
}
|
||||
if (form.isOpenCommission === 1 && form.commissionType === 20) {
|
||||
// UI 输入:0~100;保存到后端:0~1(例如 10% => 0.1)
|
||||
|
||||
@@ -73,6 +73,19 @@
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
|
||||
<!-- 物流单号 -->
|
||||
<a-form-item
|
||||
label="物流单号"
|
||||
name="expressNo"
|
||||
v-if="form.deliveryType === 0"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="form.expressNo"
|
||||
placeholder="请输入物流单号"
|
||||
:maxlength="50"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<template v-if="form.deliveryType !== 1">
|
||||
<a-form-item label="发货人" name="sendName">
|
||||
<a-input
|
||||
@@ -96,19 +109,6 @@
|
||||
</a-form-item>
|
||||
</template>
|
||||
|
||||
<!-- 快递单号 -->
|
||||
<!-- <a-form-item-->
|
||||
<!-- label="快递单号"-->
|
||||
<!-- name="trackingNumber"-->
|
||||
<!-- v-if="form.deliveryType === 0"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input-->
|
||||
<!-- v-model:value="form.trackingNumber"-->
|
||||
<!-- placeholder="请输入快递单号"-->
|
||||
<!-- :maxlength="50"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
|
||||
<!-- <!– 分单发货 –>-->
|
||||
<!-- <a-form-item label="分单发货" v-if="form.deliveryType === 0">-->
|
||||
<!-- <a-switch-->
|
||||
@@ -178,7 +178,7 @@
|
||||
deliveryMethod: 'manual', // manual手动填写 print电子面单打印
|
||||
expressId: undefined as number | undefined,
|
||||
expressName: '',
|
||||
trackingNumber: '',
|
||||
expressNo: '',
|
||||
partialDelivery: false,
|
||||
deliveryNote: '',
|
||||
sendName: '',
|
||||
@@ -210,18 +210,16 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
// trackingNumber: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请输入快递单号',
|
||||
// validator: (_: any, value: any) => {
|
||||
// if (form.deliveryType === 0 && !value) {
|
||||
// return Promise.reject('请输入快递单号');
|
||||
// }
|
||||
// return Promise.resolve();
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
expressNo: [
|
||||
{
|
||||
validator: (_: any, value: any) => {
|
||||
if (form.deliveryType === 0 && !value) {
|
||||
return Promise.reject('请输入物流单号');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
],
|
||||
deliveryTime: [{ required: true, message: '请选择发货时间' }],
|
||||
sendName: [
|
||||
{
|
||||
@@ -298,6 +296,7 @@
|
||||
if (type !== 0) {
|
||||
form.expressId = undefined;
|
||||
form.expressName = '';
|
||||
form.expressNo = '';
|
||||
form.deliveryMethod = 'manual';
|
||||
}
|
||||
if (type === 1) {
|
||||
@@ -339,24 +338,31 @@
|
||||
|
||||
// 如果是快递配送,添加快递信息
|
||||
if (form.deliveryType === 0) {
|
||||
const express =
|
||||
expressList.value.find((item) => item.expressId === form.expressId) ||
|
||||
undefined;
|
||||
updateData.expressId = form.expressId;
|
||||
updateData.sendName = form.sendName;
|
||||
updateData.sendPhone = form.sendPhone;
|
||||
updateData.sendAddress = form.sendAddress;
|
||||
// updateData.expressName = form.expressName;
|
||||
// updateData.trackingNumber = form.trackingNumber;
|
||||
updateData.expressName = form.expressName || express?.expressName;
|
||||
updateData.expressNo = form.expressNo;
|
||||
} else if (form.deliveryType === 2) {
|
||||
// 商家送货需要记录发货人信息,但不需要快递公司
|
||||
updateData.sendName = form.sendName;
|
||||
updateData.sendPhone = form.sendPhone;
|
||||
updateData.sendAddress = form.sendAddress;
|
||||
updateData.expressId = undefined;
|
||||
updateData.expressName = undefined;
|
||||
updateData.expressNo = undefined;
|
||||
} else {
|
||||
// 无需发货,清理快递/发货信息
|
||||
updateData.expressId = undefined;
|
||||
updateData.sendName = undefined;
|
||||
updateData.sendPhone = undefined;
|
||||
updateData.sendAddress = undefined;
|
||||
updateData.expressName = undefined;
|
||||
updateData.expressNo = undefined;
|
||||
}
|
||||
|
||||
// 分单发货
|
||||
@@ -387,7 +393,7 @@
|
||||
form.deliveryMethod = 'manual';
|
||||
form.expressId = undefined;
|
||||
form.expressName = '';
|
||||
form.trackingNumber = '';
|
||||
form.expressNo = '';
|
||||
form.partialDelivery = false;
|
||||
form.deliveryNote = '';
|
||||
form.sendName = '';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<a-drawer
|
||||
:width="`65%`"
|
||||
width="70%"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maxable="maxAble"
|
||||
@@ -11,110 +11,6 @@
|
||||
:footer="null"
|
||||
@ok="save"
|
||||
>
|
||||
<template #extra>
|
||||
<a-space>
|
||||
<!-- 未付款状态的操作 -->
|
||||
<template v-if="!form.payStatus">
|
||||
<!-- 取消订单:未完成且未付款 -->
|
||||
<a-button
|
||||
v-if="form.orderStatus === 0"
|
||||
@click="handleCancelOrder"
|
||||
danger
|
||||
:loading="loading"
|
||||
>
|
||||
取消订单
|
||||
</a-button>
|
||||
|
||||
<!-- 修改订单:未完成且未付款 -->
|
||||
<a-button
|
||||
v-if="form.orderStatus === 0"
|
||||
@click="handleEditOrder"
|
||||
:loading="loading"
|
||||
>
|
||||
修改订单
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<!-- 已付款状态的操作 -->
|
||||
<template v-if="form.payStatus">
|
||||
<!-- 发货按钮:已付款且未发货且未取消 -->
|
||||
<a-button
|
||||
v-if="
|
||||
form.deliveryStatus === 10 && !isCancelledStatus(form.orderStatus)
|
||||
"
|
||||
type="primary"
|
||||
@click="handleDelivery"
|
||||
:loading="loading"
|
||||
>
|
||||
发货
|
||||
</a-button>
|
||||
|
||||
<!-- 确认收货:已发货且未完成 -->
|
||||
<a-button
|
||||
v-if="form.deliveryStatus === 20 && form.orderStatus === 0"
|
||||
type="primary"
|
||||
@click="handleConfirmReceive"
|
||||
:loading="loading"
|
||||
>
|
||||
确认收货
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<!-- 退款相关操作 -->
|
||||
<template v-if="isRefundStatus(form.orderStatus)">
|
||||
<!-- 同意退款:退款申请中或客户端申请退款 -->
|
||||
<a-button
|
||||
v-if="form.orderStatus === 4 || form.orderStatus === 7"
|
||||
type="primary"
|
||||
@click="handleApproveRefund"
|
||||
:loading="loading"
|
||||
>
|
||||
同意退款
|
||||
</a-button>
|
||||
|
||||
<!-- 拒绝退款:退款申请中或客户端申请退款 -->
|
||||
<a-button
|
||||
v-if="form.orderStatus === 4 || form.orderStatus === 7"
|
||||
danger
|
||||
@click="handleRejectRefund"
|
||||
:loading="loading"
|
||||
>
|
||||
拒绝退款
|
||||
</a-button>
|
||||
|
||||
<!-- 重新处理:退款被拒绝 -->
|
||||
<a-button
|
||||
v-if="form.orderStatus === 5"
|
||||
@click="handleRetryRefund"
|
||||
:loading="loading"
|
||||
>
|
||||
重新处理
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<!-- 申请退款:已完成或已发货的订单 -->
|
||||
<a-button
|
||||
v-if="canApplyRefund(form)"
|
||||
@click="handleApplyRefund"
|
||||
:loading="loading"
|
||||
>
|
||||
申请退款
|
||||
</a-button>
|
||||
|
||||
<!-- 删除订单:已完成、已取消、退款成功 -->
|
||||
<a-button
|
||||
v-if="canDeleteOrder(form)"
|
||||
@click="handleDeleteOrder"
|
||||
danger
|
||||
:loading="loading"
|
||||
>
|
||||
删除订单
|
||||
</a-button>
|
||||
|
||||
<!-- 关闭按钮 -->
|
||||
<a-button @click="updateVisible(false)"> 关闭 </a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<a-card title="基本信息" style="margin-bottom: 20px" :bordered="false">
|
||||
<a-descriptions :column="3">
|
||||
<!-- 第一排-->
|
||||
@@ -300,6 +196,12 @@
|
||||
<a-tag v-if="form.isInvoice == 2" color="blue">不能开具</a-tag>
|
||||
</a-descriptions-item>
|
||||
<!-- 第六排-->
|
||||
<a-descriptions-item
|
||||
label="买家备注"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.buyerRemarks }}
|
||||
</a-descriptions-item>
|
||||
<!-- <a-descriptions-item-->
|
||||
<!-- label="结算状态"-->
|
||||
<!-- :labelStyle="{ width: '90px', color: '#808080' }"-->
|
||||
@@ -318,6 +220,32 @@
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
|
||||
<a-card title="商品信息" style="margin-bottom: 20px" :bordered="false">
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:data-source="orderGoods"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'goodsName'">
|
||||
<div style="display: flex; align-items: center; gap: 12px">
|
||||
<a-avatar
|
||||
:src="record.image || record.goodsImage"
|
||||
shape="square"
|
||||
:size="50"
|
||||
style="flex-shrink: 0"
|
||||
/>
|
||||
<span style="flex: 1">{{
|
||||
record.goodsName || '未知商品'
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
|
||||
<a-card title="收货信息" style="margin-bottom: 20px" :bordered="false">
|
||||
<a-spin :spinning="loading">
|
||||
<a-descriptions :column="2">
|
||||
@@ -433,48 +361,22 @@
|
||||
label="快递公司"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.shopOrderDelivery.expressName || '未填写' }}
|
||||
{{
|
||||
form.expressName ||
|
||||
form.shopOrderDelivery?.expressName ||
|
||||
'未填写'
|
||||
}}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="物流单号"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.shopOrderDelivery.expressNo || '未填写' }}
|
||||
{{ form.expressNo || form.shopOrderDelivery?.expressNo || '未填写' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
|
||||
<a-card title="商品信息" style="margin-bottom: 20px" :bordered="false">
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:data-source="orderGoods"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'goodsName'">
|
||||
<div style="display: flex; align-items: center; gap: 12px">
|
||||
<a-avatar
|
||||
:src="record.image || record.goodsImage"
|
||||
shape="square"
|
||||
:size="50"
|
||||
style="flex-shrink: 0"
|
||||
/>
|
||||
<span style="flex: 1">{{
|
||||
record.goodsName || '未知商品'
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="买家留言" style="margin-bottom: 20px" :bordered="false">
|
||||
<a-spin :spinning="loading">
|
||||
{{ form.buyerRemarks || '-' }}
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="商家备注" style="margin-bottom: 20px" :bordered="false">
|
||||
<a-spin :spinning="loading">
|
||||
{{ form.merchantRemarks || '-' }}
|
||||
@@ -653,6 +555,10 @@
|
||||
deliveryTime: undefined,
|
||||
// 无需发货备注
|
||||
deliveryNote: undefined,
|
||||
// 快递公司名称
|
||||
expressName: undefined,
|
||||
// 物流单号
|
||||
expressNo: undefined,
|
||||
// 优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡
|
||||
couponType: undefined,
|
||||
// 优惠说明
|
||||
@@ -736,10 +642,10 @@
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
dataIndex: 'quantity',
|
||||
dataIndex: 'totalNum',
|
||||
align: 'center' as const,
|
||||
customRender: ({ record }: { record: any }) => {
|
||||
return record.quantity || 1;
|
||||
return record.totalNum || 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -17,53 +17,53 @@
|
||||
allow-clear
|
||||
v-model:value="where.orderNo"
|
||||
placeholder="订单编号"
|
||||
style="width: 240px"
|
||||
style="width: 260px"
|
||||
@search="reload"
|
||||
@pressEnter="reload"
|
||||
/>
|
||||
<!-- <a-select-->
|
||||
<!-- v-model:value="where.type"-->
|
||||
<!-- style="width: 150px"-->
|
||||
<!-- placeholder="订单类型"-->
|
||||
<!-- @change="search"-->
|
||||
<!-- >-->
|
||||
<!-- <a-select-option value="">全部</a-select-option>-->
|
||||
<!-- <a-select-option :value="1">普通订单</a-select-option>-->
|
||||
<!-- <a-select-option :value="2">秒杀订单</a-select-option>-->
|
||||
<!-- <a-select-option :value="3">拼团订单</a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<!-- <a-select-->
|
||||
<!-- v-model:value="where.payStatus"-->
|
||||
<!-- style="width: 150px"-->
|
||||
<!-- placeholder="付款状态"-->
|
||||
<!-- @change="search"-->
|
||||
<!-- >-->
|
||||
<!-- <a-select-option value="">全部</a-select-option>-->
|
||||
<!-- <a-select-option :value="1">已付款</a-select-option>-->
|
||||
<!-- <a-select-option :value="0">未付款</a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<a-select
|
||||
v-model:value="where.type"
|
||||
v-model:value="where.orderStatus"
|
||||
style="width: 150px"
|
||||
placeholder="订单类型"
|
||||
placeholder="订单状态"
|
||||
@change="search"
|
||||
>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option :value="1">普通订单</a-select-option>
|
||||
<a-select-option :value="2">秒杀订单</a-select-option>
|
||||
<a-select-option :value="3">拼团订单</a-select-option>
|
||||
<a-select-option :value="1">已完成</a-select-option>
|
||||
<!-- <a-select-option :value="0">未完成</a-select-option>-->
|
||||
<!-- <a-select-option :value="2">未使用</a-select-option>-->
|
||||
<a-select-option :value="3">已取消</a-select-option>
|
||||
<a-select-option :value="4">退款中</a-select-option>
|
||||
<a-select-option :value="5">退款被拒</a-select-option>
|
||||
<a-select-option :value="6">退款成功</a-select-option>
|
||||
</a-select>
|
||||
<a-select
|
||||
v-model:value="where.payStatus"
|
||||
style="width: 150px"
|
||||
placeholder="付款状态"
|
||||
@change="search"
|
||||
>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option :value="1">已付款</a-select-option>
|
||||
<a-select-option :value="0">未付款</a-select-option>
|
||||
</a-select>
|
||||
<!-- <a-select-->
|
||||
<!-- v-model:value="where.orderStatus"-->
|
||||
<!-- style="width: 150px"-->
|
||||
<!-- placeholder="订单状态"-->
|
||||
<!-- @change="search"-->
|
||||
<!-- >-->
|
||||
<!-- <a-select-option value="">全部</a-select-option>-->
|
||||
<!-- <a-select-option :value="1">已完成</a-select-option>-->
|
||||
<!-- <a-select-option :value="0">未完成</a-select-option>-->
|
||||
<!-- <a-select-option :value="2">未使用</a-select-option>-->
|
||||
<!-- <a-select-option :value="3">已取消</a-select-option>-->
|
||||
<!-- <a-select-option :value="4">退款中</a-select-option>-->
|
||||
<!-- <a-select-option :value="5">退款被拒</a-select-option>-->
|
||||
<!-- <a-select-option :value="6">退款成功</a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<a-select
|
||||
:options="getPayType()"
|
||||
v-model:value="where.payType"
|
||||
style="width: 150px"
|
||||
placeholder="付款方式"
|
||||
@change="search"
|
||||
/>
|
||||
<!-- <a-select-->
|
||||
<!-- :options="getPayType()"-->
|
||||
<!-- v-model:value="where.payType"-->
|
||||
<!-- style="width: 150px"-->
|
||||
<!-- placeholder="付款方式"-->
|
||||
<!-- @change="search"-->
|
||||
<!-- />-->
|
||||
|
||||
<a-range-picker
|
||||
v-model:value="dateRange"
|
||||
@@ -80,9 +80,9 @@
|
||||
<template #addonBefore>
|
||||
<a-select v-model:value="type" style="width: 88px" @change="onType">
|
||||
<a-select-option value="">不限</a-select-option>
|
||||
<a-select-option value="userId"> 用户ID </a-select-option>
|
||||
<a-select-option value="phone"> 手机号 </a-select-option>
|
||||
<a-select-option value="nickname"> 昵称 </a-select-option>
|
||||
<a-select-option value="userId"> 用户ID</a-select-option>
|
||||
<a-select-option value="phone"> 手机号</a-select-option>
|
||||
<a-select-option value="nickname"> 昵称</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
</a-input-search>
|
||||
@@ -92,174 +92,176 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
import { message } from 'ant-design-vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { ShopOrder, ShopOrderParam } from '@/api/shop/shopOrder/model';
|
||||
import { listShopOrder } from '@/api/shop/shopOrder';
|
||||
import { getPayType } from '@/utils/shop';
|
||||
import {ref, watch} from 'vue';
|
||||
import {utils, writeFile} from 'xlsx';
|
||||
import {message} from 'ant-design-vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import {ShopOrder, ShopOrderParam} from '@/api/shop/shopOrder/model';
|
||||
import {listShopOrder} from '@/api/shop/shopOrder';
|
||||
import {getPayType} from '@/utils/shop';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的订单
|
||||
selection?: ShopOrder[];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的订单
|
||||
selection?: ShopOrder[];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: ShopOrderParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: ShopOrderParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<ShopOrderParam>({
|
||||
keywords: '',
|
||||
orderId: undefined,
|
||||
orderNo: undefined,
|
||||
createTimeStart: undefined,
|
||||
createTimeEnd: undefined,
|
||||
userId: undefined,
|
||||
payUserId: undefined,
|
||||
nickname: undefined,
|
||||
phone: undefined,
|
||||
payStatus: undefined,
|
||||
orderStatus: undefined,
|
||||
payType: undefined
|
||||
// 表单数据
|
||||
const {where, resetFields} = useSearch<ShopOrderParam>({
|
||||
keywords: '',
|
||||
orderId: undefined,
|
||||
orderNo: undefined,
|
||||
createTimeStart: undefined,
|
||||
createTimeEnd: undefined,
|
||||
userId: undefined,
|
||||
payUserId: undefined,
|
||||
nickname: undefined,
|
||||
phone: undefined,
|
||||
payStatus: undefined,
|
||||
orderStatus: undefined,
|
||||
payType: undefined
|
||||
});
|
||||
|
||||
const reload = () => {
|
||||
emit('search', {
|
||||
...where,
|
||||
keywords: type.value == '' ? where.keywords : undefined
|
||||
});
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
emit('search', {
|
||||
...where,
|
||||
keywords: type.value == '' ? where.keywords : undefined
|
||||
});
|
||||
};
|
||||
// 批量删除
|
||||
// const removeBatch = () => {
|
||||
// emit('remove');
|
||||
// };
|
||||
|
||||
// 批量删除
|
||||
// const removeBatch = () => {
|
||||
// emit('remove');
|
||||
// };
|
||||
const onType = () => {
|
||||
resetFields();
|
||||
};
|
||||
|
||||
const onType = () => {
|
||||
resetFields();
|
||||
};
|
||||
// 获取搜索框placeholder
|
||||
const getSearchPlaceholder = () => {
|
||||
switch (type.value) {
|
||||
case 'userId':
|
||||
where.userId = Number(where.keywords);
|
||||
return '请输入用户ID';
|
||||
case 'phone':
|
||||
where.phone = where.keywords;
|
||||
return '请输入手机号';
|
||||
case 'nickname':
|
||||
where.nickname = where.keywords;
|
||||
return '请输入用户昵称';
|
||||
default:
|
||||
return '请输入搜索内容';
|
||||
}
|
||||
};
|
||||
|
||||
// 获取搜索框placeholder
|
||||
const getSearchPlaceholder = () => {
|
||||
switch (type.value) {
|
||||
case 'userId':
|
||||
where.userId = Number(where.keywords);
|
||||
return '请输入用户ID';
|
||||
case 'phone':
|
||||
where.phone = where.keywords;
|
||||
return '请输入手机号';
|
||||
case 'nickname':
|
||||
where.nickname = where.keywords;
|
||||
return '请输入用户昵称';
|
||||
default:
|
||||
return '请输入搜索内容';
|
||||
}
|
||||
};
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
const [d1, d2] = dateRange.value ?? [];
|
||||
xlsFileName.value = `${d1}至${d2}`;
|
||||
where.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined;
|
||||
where.createTimeEnd = d2 ? d2 + ' 23:59:59' : undefined;
|
||||
emit('search', {
|
||||
...where
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
const [d1, d2] = dateRange.value ?? [];
|
||||
xlsFileName.value = `${d1}至${d2}`;
|
||||
where.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined;
|
||||
where.createTimeEnd = d2 ? d2 + ' 23:59:59' : undefined;
|
||||
emit('search', {
|
||||
...where
|
||||
});
|
||||
};
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
search();
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
search();
|
||||
};
|
||||
const dateRange = ref<[string, string]>(['', '']);
|
||||
// 变量
|
||||
const loading = ref(false);
|
||||
const orders = ref<ShopOrder[]>([]);
|
||||
const xlsFileName = ref<string>();
|
||||
const type = ref('');
|
||||
|
||||
const dateRange = ref<[string, string]>(['', '']);
|
||||
// 变量
|
||||
const loading = ref(false);
|
||||
const orders = ref<ShopOrder[]>([]);
|
||||
const xlsFileName = ref<string>();
|
||||
const type = ref('');
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
loading.value = true;
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'订单编号',
|
||||
'订单标题',
|
||||
'买家姓名',
|
||||
'手机号码',
|
||||
'实付金额(元)',
|
||||
'支付方式',
|
||||
'付款时间',
|
||||
'下单时间'
|
||||
]
|
||||
];
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
loading.value = true;
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'订单编号',
|
||||
'订单标题',
|
||||
'买家姓名',
|
||||
'手机号码',
|
||||
'实付金额(元)',
|
||||
'支付方式',
|
||||
'付款时间',
|
||||
'下单时间'
|
||||
]
|
||||
];
|
||||
|
||||
await listShopOrder(where)
|
||||
.then((list) => {
|
||||
orders.value = list;
|
||||
list?.forEach((d: ShopOrder) => {
|
||||
array.push([
|
||||
`${d.orderNo}`,
|
||||
`${d.comments}`,
|
||||
`${d.realName}`,
|
||||
`${d.phone}`,
|
||||
`${d.payPrice}`,
|
||||
`${getPayType(d.payType)}`,
|
||||
`${d.payTime || ''}`,
|
||||
`${d.createTime}`
|
||||
]);
|
||||
});
|
||||
const sheetName = `订单数据`;
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
Sheets: {}
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 },
|
||||
{ wch: 40 },
|
||||
{ wch: 20 },
|
||||
{ wch: 20 },
|
||||
{ wch: 60 },
|
||||
{ wch: 15 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 20 },
|
||||
{ wch: 10 },
|
||||
{ wch: 20 }
|
||||
];
|
||||
message.loading('正在导出...');
|
||||
setTimeout(() => {
|
||||
writeFile(
|
||||
workbook,
|
||||
`${
|
||||
where.createTimeEnd ? xlsFileName.value + '_' : ''
|
||||
}${sheetName}.xlsx`
|
||||
);
|
||||
loading.value = false;
|
||||
}, 1000);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
await listShopOrder(where)
|
||||
.then((list) => {
|
||||
orders.value = list;
|
||||
list?.forEach((d: ShopOrder) => {
|
||||
array.push([
|
||||
`${d.orderNo}`,
|
||||
`${d.comments}`,
|
||||
`${d.realName}`,
|
||||
`${d.phone}`,
|
||||
`${d.payPrice}`,
|
||||
`${getPayType(d.payType)}`,
|
||||
`${d.payTime || ''}`,
|
||||
`${d.createTime}`
|
||||
]);
|
||||
});
|
||||
const sheetName = `订单数据`;
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
Sheets: {}
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [
|
||||
{wch: 10},
|
||||
{wch: 40},
|
||||
{wch: 20},
|
||||
{wch: 20},
|
||||
{wch: 60},
|
||||
{wch: 15},
|
||||
{wch: 10},
|
||||
{wch: 10},
|
||||
{wch: 20},
|
||||
{wch: 10},
|
||||
{wch: 20}
|
||||
];
|
||||
message.loading('正在导出...');
|
||||
setTimeout(() => {
|
||||
writeFile(
|
||||
workbook,
|
||||
`${
|
||||
where.createTimeEnd ? xlsFileName.value + '_' : ''
|
||||
}${sheetName}.xlsx`
|
||||
);
|
||||
loading.value = false;
|
||||
})
|
||||
.finally(() => {});
|
||||
};
|
||||
}, 1000);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
loading.value = false;
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<a-tabs type="card" v-model:activeKey="activeKey" @change="onTabs">
|
||||
<a-tab-pane key="all" tab="全部" />
|
||||
<a-tab-pane key="unpaid" tab="待付款" />
|
||||
<a-tab-pane key="undelivered" tab="待发货" />
|
||||
<a-tab-pane key="unreceived" tab="待收货" />
|
||||
<a-tab-pane key="completed" tab="已完成" />
|
||||
<!-- <a-tab-pane key="unpaid" tab="待付款" />-->
|
||||
<a-tab-pane key="refunded" tab="退货/售后" />
|
||||
<a-tab-pane key="cancelled" tab="已关闭" />
|
||||
</a-tabs>
|
||||
@@ -25,16 +25,103 @@
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
cache-key="proShopOrderTable"
|
||||
:toolbar="false"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar> </template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'name'">
|
||||
<div @click="onSearch(record)" class="cursor-pointer">{{
|
||||
record.name || '匿名'
|
||||
}}</div>
|
||||
<template v-if="column.key === 'userInfo'">
|
||||
<a-space :size="8">
|
||||
<a-avatar
|
||||
v-if="record.avatar"
|
||||
:src="record.avatar"
|
||||
shape="square"
|
||||
/>
|
||||
<div class="leading-tight">
|
||||
<div class="cursor-pointer" @click.stop="onSearch(record)">
|
||||
{{
|
||||
record.nickname ||
|
||||
record.realName ||
|
||||
record.name ||
|
||||
'匿名'
|
||||
}}
|
||||
<span v-if="record.userId" class="text-gray-400">
|
||||
(ID:{{ record.userId }})
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="record.mobile || record.phone"
|
||||
class="text-gray-500 text-xs"
|
||||
>
|
||||
{{ record.mobile || record.phone }}
|
||||
</div>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'statusInfo'">
|
||||
<div class="py-1">
|
||||
<a-space :size="6" wrap>
|
||||
<!-- 支付状态 -->
|
||||
<a-tag
|
||||
v-if="record.payStatus == 1"
|
||||
color="green"
|
||||
@click.stop="updatePayStatus(record)"
|
||||
class="cursor-pointer"
|
||||
>已付款</a-tag
|
||||
>
|
||||
<a-tag
|
||||
v-else-if="record.payStatus == 0 || record.payStatus == null"
|
||||
@click.stop="updatePayStatus(record)"
|
||||
class="cursor-pointer"
|
||||
>未付款</a-tag
|
||||
>
|
||||
<a-tag
|
||||
v-else-if="record.payStatus == 3"
|
||||
color="orange"
|
||||
@click.stop="updatePayStatus(record)"
|
||||
class="cursor-pointer"
|
||||
>占场中</a-tag
|
||||
>
|
||||
|
||||
<!-- 发货状态 -->
|
||||
<a-tag v-if="record.deliveryStatus == 10">未发货</a-tag>
|
||||
<a-tag v-if="record.deliveryStatus == 20" color="green"
|
||||
>已发货</a-tag
|
||||
>
|
||||
<a-tag v-if="record.deliveryStatus == 30" color="blue"
|
||||
>部分发货</a-tag
|
||||
>
|
||||
|
||||
<!-- 开票状态 -->
|
||||
<!-- <a-tag v-if="record.isInvoice == 0">未开具</a-tag>-->
|
||||
<a-tag v-if="record.isInvoice == 1" color="green">已开具</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 2" color="blue">不能开具</a-tag>
|
||||
|
||||
<!-- 订单状态 -->
|
||||
<a-tag v-if="record.orderStatus === 0">未完成</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 1" color="green"
|
||||
>已完成</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 2">已关闭</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 3" color="red"
|
||||
>关闭中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 4" color="red"
|
||||
>退款申请中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 5" color="red"
|
||||
>退款被拒绝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 6" color="orange"
|
||||
>已退款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 7" color="pink"
|
||||
>客户端申请退款</a-tag
|
||||
>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderGoods'">
|
||||
<template v-for="(item, index) in record.orderGoods" :key="index">
|
||||
@@ -46,12 +133,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'phone'">
|
||||
<div v-if="record.mobile" class="text-gray-400">{{
|
||||
record.mobile
|
||||
}}</div>
|
||||
<div v-else class="text-gray-600">{{ record.phone }}</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'payType'">
|
||||
<template v-for="item in getPayType()">
|
||||
<template v-if="record.payStatus == 1">
|
||||
@@ -64,22 +145,6 @@
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'payStatus'">
|
||||
<a-tag
|
||||
v-if="record.payStatus"
|
||||
color="green"
|
||||
@click.stop="updatePayStatus(record)"
|
||||
class="cursor-pointer"
|
||||
>已付款
|
||||
</a-tag>
|
||||
<a-tag
|
||||
v-if="!record.payStatus"
|
||||
@click.stop="updatePayStatus(record)"
|
||||
class="cursor-pointer"
|
||||
>未付款
|
||||
</a-tag>
|
||||
<a-tag v-if="record.payStatus == 3">未付款,占场中</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</template>
|
||||
@@ -87,146 +152,106 @@
|
||||
<a-tag v-if="record.sex === 1">男</a-tag>
|
||||
<a-tag v-if="record.sex === 2">女</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'deliveryStatus'">
|
||||
<a-tag v-if="record.deliveryStatus == 10">未发货</a-tag>
|
||||
<a-tag v-if="record.deliveryStatus == 20" color="green"
|
||||
>已发货</a-tag
|
||||
>
|
||||
<a-tag v-if="record.deliveryStatus == 30" color="blue"
|
||||
>部分发货</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderStatus'">
|
||||
<a-tag v-if="record.orderStatus === 0">未完成</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 1" color="green">已完成</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 2">已关闭</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 3" color="red">关闭中</a-tag>
|
||||
<a-tag v-if="record.orderStatus === 4" color="red"
|
||||
>退款申请中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 5" color="red"
|
||||
>退款被拒绝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 6" color="orange"
|
||||
>退款成功</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus === 7" color="pink"
|
||||
>客户端申请退款</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'isInvoice'">
|
||||
<a-tag v-if="record.isInvoice == 0">未开具</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 1" color="green">已开具</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 2" color="blue">不能开具</a-tag>
|
||||
</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 @click.stop="openEdit(record)"> <EyeOutlined /> 详情 </a>
|
||||
<a-space>
|
||||
<!-- 查看详情 - 所有状态都可以查看 -->
|
||||
<a @click.stop="openEdit(record)"> <EyeOutlined /> 详情 </a>
|
||||
|
||||
<!-- 未付款状态的操作 -->
|
||||
<template v-if="!record.payStatus && record.orderStatus === 0">
|
||||
<a-divider type="vertical" />
|
||||
<a @click.stop="handleEditOrder(record)">
|
||||
<EditOutlined /> 修改
|
||||
</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click.stop="handleCancelOrder(record)">
|
||||
<span class="ele-text-warning"> <CloseOutlined /> 关闭 </span>
|
||||
</a>
|
||||
</template>
|
||||
<!-- 未付款状态的操作 -->
|
||||
<template v-if="!record.payStatus && record.orderStatus === 0">
|
||||
<a @click.stop="handleEditOrder(record)">
|
||||
<EditOutlined /> 修改
|
||||
</a>
|
||||
<a @click.stop="handleCancelOrder(record)">
|
||||
<span class="ele-text-warning"> <CloseOutlined /> 关闭 </span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 已付款未发货状态的操作 -->
|
||||
<template
|
||||
v-if="
|
||||
<!-- 已付款未发货状态的操作 -->
|
||||
<template
|
||||
v-if="
|
||||
record.payStatus &&
|
||||
record.deliveryStatus === 10 &&
|
||||
!isCancelledStatus(record.orderStatus)
|
||||
!isCancelledStatus(record.orderStatus) &&
|
||||
!isRefundStatus(record.orderStatus)
|
||||
"
|
||||
>
|
||||
<a-divider type="vertical" />
|
||||
<a @click.stop="handleDelivery(record)" class="ele-text-primary">
|
||||
<SendOutlined /> 发货
|
||||
</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click.stop="handleApplyRefund(record)">
|
||||
<UndoOutlined /> 退款
|
||||
</a>
|
||||
</template>
|
||||
>
|
||||
<a @click.stop="handleDelivery(record)" class="ele-text-primary">
|
||||
<SendOutlined /> 发货
|
||||
</a>
|
||||
<a v-permission="'shop:shopOrder:refund'" @click.stop="handleApplyRefund(record)">
|
||||
<UndoOutlined /> 退款
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 已发货未完成状态的操作 -->
|
||||
<template
|
||||
v-if="
|
||||
<!-- 已发货未完成状态的操作 -->
|
||||
<template
|
||||
v-if="
|
||||
record.payStatus &&
|
||||
record.deliveryStatus === 20 &&
|
||||
record.orderStatus === 0
|
||||
"
|
||||
>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
@click.stop="handleConfirmReceive(record)"
|
||||
class="ele-text-primary"
|
||||
>
|
||||
<CheckOutlined /> 确认收货
|
||||
</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click.stop="handleApplyRefund(record)">
|
||||
<UndoOutlined /> 退款
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 退款相关状态的操作 -->
|
||||
<template v-if="isRefundStatus(record.orderStatus)">
|
||||
<template
|
||||
v-if="record.orderStatus === 4 || record.orderStatus === 7"
|
||||
>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
@click.stop="handleApproveRefund(record)"
|
||||
class="ele-text-success"
|
||||
@click.stop="handleConfirmReceive(record)"
|
||||
class="ele-text-primary"
|
||||
>
|
||||
<CheckCircleOutlined /> 同意退款
|
||||
<CheckOutlined /> 确认收货
|
||||
</a>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
@click.stop="handleRejectRefund(record)"
|
||||
class="ele-text-danger"
|
||||
>
|
||||
<CloseCircleOutlined /> 拒绝退款
|
||||
<a v-permission="'shop:shopOrder:refund'" @click.stop="handleApplyRefund(record)">
|
||||
<UndoOutlined /> 退款
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<template v-if="record.orderStatus === 5">
|
||||
<a-divider type="vertical" />
|
||||
<a @click.stop="handleRetryRefund(record)">
|
||||
<RedoOutlined /> 重新处理
|
||||
<!-- 退款相关状态的操作 -->
|
||||
<template v-if="isRefundStatus(record.orderStatus)">
|
||||
<template
|
||||
v-if="record.orderStatus === 4 || record.orderStatus === 7"
|
||||
>
|
||||
<a
|
||||
@click.stop="handleApproveRefund(record)"
|
||||
class="ele-text-success"
|
||||
>
|
||||
<CheckCircleOutlined /> 同意退款
|
||||
</a>
|
||||
<a
|
||||
@click.stop="handleRejectRefund(record)"
|
||||
class="ele-text-danger"
|
||||
>
|
||||
<CloseCircleOutlined /> 拒绝退款
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<template v-if="record.orderStatus === 5">
|
||||
<a @click.stop="handleRetryRefund(record)">
|
||||
<RedoOutlined /> 重新处理
|
||||
</a>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- 已完成状态的操作 -->
|
||||
<template v-if="record.orderStatus === 1">
|
||||
<a v-permission="'shop:shopOrder:refund'" @click.stop="handleApplyRefund(record)">
|
||||
<UndoOutlined /> 退款
|
||||
</a>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- 已完成状态的操作 -->
|
||||
<template v-if="record.orderStatus === 1">
|
||||
<a-divider type="vertical" />
|
||||
<a @click.stop="handleApplyRefund(record)">
|
||||
<UndoOutlined /> 申请退款
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 删除操作 - 已完成、已关闭、退款成功的订单可以删除 -->
|
||||
<template v-if="canDeleteOrder(record)">
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此订单吗?删除后无法恢复。"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger" @click.stop>
|
||||
<DeleteOutlined /> 删除
|
||||
</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<!-- 删除操作 - 已完成、已关闭、退款成功的订单可以删除 -->
|
||||
<template v-if="canDeleteOrder(record)">
|
||||
<a-popconfirm
|
||||
title="确定要删除此订单吗?删除后无法恢复。"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger" @click.stop>
|
||||
<DeleteOutlined /> 删除
|
||||
</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
@@ -275,7 +300,7 @@
|
||||
repairOrder,
|
||||
removeShopOrder,
|
||||
removeBatchShopOrder,
|
||||
updateShopOrder
|
||||
updateShopOrder, refundShopOrder
|
||||
} from '@/api/shop/shopOrder';
|
||||
import { updateUser } from '@/api/system/user';
|
||||
import { getPayType } from '@/utils/shop';
|
||||
@@ -297,7 +322,7 @@
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 激活的标签
|
||||
const activeKey = ref<string>('all');
|
||||
const activeKey = ref<string>('undelivered');
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
@@ -326,6 +351,11 @@
|
||||
key: 'orderNo',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '用户信息',
|
||||
dataIndex: 'userId',
|
||||
key: 'userInfo'
|
||||
},
|
||||
{
|
||||
title: '商品信息',
|
||||
dataIndex: 'orderGoods',
|
||||
@@ -336,36 +366,20 @@
|
||||
dataIndex: 'payPrice',
|
||||
key: 'payPrice',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
customRender: ({ text }) => '¥' + text
|
||||
},
|
||||
// {
|
||||
// title: '支付方式',
|
||||
// dataIndex: 'payType',
|
||||
// key: 'payType',
|
||||
// align: 'center',
|
||||
// width: 120,
|
||||
// },
|
||||
{
|
||||
title: '支付方式',
|
||||
dataIndex: 'payType',
|
||||
key: 'payType',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '支付状态',
|
||||
dataIndex: 'payStatus',
|
||||
key: 'payStatus',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '发货状态',
|
||||
dataIndex: 'deliveryStatus',
|
||||
key: 'deliveryStatus',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '开票状态',
|
||||
dataIndex: 'isInvoice',
|
||||
key: 'isInvoice',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
title: '状态',
|
||||
dataIndex: 'orderStatus',
|
||||
key: 'orderStatus',
|
||||
key: 'statusInfo',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
@@ -394,7 +408,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 220,
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
@@ -579,7 +593,7 @@
|
||||
const now = new Date();
|
||||
const refundTime = toDateString(now, 'yyyy-MM-dd HH:mm:ss');
|
||||
|
||||
await updateShopOrder({
|
||||
await refundShopOrder({
|
||||
...record,
|
||||
orderStatus: 6, // 退款成功
|
||||
refundTime: refundTime
|
||||
@@ -643,7 +657,7 @@
|
||||
const now = new Date();
|
||||
const refundApplyTime = toDateString(now, 'yyyy-MM-dd HH:mm:ss');
|
||||
|
||||
await updateShopOrder({
|
||||
await refundShopOrder({
|
||||
...record,
|
||||
orderStatus: 4, // 退款申请中
|
||||
refundApplyTime: refundApplyTime
|
||||
@@ -699,11 +713,11 @@
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
openEdit(record);
|
||||
// openEdit(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
// openEdit(record);
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
61
src/views/shop/shopStore/components/search.vue
Normal file
61
src/views/shop/shopStore/components/search.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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-input-search
|
||||
allow-clear
|
||||
placeholder="门店名称"
|
||||
style="width: 240px"
|
||||
v-model:value="where.keywords"
|
||||
@search="reload"
|
||||
/>
|
||||
</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 {ShopStoreParam} from "@/api/shop/shopStore/model";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: ShopStoreParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<ShopStoreParam>({
|
||||
keywords: '',
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
304
src/views/shop/shopStore/components/shopStoreEdit.vue
Normal file
304
src/views/shop/shopStore/components/shopStoreEdit.vue
Normal file
@@ -0,0 +1,304 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:confirm-loading="loading"
|
||||
: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="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入店铺名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="门店经理" name="managerName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入门店经理"
|
||||
v-model:value="form.managerName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号码" name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入手机号码"
|
||||
:maxlength="11"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="省市区" name="region">
|
||||
<RegionsSelect
|
||||
v-model:value="regions"
|
||||
valueField="label"
|
||||
placeholder="请选择省/市/区"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="门店地址" name="address">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入门店地址"
|
||||
v-model:value="form.address"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="经纬度" name="lngAndLat">
|
||||
<a-space>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入经纬度"
|
||||
style="width: 300px"
|
||||
v-model:value="form.lngAndLat"
|
||||
/>
|
||||
<a-button type="primary" @click="openUrl(`https://lbs.qq.com/getPoint/`)">获取经纬度</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="轮廓" name="points">-->
|
||||
<!-- <div class="flex">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请选取电子围栏的轮廓"-->
|
||||
<!-- v-model:value="form.points"-->
|
||||
<!-- />-->
|
||||
<!-- </div>-->
|
||||
<!-- <template #extra>-->
|
||||
<!-- <p class="py-2">-->
|
||||
<!-- <a-->
|
||||
<!-- class="text-blue-500"-->
|
||||
<!-- href="https://lbs.qq.com/dev/console/cloud/placeCloud/datamanage?table_id=0q3W4MrK1-_6Xag7V1"-->
|
||||
<!-- target="_blank"-->
|
||||
<!-- >使用腾讯地图的工具绘制电子围栏</a-->
|
||||
<!-- >-->
|
||||
<!-- </p>-->
|
||||
<!-- </template>-->
|
||||
<!-- </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="排序号" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</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 { addShopStore, updateShopStore } from '@/api/shop/shopStore';
|
||||
import { ShopStore } from '@/api/shop/shopStore/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';
|
||||
import {openUrl} from "@/utils/common";
|
||||
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: ShopStore | 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 regions = ref<string[]>();
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<ShopStore>({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
address: undefined,
|
||||
phone: undefined,
|
||||
email: undefined,
|
||||
managerName: undefined,
|
||||
shopBanner: undefined,
|
||||
province: undefined,
|
||||
city: undefined,
|
||||
region: undefined,
|
||||
lngAndLat: undefined,
|
||||
location: undefined,
|
||||
district: undefined,
|
||||
points: undefined,
|
||||
userId: undefined,
|
||||
isDelete: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写门店名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
region: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择省/市/区',
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
address: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写门店地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.shopBanner = data.path;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.shopBanner = '';
|
||||
};
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
// 级联选择回填到表单字段,保持提交参数仍然是 province/city/region
|
||||
watch(
|
||||
regions,
|
||||
(val) => {
|
||||
form.province = val?.[0];
|
||||
form.city = val?.[1];
|
||||
form.region = val?.[2];
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateShopStore : addShopStore;
|
||||
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.shopBanner){
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.shopBanner,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
regions.value =
|
||||
form.province && form.city && form.region
|
||||
? [form.province, form.city, form.region]
|
||||
: undefined;
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
regions.value = undefined;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
regions.value = undefined;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
277
src/views/shop/shopStore/index.vue
Normal file
277
src/views/shop/shopStore/index.vue
Normal file
@@ -0,0 +1,277 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'name'">
|
||||
<a-tag color="orange">{{ record.name }}</a-tag>
|
||||
</template>
|
||||
<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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ShopStoreEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</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 {getPageTitle} from '@/utils/common';
|
||||
import ShopStoreEdit from './components/shopStoreEdit.vue';
|
||||
import { pageShopStore, removeShopStore, removeBatchShopStore } from '@/api/shop/shopStore';
|
||||
import type { ShopStore, ShopStoreParam } from '@/api/shop/shopStore/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<ShopStore[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<ShopStore | 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 pageShopStore({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '店铺ID',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '店铺名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name'
|
||||
},
|
||||
// {
|
||||
// title: '手机号码',
|
||||
// dataIndex: 'phone',
|
||||
// key: 'phone',
|
||||
// ellipsis: true
|
||||
// },
|
||||
{
|
||||
title: '门店经理',
|
||||
dataIndex: 'managerName',
|
||||
key: 'managerName'
|
||||
},
|
||||
{
|
||||
title: '所在省份',
|
||||
dataIndex: 'province',
|
||||
key: 'province'
|
||||
},
|
||||
{
|
||||
title: '所在城市',
|
||||
dataIndex: 'city',
|
||||
key: 'city'
|
||||
},
|
||||
{
|
||||
title: '所在辖区',
|
||||
dataIndex: 'region',
|
||||
key: 'region'
|
||||
},
|
||||
{
|
||||
title: '门店地址',
|
||||
dataIndex: 'address',
|
||||
key: 'address'
|
||||
},
|
||||
// {
|
||||
// title: '经度',
|
||||
// dataIndex: 'lng',
|
||||
// key: 'lng',
|
||||
// ellipsis: true
|
||||
// },
|
||||
// {
|
||||
// title: '纬度',
|
||||
// dataIndex: 'lat',
|
||||
// key: 'lat',
|
||||
// ellipsis: true
|
||||
// },
|
||||
// {
|
||||
// title: '门店备注',
|
||||
// dataIndex: 'comments',
|
||||
// key: 'comments',
|
||||
// ellipsis: true
|
||||
// },
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ShopStoreParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: ShopStore) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: ShopStore) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeShopStore(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);
|
||||
removeBatchShopStore(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: ShopStore) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopStore'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
42
src/views/shop/shopStoreFence/components/search.vue
Normal file
42
src/views/shop/shopStoreFence/components/search.vue
Normal file
@@ -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>
|
||||
287
src/views/shop/shopStoreFence/components/shopStoreFenceEdit.vue
Normal file
287
src/views/shop/shopStoreFence/components/shopStoreFenceEdit.vue
Normal file
@@ -0,0 +1,287 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:confirm-loading="loading"
|
||||
:title="isUpdate ? '编辑电子围栏' : '添加电子围栏'"
|
||||
:body-style="{ paddingBottom: '28px', maxHeight: '70vh', overflow: 'auto' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:disabled="loading"
|
||||
: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="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入围栏名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-row :gutter="16">
|
||||
<a-col :xs="24" :sm="24">
|
||||
<a-form-item label="围栏类型" name="type">
|
||||
<a-radio-group v-model:value="form.type">
|
||||
<a-radio :value="0">圆形</a-radio>
|
||||
<a-radio :value="1">方形/多边形</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-form-item label="围栏范围" name="points" :extra="pointsHelp">
|
||||
<a-textarea
|
||||
:auto-size="{ minRows: 3, maxRows: 6 }"
|
||||
allow-clear
|
||||
:placeholder="pointsPlaceholder"
|
||||
v-model:value="form.points"
|
||||
/>
|
||||
<p class="py-2">
|
||||
<a
|
||||
class="text-blue-500"
|
||||
href="https://lbs.qq.com/dev/console/cloud/placeCloud/datamanage?table_id=0q3W4MrK1-_6Xag7V1"
|
||||
target="_blank"
|
||||
>使用腾讯地图的工具绘制电子围栏</a
|
||||
>
|
||||
</p>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="定位描述" name="location">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="如:xx商圈/xx门店附近(可选)"
|
||||
v-model:value="form.location"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="所属区域" name="district">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="如:广东省/广州市/天河区(可选)"
|
||||
v-model:value="form.district"
|
||||
/>
|
||||
</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="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="备注" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入描述"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { addShopStoreFence, updateShopStoreFence } from '@/api/shop/shopStoreFence';
|
||||
import { ShopStoreFence } from '@/api/shop/shopStoreFence/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: ShopStoreFence | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = true;
|
||||
// 表单实例
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
const getDefaultForm = (): ShopStoreFence => ({
|
||||
id: undefined,
|
||||
name: '',
|
||||
type: 0,
|
||||
location: '',
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
district: '',
|
||||
points: '',
|
||||
sortNumber: 100,
|
||||
comments: '',
|
||||
status: 0,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined
|
||||
});
|
||||
|
||||
const form = reactive<ShopStoreFence>(getDefaultForm());
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
// 保存中不允许关闭,避免重复提交/状态不一致
|
||||
if (!value && loading.value) {
|
||||
return;
|
||||
}
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写电子围栏名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
type: 'number',
|
||||
message: '请选择围栏类型',
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
longitude: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写经度',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
latitude: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写纬度',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
points: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写围栏范围',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const pointsPlaceholder = computed(() => {
|
||||
return form.type === 0
|
||||
? '圆形示例:lng,lat,radius(米) 例如:113.123456,23.123456,500'
|
||||
: '多边形示例:lng,lat;lng,lat;lng,lat 例如:113.1,23.1;113.2,23.1;113.2,23.2;113.1,23.2';
|
||||
});
|
||||
|
||||
const pointsHelp = computed(() => {
|
||||
return form.type === 0
|
||||
? '按 “经度,纬度,半径(米)” 填写'
|
||||
: '按 “经度,纬度;经度,纬度;...” 填写,建议首尾闭合';
|
||||
});
|
||||
|
||||
const resetForm = async () => {
|
||||
assignObject(form, getDefaultForm());
|
||||
await nextTick();
|
||||
formRef.value?.clearValidate?.();
|
||||
};
|
||||
|
||||
const fillForm = async (data: ShopStoreFence) => {
|
||||
await resetForm();
|
||||
assignObject(form, data);
|
||||
await nextTick();
|
||||
formRef.value?.clearValidate?.();
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = async () => {
|
||||
if (!formRef.value || loading.value) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await formRef.value.validate();
|
||||
loading.value = true;
|
||||
const formData: ShopStoreFence = {
|
||||
...form,
|
||||
name: form.name?.trim(),
|
||||
location: form.location?.trim(),
|
||||
longitude: form.longitude?.trim(),
|
||||
latitude: form.latitude?.trim(),
|
||||
district: form.district?.trim(),
|
||||
points: form.points?.trim(),
|
||||
comments: form.comments?.trim()
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateShopStoreFence : addShopStoreFence;
|
||||
const msg = await saveOrUpdate(formData);
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
} catch (e: any) {
|
||||
loading.value = false;
|
||||
if (e?.message) {
|
||||
message.error(e.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
void fillForm(props.data);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
void resetForm();
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
void resetForm();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
246
src/views/shop/shopStoreFence/index.vue
Normal file
246
src/views/shop/shopStoreFence/index.vue
Normal file
@@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
: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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ShopStoreFenceEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, computed } 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 {getPageTitle} from '@/utils/common';
|
||||
import ShopStoreFenceEdit from './components/shopStoreFenceEdit.vue';
|
||||
import { pageShopStoreFence, removeShopStoreFence, removeBatchShopStoreFence } from '@/api/shop/shopStoreFence';
|
||||
import type { ShopStoreFence, ShopStoreFenceParam } from '@/api/shop/shopStoreFence/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<ShopStoreFence[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<ShopStoreFence | 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 pageShopStoreFence({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '围栏名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center',
|
||||
customRender: ({ text }) => {
|
||||
if (text === 0) {
|
||||
return '圆形';
|
||||
}
|
||||
if (text === 1) {
|
||||
return '方形/多边形';
|
||||
}
|
||||
return text;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '备注',
|
||||
// dataIndex: 'comments',
|
||||
// key: 'comments',
|
||||
// ellipsis: true
|
||||
// },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ShopStoreFenceParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: ShopStoreFence) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: ShopStoreFence) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeShopStoreFence(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);
|
||||
removeBatchShopStoreFence(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: ShopStoreFence) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopStoreFence'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
42
src/views/shop/shopStoreRider/components/search.vue
Normal file
42
src/views/shop/shopStoreRider/components/search.vue
Normal file
@@ -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>
|
||||
478
src/views/shop/shopStoreRider/components/shopStoreRiderEdit.vue
Normal file
478
src/views/shop/shopStoreRider/components/shopStoreRiderEdit.vue
Normal file
@@ -0,0 +1,478 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:confirm-loading="loading"
|
||||
: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: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="选择用户" name="userId">
|
||||
<!-- SelectUser 组件本身不支持 v-model,只通过 @done 回传选择结果;用 key 强制刷新回显 -->
|
||||
<SelectUser
|
||||
:key="String(form.userId ?? '') + selectedUserText"
|
||||
:value="selectedUserText"
|
||||
:placeholder="`选择用户`"
|
||||
@done="onChooseUser"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所属门店" name="storeId">
|
||||
<SelectShopStore
|
||||
:key="String(form.storeId ?? '') + selectedStoreText"
|
||||
:value="selectedStoreText"
|
||||
:placeholder="`选择门店`"
|
||||
@done="onChooseStore"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="配送点(小区)" name="dealerId">
|
||||
<SelectCommunity
|
||||
:key="String(form.dealerId ?? '') + selectedCommunityText"
|
||||
:value="selectedCommunityText"
|
||||
:placeholder="`选择小区`"
|
||||
@done="onChooseCommunity"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="骑手编号" name="riderNo">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入骑手编号(可选)"
|
||||
v-model:value="form.riderNo"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="姓名" name="realName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入姓名"
|
||||
v-model:value="form.realName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号" name="mobile">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入手机号"
|
||||
v-model:value="form.mobile"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="头像" name="avatar">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入头像"-->
|
||||
<!-- v-model:value="form.avatar"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="身份证号" name="idCardNo">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入身份证号"
|
||||
:value="maskedIdCardNo"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="接单状态" name="workStatus">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入接单状态:0休息/下线;1在线;2忙碌"
|
||||
v-model:value="form.workStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="自动派单" name="autoDispatchEnabled">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否开启自动派单:1是;0否"
|
||||
v-model:value="form.autoDispatchEnabled"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="派单优先级" name="dispatchPriority">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入派单优先级(同小区多骑手时可用,值越大越优先)"
|
||||
v-model:value="form.dispatchPriority"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="最大同时配送单数" name="maxOnhandOrders">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入最大同时配送单数(0表示不限制)"
|
||||
v-model:value="form.maxOnhandOrders"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否计算工资" name="commissionCalcEnabled">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否计算工资(提成):1计算;0不计算(如三方配送点可设0)"
|
||||
v-model:value="form.commissionCalcEnabled"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="提成单价(元/桶)" name="waterBucketUnitFee">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入水每桶提成金额(元/桶)"
|
||||
v-model:value="form.waterBucketUnitFee"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="其他商品提成方式" name="otherGoodsCommissionType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入其他商品提成方式:1按订单固定金额;2按订单金额比例;3按商品规则(另表)"
|
||||
v-model:value="form.otherGoodsCommissionType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="其他商品提成值" name="otherGoodsCommissionValue">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入其他商品提成值:固定金额(元)或比例(%)"
|
||||
v-model:value="form.otherGoodsCommissionValue"
|
||||
/>
|
||||
</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="排序号" 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="status">
|
||||
<a-radio-group v-model:value="form.status">
|
||||
<a-radio :value="1">启用</a-radio>
|
||||
<a-radio :value="0">禁用</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import {
|
||||
addShopStoreRider,
|
||||
updateShopStoreRider
|
||||
} from '@/api/shop/shopStoreRider';
|
||||
import { ShopStoreRider } from '@/api/shop/shopStoreRider/model';
|
||||
import { getUser } from '@/api/system/user';
|
||||
import { getShopCommunity } from '@/api/shop/shopCommunity';
|
||||
import { getShopStore } from '@/api/shop/shopStore';
|
||||
import SelectUser from '@/components/SelectUser/index.vue';
|
||||
import SelectCommunity from '@/components/SelectCommunity/index.vue';
|
||||
import SelectShopStore from '@/components/SelectShopStore/index.vue';
|
||||
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';
|
||||
import type { User } from '@/api/system/user/model';
|
||||
import type { ShopCommunity } from '@/api/shop/shopCommunity/model';
|
||||
import type { ShopStore } from '@/api/shop/shopStore/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: ShopStoreRider | 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 selectedUserText = ref('');
|
||||
const selectedCommunityText = ref('');
|
||||
const selectedStoreText = ref('');
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<ShopStoreRider>({
|
||||
id: undefined,
|
||||
storeId: undefined,
|
||||
dealerId: undefined,
|
||||
riderNo: undefined,
|
||||
realName: undefined,
|
||||
mobile: undefined,
|
||||
avatar: undefined,
|
||||
idCardNo: undefined,
|
||||
workStatus: undefined,
|
||||
autoDispatchEnabled: undefined,
|
||||
dispatchPriority: undefined,
|
||||
maxOnhandOrders: undefined,
|
||||
commissionCalcEnabled: undefined,
|
||||
waterBucketUnitFee: undefined,
|
||||
otherGoodsCommissionType: undefined,
|
||||
otherGoodsCommissionValue: undefined,
|
||||
userId: undefined,
|
||||
isDelete: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
userId: [
|
||||
{
|
||||
validator: (_rule: unknown, value: number | undefined) => {
|
||||
if (!value) {
|
||||
return Promise.reject(new Error('请选择用户'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
storeId: [
|
||||
{
|
||||
validator: (_rule: unknown, value: number | undefined) => {
|
||||
if (!value) {
|
||||
return Promise.reject(new Error('请选择门店'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
// userId: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'string',
|
||||
// message: '请选择用户',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
// dealerId: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'string',
|
||||
// message: '请选择配送点',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
// realName: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'string',
|
||||
// message: '请填写姓名',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
});
|
||||
|
||||
const _chooseImage = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.avatar = data.path;
|
||||
};
|
||||
|
||||
const _onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.avatar = '';
|
||||
};
|
||||
|
||||
const maskIdCard = (value?: string) => {
|
||||
if (!value) return '';
|
||||
const s = String(value).trim();
|
||||
const startLen = Math.min(6, Math.max(0, s.length - 4));
|
||||
const endLen = Math.min(4, s.length);
|
||||
const starLen = Math.max(4, s.length - startLen - endLen);
|
||||
if (s.length <= startLen + endLen) return s;
|
||||
return `${s.slice(0, startLen)}${'*'.repeat(starLen)}${s.slice(-endLen)}`;
|
||||
};
|
||||
|
||||
const maskedIdCardNo = computed(() => maskIdCard(form.idCardNo));
|
||||
|
||||
const onChooseUser = (user?: User) => {
|
||||
if (!user) {
|
||||
selectedUserText.value = '';
|
||||
form.userId = undefined;
|
||||
formRef.value?.validateFields(['userId']).catch(() => {});
|
||||
return;
|
||||
}
|
||||
form.userId = user.userId;
|
||||
form.realName = user.realName ?? user.nickname;
|
||||
form.mobile = user.phone ?? user.mobile;
|
||||
form.avatar = user.avatar ?? user.avatarUrl;
|
||||
form.idCardNo = user.idCard ?? user.idcard;
|
||||
|
||||
const name = user.realName ?? user.nickname ?? '';
|
||||
const phone = user.phone ?? user.mobile ?? '';
|
||||
selectedUserText.value = phone ? `${name}(${phone})` : name;
|
||||
formRef.value?.validateFields(['userId']).catch(() => {});
|
||||
};
|
||||
|
||||
const onChooseCommunity = (
|
||||
community?: ShopCommunity & { index?: number }
|
||||
) => {
|
||||
if (!community) {
|
||||
selectedCommunityText.value = '';
|
||||
form.dealerId = undefined;
|
||||
return;
|
||||
}
|
||||
form.dealerId = community.id;
|
||||
selectedCommunityText.value = community.name ?? String(community.id ?? '');
|
||||
};
|
||||
|
||||
const onChooseStore = (store?: ShopStore) => {
|
||||
if (!store) {
|
||||
selectedStoreText.value = '';
|
||||
form.storeId = undefined;
|
||||
formRef.value?.validateFields(['storeId']).catch(() => {});
|
||||
return;
|
||||
}
|
||||
form.storeId = store.id;
|
||||
selectedStoreText.value = store.name ?? String(store.id ?? '');
|
||||
formRef.value?.validateFields(['storeId']).catch(() => {});
|
||||
};
|
||||
|
||||
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
|
||||
? updateShopStoreRider
|
||||
: addShopStoreRider;
|
||||
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 = [];
|
||||
selectedUserText.value = '';
|
||||
selectedCommunityText.value = '';
|
||||
selectedStoreText.value = '';
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.avatar) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.avatar,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
|
||||
// 回显展示文本(避免组件内部不响应 props.value 更新)
|
||||
if (form.userId) {
|
||||
const uid = form.userId;
|
||||
getUser(form.userId)
|
||||
.then((user) => {
|
||||
if (form.userId !== uid) return;
|
||||
const name = user.realName ?? user.nickname ?? '';
|
||||
const phone = user.phone ?? user.mobile ?? '';
|
||||
selectedUserText.value = phone ? `${name}(${phone})` : name;
|
||||
})
|
||||
.catch(() => {
|
||||
if (form.userId !== uid) return;
|
||||
selectedUserText.value = String(form.userId ?? '');
|
||||
});
|
||||
}
|
||||
if (form.storeId) {
|
||||
// 优先使用列表接口返回的 storeName 回显,避免额外请求
|
||||
if ((props.data as any)?.storeName) {
|
||||
selectedStoreText.value = String((props.data as any).storeName);
|
||||
} else {
|
||||
const sid = form.storeId;
|
||||
getShopStore(form.storeId)
|
||||
.then((store) => {
|
||||
if (form.storeId !== sid) return;
|
||||
selectedStoreText.value =
|
||||
store.name ?? String(store.id ?? '');
|
||||
})
|
||||
.catch(() => {
|
||||
if (form.storeId !== sid) return;
|
||||
selectedStoreText.value = String(form.storeId ?? '');
|
||||
});
|
||||
}
|
||||
}
|
||||
if (form.dealerId) {
|
||||
const dealerId = form.dealerId;
|
||||
getShopCommunity(form.dealerId)
|
||||
.then((community) => {
|
||||
if (form.dealerId !== dealerId) return;
|
||||
selectedCommunityText.value =
|
||||
community.name ?? String(community.id ?? '');
|
||||
})
|
||||
.catch(() => {
|
||||
if (form.dealerId !== dealerId) return;
|
||||
selectedCommunityText.value = String(form.dealerId ?? '');
|
||||
});
|
||||
}
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
311
src/views/shop/shopStoreRider/index.vue
Normal file
311
src/views/shop/shopStoreRider/index.vue
Normal file
@@ -0,0 +1,311 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
: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 === 'storeName'">
|
||||
<a-tag v-if="record.storeName" color="orange">{{ record.storeName }}</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'workStatus'">
|
||||
<a-tag v-if="record.status === 2" color="red">忙碌</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="green">在线</a-tag>
|
||||
<a-tag v-if="record.status === 0">休息</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 1" color="green">启用</a-tag>
|
||||
<a-tag v-if="record.status === 0" 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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ShopStoreRiderEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, computed } 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 {getPageTitle} from '@/utils/common';
|
||||
import ShopStoreRiderEdit from './components/shopStoreRiderEdit.vue';
|
||||
import { pageShopStoreRider, removeShopStoreRider, removeBatchShopStoreRider } from '@/api/shop/shopStoreRider';
|
||||
import type { ShopStoreRider, ShopStoreRiderParam } from '@/api/shop/shopStoreRider/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<ShopStoreRider[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<ShopStoreRider | 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 pageShopStoreRider({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '所属门店',
|
||||
dataIndex: 'storeName',
|
||||
key: 'storeName'
|
||||
},
|
||||
{
|
||||
title: '配送员',
|
||||
dataIndex: 'realName',
|
||||
key: 'realName'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
dataIndex: 'mobile',
|
||||
key: 'mobile'
|
||||
},
|
||||
// {
|
||||
// title: '头像',
|
||||
// dataIndex: 'avatar',
|
||||
// key: 'avatar'
|
||||
// },
|
||||
{
|
||||
title: '身份证号',
|
||||
dataIndex: 'idCardNo',
|
||||
key: 'idCardNo'
|
||||
},
|
||||
{
|
||||
title: '接单状态',
|
||||
dataIndex: 'workStatus',
|
||||
key: 'workStatus',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '自动派单',
|
||||
dataIndex: 'autoDispatchEnabled',
|
||||
key: 'autoDispatchEnabled',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '派单优先级',
|
||||
dataIndex: 'dispatchPriority',
|
||||
key: 'dispatchPriority',
|
||||
width: 90,
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '最大同时配送单数(0表示不限制)',
|
||||
// dataIndex: 'maxOnhandOrders',
|
||||
// key: 'maxOnhandOrders',
|
||||
// width: 120
|
||||
// },
|
||||
// {
|
||||
// title: '是否计算工资',
|
||||
// dataIndex: 'commissionCalcEnabled',
|
||||
// key: 'commissionCalcEnabled',
|
||||
// width: 90
|
||||
// },
|
||||
// {
|
||||
// title: '水每桶提成金额(元/桶)',
|
||||
// dataIndex: 'waterBucketUnitFee',
|
||||
// key: 'waterBucketUnitFee'
|
||||
// },
|
||||
// {
|
||||
// title: '商品提成方式',
|
||||
// dataIndex: 'otherGoodsCommissionType',
|
||||
// key: 'otherGoodsCommissionType'
|
||||
// },
|
||||
// {
|
||||
// title: '其他商品提成值:固定金额(元)或比例(%)',
|
||||
// dataIndex: 'otherGoodsCommissionValue',
|
||||
// key: 'otherGoodsCommissionValue'
|
||||
// },
|
||||
// {
|
||||
// title: '备注',
|
||||
// dataIndex: 'comments',
|
||||
// key: 'comments',
|
||||
// ellipsis: true
|
||||
// },
|
||||
// {
|
||||
// title: '排序号',
|
||||
// dataIndex: 'sortNumber',
|
||||
// key: 'sortNumber',
|
||||
// width: 120
|
||||
// },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ShopStoreRiderParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: ShopStoreRider) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: ShopStoreRider) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeShopStoreRider(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);
|
||||
removeBatchShopStoreRider(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: ShopStoreRider) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopStoreRider'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
42
src/views/shop/shopStoreUser/components/search.vue
Normal file
42
src/views/shop/shopStoreUser/components/search.vue
Normal file
@@ -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>
|
||||
219
src/views/shop/shopStoreUser/components/shopStoreUserEdit.vue
Normal file
219
src/views/shop/shopStoreUser/components/shopStoreUserEdit.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="storeId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请选择门店"
|
||||
v-model:value="form.storeId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="选择用户" name="userId">
|
||||
<SelectUser
|
||||
:placeholder="`选择用户`"
|
||||
v-model:value="form.userId"
|
||||
@done="onToUser"
|
||||
/>
|
||||
</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="排序号" 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="isDelete">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否删除"
|
||||
v-model:value="form.isDelete"
|
||||
/>
|
||||
</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 { addShopStoreUser, updateShopStoreUser } from '@/api/shop/shopStoreUser';
|
||||
import { ShopStoreUser } from '@/api/shop/shopStoreUser/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';
|
||||
import {User} from "@/api/system/user/model";
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: ShopStoreUser | 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<ShopStoreUser>({
|
||||
id: undefined,
|
||||
storeId: undefined,
|
||||
userId: undefined,
|
||||
isDelete: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
shopStoreUserId: undefined,
|
||||
shopStoreUserName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
shopStoreUserName: [
|
||||
{
|
||||
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 onToUser = (item: User) => {
|
||||
form.userId = item.userId;
|
||||
form.realName = item.realName;
|
||||
// form.toUserId = item.userId;
|
||||
// form.toUserName = item.nickname;
|
||||
};
|
||||
|
||||
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 ? updateShopStoreUser : addShopStoreUser;
|
||||
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>
|
||||
244
src/views/shop/shopStoreUser/index.vue
Normal file
244
src/views/shop/shopStoreUser/index.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
: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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ShopStoreUserEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, computed } 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 {getPageTitle} from '@/utils/common';
|
||||
import ShopStoreUserEdit from './components/shopStoreUserEdit.vue';
|
||||
import { pageShopStoreUser, removeShopStoreUser, removeBatchShopStoreUser } from '@/api/shop/shopStoreUser';
|
||||
import type { ShopStoreUser, ShopStoreUserParam } from '@/api/shop/shopStoreUser/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<ShopStoreUser[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<ShopStoreUser | 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 pageShopStoreUser({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '所属门店',
|
||||
dataIndex: 'storeId',
|
||||
key: 'storeId',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ShopStoreUserParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: ShopStoreUser) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: ShopStoreUser) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeShopStoreUser(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);
|
||||
removeBatchShopStoreUser(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: ShopStoreUser) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopStoreUser'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
42
src/views/shop/shopStoreWarehouse/components/search.vue
Normal file
42
src/views/shop/shopStoreWarehouse/components/search.vue
Normal file
@@ -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,237 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入仓库名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="仓库编号" name="code">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入唯一标识"
|
||||
v-model:value="form.code"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="类型" name="type">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入类型 中心仓,区域仓,门店仓"
|
||||
v-model:value="form.type"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="仓库地址" name="address">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入仓库地址"
|
||||
v-model:value="form.address"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="仓库管理员" name="realName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入真实姓名"
|
||||
v-model:value="form.realName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="联系电话" name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入联系电话"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所在省份" name="province">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入所在省份"
|
||||
v-model:value="form.province"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所在城市" name="city">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入所在城市"
|
||||
v-model:value="form.city"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所在辖区" name="region">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入所在辖区"
|
||||
v-model:value="form.region"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="经纬度" name="lngAndLat">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入经纬度"
|
||||
v-model:value="form.lngAndLat"
|
||||
/>
|
||||
</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="排序号" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</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 } from 'ele-admin-pro';
|
||||
import { addShopStoreWarehouse, updateShopStoreWarehouse } from '@/api/shop/shopStoreWarehouse';
|
||||
import { ShopStoreWarehouse } from '@/api/shop/shopStoreWarehouse/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';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: ShopStoreWarehouse | 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<ShopStoreWarehouse>({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
type: undefined,
|
||||
address: undefined,
|
||||
realName: undefined,
|
||||
phone: undefined,
|
||||
province: undefined,
|
||||
city: undefined,
|
||||
region: undefined,
|
||||
lngAndLat: undefined,
|
||||
userId: undefined,
|
||||
isDelete: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
shopStoreWarehouseName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写仓库名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
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 ? updateShopStoreWarehouse : addShopStoreWarehouse;
|
||||
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);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
241
src/views/shop/shopStoreWarehouse/index.vue
Normal file
241
src/views/shop/shopStoreWarehouse/index.vue
Normal file
@@ -0,0 +1,241 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<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"
|
||||
: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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ShopStoreWarehouseEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</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 {getPageTitle} from '@/utils/common';
|
||||
import ShopStoreWarehouseEdit from './components/shopStoreWarehouseEdit.vue';
|
||||
import { pageShopStoreWarehouse, removeShopStoreWarehouse, removeBatchShopStoreWarehouse } from '@/api/shop/shopStoreWarehouse';
|
||||
import type { ShopStoreWarehouse, ShopStoreWarehouseParam } from '@/api/shop/shopStoreWarehouse/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<ShopStoreWarehouse[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<ShopStoreWarehouse | 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 pageShopStoreWarehouse({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '仓库名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '仓库编号',
|
||||
dataIndex: 'code',
|
||||
key: 'code'
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type'
|
||||
},
|
||||
{
|
||||
title: '仓库地址',
|
||||
dataIndex: 'address',
|
||||
key: 'address',
|
||||
},
|
||||
{
|
||||
title: '所在城市',
|
||||
dataIndex: 'city',
|
||||
key: 'city',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ShopStoreWarehouseParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: ShopStoreWarehouse) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: ShopStoreWarehouse) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeShopStoreWarehouse(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);
|
||||
removeBatchShopStoreWarehouse(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: ShopStoreWarehouse) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopStoreWarehouse'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a
|
||||
href="https://server.websoft.top/api/system/user/import/template"
|
||||
href="https://glt-server.websoft.top/api/system/user/import/template"
|
||||
download="用户导入模板.xlsx"
|
||||
>
|
||||
下载导入模板
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<a-button type="dashed" @click="openImport">恢复</a-button>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词搜索"
|
||||
placeholder="请输入菜单名称"
|
||||
style="width: 240px"
|
||||
v-model:value="where.keywords"
|
||||
v-model:value="where.title"
|
||||
@search="reload"
|
||||
/>
|
||||
<a-button type="text" @click="reset">重置</a-button>
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { addSetting, listSetting, updateSetting } from "@/api/system/setting";
|
||||
import { addSetting, listSetting, updateSettingByKey } from "@/api/system/setting";
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { uploadFile } from "@/api/system/file";
|
||||
import { FILE_SERVER } from "@/config/setting";
|
||||
@@ -149,7 +149,7 @@
|
||||
|
||||
// 保存字段信息(设定好key和描述,content里的字段是随意加的会自动转为json保存到数据库)
|
||||
const settingId = ref(null);
|
||||
const settingKey = ref('');
|
||||
const settingKey = ref('basic');
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
@@ -167,6 +167,8 @@
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Setting>({
|
||||
settingId: undefined,
|
||||
settingKey: settingKey.value,
|
||||
siteName: '',
|
||||
icp: '',
|
||||
copyright: '',
|
||||
@@ -266,11 +268,12 @@
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
form.settingKey = settingKey.value;
|
||||
const appForm = {
|
||||
...form,
|
||||
content: JSON.stringify(form),
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateSetting : addSetting;
|
||||
const saveOrUpdate = isUpdate.value ? updateSettingByKey : addSetting;
|
||||
saveOrUpdate(appForm)
|
||||
.then((msg) => {
|
||||
message.success('保存成功');
|
||||
@@ -285,32 +288,64 @@
|
||||
watch(
|
||||
() => props.data,
|
||||
(data) => {
|
||||
if(data?.settingId){
|
||||
isUpdate.value = true
|
||||
// 表单赋值
|
||||
if(data.content){
|
||||
const jsonData = JSON.parse(data.content);
|
||||
assignFields(jsonData);
|
||||
// 头像赋值
|
||||
logo.value = [];
|
||||
if (jsonData.logo) {
|
||||
logo.value.push({ uid:1, url: jsonData.logo, status: '' });
|
||||
}
|
||||
if(jsonData.keyword){
|
||||
keyword.value = JSON.parse(jsonData.keyword)
|
||||
}
|
||||
}
|
||||
// 其他必要参数
|
||||
form.settingId = data.settingId
|
||||
form.settingKey = data.settingKey
|
||||
|
||||
} else {
|
||||
// 新增
|
||||
isUpdate.value = false
|
||||
const activeMatch = props.value === settingKey.value;
|
||||
if (!data || typeof data !== 'object') {
|
||||
if (!activeMatch) return;
|
||||
isUpdate.value = false;
|
||||
resetFields();
|
||||
form.settingKey = props.value
|
||||
logo.value = [];
|
||||
keyword.value = [];
|
||||
form.settingId = undefined;
|
||||
form.settingKey = settingKey.value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const normalized: any = Array.isArray(data)
|
||||
? data.find((d) => d?.settingKey === settingKey.value) ?? data[0]
|
||||
: (data as any).data && typeof (data as any).data === 'object'
|
||||
? (data as any).data
|
||||
: data;
|
||||
|
||||
let parsedContent: any | undefined;
|
||||
const rawContent = (normalized as any).content;
|
||||
if (rawContent) {
|
||||
if (typeof rawContent === 'string') {
|
||||
try {
|
||||
parsedContent = JSON.parse(rawContent);
|
||||
} catch {
|
||||
parsedContent = undefined;
|
||||
}
|
||||
} else if (typeof rawContent === 'object') {
|
||||
parsedContent = rawContent;
|
||||
}
|
||||
}
|
||||
|
||||
const contentOrRow = parsedContent ?? normalized;
|
||||
const incomingKey = (contentOrRow as any).settingKey ?? (normalized as any).settingKey;
|
||||
if (!activeMatch && incomingKey !== settingKey.value) return;
|
||||
|
||||
isUpdate.value = true;
|
||||
assignFields(contentOrRow);
|
||||
|
||||
// 头像/关键词回显(兼容 content 与平铺字段两种返回)
|
||||
logo.value = [];
|
||||
const logoPath = (contentOrRow as any).logo;
|
||||
if (logoPath) {
|
||||
logo.value.push({ uid: 1, url: logoPath, status: '' });
|
||||
}
|
||||
const rawKeyword = (contentOrRow as any).keyword;
|
||||
if (rawKeyword) {
|
||||
try {
|
||||
keyword.value = typeof rawKeyword === 'string' ? JSON.parse(rawKeyword) : rawKeyword;
|
||||
} catch {
|
||||
keyword.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
form.settingId = (normalized as any).settingId;
|
||||
form.settingKey = settingKey.value;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
</script>
|
||||
|
||||
@@ -50,7 +50,7 @@ const props = defineProps<{
|
||||
|
||||
// 保存字段信息(设定好key和描述,content里的字段是随意加的会自动转为json保存到数据库)
|
||||
const settingId = ref(undefined);
|
||||
const settingKey = ref('setting');
|
||||
const settingKey = ref('clear');
|
||||
const comments = ref('系统设置');
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
@@ -64,6 +64,8 @@ const isUpdate = ref(false);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Setting>({
|
||||
settingId: undefined,
|
||||
settingKey: settingKey.value,
|
||||
clearCache: 'setting,dict,category,temp',
|
||||
tenantId: localStorage.getItem('TenantId')
|
||||
});
|
||||
@@ -116,22 +118,44 @@ const save = () => {
|
||||
watch(
|
||||
() => props.data,
|
||||
(data) => {
|
||||
if(data?.settingId){
|
||||
isUpdate.value = true
|
||||
// 表单赋值
|
||||
if(data.content){
|
||||
const jsonData = JSON.parse(data.content);
|
||||
assignFields(jsonData);
|
||||
}
|
||||
// 其他必要参数
|
||||
form.settingId = data.settingId
|
||||
form.settingKey = data.settingKey
|
||||
} else {
|
||||
// 新增
|
||||
isUpdate.value = false
|
||||
const activeMatch = props.value === settingKey.value;
|
||||
if (!data || typeof data !== 'object') {
|
||||
if (!activeMatch) return;
|
||||
isUpdate.value = false;
|
||||
resetFields();
|
||||
form.settingKey = props.value
|
||||
form.settingId = undefined;
|
||||
form.settingKey = settingKey.value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const normalized: any = Array.isArray(data)
|
||||
? data.find((d) => d?.settingKey === settingKey.value) ?? data[0]
|
||||
: (data as any).data && typeof (data as any).data === 'object'
|
||||
? (data as any).data
|
||||
: data;
|
||||
|
||||
let parsedContent: any | undefined;
|
||||
const rawContent = (normalized as any).content;
|
||||
if (rawContent) {
|
||||
if (typeof rawContent === 'string') {
|
||||
try {
|
||||
parsedContent = JSON.parse(rawContent);
|
||||
} catch {
|
||||
parsedContent = undefined;
|
||||
}
|
||||
} else if (typeof rawContent === 'object') {
|
||||
parsedContent = rawContent;
|
||||
}
|
||||
}
|
||||
const contentOrRow = parsedContent ?? normalized;
|
||||
const incomingKey = (contentOrRow as any).settingKey ?? (normalized as any).settingKey;
|
||||
if (!activeMatch && incomingKey !== settingKey.value) return;
|
||||
|
||||
isUpdate.value = true;
|
||||
assignFields(contentOrRow);
|
||||
form.settingId = (normalized as any).settingId;
|
||||
form.settingKey = settingKey.value;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { addSetting, listSetting, updateSetting } from "@/api/system/setting";
|
||||
import { addSetting, listSetting, updateSettingByKey } from "@/api/system/setting";
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { uploadFile } from "@/api/system/file";
|
||||
import { FILE_SERVER } from "@/config/setting";
|
||||
@@ -61,6 +61,8 @@
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Setting>({
|
||||
settingId: undefined,
|
||||
settingKey: settingKey.value,
|
||||
siteName: '',
|
||||
icp: '',
|
||||
copyright: '',
|
||||
@@ -152,11 +154,12 @@
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
form.settingKey = settingKey.value;
|
||||
const appForm = {
|
||||
...form,
|
||||
content: JSON.stringify(form),
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateSetting : addSetting;
|
||||
const saveOrUpdate = isUpdate.value ? updateSettingByKey : addSetting;
|
||||
saveOrUpdate(appForm)
|
||||
.then((msg) => {
|
||||
message.success('保存成功');
|
||||
@@ -171,32 +174,63 @@
|
||||
watch(
|
||||
() => props.data,
|
||||
(data) => {
|
||||
if(data?.settingId){
|
||||
isUpdate.value = true
|
||||
// 表单赋值
|
||||
if(data.content){
|
||||
const jsonData = JSON.parse(data.content);
|
||||
assignFields(jsonData);
|
||||
// 头像赋值
|
||||
logo.value = [];
|
||||
if (jsonData.logo) {
|
||||
logo.value.push({ uid:1, url: FILE_SERVER + jsonData.logo, status: '' });
|
||||
}
|
||||
if(jsonData.keyword){
|
||||
keyword.value = JSON.parse(jsonData.keyword)
|
||||
}
|
||||
}
|
||||
// 其他必要参数
|
||||
form.settingId = data.settingId
|
||||
form.settingKey = data.settingKey
|
||||
|
||||
} else {
|
||||
// 新增
|
||||
isUpdate.value = false
|
||||
const activeMatch = props.value === settingKey.value;
|
||||
if (!data || typeof data !== 'object') {
|
||||
if (!activeMatch) return;
|
||||
isUpdate.value = false;
|
||||
resetFields();
|
||||
form.settingKey = props.value
|
||||
logo.value = [];
|
||||
keyword.value = [];
|
||||
form.settingId = undefined;
|
||||
form.settingKey = settingKey.value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const normalized: any = Array.isArray(data)
|
||||
? data.find((d) => d?.settingKey === settingKey.value) ?? data[0]
|
||||
: (data as any).data && typeof (data as any).data === 'object'
|
||||
? (data as any).data
|
||||
: data;
|
||||
|
||||
let parsedContent: any | undefined;
|
||||
const rawContent = (normalized as any).content;
|
||||
if (rawContent) {
|
||||
if (typeof rawContent === 'string') {
|
||||
try {
|
||||
parsedContent = JSON.parse(rawContent);
|
||||
} catch {
|
||||
parsedContent = undefined;
|
||||
}
|
||||
} else if (typeof rawContent === 'object') {
|
||||
parsedContent = rawContent;
|
||||
}
|
||||
}
|
||||
const contentOrRow = parsedContent ?? normalized;
|
||||
const incomingKey = (contentOrRow as any).settingKey ?? (normalized as any).settingKey;
|
||||
if (!activeMatch && incomingKey !== settingKey.value) return;
|
||||
|
||||
isUpdate.value = true;
|
||||
assignFields(contentOrRow);
|
||||
|
||||
// 头像/关键词回显(兼容 content 与平铺字段两种返回)
|
||||
logo.value = [];
|
||||
const logoPath = (contentOrRow as any).logo;
|
||||
if (logoPath) {
|
||||
logo.value.push({ uid: 1, url: FILE_SERVER + logoPath, status: '' });
|
||||
}
|
||||
const rawKeyword = (contentOrRow as any).keyword;
|
||||
if (rawKeyword) {
|
||||
try {
|
||||
keyword.value = typeof rawKeyword === 'string' ? JSON.parse(rawKeyword) : rawKeyword;
|
||||
} catch {
|
||||
keyword.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
form.settingId = (normalized as any).settingId;
|
||||
form.settingKey = settingKey.value;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
</script>
|
||||
|
||||
@@ -86,7 +86,7 @@ import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { addSetting, updateSetting } from "@/api/system/setting";
|
||||
import { addSetting, updateSettingByKey } from "@/api/system/setting";
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { uploadFile } from "@/api/system/file";
|
||||
import { FILE_SERVER } from "@/config/setting";
|
||||
@@ -116,6 +116,8 @@ const isUpdate = ref(false);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Setting>({
|
||||
settingId: undefined,
|
||||
settingKey: settingKey.value,
|
||||
appId: '',
|
||||
appSecret: '',
|
||||
tenantId: localStorage.getItem('TenantId')
|
||||
@@ -169,11 +171,12 @@ const save = () => {
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
form.settingKey = settingKey.value;
|
||||
const appForm = {
|
||||
...form,
|
||||
content: JSON.stringify(form)
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateSetting : addSetting;
|
||||
const saveOrUpdate = isUpdate.value ? updateSettingByKey : addSetting;
|
||||
saveOrUpdate(appForm)
|
||||
.then((msg) => {
|
||||
message.success('保存成功');
|
||||
@@ -189,23 +192,45 @@ const save = () => {
|
||||
watch(
|
||||
() => props.data,
|
||||
(data) => {
|
||||
if(data?.settingId){
|
||||
isUpdate.value = true
|
||||
// 表单赋值
|
||||
if(data.content){
|
||||
const jsonData = JSON.parse(data.content);
|
||||
assignFields(jsonData);
|
||||
}
|
||||
// 其他必要参数
|
||||
form.settingId = data.settingId
|
||||
form.settingKey = data.settingKey
|
||||
} else {
|
||||
// 新增
|
||||
isUpdate.value = false
|
||||
const activeMatch = props.value === settingKey.value;
|
||||
if (!data || typeof data !== 'object') {
|
||||
if (!activeMatch) return;
|
||||
isUpdate.value = false;
|
||||
resetFields();
|
||||
form.settingKey = props.value
|
||||
form.settingId = undefined;
|
||||
form.settingKey = settingKey.value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const normalized: any = Array.isArray(data)
|
||||
? data.find((d) => d?.settingKey === settingKey.value) ?? data[0]
|
||||
: (data as any).data && typeof (data as any).data === 'object'
|
||||
? (data as any).data
|
||||
: data;
|
||||
|
||||
let parsedContent: any | undefined;
|
||||
const rawContent = (normalized as any).content;
|
||||
if (rawContent) {
|
||||
if (typeof rawContent === 'string') {
|
||||
try {
|
||||
parsedContent = JSON.parse(rawContent);
|
||||
} catch {
|
||||
parsedContent = undefined;
|
||||
}
|
||||
} else if (typeof rawContent === 'object') {
|
||||
parsedContent = rawContent;
|
||||
}
|
||||
}
|
||||
const contentOrRow = parsedContent ?? normalized;
|
||||
const incomingKey = (contentOrRow as any).settingKey ?? (normalized as any).settingKey;
|
||||
if (!activeMatch && incomingKey !== settingKey.value) return;
|
||||
|
||||
isUpdate.value = true;
|
||||
assignFields(contentOrRow);
|
||||
form.settingId = (normalized as any).settingId;
|
||||
form.settingKey = settingKey.value;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ import { storeToRefs } from "pinia";
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
import { FormInstance } from "ant-design-vue/es/form";
|
||||
import useFormData from "@/utils/use-form-data";
|
||||
import { addSetting, updateSetting } from "@/api/system/setting";
|
||||
import { addSetting, updateSettingByKey } from "@/api/system/setting";
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { uploadFile } from "@/api/system/file";
|
||||
import Upload from "@/components/UploadCert/index.vue";
|
||||
@@ -287,6 +287,8 @@ const token = localStorage.getItem(TOKEN_STORE_NAME);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Setting>({
|
||||
settingId: undefined,
|
||||
settingKey: settingKey.value,
|
||||
payMethod: 10,
|
||||
signMode: "公钥证书",
|
||||
appId: "",
|
||||
@@ -477,11 +479,12 @@ const save = () => {
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
form.settingKey = settingKey.value;
|
||||
const appForm = {
|
||||
...form,
|
||||
content: JSON.stringify(form)
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateSetting : addSetting;
|
||||
const saveOrUpdate = isUpdate.value ? updateSettingByKey : addSetting;
|
||||
saveOrUpdate(appForm)
|
||||
.then((msg) => {
|
||||
message.success("保存成功");
|
||||
@@ -498,23 +501,47 @@ const save = () => {
|
||||
watch(
|
||||
() => props.data,
|
||||
(data) => {
|
||||
if (data?.settingId) {
|
||||
isUpdate.value = true;
|
||||
// 表单赋值
|
||||
if (data.content) {
|
||||
const jsonData = JSON.parse(data.content);
|
||||
assignFields(jsonData);
|
||||
}
|
||||
// 其他必要参数
|
||||
form.settingId = data.settingId;
|
||||
form.settingKey = data.settingKey;
|
||||
} else {
|
||||
// 新增
|
||||
const activeMatch = props.value === settingKey.value;
|
||||
if (!data || typeof data !== "object") {
|
||||
if (!activeMatch) return;
|
||||
isUpdate.value = false;
|
||||
resetFields();
|
||||
form.settingKey = props.value;
|
||||
form.settingId = undefined;
|
||||
form.settingKey = settingKey.value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const normalized: any = Array.isArray(data)
|
||||
? data.find((d) => d?.settingKey === settingKey.value) ?? data[0]
|
||||
: (data as any).data && typeof (data as any).data === "object"
|
||||
? (data as any).data
|
||||
: data;
|
||||
|
||||
let parsedContent: any | undefined;
|
||||
const rawContent = (normalized as any).content;
|
||||
if (rawContent) {
|
||||
if (typeof rawContent === "string") {
|
||||
try {
|
||||
parsedContent = JSON.parse(rawContent);
|
||||
} catch {
|
||||
parsedContent = undefined;
|
||||
}
|
||||
} else if (typeof rawContent === "object") {
|
||||
parsedContent = rawContent;
|
||||
}
|
||||
}
|
||||
|
||||
const contentOrRow = parsedContent ?? normalized;
|
||||
const incomingKey =
|
||||
(contentOrRow as any).settingKey ?? (normalized as any).settingKey;
|
||||
if (!activeMatch && incomingKey !== settingKey.value) return;
|
||||
|
||||
isUpdate.value = true;
|
||||
assignFields(contentOrRow);
|
||||
form.settingId = (normalized as any).settingId;
|
||||
form.settingKey = settingKey.value;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { addSetting, updateSetting } from "@/api/system/setting";
|
||||
import { addSetting, updateSettingByKey } from "@/api/system/setting";
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { uploadFile } from "@/api/system/file";
|
||||
import { FILE_SERVER } from "@/config/setting";
|
||||
@@ -117,6 +117,8 @@ const isUpdate = ref(false);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Setting>({
|
||||
settingId: undefined,
|
||||
settingKey: settingKey.value,
|
||||
isOpenPrinter: '0',
|
||||
printerType: '1',
|
||||
printerStatus: '20',
|
||||
@@ -174,11 +176,12 @@ const save = () => {
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
form.settingKey = settingKey.value;
|
||||
const appForm = {
|
||||
...form,
|
||||
content: JSON.stringify(form)
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateSetting : addSetting;
|
||||
const saveOrUpdate = isUpdate.value ? updateSettingByKey : addSetting;
|
||||
saveOrUpdate(appForm)
|
||||
.then((msg) => {
|
||||
message.success('保存成功');
|
||||
@@ -193,22 +196,44 @@ const save = () => {
|
||||
watch(
|
||||
() => props.data,
|
||||
(data) => {
|
||||
if(data?.settingId){
|
||||
isUpdate.value = true
|
||||
// 表单赋值
|
||||
if(data.content){
|
||||
const jsonData = JSON.parse(data.content);
|
||||
assignFields(jsonData);
|
||||
}
|
||||
// 其他必要参数
|
||||
form.settingId = data.settingId
|
||||
form.settingKey = data.settingKey
|
||||
} else {
|
||||
// 新增
|
||||
isUpdate.value = false
|
||||
const activeMatch = props.value === settingKey.value;
|
||||
if (!data || typeof data !== 'object') {
|
||||
if (!activeMatch) return;
|
||||
isUpdate.value = false;
|
||||
resetFields();
|
||||
form.settingKey = props.value
|
||||
form.settingId = undefined;
|
||||
form.settingKey = settingKey.value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const normalized: any = Array.isArray(data)
|
||||
? data.find((d) => d?.settingKey === settingKey.value) ?? data[0]
|
||||
: (data as any).data && typeof (data as any).data === 'object'
|
||||
? (data as any).data
|
||||
: data;
|
||||
|
||||
let parsedContent: any | undefined;
|
||||
const rawContent = (normalized as any).content;
|
||||
if (rawContent) {
|
||||
if (typeof rawContent === 'string') {
|
||||
try {
|
||||
parsedContent = JSON.parse(rawContent);
|
||||
} catch {
|
||||
parsedContent = undefined;
|
||||
}
|
||||
} else if (typeof rawContent === 'object') {
|
||||
parsedContent = rawContent;
|
||||
}
|
||||
}
|
||||
const contentOrRow = parsedContent ?? normalized;
|
||||
const incomingKey = (contentOrRow as any).settingKey ?? (normalized as any).settingKey;
|
||||
if (!activeMatch && incomingKey !== settingKey.value) return;
|
||||
|
||||
isUpdate.value = true;
|
||||
assignFields(contentOrRow);
|
||||
form.settingId = (normalized as any).settingId;
|
||||
form.settingKey = settingKey.value;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -114,16 +114,47 @@
|
||||
watch(
|
||||
() => props.data,
|
||||
(data) => {
|
||||
console.log(data, 'propss');
|
||||
if (data?.settingKey) {
|
||||
isUpdate.value = true;
|
||||
// 表单赋值
|
||||
assignFields(data);
|
||||
} else {
|
||||
// 新增
|
||||
const settingKey = 'privacy';
|
||||
const activeMatch = props.value === settingKey;
|
||||
if (!data || typeof data !== 'object') {
|
||||
if (!activeMatch) return;
|
||||
isUpdate.value = false;
|
||||
resetFields();
|
||||
form.settingId = undefined;
|
||||
form.settingKey = settingKey;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const normalized: any = Array.isArray(data)
|
||||
? data.find((d) => d?.settingKey === settingKey) ?? data[0]
|
||||
: (data as any).data && typeof (data as any).data === 'object'
|
||||
? (data as any).data
|
||||
: data;
|
||||
|
||||
let parsedContent: any | undefined;
|
||||
const rawContent = (normalized as any).content;
|
||||
if (rawContent) {
|
||||
if (typeof rawContent === 'string') {
|
||||
try {
|
||||
parsedContent = JSON.parse(rawContent);
|
||||
} catch {
|
||||
parsedContent = undefined;
|
||||
}
|
||||
} else if (typeof rawContent === 'object') {
|
||||
parsedContent = rawContent;
|
||||
}
|
||||
}
|
||||
|
||||
const contentOrRow = parsedContent ?? normalized;
|
||||
const incomingKey =
|
||||
(contentOrRow as any).settingKey ?? (normalized as any).settingKey;
|
||||
if (!activeMatch && incomingKey !== settingKey) return;
|
||||
|
||||
isUpdate.value = true;
|
||||
assignFields(contentOrRow);
|
||||
form.settingId = (normalized as any).settingId;
|
||||
form.settingKey = settingKey;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user