Compare commits
20 Commits
fad67cdbad
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 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_SERVER_API_URL=http://127.0.0.1:8000/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
|
||||
|
||||
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));
|
||||
}
|
||||
51
src/api/glt/gltTicketOrder/model/index.ts
Normal file
51
src/api/glt/gltTicketOrder/model/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 送水订单
|
||||
*/
|
||||
export interface GltTicketOrder {
|
||||
//
|
||||
id?: number;
|
||||
// 用户水票ID
|
||||
userTicketId?: number;
|
||||
// 门店ID
|
||||
storeId?: number;
|
||||
// 配送员
|
||||
riderId?: number;
|
||||
// 仓库ID
|
||||
warehouseId?: number;
|
||||
// 关联收货地址
|
||||
addressId?: number;
|
||||
// 收货地址
|
||||
address?: string;
|
||||
// 买家留言
|
||||
buyerRemarks?: string;
|
||||
// 用于统计
|
||||
price?: string;
|
||||
// 购买数量
|
||||
totalNum?: 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 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));
|
||||
}
|
||||
53
src/api/glt/gltUserTicket/model/index.ts
Normal file
53
src/api/glt/gltUserTicket/model/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 我的水票
|
||||
*/
|
||||
export interface GltUserTicket {
|
||||
//
|
||||
id?: number;
|
||||
// 模板ID
|
||||
templateId?: number;
|
||||
// 商品ID
|
||||
goodsId?: number;
|
||||
// 订单ID
|
||||
orderId?: number;
|
||||
// 订单编号
|
||||
orderNo?: string;
|
||||
// 订单商品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;
|
||||
}
|
||||
@@ -42,6 +42,8 @@ export interface ShopDealerUser {
|
||||
thirdNum?: number;
|
||||
// 专属二维码
|
||||
qrcode?: string;
|
||||
// 配送员所属门店
|
||||
shopName?: string;
|
||||
// 是否删除
|
||||
isDelete?: number;
|
||||
// 租户id
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
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/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));
|
||||
}
|
||||
61
src/api/shop/shopStoreRider/model/index.ts
Normal file
61
src/api/shop/shopStoreRider/model/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 配送员
|
||||
*/
|
||||
export interface ShopStoreRider {
|
||||
// 主键ID
|
||||
id?: 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/shopWarehouse/index.ts
Normal file
105
src/api/shop/shopWarehouse/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopWarehouse, ShopWarehouseParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询仓库
|
||||
*/
|
||||
export async function pageShopWarehouse(params: ShopWarehouseParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopWarehouse>>>(
|
||||
'/shop/shop-warehouse/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仓库列表
|
||||
*/
|
||||
export async function listShopWarehouse(params?: ShopWarehouseParam) {
|
||||
const res = await request.get<ApiResult<ShopWarehouse[]>>(
|
||||
'/shop/shop-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 addShopWarehouse(data: ShopWarehouse) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-warehouse',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仓库
|
||||
*/
|
||||
export async function updateShopWarehouse(data: ShopWarehouse) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-warehouse',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除仓库
|
||||
*/
|
||||
export async function removeShopWarehouse(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-warehouse/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除仓库
|
||||
*/
|
||||
export async function removeBatchShopWarehouse(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-warehouse/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询仓库
|
||||
*/
|
||||
export async function getShopWarehouse(id: number) {
|
||||
const res = await request.get<ApiResult<ShopWarehouse>>(
|
||||
'/shop/shop-warehouse/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
53
src/api/shop/shopWarehouse/model/index.ts
Normal file
53
src/api/shop/shopWarehouse/model/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
export interface ShopWarehouse {
|
||||
// 自增ID
|
||||
id?: number;
|
||||
// 仓库名称
|
||||
name?: string;
|
||||
// 唯一标识
|
||||
code?: string;
|
||||
// 类型 中心仓,区域仓,门店仓
|
||||
type?: string;
|
||||
// 仓库地址
|
||||
address?: string;
|
||||
// 真实姓名
|
||||
realName?: string;
|
||||
// 联系电话
|
||||
phone?: string;
|
||||
// 省份
|
||||
province?: string;
|
||||
// 城市
|
||||
city: undefined,
|
||||
// 区域
|
||||
region: undefined,
|
||||
// 经纬度
|
||||
lngAndLat?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 是否删除
|
||||
isDelete?: number;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 仓库搜索条件
|
||||
*/
|
||||
export interface ShopWarehouseParam 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>
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,461 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="900"
|
||||
: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-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="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="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="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>
|
||||
300
src/views/glt/gltUserTicket/index.vue
Normal file
300
src/views/glt/gltUserTicket/index.vue
Normal file
@@ -0,0 +1,300 @@
|
||||
<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 === 'buyQty'">
|
||||
{{ record.availableQty }}
|
||||
</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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<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: 'buyQty',
|
||||
key: 'buyQty',
|
||||
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: '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?: 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>
|
||||
257
src/views/glt/gltUserTicketRelease/index.vue
Normal file
257
src/views/glt/gltUserTicketRelease/index.vue
Normal file
@@ -0,0 +1,257 @@
|
||||
<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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<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: 'releaseTime',
|
||||
key: 'releaseTime',
|
||||
width: 120
|
||||
},
|
||||
// {
|
||||
// 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?: 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>
|
||||
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>
|
||||
@@ -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)" />
|
||||
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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="请输入礼品卡名称"
|
||||
|
||||
@@ -736,10 +736,10 @@
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
dataIndex: 'quantity',
|
||||
dataIndex: 'totalNum',
|
||||
align: 'center' as const,
|
||||
customRender: ({ record }: { record: any }) => {
|
||||
return record.quantity || 1;
|
||||
return record.totalNum || 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
repairOrder,
|
||||
removeShopOrder,
|
||||
removeBatchShopOrder,
|
||||
updateShopOrder
|
||||
updateShopOrder, refundShopOrder
|
||||
} from '@/api/shop/shopOrder';
|
||||
import { updateUser } from '@/api/system/user';
|
||||
import { getPayType } from '@/utils/shop';
|
||||
@@ -579,7 +579,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 +643,7 @@
|
||||
const now = new Date();
|
||||
const refundApplyTime = toDateString(now, 'yyyy-MM-dd HH:mm:ss');
|
||||
|
||||
await updateShopOrder({
|
||||
await refundShopOrder({
|
||||
...record,
|
||||
orderStatus: 4, // 退款申请中
|
||||
refundApplyTime: refundApplyTime
|
||||
|
||||
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>
|
||||
303
src/views/shop/shopStore/components/shopStoreEdit.vue
Normal file
303
src/views/shop/shopStore/components/shopStoreEdit.vue
Normal file
@@ -0,0 +1,303 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="请输入经纬度"
|
||||
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/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>
|
||||
407
src/views/shop/shopStoreRider/components/shopStoreRiderEdit.vue
Normal file
407
src/views/shop/shopStoreRider/components/shopStoreRiderEdit.vue
Normal file
@@ -0,0 +1,407 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑配送员' : '添加配送员'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 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="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="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 { 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 { 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';
|
||||
|
||||
// 是否是修改
|
||||
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 form = reactive<ShopStoreRider>({
|
||||
id: 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: [
|
||||
// {
|
||||
// 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;
|
||||
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;
|
||||
};
|
||||
|
||||
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 { 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 = '';
|
||||
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.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>
|
||||
306
src/views/shop/shopStoreRider/index.vue
Normal file
306
src/views/shop/shopStoreRider/index.vue
Normal file
@@ -0,0 +1,306 @@
|
||||
<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 === '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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<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: 'status',
|
||||
// key: 'status',
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
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: '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/shopWarehouse/components/search.vue
Normal file
42
src/views/shop/shopWarehouse/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/shopWarehouse/components/shopWarehouseEdit.vue
Normal file
287
src/views/shop/shopWarehouse/components/shopWarehouseEdit.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' }"
|
||||
@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-radio-group v-model:value="form.type">
|
||||
<a-radio value="中心仓">中心仓</a-radio>
|
||||
<a-radio value="区域仓">区域仓</a-radio>
|
||||
<a-radio value="门店仓">门店仓</a-radio>
|
||||
</a-radio-group>
|
||||
</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="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="lngAndLat">
|
||||
<a-space>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入经纬度"
|
||||
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="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 { addShopWarehouse, updateShopWarehouse } from '@/api/shop/shopWarehouse';
|
||||
import { ShopWarehouse } from '@/api/shop/shopWarehouse/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 RegionsSelect from "@/components/RegionsSelect/index.vue";
|
||||
import {openUrl} from "@/utils/common";
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: ShopWarehouse | 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<ShopWarehouse>({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
type: '中心仓',
|
||||
address: undefined,
|
||||
realName: undefined,
|
||||
phone: undefined,
|
||||
lngAndLat: undefined,
|
||||
userId: undefined,
|
||||
isDelete: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
province: undefined,
|
||||
city: undefined,
|
||||
region: 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'
|
||||
}
|
||||
],
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择仓库类型',
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
region: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择省/市/区',
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
// 级联选择回填到表单字段,保持提交参数仍然是 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 ? updateShopWarehouse : addShopWarehouse;
|
||||
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'
|
||||
})
|
||||
}
|
||||
regions.value =
|
||||
form.province && form.city && form.region
|
||||
? [form.province, form.city, form.region]
|
||||
: undefined;
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
form.type = '中心仓';
|
||||
regions.value = undefined;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
regions.value = undefined;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
262
src/views/shop/shopWarehouse/index.vue
Normal file
262
src/views/shop/shopWarehouse/index.vue
Normal file
@@ -0,0 +1,262 @@
|
||||
<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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ShopWarehouseEdit 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 ShopWarehouseEdit from './components/shopWarehouseEdit.vue';
|
||||
import { pageShopWarehouse, removeShopWarehouse, removeBatchShopWarehouse } from '@/api/shop/shopWarehouse';
|
||||
import type { ShopWarehouse, ShopWarehouseParam } from '@/api/shop/shopWarehouse/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<ShopWarehouse[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<ShopWarehouse | 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 pageShopWarehouse({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '自增ID',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '仓库名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '仓库编号',
|
||||
dataIndex: 'code',
|
||||
key: 'code'
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type'
|
||||
},
|
||||
{
|
||||
title: '仓库地址',
|
||||
dataIndex: 'address',
|
||||
key: 'address'
|
||||
},
|
||||
// {
|
||||
// title: '联系人',
|
||||
// dataIndex: 'realName',
|
||||
// key: 'realName'
|
||||
// },
|
||||
// {
|
||||
// title: '联系电话',
|
||||
// dataIndex: 'phone',
|
||||
// key: 'phone'
|
||||
// },
|
||||
// {
|
||||
// title: '经纬度',
|
||||
// dataIndex: 'lngAndLat',
|
||||
// key: 'lngAndLat',
|
||||
// ellipsis: true
|
||||
// },
|
||||
// {
|
||||
// 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?: ShopWarehouseParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: ShopWarehouse) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: ShopWarehouse) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeShopWarehouse(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);
|
||||
removeBatchShopWarehouse(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: ShopWarehouse) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopWarehouse'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -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>
|
||||
|
||||
@@ -136,6 +136,8 @@
|
||||
const form = reactive<UserVerify>({
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
adminId: undefined,
|
||||
adminName: undefined,
|
||||
type: undefined,
|
||||
name: undefined,
|
||||
realName: undefined,
|
||||
|
||||
@@ -31,6 +31,19 @@
|
||||
>原因:{{ record.comments }}</div
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'adminName'">
|
||||
<span class="text-gray-400">{{ record.adminName || '-' }}</span>
|
||||
</template>
|
||||
<template v-if="column.key ==='createTime'">
|
||||
<div class="flex flex-col">
|
||||
<a-tooltip title="创建时间">
|
||||
<span class="text-gray-500">{{ record.createTime }}</span>
|
||||
</a-tooltip>
|
||||
<a-tooltip :title="`审核通过时间`">
|
||||
<span class="text-purple-500">{{ record.updateTime }}</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
@@ -73,7 +86,6 @@
|
||||
UserVerifyParam
|
||||
} from '@/api/system/userVerify/model';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
import Extra from '@/views/system/user/components/Extra.vue';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -167,6 +179,12 @@
|
||||
key: 'status',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作员',
|
||||
dataIndex: 'adminName',
|
||||
key: 'adminName',
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '驳回',
|
||||
// dataIndex: 'comments',
|
||||
@@ -174,7 +192,7 @@
|
||||
// align: 'center',
|
||||
// },
|
||||
{
|
||||
title: '添加时间',
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
|
||||
Reference in New Issue
Block a user