363 lines
8.1 KiB
TypeScript
363 lines
8.1 KiB
TypeScript
import request from '@/utils/request'
|
||
const v = "1.0";
|
||
|
||
/** 查询当前主体可见的货主列表 */
|
||
export function storeList(data: {
|
||
keyword?: string
|
||
page?: number
|
||
page_size?: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.list',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 货主侧查询签约关系列表 */
|
||
export function storeWarehouseList(data: {
|
||
keyword?: string
|
||
page?: number
|
||
page_size?: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.list',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 查询当前主体可见的仓库列表 */
|
||
export function warehouseList(data: {
|
||
keyword?: string
|
||
page?: number
|
||
page_size?: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.warehouse.list',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
/**
|
||
* 发起或确认签约(当前主体始终为 store_id 方/消费方,对方为 warehouse_id 方/提供方)
|
||
* - counterparty_id:对方主体 ID(必传,兼容 warehouse_id / store_id)
|
||
* - temp_code:临时签约码;传入后进入确认或预览流程
|
||
*/
|
||
export function storeWarehouseSign(data: {
|
||
counterparty_id: number
|
||
temp_code?: string
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.sign',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 货主确认签约 */
|
||
export function storeWarehouseConfirmSign(data: {
|
||
id: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.confirmSign',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 解除或停用签约关系(仓库侧传 warehouse_use_status,货主侧传 store_use_status) */
|
||
export function storeWarehouseUnbind(data: {
|
||
id: number
|
||
warehouse_use_status?: number
|
||
store_use_status?: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.unbind',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 修改签约备注 */
|
||
export function storeWarehouseRename(data: {
|
||
id: number
|
||
remask: string
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.rename',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 读取签约策略配置 */
|
||
export function storeWarehouseGetPolicyConfig(data: {
|
||
id: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.getPolicyConfig',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 获取签约策略可配置字段元信息列表 */
|
||
export function storeWarehouseGetPolicyConfigFields() {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.getPolicyConfigFields',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data: {},
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 保存签约策略配置 */
|
||
export function storeWarehouseSavePolicyConfig(data: {
|
||
id: number
|
||
policy_config: Record<string, any>
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.savePolicyConfig',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/**
|
||
* 设置签约关系下的面单目标余额(覆盖写入,非增减量)并记录变更日志。
|
||
* 兼容字段名:target_quantity / print_quantity / change_quantity / adjust_quantity,均解释为目标余额。
|
||
*/
|
||
export function storeWarehouseAdjustPrintQuantity(data: {
|
||
id: number
|
||
/** 目标面单余额(覆盖当前余额,非增减量) */
|
||
target_quantity: number
|
||
reason: string
|
||
business_type?: string
|
||
business_id?: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.adjustPrintQuantity',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 按 store_id 分页查询面单余额变更日志 */
|
||
export function storeWarehouseQueryPrintQuantityLogs(data: {
|
||
store_id: number | string
|
||
pagination?: {
|
||
page?: number
|
||
page_size?: number
|
||
}
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.queryPrintQuantityLogs',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
|
||
/** 查询签约关系下的奇门接口配置列表 */
|
||
export function listApiConfig(data: {
|
||
id: number
|
||
interface_type_id?: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.listApiConfig',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 保存接口配置(新增或更新)
|
||
* - app_name:必传,不再自动生成
|
||
* - QM_WMS 类型:须填写 qimen_app_key(ERP)/ qimen_warehouse_code
|
||
* - OPEN_API 类型:系统自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),无需传入奇门字段
|
||
*/
|
||
export function saveApiConfig(data: {
|
||
id: number
|
||
interface_type_id: number
|
||
/** 应用名称(必传,不再自动生成) */
|
||
app_name: string
|
||
/** ERP AppKey(来自 index.getQimenAppList 下拉选择) */
|
||
qimen_app_key?: string
|
||
qimen_customer_id?: string
|
||
qimen_warehouse_code?: string
|
||
api_version?: string
|
||
contact_person?: string
|
||
contact_phone?: string
|
||
email?: string
|
||
is_enabled?: number
|
||
callback_url?: string
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.saveApiConfig',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 按 store_id 分页查询面单余额变更日志 */
|
||
export function queryPrintQuantityLogs(data: {
|
||
store_id: number | string
|
||
pagination?: { page?: number; page_size?: number }
|
||
}) {
|
||
const sid = Number(data.store_id)
|
||
if (!Number.isFinite(sid)) {
|
||
return Promise.reject(new Error('storeWarehouse.store.queryPrintQuantityLogs:store_id 无效'))
|
||
}
|
||
const body: Record<string, unknown> = { store_id: sid }
|
||
if (data.pagination && typeof data.pagination === 'object') {
|
||
body.pagination = data.pagination
|
||
}
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.queryPrintQuantityLogs',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data: body,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 删除签约关系上的奇门接口配置 */
|
||
export function storeWarehouseDeleteQimenConfig(data: {
|
||
id: number
|
||
interface_type_id?: number
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.deleteQimenConfig',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/** 仓库代货主一键开户:同时完成账号注册、货主创建和仓库-货主签约 */
|
||
export function storeWarehouseOpenAccount(data: {
|
||
username: string
|
||
password?: string
|
||
real_name?: string
|
||
company_name: string
|
||
business_license?: string
|
||
contact_person: string
|
||
contact_phone?: string
|
||
legal_person?: string
|
||
contact_email?: string
|
||
address?: string
|
||
industry?: string
|
||
logo_url?: string
|
||
domain?: string
|
||
auth_start?: string
|
||
auth_end?: string
|
||
print_quantity?: number
|
||
apply_reason?: string
|
||
store_remask?: string
|
||
warehouse_remask?: string
|
||
}) {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'storeWarehouse.store.openAccount',
|
||
v,
|
||
timestamp: new Date().getTime()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|