pricing-engine
动态定价引擎 — 根据 LME 铜价、数量阶梯、客户等级、实时汇率自动计算报价,集成 quotation-workflow 生成报价单
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/cjboy007/ssa-pricing-enginepricing-engine
Description
动态定价引擎 Skill,根据 LME 铜价、数量阶梯、客户等级(A/B/C/D)、实时汇率自动计算产品报价,并一键集成到 quotation-workflow 生成完整报价单。支持协议价覆盖(一客一价)、底价红线保护、历史报价记录。
适用场景:
- 收到询价时快速生成动态报价
- 批量报价单生成(多 SKU / 多客户)
- 查询历史报价记录和客户价格档案
- 铜价波动时快速重新报价
Dependencies
| Skill | 说明 |
|---|---|
quotation-workflow | PDF/HTML/Excel 报价单生成(必须已安装并配置) |
copper-price-monitor | 铜价数据源(输出文件供本 Skill 读取) |
customer-segmentation | 客户等级数据(A/B/C/D)参考来源 |
Environment Variables
| 变量 | 默认值 | 说明 |
|---|---|---|
DRY_RUN | false | true 时使用模拟数据(铜价 9500 USD/吨,固定汇率),跳过 PDF 生成 |
PRICING_LOG | false | true 时启用详细日志(写入 logs/ 目录) |
COPPER_LOG | false | true 时启用铜价适配层日志 |
CACHE_TTL_MS | 14400000 | 汇率缓存时间(毫秒,默认 4 小时) |
PRICE_HISTORY_FILE | output/price-history.jsonl | 自定义历史报价存储路径 |
Directory Structure
pricing-engine/
├── SKILL.md
├── README.md
├── config/
│ ├── products-cost.json # 产品基础成本表
│ ├── discount-rules.json # 数量阶梯 + 客户等级折扣规则
│ ├── margin-rules.json # 利润率目标 + 底价红线
│ └── customer-overrides.json # 客户协议价覆盖(一客一价)
├── scripts/
│ ├── exchange-rate.js # 汇率模块(4h 缓存 + 离线降级)
│ ├── copper-price-adapter.js # 铜价适配层
│ ├── pricing-engine.js # 核心定价引擎
│ ├── price-history.js # 历史报价记录
│ └── quotation-integration.js # 集成报价单工作流
├── cache/ # 汇率缓存(自动生成)
├── data/ # 内部数据(报价单编号计数器等)
├── logs/ # 运行日志(PRICING_LOG=true 时写入)
└── output/ # 生成报价单 + 历史记录 JSONL
Scripts
scripts/pricing-engine.js — 核心定价引擎
输入产品 SKU + 数量 + 客户等级 + 币种,输出含利润率的报价结果。 优先级:协议价(customer-overrides) > 公式定价。 低于底价红线时触发 Discord 通知并等待人工确认。
CLI 用法:
cd <pricing-engine-root>/scripts
# 单品报价(SKU 数量 客户等级 [币种])
node pricing-engine.js quote HDMI-2.1-8K-2M 1000 B USD
node pricing-engine.js quote HDMI-2.1-8K-2M 5000 A CNY
# 批量报价(JSON 文件)
node pricing-engine.js batch /path/to/items.json
# 查询产品基础成本
node pricing-engine.js cost HDMI-2.1-8K-2M
# 列出所有产品
node pricing-engine.js products
require() API:
const { calculatePrice, calculateBatch, getProductCost, listProducts } = require('./pricing-engine');
// 单品报价
const result = await calculatePrice('HDMI-2.1-8K-2M', 1000, 'B', 'USD');
// → { unitPrice, totalPrice, margin, discount, method, floorPriceWarning, ... }
// 批量报价
const batch = await calculateBatch([
{ sku: 'HDMI-2.1-8K-2M', quantity: 1000 },
{ sku: 'DP-1.4-4K-2M', quantity: 500 }
], 'B', 'USD');
客户等级: A(VIP)/ B(优质)/ C(标准)/ D(新客户)
scripts/quotation-integration.js — 集成报价单工作流
定价引擎输出 → quotation-workflow 数据格式 → 自动生成 PDF/HTML 报价单。自动记录报价历史。
CLI 用法:
cd <pricing-engine-root>/scripts
# 生成完整报价单(含 PDF)
node quotation-integration.js generate \
--customer CUST-001 \
--name "Acme Corp" \
--items '[{"sku":"HDMI-2.1-8K-2M","quantity":1000}]' \
--currency USD \
--grade B
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-cjboy007-ssa-pricing-engine": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
logistics
物流管理技能,提供提单生成、报关单据生成、物流跟踪等功能。支持 OKKI 客户数据同步和自动化文档处理。
okki-email-sync
Synchronize email activities and quotation events with OKKI CRM as follow-up trail records. Automatically matches emails to CRM customers via domain lookup and vector search, creates trail records (email type=102, quotation type=101), and deduplicates entries. Requires OKKI CRM API access and optional vector search setup. Use when you need to automatically log email communications and quotation events in your CRM.
follow-up-engine
Automated customer follow-up scheduling and execution engine for B2B sales. Generates personalized follow-up email drafts based on customer stage, last contact date, and follow-up strategy. Integrates with CRM systems (configurable) to sync follow-up records. Use when you need to automate outbound sales follow-ups, schedule reminders, or generate follow-up email content for dormant leads.
报价单工作流
自动化生成报价单(Excel/Word/HTML/PDF),集成数据验证防止示例数据,支持 OKKI CRM
auto-evolution
Multi-agent auto-evolution system — orchestrate review-execute-audit loops with 4 roles (Coordinator, Reviewer, Executor, Auditor). A single coordinator agent drives the loop by spawning sub-agents for review, execution, and audit. Break goals into subtasks, auto-iterate with dual quality gates, and auto-package results. Use when: user wants autonomous task execution with built-in quality assurance.