账单
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
import { get } from '@/utils/request'
|
||||
import type { PaginatedData } from '@/types/api'
|
||||
|
||||
/** 账单支付进度:0 待支付 / 1 审核中 / 2 已支付(由后端推导,展示以此为准) */
|
||||
export type BillPayState = 0 | 1 | 2
|
||||
|
||||
/** 账单(列表行与详情的 bill 字段一致) */
|
||||
export interface Bill {
|
||||
id: number
|
||||
/** 账单编号(ZD 前缀) */
|
||||
bill_no: string
|
||||
/** 账单日期(出账日,Y-m-d) */
|
||||
bill_date: string
|
||||
/** 关联采购单 ID */
|
||||
purchase_id: number
|
||||
/** 关联采购单 */
|
||||
purchase: { id: number; purchase_no: string; purchase_date: string } | null
|
||||
/** 商品金额(订单汇总快照) */
|
||||
product_amount: string
|
||||
/** 配送费 */
|
||||
delivery_fee: string
|
||||
/** 周转筐 / 周转托盘数量 */
|
||||
box_num: number
|
||||
tray_num: number
|
||||
/** 筐 / 托盘单价(出账时快照) */
|
||||
box_price: string
|
||||
tray_price: string
|
||||
/** 附加金额 = box_num×box_price + tray_num×tray_price */
|
||||
added_amount: string
|
||||
/** 账单总金额 = 商品金额 + 配送费 + 附加金额 */
|
||||
total_amount: string
|
||||
/** 原始支付状态:0 未支付 / 1 已支付(展示用 pay_state 系列字段) */
|
||||
status: 0 | 1
|
||||
status_name: string
|
||||
/** 支付进度:0 待支付 / 1 审核中 / 2 已支付 */
|
||||
pay_state: BillPayState
|
||||
/** 支付进度中文名(列表状态标签直接用它) */
|
||||
pay_state_name: string
|
||||
/** 是否可发起合并付款(=待支付) */
|
||||
can_pay: boolean
|
||||
/** 关联支付记录 ID,0=未发起付款 */
|
||||
payment_id: number
|
||||
/** 应结算日期 = 账单日期 + 门店回款周期天数 */
|
||||
settlement_date: string
|
||||
/** 付款时间(已支付时非空) */
|
||||
paid_at: string | null
|
||||
/** 付款备注 */
|
||||
pay_remark: string
|
||||
/** 账单备注 */
|
||||
remark: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
/** 待支付汇总(门店口径,含审核中,不受筛选参数影响) */
|
||||
export interface BillSummary {
|
||||
unpaid_count: number
|
||||
unpaid_amount: string
|
||||
}
|
||||
|
||||
/** 账单合并商品明细(跨本账单全部订单按商品聚合) */
|
||||
export interface BillItem {
|
||||
product_id: number
|
||||
product_name: string
|
||||
product_spec: string
|
||||
unit: string
|
||||
/** 加权平均单价(Σ金额÷Σ数量) */
|
||||
price: string
|
||||
/** 合计数量 */
|
||||
quantity: number
|
||||
weight: string
|
||||
/** 合计金额 */
|
||||
amount: string
|
||||
}
|
||||
|
||||
/** 账单关联订单 */
|
||||
export interface BillOrder {
|
||||
id: number
|
||||
order_no: string
|
||||
order_date: string
|
||||
total_quantity: number
|
||||
total_weight: string
|
||||
total_amount: string
|
||||
/** 订单状态枚举(0/1/2/3/4/9) */
|
||||
status: number
|
||||
}
|
||||
|
||||
/** 账单详情 */
|
||||
export interface BillDetail {
|
||||
bill: Bill
|
||||
items: BillItem[]
|
||||
orders: BillOrder[]
|
||||
}
|
||||
|
||||
/** 账单列表查询参数 */
|
||||
export interface BillListParams {
|
||||
/** 原始支付状态:0 未支付(含审核中)/ 1 已支付,不传=全部 */
|
||||
status?: 0 | 1
|
||||
/** 传 1 = 仅可发起付款的账单(合并付款选择页专用) */
|
||||
payable?: 1
|
||||
/** 账单日期起(Y-m-d) */
|
||||
start_date?: string
|
||||
/** 账单日期止(Y-m-d),不得早于 start_date */
|
||||
end_date?: string
|
||||
page?: number
|
||||
/** 每页数量,默认 10,最大 50 */
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
/** 账单列表(附加 summary 待支付汇总):GET /mini/bill */
|
||||
export function getBillListApi(params: BillListParams = {}) {
|
||||
return get<PaginatedData<Bill> & { summary: BillSummary }>('/mini/bill', { data: params })
|
||||
}
|
||||
|
||||
/** 账单详情(校验本店归属):GET /mini/bill/{id} */
|
||||
export function getBillDetailApi(id: number) {
|
||||
return get<BillDetail>(`/mini/bill/${id}`)
|
||||
}
|
||||
Reference in New Issue
Block a user