init: 橘视厅酒店版会员系统前端
This commit is contained in:
55
src/api/manage/activationCode.ts
Normal file
55
src/api/manage/activationCode.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageResponse } from './types'
|
||||
|
||||
// ===================== 天卡设备激活码 =====================
|
||||
|
||||
/** 激活码实体 */
|
||||
export interface ActivationCodeItem {
|
||||
id: number
|
||||
/** 激活码(5位字符,如 7A3FK) */
|
||||
code: string
|
||||
/** 渠道组织ID */
|
||||
channelOrgId: number
|
||||
/** 门店组织ID */
|
||||
storeOrgId: number
|
||||
/** 状态:ACTIVE-启用 / DISABLED-禁用 */
|
||||
status: 'ACTIVE' | 'DISABLED'
|
||||
/** 最大可激活设备数(0=不限) */
|
||||
maxDeviceCount: number
|
||||
/** 已激活设备数 */
|
||||
activatedCount: number
|
||||
/** 备注 */
|
||||
remark: string | null
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
/** 生成激活码请求体 */
|
||||
export interface ActivationCodeGenerateBody {
|
||||
storeOrgId: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/** 按门店查询激活码列表(GET /manage/daycard/activation-code/list/{storeOrgId}) */
|
||||
export function getActivationCodeList (storeOrgId: number): Promise<ManageResponse<{ list: ActivationCodeItem[] }>> {
|
||||
return http.get(http.adornUrl(`/manage/daycard/activation-code/list/${storeOrgId}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 为门店生成激活码(每门店一个,已存在则返回已有的) */
|
||||
export function generateActivationCode (data: ActivationCodeGenerateBody): Promise<ManageResponse<ActivationCodeItem>> {
|
||||
return http.post(http.adornUrl('/manage/daycard/activation-code/generate'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 重新生成激活码(旧码失效) */
|
||||
export function regenerateActivationCode (id: number): Promise<ManageResponse<{ code: string }>> {
|
||||
return http.post(http.adornUrl(`/manage/daycard/activation-code/${id}/regenerate`), http.adornData({})).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 启用/禁用激活码(PUT /manage/daycard/activation-code/{id}/status) */
|
||||
export function updateActivationCodeStatus (id: number, status: 'ACTIVE' | 'DISABLED'): Promise<ManageResponse> {
|
||||
return http.put(http.adornUrl(`/manage/daycard/activation-code/${id}/status`), http.adornData({ status })).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除激活码(软删除) */
|
||||
export function deleteActivationCode (id: number): Promise<ManageResponse> {
|
||||
return http.delete(http.adornUrl(`/manage/daycard/activation-code/${id}`)).then(res => res.data)
|
||||
}
|
||||
75
src/api/manage/channel.ts
Normal file
75
src/api/manage/channel.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
*/
|
||||
export interface ChannelInfo {
|
||||
id: number
|
||||
parentId: number
|
||||
mpath: string
|
||||
name: string
|
||||
orderNo?: number
|
||||
type: string
|
||||
/** 后端 @JsonProperty("orgCode") 重命名,JSON 中为 orgCode */
|
||||
orgCode?: string
|
||||
canHoldInventory: boolean
|
||||
activationPrefix: string
|
||||
brandLogoUrl: string | null
|
||||
developmentStaff?: string
|
||||
contactPhone?: string
|
||||
servicePartner?: string
|
||||
wechatQrImageUrl?: string | null
|
||||
status: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
/** 非表字段,后端 join 返回 */
|
||||
parentOrgName?: string
|
||||
channelName?: string
|
||||
children?: ChannelInfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道列表查询参数
|
||||
*/
|
||||
export interface ChannelListParams extends ManagePageParams {
|
||||
name?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道保存/更新数据
|
||||
*/
|
||||
export interface ChannelSaveData {
|
||||
id?: number
|
||||
parentId: number
|
||||
name: string
|
||||
orgCode?: string
|
||||
canHoldInventory?: boolean
|
||||
activationPrefix?: string
|
||||
brandLogoUrl?: string
|
||||
developmentStaff?: string
|
||||
contactPhone?: string
|
||||
servicePartner?: string
|
||||
}
|
||||
|
||||
/** 渠道分页列表 */
|
||||
export function getChannelList(params?: ChannelListParams): Promise<ManageListResponse<ChannelInfo>> {
|
||||
return http.get(http.adornUrl('/manage/org/channel/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 渠道详情 */
|
||||
export function getChannelInfo(id: number): Promise<ManageResponse<{ channel?: ChannelInfo }>> {
|
||||
return http.get(http.adornUrl(`/manage/org/channel/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新增/修改渠道 */
|
||||
export function saveOrUpdateChannel(data: ChannelSaveData): Promise<ManageResponse> {
|
||||
const url = data.id ? '/manage/org/channel/update' : '/manage/org/channel/save'
|
||||
return http.post(http.adornUrl(url), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除渠道(批量软删除) */
|
||||
export function deleteChannel(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/org/channel/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
112
src/api/manage/content-package.ts
Normal file
112
src/api/manage/content-package.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 内容包信息(绑定 partnerId)
|
||||
*/
|
||||
export interface ContentPackage {
|
||||
id: number
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId: string
|
||||
name: string
|
||||
description?: string
|
||||
/** 状态:ACTIVE-启用 / DISABLED-禁用 */
|
||||
status: 'ACTIVE' | 'DISABLED'
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
/** 非表字段,后端 join 返回 */
|
||||
partnerName?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 内容包保存/更新数据
|
||||
*/
|
||||
export interface ContentPackageSaveData {
|
||||
id?: number
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId: string
|
||||
name: string
|
||||
description?: string
|
||||
status?: 'ACTIVE' | 'DISABLED'
|
||||
}
|
||||
|
||||
/**
|
||||
* 内容包列表查询参数
|
||||
*/
|
||||
export interface ContentPackageListParams extends ManagePageParams {
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId?: string
|
||||
name?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
/** 内容包分页列表 */
|
||||
export function getContentPackageList(params?: ContentPackageListParams): Promise<ManageListResponse<ContentPackage>> {
|
||||
return http.get(http.adornUrl('/manage/content-package/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
// ===================== 栏目内容选择辅助接口 =====================
|
||||
|
||||
/** 栏目内容预览项(精简字段,供管理员勾选) */
|
||||
export interface CatalogContentItem {
|
||||
contentcode: string
|
||||
name: string
|
||||
posterimg?: string
|
||||
categoryname?: string
|
||||
score?: string
|
||||
isFree?: number | string
|
||||
episodecount?: number
|
||||
duration?: number
|
||||
releaseyear?: string
|
||||
originalcountry?: string
|
||||
}
|
||||
|
||||
/** 内容包详情(含解析后的内容列表,前端直接展示,无需 JSON.parse) */
|
||||
export interface ContentPackageDetail {
|
||||
/** 原始实体(contentCodes 是 JSON 字符串) */
|
||||
contentPackage: ContentPackage
|
||||
/** 解析后的内容数组 */
|
||||
contentList: CatalogContentItem[]
|
||||
}
|
||||
|
||||
/** 内容包详情(按 id,含 contentList) */
|
||||
export function getContentPackageInfo(id: number): Promise<ManageResponse<ContentPackageDetail>> {
|
||||
return http.get(http.adornUrl(`/manage/content-package/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 内容包详情(按 partnerId,含 contentList) */
|
||||
export function getContentPackageInfoByPartner(partnerId: string): Promise<ManageResponse<ContentPackageDetail>> {
|
||||
return http.get(http.adornUrl(`/manage/content-package/info-by-partner/${partnerId}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新增/修改内容包元信息(绑定 partnerId) */
|
||||
export function saveOrUpdateContentPackage(data: ContentPackageSaveData): Promise<ManageResponse> {
|
||||
const url = data.id ? '/manage/content-package/update' : '/manage/content-package/save'
|
||||
return http.post(http.adornUrl(url), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除内容包(软删除,批量) */
|
||||
export function deleteContentPackage(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/content-package/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 拉取栏目内容预览(GET /manage/content-package/fetch-contents?catalogid=&pagesize=) */
|
||||
export function fetchPackageContents(params: { catalogid: string | number; pagesize?: number; pageindex?: number }): Promise<ManageResponse<{ list: CatalogContentItem[]; totalCount: number; totalPage: number }>> {
|
||||
return http.get(http.adornUrl('/manage/content-package/fetch-contents'), { params: http.adornParams(params) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 一键保存勾选内容请求体(POST /manage/content-package/save-from-selection;传 id 覆盖,不传新建) */
|
||||
export interface SaveFromSelectionBody {
|
||||
/** 传 id 按 id 更新覆盖;不传按 partnerId 查找 */
|
||||
id?: number
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId: string
|
||||
name: string
|
||||
catalogIds: string
|
||||
selectedContents: CatalogContentItem[]
|
||||
}
|
||||
|
||||
/** 一键保存勾选内容(管理员勾选的内容对象数组直接传后端,序列化存入 content_codes;不带 t 时间戳) */
|
||||
export function saveContentPackageFromSelection(data: SaveFromSelectionBody): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/content-package/save-from-selection'), http.adornData(data, false)).then(res => res.data)
|
||||
}
|
||||
151
src/api/manage/daycard.ts
Normal file
151
src/api/manage/daycard.ts
Normal file
@@ -0,0 +1,151 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
// ===================== 天卡池 =====================
|
||||
|
||||
/** 天卡池实体 */
|
||||
export interface DayCardPoolItem {
|
||||
id: number
|
||||
/** 卡密(橘视厅激活码) */
|
||||
cardCode: string
|
||||
/** 第三方引用标识(橘视厅免密登录 uid) */
|
||||
thirdPartyRef: string
|
||||
/** 第三方卡号(D + 24位随机,App 用于访问内容) */
|
||||
thirdCardNo: string
|
||||
cardType: string
|
||||
partnerId: number
|
||||
/** 状态: UNUSED / RESERVED / USED */
|
||||
status: string
|
||||
/** 激活状态: PENDING / SUCCESS / FAILED */
|
||||
activateStatus: string
|
||||
activateError: string | null
|
||||
activatedAt: string | null
|
||||
orderNo: string | null
|
||||
deviceId: number | null
|
||||
importBatchId: number | null
|
||||
expireAt: string | null
|
||||
usedAt: string | null
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/** 卡池列表参数 */
|
||||
export interface DayCardPoolListParams extends ManagePageParams {
|
||||
partnerId?: number
|
||||
status?: string
|
||||
cardCode?: string
|
||||
orderNo?: string
|
||||
}
|
||||
|
||||
/** 卡池统计 */
|
||||
export interface DayCardPoolStats {
|
||||
total: number
|
||||
available: number
|
||||
reserved: number
|
||||
used: number
|
||||
}
|
||||
|
||||
/** 导入卡密请求 */
|
||||
export interface DayCardPoolImportData {
|
||||
partnerId: number
|
||||
cardCodes: string[]
|
||||
}
|
||||
|
||||
/** 导入卡密响应 */
|
||||
export interface DayCardPoolImportResult {
|
||||
successCount: number
|
||||
totalCount: number
|
||||
}
|
||||
|
||||
/** 导入批次 */
|
||||
export interface DayCardImportBatch {
|
||||
id: number
|
||||
batchNo: string
|
||||
partnerId: number
|
||||
status: string
|
||||
totalCount: number
|
||||
successCount: number
|
||||
failCount: number
|
||||
remark: string | null
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
/** 获取天卡池列表 */
|
||||
export function getDayCardPoolList (params?: DayCardPoolListParams): Promise<ManageListResponse<DayCardPoolItem>> {
|
||||
return http.get(http.adornUrl('/manage/daycard/pool/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 获取卡池统计 */
|
||||
export function getDayCardPoolStats (partnerId?: number): Promise<ManageResponse<{ stats?: DayCardPoolStats }>> {
|
||||
return http.get(http.adornUrl('/manage/daycard/pool/stats'), { params: http.adornParams({ partnerId }) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 导入卡密 */
|
||||
export function importDayCardPool (data: DayCardPoolImportData): Promise<ManageResponse<DayCardPoolImportResult>> {
|
||||
return http.post(http.adornUrl('/manage/daycard/pool/import'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
// ===================== 天卡订单 =====================
|
||||
|
||||
/** 天卡订单实体 */
|
||||
export interface DayCardOrderItem {
|
||||
id: number
|
||||
orderNo: string
|
||||
partnerId: number
|
||||
deviceId: number
|
||||
storeOrgId: number
|
||||
channelOrgId: number
|
||||
/** 卡号(值为 DayCardPoolEntity.cardCode) */
|
||||
cardNo: string | null
|
||||
/** 订单状态: CREATED / PAYING / PAID / PAY_FAILED / CANCELLED */
|
||||
status: string
|
||||
amount: number
|
||||
/** 支付渠道: WECHAT 等 */
|
||||
payChannel: string | null
|
||||
/** 微信支付二维码链接 */
|
||||
codeUrl: string | null
|
||||
payNo: string | null
|
||||
payAmount: number | null
|
||||
payTime: string | null
|
||||
expireTime: string | null
|
||||
cancelTime: string | null
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
/** 非表字段 */
|
||||
partnerName?: string
|
||||
deviceMac?: string
|
||||
}
|
||||
|
||||
/** 订单列表参数 */
|
||||
export interface DayCardOrderListParams extends ManagePageParams {
|
||||
partnerId?: number
|
||||
orderNo?: string
|
||||
status?: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
}
|
||||
|
||||
/** 获取订单列表 */
|
||||
export function getDayCardOrderList (params?: DayCardOrderListParams): Promise<ManageListResponse<DayCardOrderItem>> {
|
||||
return http.get(http.adornUrl('/manage/daycard/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 获取订单详情 */
|
||||
export function getDayCardOrderInfo (orderNo: string): Promise<ManageResponse<{ order?: DayCardOrderItem }>> {
|
||||
return http.get(http.adornUrl(`/manage/daycard/info/${orderNo}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
// ===================== 设备权益 =====================
|
||||
|
||||
/** 设备天卡权益 */
|
||||
export interface DeviceBenefits {
|
||||
hasBenefits: boolean
|
||||
thirdCardNo?: string
|
||||
cardCode?: string
|
||||
expireAt?: string
|
||||
}
|
||||
|
||||
/** 查询设备天卡权益 */
|
||||
export function getDeviceBenefits (deviceId: number): Promise<ManageResponse<DeviceBenefits>> {
|
||||
return http.get(http.adornUrl(`/manage/daycard/benefits/${deviceId}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
117
src/api/manage/device.ts
Normal file
117
src/api/manage/device.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 终端/设备信息
|
||||
*/
|
||||
export interface DeviceInfo {
|
||||
id: number
|
||||
storeOrgId: number
|
||||
mac: string
|
||||
deviceSn: string
|
||||
wifiMac?: string
|
||||
deviceUid?: string
|
||||
androidId?: string
|
||||
manufacturer?: string
|
||||
model?: string
|
||||
brand?: string
|
||||
identifierStrategy?: string
|
||||
deviceName: string
|
||||
deviceModel: string
|
||||
verCode?: string
|
||||
verName?: string
|
||||
androidVersion?: string
|
||||
roomNo: string
|
||||
lastHeartbeat?: string
|
||||
remark: string
|
||||
status: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
/** 非表字段,后端 join 返回 */
|
||||
storeName?: string
|
||||
channelOrgId?: number
|
||||
channelName?: string
|
||||
agentOrgName?: string
|
||||
/** 设备来源:PLATFORM-平台 / PARTNER-第三方接口注册 */
|
||||
source?: string
|
||||
/** 合作伙伴UUID(source=PARTNER 时) */
|
||||
partnerId?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 终端列表查询参数
|
||||
*/
|
||||
export interface DeviceListParams extends ManagePageParams {
|
||||
storeOrgId?: number
|
||||
status?: string
|
||||
deviceName?: string
|
||||
mac?: string
|
||||
/** 设备来源:PLATFORM / PARTNER */
|
||||
source?: string
|
||||
/** 合作伙伴UUID(source=PARTNER 时筛选) */
|
||||
partnerId?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 终端保存/更新数据
|
||||
*/
|
||||
export interface DeviceSaveData {
|
||||
id?: number
|
||||
storeOrgId: number
|
||||
mac?: string
|
||||
wifiMac?: string
|
||||
deviceUid?: string
|
||||
deviceSn?: string
|
||||
deviceName?: string
|
||||
deviceModel?: string
|
||||
roomNo?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/** 终端分页列表 */
|
||||
export function getDeviceList(params?: DeviceListParams): Promise<ManageListResponse<DeviceInfo>> {
|
||||
return http.get(http.adornUrl('/manage/device/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 终端详情 */
|
||||
export function getDeviceInfo(id: number): Promise<ManageResponse<{ device?: DeviceInfo }>> {
|
||||
return http.get(http.adornUrl(`/manage/device/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新增/修改终端 */
|
||||
export function saveOrUpdateDevice(data: DeviceSaveData): Promise<ManageResponse> {
|
||||
const url = data.id ? '/manage/device/update' : '/manage/device/save'
|
||||
return http.post(http.adornUrl(url), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除终端(批量软删除) */
|
||||
export function deleteDevice(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/device/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 绑定门店(query 参数传 deviceId 和 storeOrgId) */
|
||||
export function bindDeviceStore(deviceId: number, storeOrgId: number): Promise<ManageResponse> {
|
||||
return http.post(
|
||||
http.adornUrl('/manage/device/bindStore'),
|
||||
http.adornData({}),
|
||||
{ params: http.adornParams({ deviceId, storeOrgId }) }
|
||||
).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 解绑设备(换场所):清门店关联 + 作废 sign + 释放天卡权益 */
|
||||
export function unbindDeviceOrg(deviceId: number): Promise<ManageResponse> {
|
||||
return http.post(
|
||||
http.adornUrl('/manage/daycard/device/unbind-org'),
|
||||
http.adornData({}),
|
||||
{ params: http.adornParams({ deviceId }) }
|
||||
).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 退天卡:仅退卡,不解绑门店 */
|
||||
export function unbindDayCard(deviceId: number): Promise<ManageResponse> {
|
||||
return http.post(
|
||||
http.adornUrl('/manage/daycard/device/unbind'),
|
||||
http.adornData({}),
|
||||
{ params: http.adornParams({ deviceId }) }
|
||||
).then(res => res.data)
|
||||
}
|
||||
28
src/api/manage/index.ts
Normal file
28
src/api/manage/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* /manage/ 接口模块统一导出
|
||||
*
|
||||
* 业务请从各模块按需引入,例如:
|
||||
* import { getChannelList } from '@/api/manage/channel'
|
||||
* import { getOverviewStats } from '@/api/manage/stats'
|
||||
*
|
||||
* 或从统一入口引入:
|
||||
* import { getChannelList, getOverviewStats } from '@/api/manage'
|
||||
*/
|
||||
export * from './types'
|
||||
export * from './channel'
|
||||
export * from './store'
|
||||
export * from './orgTree'
|
||||
export * from './device'
|
||||
export * from './payConfig'
|
||||
export * from './price'
|
||||
export * from './stats'
|
||||
export * from './daycard'
|
||||
export * from './activationCode'
|
||||
export * from './profitRule'
|
||||
export * from './profitReceiver'
|
||||
export * from './profitSharing'
|
||||
export * from './refund'
|
||||
export * from './partner'
|
||||
export * from './content-package'
|
||||
export * from './partner-card'
|
||||
export * from './openapiCallLog'
|
||||
42
src/api/manage/openapiCallLog.ts
Normal file
42
src/api/manage/openapiCallLog.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* OpenAPI 调用日志(第三方接口审计日志)
|
||||
*/
|
||||
export interface OpenApiCallLogItem {
|
||||
id: number
|
||||
/** 合作伙伴UUID */
|
||||
partnerId: string
|
||||
/** 应用Key */
|
||||
appKey: string
|
||||
/** 接口路径 */
|
||||
api: string
|
||||
/** 请求方法:GET / POST */
|
||||
httpMethod: string
|
||||
/** 请求参数(consume 记录设备标识,media 记录 query string) */
|
||||
params: string
|
||||
/** 结果码:0=成功,400/500=失败 */
|
||||
resultCode: number
|
||||
/** 调用方IP */
|
||||
ip: string
|
||||
/** 耗时(毫秒) */
|
||||
costMs: number
|
||||
/** 调用时间 */
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*/
|
||||
export interface OpenApiCallLogListParams extends ManagePageParams {
|
||||
/** 合作伙伴UUID */
|
||||
partnerId?: string
|
||||
/** 接口路径(模糊查询) */
|
||||
api?: string
|
||||
}
|
||||
|
||||
/** OpenAPI 调用日志列表(第三方接口审计日志) */
|
||||
export function getOpenApiCallLogList(params?: OpenApiCallLogListParams): Promise<ManageListResponse<OpenApiCallLogItem>> {
|
||||
return http.get(http.adornUrl('/manage/openapi/call-log/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
22
src/api/manage/orgTree.ts
Normal file
22
src/api/manage/orgTree.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageResponse } from './types'
|
||||
|
||||
/**
|
||||
* 组织树节点
|
||||
*/
|
||||
export interface OrgTreeNode {
|
||||
id: number
|
||||
name: string
|
||||
type: string
|
||||
mpath: string
|
||||
code?: string
|
||||
children: OrgTreeNode[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取完整组织树
|
||||
* 层级:PLATFORM → CHANNEL → SERVICE_PROVIDER → STORE
|
||||
*/
|
||||
export function getOrgTree(): Promise<ManageResponse<{ tree?: OrgTreeNode[] }>> {
|
||||
return http.get(http.adornUrl('/manage/org/tree'), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
98
src/api/manage/partner-card.ts
Normal file
98
src/api/manage/partner-card.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 合作伙伴天卡(卡密级别)
|
||||
*/
|
||||
export interface PartnerCardItem {
|
||||
id: number
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId: string
|
||||
/** 平台天卡池ID(day_card_pool.id) */
|
||||
poolId: number
|
||||
/** 天卡卡密 */
|
||||
cardCode: string
|
||||
/** 橘视厅第三方卡号 */
|
||||
thirdCardNo: string
|
||||
/** 状态:AVAILABLE-可用 / CONSUMED-已消耗 / DISABLED-已禁用 */
|
||||
status: 'AVAILABLE' | 'CONSUMED' | 'DISABLED'
|
||||
/** 消耗后绑定的设备ID(未消耗=null) */
|
||||
deviceId: number | null
|
||||
/** 渠道机构ID(消耗时传入,未消耗=null) */
|
||||
channelOrgId: number | null
|
||||
/** 采购批次号(同批次采购的天卡批次号相同) */
|
||||
purchaseBatch: string
|
||||
/** 消耗时间(未消耗=null) */
|
||||
consumedAt: string | null
|
||||
deleteFlag: string
|
||||
/** 创建时间(采购时间) */
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存统计
|
||||
*/
|
||||
export interface PartnerCardStats {
|
||||
total: number
|
||||
available: number
|
||||
used: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存列表查询参数
|
||||
*/
|
||||
export interface PartnerCardListParams extends ManagePageParams {
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId?: string
|
||||
/** 状态:AVAILABLE / CONSUMED / DISABLED */
|
||||
status?: string
|
||||
/** 采购批次号 */
|
||||
purchaseBatch?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购天卡请求体(后端 @RequestParam,参数走 URL query)
|
||||
*/
|
||||
export interface PartnerCardPurchaseBody {
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId: string
|
||||
/** 采购卡数 */
|
||||
quantity: number
|
||||
/** 金额(分) */
|
||||
amount?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/** 天卡库存列表(卡密级别) */
|
||||
export function getPartnerCardList(params?: PartnerCardListParams): Promise<ManageListResponse<PartnerCardItem>> {
|
||||
return http.get(http.adornUrl('/manage/partner-card/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 采购天卡(划拨天卡到 partner 池子;后端 @RequestParam,参数走 URL query,不放 JSON body) */
|
||||
export function purchasePartnerCard(data: PartnerCardPurchaseBody): Promise<ManageResponse> {
|
||||
return http.post(
|
||||
http.adornUrl('/manage/partner-card/purchase'),
|
||||
http.adornData({}),
|
||||
{ params: http.adornParams({ partnerId: data.partnerId, quantity: data.quantity, amount: data.amount, remark: data.remark }, false) }
|
||||
).then(res => res.data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退天卡请求体(后端 @RequestParam,参数走 URL query)
|
||||
*/
|
||||
export interface PartnerCardRevertBody {
|
||||
/** 合作伙伴UUID(字符串) */
|
||||
partnerId: string
|
||||
/** 回退数量 */
|
||||
quantity: number
|
||||
}
|
||||
|
||||
/** 回退天卡(从 partner 池取 N 张 AVAILABLE 天卡回退;平台池 RESERVED->UNUSED,partner 池卡 DISABLED;@RequestParam,URL query) */
|
||||
export function revertPartnerCard(data: PartnerCardRevertBody): Promise<ManageResponse<{ reverted: number }>> {
|
||||
return http.post(
|
||||
http.adornUrl('/manage/partner-card/revert'),
|
||||
http.adornData({}),
|
||||
{ params: http.adornParams({ partnerId: data.partnerId, quantity: data.quantity }, false) }
|
||||
).then(res => res.data)
|
||||
}
|
||||
67
src/api/manage/partner.ts
Normal file
67
src/api/manage/partner.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 合作伙伴信息
|
||||
*/
|
||||
export interface PartnerInfo {
|
||||
id: number
|
||||
/** 合作伙伴业务UUID(16位字符串,传给内容包/采购等接口用此字段,非自增 id) */
|
||||
partnerId: string
|
||||
name: string
|
||||
/** 应用标识(新增后由后端自动生成) */
|
||||
appKey: string
|
||||
/** 应用密钥(新增后由后端自动生成,仅明文返回一次) */
|
||||
appSecret: string
|
||||
/** 状态:ACTIVE-启用 / DISABLED-禁用(禁用后 appKey 签名校验失败) */
|
||||
status: 'ACTIVE' | 'DISABLED'
|
||||
/** 限流(次/分钟,0=不限) */
|
||||
rateLimit?: number
|
||||
remark?: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 合作伙伴保存/更新数据
|
||||
*/
|
||||
export interface PartnerSaveData {
|
||||
id?: number
|
||||
name: string
|
||||
status?: 'ACTIVE' | 'DISABLED'
|
||||
rateLimit?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 合作伙伴列表查询参数
|
||||
*/
|
||||
export interface PartnerListParams extends ManagePageParams {
|
||||
name?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
/** 合作伙伴分页列表 */
|
||||
export function getPartnerList(params?: PartnerListParams): Promise<ManageListResponse<PartnerInfo>> {
|
||||
return http.get(http.adornUrl('/manage/partner/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 合作伙伴详情(含 appKey/appSecret 明文) */
|
||||
export function getPartnerInfo(id: number): Promise<ManageResponse<PartnerInfo>> {
|
||||
return http.get(http.adornUrl(`/manage/partner/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新增合作伙伴(自动生成 appKey/appSecret,返回在 data 中) */
|
||||
export function savePartner(data: PartnerSaveData): Promise<ManageResponse<PartnerInfo>> {
|
||||
return http.post(http.adornUrl('/manage/partner/save'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 修改合作伙伴(改名称/状态/限流等;status=DISABLED 禁用) */
|
||||
export function updatePartner(data: PartnerSaveData): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/partner/update'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除合作伙伴(软删除,批量) */
|
||||
export function deletePartner(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/partner/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
63
src/api/manage/payConfig.ts
Normal file
63
src/api/manage/payConfig.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 微信支付配置信息
|
||||
*/
|
||||
export interface PayConfigInfo {
|
||||
id: number
|
||||
partnerId: number | null
|
||||
appId: string
|
||||
mchId: string
|
||||
apiV3Key: string
|
||||
certSerialNo: string
|
||||
privateKeyPath: string
|
||||
notifyUrl: string
|
||||
status: string
|
||||
remark: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付配置列表查询参数
|
||||
*/
|
||||
export interface PayConfigListParams extends ManagePageParams {
|
||||
partnerId?: number
|
||||
status?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付配置保存/更新数据
|
||||
*/
|
||||
export interface PayConfigSaveData {
|
||||
id?: number
|
||||
partnerId?: number
|
||||
appId: string
|
||||
mchId: string
|
||||
apiV3Key: string
|
||||
certSerialNo?: string
|
||||
privateKeyPath?: string
|
||||
notifyUrl: string
|
||||
status?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/** 支付配置分页列表 */
|
||||
export function getPayConfigList(params?: PayConfigListParams): Promise<ManageListResponse<PayConfigInfo>> {
|
||||
return http.get(http.adornUrl('/manage/payconfig/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 支付配置详情 */
|
||||
export function getPayConfigInfo(id: number): Promise<ManageResponse<{ config?: PayConfigInfo }>> {
|
||||
return http.get(http.adornUrl(`/manage/payconfig/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新增/修改支付配置 */
|
||||
export function saveOrUpdatePayConfig(data: PayConfigSaveData): Promise<ManageResponse> {
|
||||
const url = data.id ? '/manage/payconfig/update' : '/manage/payconfig/save'
|
||||
return http.post(http.adornUrl(url), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除支付配置(批量软删除) */
|
||||
export function deletePayConfig(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/payconfig/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
71
src/api/manage/price.ts
Normal file
71
src/api/manage/price.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 定价策略信息
|
||||
*/
|
||||
export interface PriceConfigInfo {
|
||||
id: number
|
||||
partnerId: number
|
||||
channelOrgId: number | null
|
||||
storeOrgId: number | null
|
||||
price: number
|
||||
durationHours: number
|
||||
name: string
|
||||
status: string
|
||||
/** 生效起始日期 yyyy-MM-dd */
|
||||
effectiveFrom: string | null
|
||||
/** 生效截止日期 yyyy-MM-dd(null=长期) */
|
||||
effectiveTo: string | null
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 定价策略列表查询参数
|
||||
*/
|
||||
export interface PriceListParams extends ManagePageParams {
|
||||
partnerId?: number
|
||||
channelOrgId?: number
|
||||
storeOrgId?: number
|
||||
status?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 定价策略保存/更新数据
|
||||
*/
|
||||
export interface PriceSaveData {
|
||||
id?: number
|
||||
partnerId?: number
|
||||
channelOrgId?: number
|
||||
storeOrgId?: number
|
||||
price: number
|
||||
durationHours?: number
|
||||
name?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
/** 定价策略分页列表 */
|
||||
export function getPriceList(params?: PriceListParams): Promise<ManageListResponse<PriceConfigInfo>> {
|
||||
return http.get(http.adornUrl('/manage/price/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 定价策略详情 */
|
||||
export function getPriceInfo(id: number): Promise<ManageResponse<{ config?: PriceConfigInfo }>> {
|
||||
return http.get(http.adornUrl(`/manage/price/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新增/修改定价策略 */
|
||||
export function saveOrUpdatePrice(data: PriceSaveData): Promise<ManageResponse> {
|
||||
const url = data.id ? '/manage/price/update' : '/manage/price/save'
|
||||
return http.post(http.adornUrl(url), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除定价策略(批量软删除) */
|
||||
export function deletePrice(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/price/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 查询生效中的定价(GET /manage/price/effective?channelOrgId=&storeOrgId=) */
|
||||
export function getEffectivePrice(params: { channelOrgId?: number; storeOrgId?: number }): Promise<ManageResponse<{ config?: PriceConfigInfo }>> {
|
||||
return http.get(http.adornUrl('/manage/price/effective'), { params: http.adornParams(params) }).then(res => res.data)
|
||||
}
|
||||
58
src/api/manage/profitReceiver.ts
Normal file
58
src/api/manage/profitReceiver.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
// ===================== 分账接收方 =====================
|
||||
|
||||
export interface ProfitReceiver {
|
||||
id: number
|
||||
/** 关联组织ID(渠道/代理商/门店) */
|
||||
orgId: number
|
||||
orgName: string
|
||||
/** 接收方类型: MERCHANT_ID-商户号 / PERSONAL_OPENID-个人openid */
|
||||
receiverType: 'MERCHANT_ID' | 'PERSONAL_OPENID'
|
||||
/** 接收方账号(商户号或openid) */
|
||||
receiverAccount: string
|
||||
/** 收款方名称 */
|
||||
receiverName: string
|
||||
/** 绑定状态: PENDING-待确认 / ACTIVE-已绑定 / FAILED-绑定失败 */
|
||||
bindStatus: 'PENDING' | 'ACTIVE' | 'FAILED'
|
||||
}
|
||||
|
||||
export interface ProfitReceiverSaveBody {
|
||||
id?: number
|
||||
orgId: number
|
||||
receiverType: 'MERCHANT_ID' | 'PERSONAL_OPENID'
|
||||
receiverAccount: string
|
||||
receiverName: string
|
||||
}
|
||||
|
||||
export interface ProfitReceiverListParams extends ManagePageParams {
|
||||
orgId?: number
|
||||
bindStatus?: string
|
||||
}
|
||||
|
||||
/** 接收方列表 */
|
||||
export function getProfitReceiverList (params?: ProfitReceiverListParams): Promise<ManageListResponse<ProfitReceiver>> {
|
||||
return http.get(http.adornUrl('/manage/profit-receiver/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 接收方详情 */
|
||||
export function getProfitReceiverInfo (id: number): Promise<ManageResponse<{ receiver?: ProfitReceiver }>> {
|
||||
return http.get(http.adornUrl(`/manage/profit-receiver/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 保存接收方 */
|
||||
export function saveProfitReceiver (data: ProfitReceiverSaveBody): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/profit-receiver/save'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除接收方(body: Long[] ids) */
|
||||
export function deleteProfitReceiver (ids: number | number[]): Promise<ManageResponse> {
|
||||
const arr = Array.isArray(ids) ? ids : [ids]
|
||||
return http.post(http.adornUrl('/manage/profit-receiver/delete'), http.adornData(arr, false)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 同步接收方到微信(POST /manage/profit-receiver/sync/{id}) */
|
||||
export function syncProfitReceiver (id: number): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl(`/manage/profit-receiver/sync/${id}`), http.adornData({})).then(res => res.data)
|
||||
}
|
||||
100
src/api/manage/profitRule.ts
Normal file
100
src/api/manage/profitRule.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
// ===================== 分润规则 =====================
|
||||
|
||||
export interface ProfitRule {
|
||||
id: number
|
||||
ruleName: string
|
||||
scopeType: 'GLOBAL' | 'CHANNEL' | 'AGENT' | 'STORE'
|
||||
scopeOrgId: number | null
|
||||
scopeOrgName: string | null
|
||||
priority: number
|
||||
status: 'ACTIVE' | 'INACTIVE'
|
||||
effectiveFrom: string | null
|
||||
effectiveTo: string | null
|
||||
}
|
||||
|
||||
export interface ProfitRuleItem {
|
||||
id: number
|
||||
orgRole: 'PLATFORM' | 'CHANNEL' | 'AGENT' | 'STORE'
|
||||
shareType: 'RATIO' | 'FIXED'
|
||||
/** RATIO: 百分比(如 20 表示 20%);FIXED: 分 */
|
||||
shareValue: number
|
||||
sortOrder: number
|
||||
}
|
||||
|
||||
export interface ProfitRuleDetail extends ProfitRule {
|
||||
items: ProfitRuleItem[]
|
||||
}
|
||||
|
||||
export interface ProfitRuleSaveBody {
|
||||
id?: number
|
||||
ruleName: string
|
||||
scopeType: 'GLOBAL' | 'CHANNEL' | 'AGENT' | 'STORE'
|
||||
scopeOrgId: number | null
|
||||
priority: number
|
||||
status: 'ACTIVE' | 'INACTIVE'
|
||||
effectiveFrom: string | null
|
||||
effectiveTo: string | null
|
||||
items: Omit<ProfitRuleItem, 'id'>[]
|
||||
}
|
||||
|
||||
export interface ProfitRuleListParams extends ManagePageParams {
|
||||
scopeType?: string
|
||||
}
|
||||
|
||||
// ===================== 试算 =====================
|
||||
|
||||
export interface ProfitRulePreviewBody {
|
||||
storeOrgId: number
|
||||
/** 单位:分 */
|
||||
amount: number
|
||||
}
|
||||
|
||||
export interface ProfitRulePreviewDetail {
|
||||
orgRole: 'PLATFORM' | 'CHANNEL' | 'AGENT' | 'STORE'
|
||||
orgId: number
|
||||
orgName: string
|
||||
shareType: 'RATIO' | 'FIXED'
|
||||
shareValue: number
|
||||
/** 计算后金额(分) */
|
||||
amount: number
|
||||
}
|
||||
|
||||
export interface ProfitRulePreviewResp {
|
||||
ruleId: number
|
||||
ruleName: string
|
||||
details: ProfitRulePreviewDetail[]
|
||||
nonPlatformTotalRatio: number
|
||||
warning: string | null
|
||||
}
|
||||
|
||||
// ===================== API 方法 =====================
|
||||
|
||||
/** 分润规则列表 */
|
||||
export function getProfitRuleList (params?: ProfitRuleListParams): Promise<ManageListResponse<ProfitRule>> {
|
||||
return http.get(http.adornUrl('/manage/profit-rule/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 分润规则详情(含 items 子表) */
|
||||
export function getProfitRuleInfo (id: number): Promise<ManageResponse<{ rule?: ProfitRuleDetail }>> {
|
||||
return http.get(http.adornUrl(`/manage/profit-rule/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 保存/更新分润规则 */
|
||||
export function saveOrUpdateProfitRule (data: ProfitRuleSaveBody): Promise<ManageResponse> {
|
||||
const url = data.id ? '/manage/profit-rule/update' : '/manage/profit-rule/save'
|
||||
return http.post(http.adornUrl(url), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除分润规则(body: Long[] ids) */
|
||||
export function deleteProfitRule (ids: number | number[]): Promise<ManageResponse> {
|
||||
const arr = Array.isArray(ids) ? ids : [ids]
|
||||
return http.post(http.adornUrl('/manage/profit-rule/delete'), http.adornData(arr, false)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 试算分润(POST /manage/profit-rule/preview) */
|
||||
export function previewProfitRule (data: ProfitRulePreviewBody): Promise<ManageResponse<ProfitRulePreviewResp>> {
|
||||
return http.post(http.adornUrl('/manage/profit-rule/preview'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
86
src/api/manage/profitSharing.ts
Normal file
86
src/api/manage/profitSharing.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
// ===================== 分账记录 =====================
|
||||
|
||||
export interface ProfitSharingItem {
|
||||
id: number
|
||||
/** 支付订单号 */
|
||||
payOrderNo: string
|
||||
/** 分账单号 */
|
||||
outOrderNo: string
|
||||
status: 'PENDING' | 'SUCCESS' | 'FAILED' | 'PARTIAL'
|
||||
/** 订单总金额(分) */
|
||||
totalAmount: number
|
||||
ruleName: string | null
|
||||
createdAt: string
|
||||
storeName: string | null
|
||||
channelName: string | null
|
||||
}
|
||||
|
||||
export interface ProfitSharingDetailItem {
|
||||
id: number
|
||||
orgRole: 'PLATFORM' | 'CHANNEL' | 'AGENT' | 'STORE'
|
||||
orgName: string | null
|
||||
receiverAccount: string
|
||||
/** 分账金额(分) */
|
||||
amount: number
|
||||
status: 'PENDING' | 'SUCCESS' | 'FAILED'
|
||||
successTime: string | null
|
||||
failReason: string | null
|
||||
}
|
||||
|
||||
export interface ProfitSharingDetail extends ProfitSharingItem {
|
||||
/** 规则快照 JSON */
|
||||
ruleSnapshot: string | null
|
||||
/** 组织链路快照 */
|
||||
orgPathSnapshot: string | null
|
||||
details: ProfitSharingDetailItem[]
|
||||
}
|
||||
|
||||
export interface ProfitSharingListParams extends ManagePageParams {
|
||||
orderNo?: string
|
||||
status?: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
}
|
||||
|
||||
/** 分账记录列表(含 details 子表) */
|
||||
export function getProfitSharingList (params?: ProfitSharingListParams): Promise<ManageListResponse<ProfitSharingItem>> {
|
||||
return http.get(http.adornUrl('/manage/profit-sharing/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 分账记录详情(含明细) */
|
||||
export function getProfitSharingInfo (id: number): Promise<ManageResponse<{ sharing?: ProfitSharingDetail }>> {
|
||||
return http.get(http.adornUrl(`/manage/profit-sharing/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 分账统计 */
|
||||
export interface ProfitSharingStatsSummary {
|
||||
totalCount: number
|
||||
totalAmount: number
|
||||
successCount: number
|
||||
successAmount: number
|
||||
}
|
||||
|
||||
export interface ProfitSharingStatsGroup {
|
||||
orgId: number
|
||||
orgName: string
|
||||
orgType: string
|
||||
count: number
|
||||
amount: number
|
||||
}
|
||||
|
||||
export interface ProfitSharingStats {
|
||||
summary: ProfitSharingStatsSummary
|
||||
groups: ProfitSharingStatsGroup[]
|
||||
}
|
||||
|
||||
export function getProfitSharingStats (params?: { startDate?: string; endDate?: string; groupBy?: string }): Promise<ManageResponse<{ stats?: ProfitSharingStats }>> {
|
||||
return http.get(http.adornUrl('/manage/profit-sharing/stats'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 重试分账 */
|
||||
export function retryProfitSharing (id: number): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/profit-sharing/retry'), http.adornData({ id })).then(res => res.data)
|
||||
}
|
||||
60
src/api/manage/refund.ts
Normal file
60
src/api/manage/refund.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
// ===================== 退款记录 =====================
|
||||
|
||||
export interface RefundItem {
|
||||
id: number
|
||||
/** 退款单号 */
|
||||
refundNo: string
|
||||
/** 原支付订单号 */
|
||||
payOrderNo: string
|
||||
/** 退款金额(分) */
|
||||
refundAmount: number
|
||||
/** 原订单金额(分) */
|
||||
totalAmount: number
|
||||
/** 退款状态 */
|
||||
status: 'PENDING' | 'PROCESSING' | 'SUCCESS' | 'FAILED' | 'CLOSED'
|
||||
/** 退款原因 */
|
||||
reason: string | null
|
||||
/** 微信退款单号 */
|
||||
wxRefundId: string | null
|
||||
/** 退款发起人 */
|
||||
operator: string | null
|
||||
errorMessage: string | null
|
||||
refundedAt: string | null
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface RefundListParams extends ManagePageParams {
|
||||
refundNo?: string
|
||||
payOrderNo?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
/** 发起退款请求体(文档:body {orderNo, reason}) */
|
||||
export interface RefundApplyBody {
|
||||
orderNo: string
|
||||
reason: string
|
||||
}
|
||||
|
||||
/** 退款记录列表 */
|
||||
export function getRefundList (params?: RefundListParams): Promise<ManageListResponse<RefundItem>> {
|
||||
return http.get(http.adornUrl('/manage/refund/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 退款详情(按退款单号 refundNo 查询) */
|
||||
export function getRefundInfo (refundNo: string): Promise<ManageResponse<{ refund?: RefundItem }>> {
|
||||
return http.get(http.adornUrl(`/manage/refund/info/${refundNo}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 发起退款(POST /manage/refund/apply) */
|
||||
export function applyRefund (data: RefundApplyBody): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/refund/apply'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 重试退款 */
|
||||
export function retryRefund (id: number): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/refund/retry'), http.adornData({ id })).then(res => res.data)
|
||||
}
|
||||
73
src/api/manage/stats.ts
Normal file
73
src/api/manage/stats.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageResponse } from './types'
|
||||
|
||||
/**
|
||||
* 总览看板统计
|
||||
*/
|
||||
export interface OverviewStats {
|
||||
totalOrders: number
|
||||
todayOrders: number
|
||||
totalRevenue: number
|
||||
todayRevenue: number
|
||||
totalPool: number
|
||||
availablePool: number
|
||||
usedPool: number
|
||||
activateFailed: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单趋势统计项
|
||||
*/
|
||||
export interface OrderTrendItem {
|
||||
date: string
|
||||
orderCount: number
|
||||
revenue: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存统计
|
||||
* 实际返回:statusStats / activateStats 均为 Map<状态, 数量>
|
||||
*/
|
||||
export interface PoolStats {
|
||||
/** 按库存状态:{ UNUSED: 1, USED: 2 } */
|
||||
statusStats: Record<string, number>
|
||||
/** 按激活状态:{ PENDING: 2, FAILED: 1 } */
|
||||
activateStats: Record<string, number>
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道统计项
|
||||
*/
|
||||
export interface ChannelStatItem {
|
||||
channelOrgId: number
|
||||
orderCount: number
|
||||
revenue: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单趋势统计查询参数
|
||||
*/
|
||||
export interface OrderStatsParams {
|
||||
startDate: string
|
||||
endDate: string
|
||||
}
|
||||
|
||||
/** 总览看板 */
|
||||
export function getOverviewStats(): Promise<ManageResponse<{ overview?: OverviewStats }>> {
|
||||
return http.get(http.adornUrl('/manage/stats/overview'), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 订单趋势统计 */
|
||||
export function getOrderStats(params: OrderStatsParams): Promise<ManageResponse<{ orderStats?: { list: OrderTrendItem[] } }>> {
|
||||
return http.get(http.adornUrl('/manage/stats/orders'), { params: http.adornParams(params) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 库存统计 */
|
||||
export function getPoolStats(): Promise<ManageResponse<{ poolStats?: PoolStats }>> {
|
||||
return http.get(http.adornUrl('/manage/stats/pool'), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 渠道统计 */
|
||||
export function getChannelStats(): Promise<ManageResponse<{ channelStats?: { list: ChannelStatItem[] } }>> {
|
||||
return http.get(http.adornUrl('/manage/stats/channels'), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
63
src/api/manage/store.ts
Normal file
63
src/api/manage/store.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
||||
|
||||
/**
|
||||
* 门店信息
|
||||
*/
|
||||
export interface StoreInfo {
|
||||
id: number
|
||||
parentId: number
|
||||
mpath: string
|
||||
name: string
|
||||
orderNo?: number
|
||||
type: string
|
||||
/** 后端 @JsonProperty("orgCode") 重命名,JSON 中为 orgCode */
|
||||
orgCode?: string
|
||||
status: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
/** 非表字段,后端 join 返回 */
|
||||
parentOrgName?: string
|
||||
channelName?: string
|
||||
children?: StoreInfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店列表查询参数
|
||||
*/
|
||||
export interface StoreListParams extends ManagePageParams {
|
||||
name?: string
|
||||
status?: string
|
||||
channelOrgId?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店保存/更新数据
|
||||
*/
|
||||
export interface StoreSaveData {
|
||||
id?: number
|
||||
parentId: number
|
||||
name: string
|
||||
orgCode?: string
|
||||
}
|
||||
|
||||
/** 门店分页列表 */
|
||||
export function getStoreList(params?: StoreListParams): Promise<ManageListResponse<StoreInfo>> {
|
||||
return http.get(http.adornUrl('/manage/org/store/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 门店详情 */
|
||||
export function getStoreInfo(id: number): Promise<ManageResponse<{ store?: StoreInfo }>> {
|
||||
return http.get(http.adornUrl(`/manage/org/store/info/${id}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 新增/修改门店 */
|
||||
export function saveOrUpdateStore(data: StoreSaveData): Promise<ManageResponse> {
|
||||
const url = data.id ? '/manage/org/store/update' : '/manage/org/store/save'
|
||||
return http.post(http.adornUrl(url), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除门店(批量软删除) */
|
||||
export function deleteStore(ids: number[]): Promise<ManageResponse> {
|
||||
return http.post(http.adornUrl('/manage/org/store/delete'), http.adornData(ids, false)).then(res => res.data)
|
||||
}
|
||||
33
src/api/manage/types.ts
Normal file
33
src/api/manage/types.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* /manage/ 接口共享类型定义
|
||||
*
|
||||
* 统一响应格式:{ code, msg, data: {...} }
|
||||
* - 业务数据统一在 data 字段内
|
||||
* - 分页结构在 data.page 内:{ data: { page: { totalCount, list, ... } } }
|
||||
*/
|
||||
|
||||
/** /manage/ 接口统一响应基础格式 */
|
||||
export interface ManageResponse<T = any> {
|
||||
code: number
|
||||
msg: string
|
||||
data: T
|
||||
}
|
||||
|
||||
/** /manage/ 分页 page 对象 */
|
||||
export interface ManagePage<T = any> {
|
||||
totalCount: number
|
||||
pageSize?: number
|
||||
totalPage?: number
|
||||
currPage?: number
|
||||
list: T[]
|
||||
}
|
||||
|
||||
/** /manage/ 分页列表响应 */
|
||||
export interface ManageListResponse<T = any> extends ManageResponse<{ page: ManagePage<T> }> {}
|
||||
|
||||
/** 分页查询参数 */
|
||||
export interface ManagePageParams {
|
||||
page?: number
|
||||
limit?: number
|
||||
[key: string]: any
|
||||
}
|
||||
Reference in New Issue
Block a user