corp-mp/src/lib/feedback.ts

38 lines
1.0 KiB
TypeScript

export const COMPLAINT_TYPES = [
{ value: '莫名扣费', label: '莫名扣费' },
{ value: '超过7天未解决', label: '超过7天未解决' },
{ value: '交易被骗', label: '交易被骗' },
{ value: '不满意商家服务', label: '不满意商家服务' },
{ value: '其他问题', label: '其他问题' },
] as const
export type ComplaintType = (typeof COMPLAINT_TYPES)[number]['value']
export function getFeedbackImageSrc (image: { url?: string, preview?: string }) {
return image.preview || ''
}
export type FeedbackOrder = {
order_id?: string
out_trade_no?: string
goods_name?: string
}
export function buildFeedbackPayload (input: {
contact: string
content: string
images?: string[]
type: string
order?: FeedbackOrder | null
}) {
return {
contact: input.contact,
content: input.content,
images: input.images || [],
type: input.type,
order_id: String(input.order?.order_id || ''),
out_trade_no: String(input.order?.out_trade_no || ''),
goods_name: String(input.order?.goods_name || ''),
}
}