修改快递接口配置,未完成
This commit is contained in:
parent
8440c01b4d
commit
2c6c10b79c
@ -180,6 +180,55 @@ export function getPlatformList(data?: Record<string, unknown>) {
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取平台授权链接(当前仅支持 PDD) */
|
||||||
|
export function getPlatformOauthLink(data?: {
|
||||||
|
code?: string
|
||||||
|
platform_code?: string
|
||||||
|
platformCode?: string
|
||||||
|
}) {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'index.getPlatformOauthLink',
|
||||||
|
v: '1.0',
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: data ?? {},
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取当前登录仓库下的店铺列表 */
|
||||||
|
export function getShopList() {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'index.getShopList',
|
||||||
|
v: '1.0',
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取指定店铺可用快递列表 */
|
||||||
|
export function getShopExpressList(data?: { shop_id?: string | number; shopId?: string | number }) {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'index.getShopExpressList',
|
||||||
|
v: '1.0',
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: data ?? {},
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
/** 快递公司产品类型列表(可选按快递公司编码筛选) */
|
/** 快递公司产品类型列表(可选按快递公司编码筛选) */
|
||||||
export function getExpressProductTypeList(data?: { express_code?: string }) {
|
export function getExpressProductTypeList(data?: { express_code?: string }) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -50,7 +50,6 @@ export type ExpressInterfaceCreateParams = {
|
|||||||
weight?: number
|
weight?: number
|
||||||
token?: string
|
token?: string
|
||||||
viewer?: string
|
viewer?: string
|
||||||
client_id?: string
|
|
||||||
is_share?: number
|
is_share?: number
|
||||||
share_id?: number
|
share_id?: number
|
||||||
can_use_count?: number
|
can_use_count?: number
|
||||||
@ -58,8 +57,8 @@ export type ExpressInterfaceCreateParams = {
|
|||||||
city_name?: string
|
city_name?: string
|
||||||
district_name?: string
|
district_name?: string
|
||||||
site_code?: string
|
site_code?: string
|
||||||
product_type?: string
|
|
||||||
shop_name?: string
|
shop_name?: string
|
||||||
|
ext_data?: Record<string, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function expressInterfaceCreate(data: ExpressInterfaceCreateParams) {
|
export function expressInterfaceCreate(data: ExpressInterfaceCreateParams) {
|
||||||
|
|||||||
@ -1,18 +1,16 @@
|
|||||||
import pcasCodeData from 'china-division/dist/pcas-code.json'
|
import pcasCodeData from 'china-division/dist/pcas-code.json'
|
||||||
import type { ExpressInterfaceCreateParams } from '@/api/setting.expressinterface/expressInterface'
|
import type { ExpressInterfaceCreateParams } from '@/api/setting.expressInterface/expressInterface'
|
||||||
|
|
||||||
export const expressInterfaceFieldLabels: Record<string, string> = {
|
export const expressInterfaceFieldLabels: Record<string, string> = {
|
||||||
id: 'ID',
|
id: 'ID',
|
||||||
name: '配置名称',
|
name: '配置名称',
|
||||||
express_code: '快递编码',
|
express_code: '快递编码',
|
||||||
platform_code: '平台编码',
|
platform_code: '平台编码',
|
||||||
express_platform_id: '平台接口ID',
|
|
||||||
sender_name: '发件人',
|
sender_name: '发件人',
|
||||||
sender_tel: '发件电话',
|
sender_tel: '发件电话',
|
||||||
weight: '预设重量',
|
weight: '权重',
|
||||||
token: 'Token',
|
token: 'Token',
|
||||||
viewer: '查看者',
|
viewer: '验视人',
|
||||||
client_id: '客户端ID',
|
|
||||||
is_share: '是否共享',
|
is_share: '是否共享',
|
||||||
share_id: '共享记录ID',
|
share_id: '共享记录ID',
|
||||||
can_use_count: '可用单量',
|
can_use_count: '可用单量',
|
||||||
@ -20,7 +18,6 @@ export const expressInterfaceFieldLabels: Record<string, string> = {
|
|||||||
city_name: '市',
|
city_name: '市',
|
||||||
district_name: '区/县',
|
district_name: '区/县',
|
||||||
site_code: '站点编码',
|
site_code: '站点编码',
|
||||||
product_type: '快递产品类型',
|
|
||||||
shop_name: '店铺名称',
|
shop_name: '店铺名称',
|
||||||
warehouse_id: '仓库ID',
|
warehouse_id: '仓库ID',
|
||||||
express: '关联快递',
|
express: '关联快递',
|
||||||
@ -33,19 +30,16 @@ const DETAIL_KEY_ORDER = [
|
|||||||
'name',
|
'name',
|
||||||
'express_code',
|
'express_code',
|
||||||
'platform_code',
|
'platform_code',
|
||||||
'express_platform_id',
|
|
||||||
'weight',
|
'weight',
|
||||||
'sender_name',
|
'sender_name',
|
||||||
'sender_tel',
|
'sender_tel',
|
||||||
'site_code',
|
'site_code',
|
||||||
'shop_name',
|
'shop_name',
|
||||||
'product_type',
|
|
||||||
'can_use_count',
|
'can_use_count',
|
||||||
'province_name',
|
'province_name',
|
||||||
'city_name',
|
'city_name',
|
||||||
'district_name',
|
'district_name',
|
||||||
'viewer',
|
'viewer',
|
||||||
'client_id',
|
|
||||||
'is_share',
|
'is_share',
|
||||||
'share_id',
|
'share_id',
|
||||||
'token',
|
'token',
|
||||||
@ -87,13 +81,6 @@ export const expressInterfaceColumns: ExpressInterfaceColumn[] = [
|
|||||||
{ prop: 'name', label: '配置名称', minWidth: 150, formatter: (row) => row.name || '--' },
|
{ prop: 'name', label: '配置名称', minWidth: 150, formatter: (row) => row.name || '--' },
|
||||||
{ prop: 'express_code', label: '快递编码', minWidth: 110, formatter: (row) => row.express_code || '--' },
|
{ prop: 'express_code', label: '快递编码', minWidth: 110, formatter: (row) => row.express_code || '--' },
|
||||||
{ prop: 'platform_code', label: '平台编码', minWidth: 110, formatter: (row) => row.platform_code || '--' },
|
{ prop: 'platform_code', label: '平台编码', minWidth: 110, formatter: (row) => row.platform_code || '--' },
|
||||||
{
|
|
||||||
prop: 'express_platform_id',
|
|
||||||
label: '平台接口ID',
|
|
||||||
width: 110,
|
|
||||||
align: 'right',
|
|
||||||
formatter: (row) => formatExpressInterfaceNumber(row.express_platform_id)
|
|
||||||
},
|
|
||||||
{ prop: 'sender_name', label: '发件人', minWidth: 100, formatter: (row) => row.sender_name || '--' },
|
{ prop: 'sender_name', label: '发件人', minWidth: 100, formatter: (row) => row.sender_name || '--' },
|
||||||
{ prop: 'sender_tel', label: '发件电话', minWidth: 120, formatter: (row) => row.sender_tel || '--' },
|
{ prop: 'sender_tel', label: '发件电话', minWidth: 120, formatter: (row) => row.sender_tel || '--' },
|
||||||
{ prop: 'shop_name', label: '店铺', minWidth: 140, formatter: (row) => row.shop_name || '--' },
|
{ prop: 'shop_name', label: '店铺', minWidth: 140, formatter: (row) => row.shop_name || '--' },
|
||||||
@ -107,7 +94,7 @@ export const expressInterfaceColumns: ExpressInterfaceColumn[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'weight',
|
prop: 'weight',
|
||||||
label: '预设重量',
|
label: '权重',
|
||||||
width: 96,
|
width: 96,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
formatter: (row) => formatExpressInterfaceNumber(row.weight)
|
formatter: (row) => formatExpressInterfaceNumber(row.weight)
|
||||||
@ -211,14 +198,6 @@ export const expressInterfaceScanFields = [
|
|||||||
options: [] as { label: string; value: string }[]
|
options: [] as { label: string; value: string }[]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
value: 'express_platform_id',
|
|
||||||
label: '平台接口ID',
|
|
||||||
type: 'number',
|
|
||||||
placeholder: '请输入平台接口ID',
|
|
||||||
operators: ['eq'],
|
|
||||||
defaultOperator: 'eq'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: 'sender_name',
|
value: 'sender_name',
|
||||||
label: '发件人',
|
label: '发件人',
|
||||||
@ -251,31 +230,15 @@ export const expressInterfaceScanFields = [
|
|||||||
operators: ['eq', 'contains', 'like'],
|
operators: ['eq', 'contains', 'like'],
|
||||||
defaultOperator: 'contains'
|
defaultOperator: 'contains'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: 'product_type',
|
|
||||||
label: '快递产品类型',
|
|
||||||
type: 'text',
|
|
||||||
placeholder: '请输入产品类型',
|
|
||||||
operators: ['eq', 'contains', 'like'],
|
|
||||||
defaultOperator: 'contains'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: 'viewer',
|
value: 'viewer',
|
||||||
label: '查看者',
|
label: '验视人',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
placeholder: '请输入查看者',
|
placeholder: '请输入验视人',
|
||||||
operators: ['eq', 'contains', 'like'],
|
operators: ['eq', 'contains', 'like'],
|
||||||
defaultOperator: 'contains'
|
defaultOperator: 'contains'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: 'client_id',
|
|
||||||
label: '客户端ID',
|
|
||||||
type: 'text',
|
|
||||||
placeholder: '请输入客户端ID',
|
|
||||||
operators: ['eq', 'contains', 'like'],
|
|
||||||
defaultOperator: 'contains'
|
|
||||||
},
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
function getFieldConfig(key: string, fields: typeof expressInterfaceScanFields) {
|
function getFieldConfig(key: string, fields: typeof expressInterfaceScanFields) {
|
||||||
@ -438,22 +401,17 @@ export const defaultExpressInterfaceForm = {
|
|||||||
name: '',
|
name: '',
|
||||||
express_code: '',
|
express_code: '',
|
||||||
platform_code: '',
|
platform_code: '',
|
||||||
express_platform_id: 1,
|
|
||||||
sender_name: '',
|
sender_name: '',
|
||||||
sender_tel: '',
|
sender_tel: '',
|
||||||
weight: 1,
|
weight: 1,
|
||||||
token: '',
|
|
||||||
viewer: '',
|
viewer: '',
|
||||||
client_id: '',
|
|
||||||
is_share: 0,
|
is_share: 0,
|
||||||
share_id: undefined as number | undefined,
|
|
||||||
can_use_count: undefined as number | undefined,
|
|
||||||
site_code: '',
|
site_code: '',
|
||||||
shop_name: '',
|
shop_name: '',
|
||||||
|
ext_data: undefined as Record<string, any> | undefined,
|
||||||
province_name: '',
|
province_name: '',
|
||||||
city_name: '',
|
city_name: '',
|
||||||
district_name: '',
|
district_name: ''
|
||||||
product_type: ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function omitEmptyString(val: unknown): string | undefined {
|
function omitEmptyString(val: unknown): string | undefined {
|
||||||
@ -467,7 +425,7 @@ function omitOptionalNumber(val: unknown): number | undefined {
|
|||||||
return Number.isFinite(n) ? n : undefined
|
return Number.isFinite(n) ? n : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/** setting.expressInterface.create 请求体(禁止 warehouse_id / express_platform_id) */
|
/** setting.expressInterface.create 请求体(禁止 warehouse_id) */
|
||||||
export function buildExpressInterfaceCreatePayload(
|
export function buildExpressInterfaceCreatePayload(
|
||||||
form: Record<string, any>
|
form: Record<string, any>
|
||||||
): ExpressInterfaceCreateParams {
|
): ExpressInterfaceCreateParams {
|
||||||
@ -480,14 +438,11 @@ export function buildExpressInterfaceCreatePayload(
|
|||||||
const optionalStrings = [
|
const optionalStrings = [
|
||||||
'sender_name',
|
'sender_name',
|
||||||
'sender_tel',
|
'sender_tel',
|
||||||
'token',
|
|
||||||
'viewer',
|
'viewer',
|
||||||
'client_id',
|
|
||||||
'province_name',
|
'province_name',
|
||||||
'city_name',
|
'city_name',
|
||||||
'district_name',
|
'district_name',
|
||||||
'site_code',
|
'site_code',
|
||||||
'product_type',
|
|
||||||
'shop_name'
|
'shop_name'
|
||||||
] as const
|
] as const
|
||||||
for (const key of optionalStrings) {
|
for (const key of optionalStrings) {
|
||||||
@ -501,22 +456,17 @@ export function buildExpressInterfaceCreatePayload(
|
|||||||
const isShare = omitOptionalNumber(form.is_share)
|
const isShare = omitOptionalNumber(form.is_share)
|
||||||
if (isShare !== undefined) payload.is_share = isShare
|
if (isShare !== undefined) payload.is_share = isShare
|
||||||
|
|
||||||
const shareId = omitOptionalNumber(form.share_id)
|
if (form.ext_data && typeof form.ext_data === 'object') {
|
||||||
if (shareId !== undefined) payload.share_id = shareId
|
payload.ext_data = form.ext_data
|
||||||
|
}
|
||||||
const canUseCount = omitOptionalNumber(form.can_use_count)
|
|
||||||
if (canUseCount !== undefined) payload.can_use_count = canUseCount
|
|
||||||
|
|
||||||
return payload
|
return payload
|
||||||
}
|
}
|
||||||
|
|
||||||
/** setting.expressInterface.update 请求体 */
|
/** setting.expressInterface.update 请求体 */
|
||||||
export function buildExpressInterfaceUpdatePayload(form: Record<string, any>): Record<string, any> {
|
export function buildExpressInterfaceUpdatePayload(form: Record<string, any>): Record<string, any> {
|
||||||
const payload: Record<string, any> = {
|
return {
|
||||||
...buildExpressInterfaceCreatePayload(form),
|
...buildExpressInterfaceCreatePayload(form),
|
||||||
id: form.id
|
id: form.id
|
||||||
}
|
}
|
||||||
const expressPlatformId = omitOptionalNumber(form.express_platform_id)
|
|
||||||
if (expressPlatformId !== undefined) payload.express_platform_id = expressPlatformId
|
|
||||||
return payload
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user