front/src/api/system/otherConfig.ts
zzh a7993c12b6
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m18s
feat: 品牌/收款码图可清除,未配置显示 LOGO 文字
去掉本地默认品牌图回退;配置弹窗原生拖拽预览并支持清除;登录/顶栏/官网/侧栏统一走配置图。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-19 19:30:02 +08:00

144 lines
4.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { axiosInstance } from '@/api/rbac'
import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common'
export interface SystemOtherConfigDto {
id?: number | string
configCode?: string
configName?: string
enabled?: boolean
baseUrl?: string
appKey?: string
appSecret?: string
timeoutSeconds?: number
remark?: string
createTime?: string
updateTime?: string
}
export type SystemOtherConfigListParams = {
page?: number
pageSize?: number
keyword?: string
}
export async function getSystemOtherConfigList(params: SystemOtherConfigListParams) {
const res = await axiosInstance.get(omsUrl('/system/other-config/list'), { params })
return parseListPayload(res.data)
}
export async function getSystemOtherConfigDetail(id: number | string) {
const res = await axiosInstance.get(omsUrl('/system/other-config/detail'), { params: { id } })
return unwrapData<SystemOtherConfigDto>(res.data)
}
export async function createSystemOtherConfig(
body: Omit<SystemOtherConfigDto, 'id' | 'createTime' | 'updateTime'>
) {
const res = await axiosInstance.post(omsUrl('/system/other-config/create'), body)
assertBusinessOk(res.data)
}
export type SystemOtherConfigUpdateBody = Omit<SystemOtherConfigDto, 'createTime' | 'updateTime'> & {
id: number | string
}
export async function updateSystemOtherConfig(body: SystemOtherConfigUpdateBody) {
const res = await axiosInstance.post(omsUrl('/system/other-config/update'), body)
assertBusinessOk(res.data)
}
export async function deleteSystemOtherConfig(id: number | string) {
const res = await axiosInstance.post(omsUrl('/system/other-config/delete'), { id })
assertBusinessOk(res.data)
}
export type PaymentReceiveQrChannel = 'alipay' | 'wechat'
export interface PaymentReceiveQrDto {
alipayUrl?: string
wechatUrl?: string
}
/** 获取充值收款码(支付宝 / 微信)可访问地址 */
export async function getPaymentReceiveQr() {
const res = await axiosInstance.get(omsUrl('/system/other-config/payment-qr'))
return unwrapData<PaymentReceiveQrDto>(res.data)
}
/** 上传并替换充值收款码图片 */
export async function uploadPaymentReceiveQr(channel: PaymentReceiveQrChannel, file: File) {
const form = new FormData()
form.append('channel', channel)
form.append('file', file)
const res = await axiosInstance.post(omsUrl('/system/other-config/payment-qr/upload'), form, {
headers: { 'Content-Type': 'multipart/form-data' },
})
return unwrapData<PaymentReceiveQrDto>(res.data)
}
/** 清除指定渠道充值收款码 */
export async function clearPaymentReceiveQr(channel: PaymentReceiveQrChannel) {
const res = await axiosInstance.post(
omsUrl(`/system/other-config/payment-qr/clear?channel=${encodeURIComponent(channel)}`),
)
return unwrapData<PaymentReceiveQrDto>(res.data)
}
export type BrandLogoChannel = 'portal' | 'site' | 'favicon' | 'mascot'
export interface BrandLogoDto {
portalUrl?: string
siteUrl?: string
faviconUrl?: string
mascotUrl?: string
}
/** 获取品牌 Logo(系统顶栏 / 官网 / 标签 / 吉祥物)可访问地址 */
export async function getBrandLogo() {
const res = await axiosInstance.get(omsUrl('/system/other-config/brand-logo'))
return unwrapData<BrandLogoDto>(res.data)
}
/** 上传并替换品牌 Logo */
export async function uploadBrandLogo(channel: BrandLogoChannel, file: File) {
const form = new FormData()
form.append('channel', channel)
form.append('file', file)
const res = await axiosInstance.post(omsUrl('/system/other-config/brand-logo/upload'), form, {
headers: { 'Content-Type': 'multipart/form-data' },
})
return unwrapData<BrandLogoDto>(res.data)
}
/** 清除指定渠道品牌 Logo(前端回退文字 LOGO) */
export async function clearBrandLogo(channel: BrandLogoChannel) {
const res = await axiosInstance.post(
omsUrl(`/system/other-config/brand-logo/clear?channel=${encodeURIComponent(channel)}`),
)
return unwrapData<BrandLogoDto>(res.data)
}
/** 轨迹服务默认配置编码 */
export const TRACK_SERVICE_CONFIG_CODE = 'track_service'
/** API 中心(接口通 / itfx)网关 */
export const API_CENTER_CONFIG_CODE = 'api_center'
/** 国内揽收开放接口(历史配置;鉴权在 itfx,OMS 不再校验 AppKey) */
export const PICKUP_OPEN_API_CONFIG_CODE = 'pickup_open_api'
/** 微信公众号 */
export const WECHAT_MP_CONFIG_CODE = 'wechat_mp'
/** 微信公众号关注跳转链接 */
export const WECHAT_MP_FOLLOW_CONFIG_CODE = 'wechat_mp_follow'
/** 店铺授权平台配置编码 */
export const PLATFORM_SHOP_CONFIG_CODES = {
common: 'platform_shop',
tiktok: 'platform_shop_tiktok',
temu: 'platform_shop_temu',
shopee: 'platform_shop_shopee',
lazada: 'platform_shop_lazada',
} as const