一个可以在本机运行的进销存演示项目:Vue 3 + TypeScript 前端,PHP REST API,SQLite 数据库。它覆盖客户、商品、订单和库存的基本业务流程,也包含管理员与员工两种角色。
订单创建时会在同一个数据库事务中计算金额并扣减库存。库存不足时订单不会落库;取消订单会回补库存,重复取消会被拒绝。关键操作会写入审计日志。
需要 Windows x64、Node.js 20.19+ 和 npm。后端需要启用 pdo_sqlite 的 PHP 8.2+。如果本机没有 PHP,可以运行项目提供的脚本,在 vendor/php 下载便携版 PHP 8.4.27;它不会安装到系统目录。
npm install
node scripts/setup-php.mjs然后双击 START_LOCAL.cmd,在浏览器打开 http://127.0.0.1:5173。脚本会分别启动前端和 API;关闭两个命令行窗口即可停止。已经有可用 PHP 的情况下,可跳过下载脚本,用自己的 php.exe 启动后端:
php -c php.ini -S 127.0.0.1:8081 -t api api/router.php
npm run dev这两个命令需要在不同终端执行。首次启动 API 时会自动创建本地数据库 data/enterpriseflow.sqlite。
| 角色 | 用户名 | 密码 |
|---|---|---|
| 管理员 | admin |
Admin@2026Demo |
| 员工 | staff |
Staff@2026Demo |
这些是固定的演示账号。服务默认只监听 127.0.0.1,不要把它直接暴露到公网。
用管理员账号新增客户和商品,创建订单后查看库存变化,再取消订单检查库存回补。切换到员工账号,可以对照体验受限操作。首页展示客户、商品和订单概况,审计页面记录关键变更。
npm run test:api
npm run buildtest:api 需要先启动 PHP API。2026-10-22 的本地验证中,29 项 HTTP 检查通过,前端类型检查和构建通过,浏览器可以渲染登录页。尚未完成逐页交互验收或并发压力测试。
这是本地演示项目,没有支付、复杂审批或生产环境部署配置。
EnterpriseFlow is a locally run inventory and order management demo. The frontend uses Vue 3 and TypeScript; the REST API uses PHP and SQLite. It covers customers, products, orders, stock adjustments, audit records, and admin/staff permissions.
Creating an order calculates the total and deducts stock in one database transaction. An order with insufficient stock is rejected. Cancellation restores stock, and a second cancellation is rejected.
You need Windows x64, Node.js 20.19+, npm, and PHP 8.2+ with pdo_sqlite. If PHP is unavailable, the setup script downloads a portable PHP 8.4.27 build into vendor/php without installing it system wide.
npm install
node scripts/setup-php.mjsDouble-click START_LOCAL.cmd, then open http://127.0.0.1:5173. Close the two terminal windows to stop the servers. If you already have a suitable PHP installation, skip the download and start the servers in separate terminals:
php -c php.ini -S 127.0.0.1:8081 -t api api/router.php
npm run devThe API creates data/enterpriseflow.sqlite on first use. Demo credentials are admin / Admin@2026Demo and staff / Staff@2026Demo. They are hardcoded for local use; do not expose this demo to the public internet.
Try adding a customer and a product, placing an order, checking the stock deduction, and cancelling the order. Switch to the staff account to see the permission differences.
Run npm run test:api while the PHP API is running, and use npm run build for the frontend type check and production build. On 2026-10-22, 29 HTTP checks and the frontend build passed locally; browser rendering of the login page was also checked. Full click-through testing and concurrent load testing have not been completed.
This is a local demo, without payments, approval workflows, or production deployment configuration.