221 lines
4.5 KiB
TypeScript
221 lines
4.5 KiB
TypeScript
import type {
|
|
ContractStatus,
|
|
GeoLocationStatus,
|
|
MerchantDocumentStatus,
|
|
MerchantDocumentType,
|
|
MerchantStatus,
|
|
OperatingMode,
|
|
StaffRoleType,
|
|
StaffStatus,
|
|
StoreStatus,
|
|
} from '#/enums/merchantEnum';
|
|
|
|
import { requestClient } from '#/api/request';
|
|
|
|
export * from '#/enums/merchantEnum';
|
|
|
|
/**
|
|
* 商户门店信息
|
|
*/
|
|
export interface MerchantStoreDto {
|
|
/** 门店ID */
|
|
id: string;
|
|
/** 门店名称 */
|
|
name: string;
|
|
/** 营业执照号 */
|
|
licenseNumber?: string;
|
|
/** 联系电话 */
|
|
contactPhone?: string;
|
|
/** 门店地址 */
|
|
address: string;
|
|
/** 门店状态 */
|
|
status: StoreStatus;
|
|
}
|
|
|
|
/**
|
|
* 商户详情信息
|
|
*/
|
|
export interface MerchantDetailDto {
|
|
/** 商户ID */
|
|
id: string;
|
|
/** 租户ID */
|
|
tenantId: string;
|
|
/** 租户名称 */
|
|
tenantName?: string;
|
|
/** 商户名称 */
|
|
name: string;
|
|
/** 经营模式 */
|
|
operatingMode?: OperatingMode;
|
|
/** 营业执照号 */
|
|
licenseNumber?: string;
|
|
/** 法人/负责人 */
|
|
legalRepresentative?: string;
|
|
/** 注册地址 */
|
|
registeredAddress?: string;
|
|
/** 所在省份 */
|
|
province?: string;
|
|
/** 所在城市 */
|
|
city?: string;
|
|
/** 所在区县 */
|
|
district?: string;
|
|
/** 商户经度 */
|
|
longitude?: null | number;
|
|
/** 商户纬度 */
|
|
latitude?: null | number;
|
|
/** 地理定位状态 */
|
|
geoStatus?: GeoLocationStatus;
|
|
/** 地理定位失败原因 */
|
|
geoFailReason?: string;
|
|
/** 地理定位成功时间 */
|
|
geoUpdatedAt?: null | string;
|
|
/** 联系电话 */
|
|
contactPhone?: string;
|
|
/** 联系邮箱 */
|
|
contactEmail?: string;
|
|
/** 商户状态 */
|
|
status: MerchantStatus;
|
|
/** 是否冻结 */
|
|
isFrozen: boolean;
|
|
/** 冻结原因 */
|
|
frozenReason?: string;
|
|
/** 冻结时间 */
|
|
frozenAt?: null | string;
|
|
/** 审核通过人 */
|
|
approvedBy?: string;
|
|
/** 审核通过时间 */
|
|
approvedAt?: null | string;
|
|
/** 关联门店 */
|
|
stores: MerchantStoreDto[];
|
|
/** 并发版本 */
|
|
rowVersion?: string;
|
|
/** 创建时间 */
|
|
createdAt: string;
|
|
/** 创建人 */
|
|
createdBy?: string;
|
|
/** 更新时间 */
|
|
updatedAt?: null | string;
|
|
/** 更新人 */
|
|
updatedBy?: string;
|
|
}
|
|
|
|
/**
|
|
* 商户资质信息
|
|
*/
|
|
export interface MerchantDocumentDto {
|
|
id: string;
|
|
merchantId: string;
|
|
documentType: MerchantDocumentType;
|
|
status: MerchantDocumentStatus;
|
|
fileUrl: string;
|
|
documentNumber?: string;
|
|
issuedAt?: null | string;
|
|
expiresAt?: null | string;
|
|
remarks?: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
/**
|
|
* 商户合同信息
|
|
*/
|
|
export interface MerchantContractDto {
|
|
id: string;
|
|
merchantId: string;
|
|
contractNumber: string;
|
|
status: ContractStatus;
|
|
startDate: string;
|
|
endDate: string;
|
|
fileUrl: string;
|
|
signedAt?: null | string;
|
|
terminatedAt?: null | string;
|
|
terminationReason?: string;
|
|
}
|
|
|
|
/**
|
|
* 商户员工信息
|
|
*/
|
|
export interface MerchantStaffDto {
|
|
id: string;
|
|
tenantId: string;
|
|
merchantId: string;
|
|
storeId?: null | string;
|
|
name: string;
|
|
phone: string;
|
|
email?: string;
|
|
roleType: StaffRoleType;
|
|
status: StaffStatus;
|
|
}
|
|
|
|
/**
|
|
* 商户审核日志
|
|
*/
|
|
export interface MerchantAuditLogDto {
|
|
id: string;
|
|
merchantId: string;
|
|
action: number; // MerchantAuditAction (need to define)
|
|
operatorId?: string;
|
|
title: string;
|
|
description?: string;
|
|
operatorName?: string;
|
|
ipAddress?: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
/**
|
|
* 商户变更日志
|
|
*/
|
|
export interface MerchantChangeLogDto {
|
|
id: string;
|
|
fieldName: string;
|
|
oldValue?: string;
|
|
newValue?: string;
|
|
changedBy?: string;
|
|
changedByName?: string;
|
|
changedAt: string;
|
|
changeReason?: string;
|
|
}
|
|
|
|
/**
|
|
* 商户中心聚合信息
|
|
*/
|
|
export interface CurrentMerchantCenterDto {
|
|
merchant: MerchantDetailDto;
|
|
documents: MerchantDocumentDto[];
|
|
contracts: MerchantContractDto[];
|
|
staffs: MerchantStaffDto[];
|
|
auditLogs: MerchantAuditLogDto[];
|
|
changeLogs: MerchantChangeLogDto[];
|
|
}
|
|
|
|
/**
|
|
* 获取当前商户中心信息
|
|
*/
|
|
export async function getMerchantInfoApi() {
|
|
return requestClient.get<CurrentMerchantCenterDto>('/merchant/info');
|
|
}
|
|
|
|
/**
|
|
* 更新商户信息参数
|
|
*/
|
|
export interface UpdateMerchantDto {
|
|
id: string;
|
|
name: string;
|
|
operatingMode?: OperatingMode;
|
|
licenseNumber?: string;
|
|
legalRepresentative?: string;
|
|
contactPhone?: string;
|
|
contactEmail?: string;
|
|
registeredAddress?: string;
|
|
}
|
|
|
|
/**
|
|
* 更新商户信息
|
|
*/
|
|
export async function updateMerchantInfoApi(data: UpdateMerchantDto) {
|
|
return requestClient.post('/merchant/update', data);
|
|
}
|
|
|
|
/** 手动重试当前商户地理定位 */
|
|
export async function retryMerchantGeocodeApi() {
|
|
return requestClient.post('/merchant/geocode/retry');
|
|
}
|