// Cube.js 数据模型 - 运费 // 基于 fys_jstFreightCost 表 cube(`FreightCosts`, { sql: `SELECT * FROM rpt.fys_jstFreightCost`, measures: { count: { sql: `Id`, type: `count`, }, totalFreight: { sql: `freightCost`, type: `sum`, format: `currency`, title: `总运费`, }, avgFreight: { sql: `freightCost`, type: `avg`, format: `currency`, title: `平均运费`, }, totalWeight: { sql: `weight`, type: `sum`, title: `总重量`, }, avgWeight: { sql: `weight`, type: `avg`, title: `平均重量`, }, }, dimensions: { id: { sql: `Id`, type: `number`, primaryKey: true, }, oId: { sql: `o_id`, type: `number`, title: `聚水潭内部单号`, }, soId: { sql: `so_id`, type: `string`, title: `线上单号`, }, shopName: { sql: `shop_name`, type: `string`, title: `店铺名称`, }, receiverState: { sql: `receiver_state`, type: `string`, title: `省份`, }, expressNo: { sql: `expressNo`, type: `string`, title: `快递单号`, }, expressName: { sql: `expressName`, type: `string`, title: `快递公司`, }, freightType: { sql: `CASE WHEN type = 0 THEN '费率' WHEN type = 1 THEN '专线' ELSE '其他' END`, type: `string`, title: `运费类型`, }, sendDate: { sql: `send_date`, type: `time`, title: `发货日期`, }, createTime: { sql: `createTime`, type: `time`, title: `创建时间`, }, }, });