This commit is contained in:
2025-09-16 22:11:19 +08:00
parent 562ec4abf9
commit 46c5682960
65 changed files with 1997 additions and 56 deletions

View File

@@ -1,6 +1,6 @@
## partsinquiry 数据库文档
更新日期2025-09-16
更新日期2025-09-16(已插入演示数据)
说明:本文件根据远程库 mysql.tonaspace.com 中 `partsinquiry` 的实际结构生成,字段/索引/外键信息以线上为准。
@@ -371,8 +371,8 @@
**Indexes**: - PRIMARY KEY: `id` - KEY: `idx_ot_shop_time` (`shop_id`,`tx_time`) - KEY: `idx_ot_account` (`account_id`)
**Foreign Keys**: - `fk_ot_shop`: `shop_id``shops(id)` - `fk_ot_user`: `user_id``users(id)` - `fk_ot_account`: `account_id``accounts(id)`
### product_images 触发器
- `trg_products_ai`: AFTER INSERT ON `products`更新 `products.search_text`
### 触发器
- `trg_products_bi`: BEFORE INSERT ON `products`设置 `products.search_text`
- `trg_products_au`: BEFORE UPDATE ON `products` → 维护 `products.search_text`
- `trg_palias_ai`: AFTER INSERT ON `product_aliases` → 重建 `products.search_text`
- `trg_palias_au`: AFTER UPDATE ON `product_aliases` → 重建 `products.search_text`
@@ -399,3 +399,10 @@
**Indexes**: - PRIMARY KEY: `id` - KEY: `idx_notices_shop` (`shop_id`,`status`,`is_pinned`,`created_at`) - KEY: `idx_notices_time` (`starts_at`,`ends_at`)
**Foreign Keys**: - `fk_notices_shop`: `shop_id``shops(id)` ON UPDATE NO ACTION ON DELETE NO ACTION - `fk_notices_user`: `user_id``users(id)` ON UPDATE NO ACTION ON DELETE NO ACTION
### 附:演示种子数据(非完整,仅用于联调验证)
- 演示店铺演示店A用户 3全部店长 owner
- 商品域基础单位3条、类别2条、全局SKU2条、商品2条含别名/价格/库存/图片)
- 往来与账户客户2、供应商2、账户3
- 单据销售单1含明细2与进货单1含明细2、收付款各1、其他收支2
- 审核与公告part_submissions 1、attachments 1、notices 2、新增 wechat 身份与会话各1

View File

@@ -27,6 +27,174 @@ paths:
type: array
items:
$ref: '#/components/schemas/Notice'
/api/metrics/overview:
get:
summary: 概览统计(❌ Partially Implemented
description: 返回今日/本月销售额、本月利润与库存商品数量。前端已接入,后端待实现。
responses:
'200':
description: 成功
content:
application/json:
schema:
$ref: '#/components/schemas/MetricsOverview'
/api/accounts:
get:
summary: 账户列表(❌ Partially Implemented
description: 前端账户选择页已接入,后端返回数组或 {list:[]} 皆可。
responses:
'200':
description: 成功
content:
application/json:
schema:
oneOf:
- type: array
items:
$ref: '#/components/schemas/Account'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/Account'
/api/suppliers:
get:
summary: 供应商搜索(❌ Partially Implemented
parameters:
- in: query
name: kw
schema:
type: string
responses:
'200':
description: 成功
content:
application/json:
schema:
oneOf:
- type: array
items:
$ref: '#/components/schemas/Supplier'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/Supplier'
/api/other-transactions:
post:
summary: 新建其他收入/支出(❌ Partially Implemented
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOtherTransactionRequest'
responses:
'200':
description: 成功
content:
application/json:
schema:
type: object
properties:
id:
type: integer
format: int64
/api/products:
get:
summary: 商品搜索(❌ Partially Implemented
description: 前端已接入查询参数 kw/page/size后端待实现或对齐。
parameters:
- in: query
name: kw
schema:
type: string
- in: query
name: page
schema:
type: integer
default: 1
- in: query
name: size
schema:
type: integer
default: 50
responses:
'200':
description: 成功
content:
application/json:
schema:
oneOf:
- type: array
items:
$ref: '#/components/schemas/Product'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/Product'
/api/customers:
get:
summary: 客户搜索(❌ Partially Implemented
description: 前端已接入查询参数 kw/page/size后端待实现或对齐。
parameters:
- in: query
name: kw
schema:
type: string
- in: query
name: page
schema:
type: integer
default: 1
- in: query
name: size
schema:
type: integer
default: 50
responses:
'200':
description: 成功
content:
application/json:
schema:
oneOf:
- type: array
items:
$ref: '#/components/schemas/Customer'
- type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/Customer'
/api/orders:
post:
summary: 新建单据(❌ Partially Implemented
description: 前端开单页已提交 payload后端待实现。
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrderRequest'
responses:
'200':
description: 成功
content:
application/json:
schema:
type: object
properties:
id:
type: integer
format: int64
orderNo:
type: string
components:
schemas:
Notice:
@@ -52,6 +220,66 @@ components:
startsAt:
type: string
format: date-time
MetricsOverview:
type: object
properties:
todaySales:
type: string
example: '1234.56'
monthSales:
type: string
example: '23456.78'
monthProfit:
type: string
example: '3456.78'
stockCount:
type: string
example: '1200'
Account:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
type:
type: string
enum: [cash, bank, alipay, wechat, other]
balance:
type: number
Supplier:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
mobile:
type: string
CreateOtherTransactionRequest:
type: object
properties:
type:
type: string
enum: [income, expense]
category:
type: string
counterpartyId:
type: integer
format: int64
nullable: true
accountId:
type: integer
format: int64
amount:
type: number
txTime:
type: string
format: date
remark:
type: string
endsAt:
type: string
format: date-time
@@ -64,4 +292,55 @@ components:
updatedAt:
type: string
format: date-time
Product:
type: object
properties:
id:
type: integer
format: int64
code:
type: string
name:
type: string
price:
type: number
stock:
type: number
Customer:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
mobile:
type: string
CreateOrderRequest:
type: object
properties:
type:
type: string
description: 'sale.out/sale.return/sale.collect/purchase/income/expense 等'
orderTime:
type: string
format: date
customerId:
type: integer
format: int64
nullable: true
items:
type: array
items:
type: object
properties:
productId:
type: integer
format: int64
quantity:
type: number
unitPrice:
type: number
amount:
type: number

167
doc/requirements.md Normal file
View File

@@ -0,0 +1,167 @@
* ### **配件查询App需求规格说明书**
#### 1.0 项目概述
本项目旨在开发一款面向小微商户的移动端进销存管理应用,命名为“配件查询”。该应用核心功能是帮助用户高效管理商品、库存、销售、采购、客户、供应商及财务收支,并通过数据报表提供经营状况分析,助力商户实现数字化经营。
参考的小程序“智慧记进销存”,但是多了一个配件查询功能,以下所罗列的内容大多也参考至该小程序,如有歧义可优先参照这个小程序,拿不准优先问。
#### 2.0 功能模块需求
**2.1 首页 (Dashboard)**
* **2.1.1 核心数据概览:** 首页需直观展示当日、当月的核心经营数据。
* 今日销售额
* 本月销售额
* 本月利润
* 库存商品数量
**2.1.2 广告位:** 在首页区域提供一个展示广告的区域。
* **2.1.3 快捷功能入口:** 提供一个快捷功能区域,方便用户快速访问常用功能。
* 默认应包含客户管理、销售开单、账户管理、供应商管理、进货开单、其他支出、VIP会员、报表统计等。
* **2.1.4 在线客服:** 提供一个悬浮的“咨询”或“在线客服”入口,方便用户随时获取帮助。
**2.2 货品管理模块**
* **2.2.1 货品列表与库存:**
* 展示所有货品的列表,包含名称、库存等基本信息。
* 支持按“全部类别”或指定类别筛选货品。
* 提供搜索功能,支持通过货品名称或条形码进行模糊查找。
* 列表底部显示总货品种类数量。
* 当库存为空时,应有明显的空状态提示,并引导用户“点击右上角‘+’录入货品信息”。
* **2.2.2 新增/编辑货品:**
* 支持添加商品图片。
* App端支持录入或扫描商品条形码小程序端仅支持手动录入不支持扫码。
* **货品名称**为必填项。
* 可为货品选择**类别**和**主单位**。
* 支持自定义扩展货品属性(如品牌、型号、产地、保质期等)。
* 货品图片支持多图上传,支持拖拽排序,支持图片放大预览。
* 可录入**当前库存**、**安全库存**(一个数值区间,用于库存预警)。
* 需分别录入四种价格,**进货价**、**批发价**、**大单报价**和**零售价**。
* 提供**备注**字段,用于记录额外信息。
* 保存后,可选择“继续新增”或返回列表。
* **2.2.3 货品设置:**
* 支持自定义**货品类别**管理。
* 支持自定义**货品单位**管理。
* 提供开关选项,允许用户选择是否“隐藏零库存商品”和“隐藏进货价”。
**2.3 开单(交易)模块**
* **2.3.1 核心功能:** 该模块是应用的核心操作区,整合了销售、进货和财务记账功能。
* **2.3.2 销售开单:**
* **出货单:**
* 自动记录开单**时间**,并支持手动修改。
* 可选择**客户**,默认为“零售客户”。
* 通过“+”号从货品列表中选择商品,自动计算**合计金额**。
* 支持在订单中对单个商品进行操作(如修改数量、价格等)。
* **退货单:** 用于处理客户退货业务。
* **收款单:** 用于处理销售单的后续收款或直接创建收款记录。
* **2.3.3 进货开单:** 用于记录从供应商处采购商品的业务流程。
* **2.3.4 其他收入/支出:**
* **其他收入:**
* 支持对收入进行分类,如“销售收入”、“经营所得”、“利息收入”等。
* 可选择**往来单位**和**结算账户**(如现金、银行等)。
* 可添加备注并选择日期。
* **其他支出:**
* 支持对支出进行分类,如“经营支出”、“办公用品”、“房租”等。
* 同样支持选择**往来单位**和**结算账户**。
**2.4 明细查询模块**
* **2.4.1 维度筛选:**
* 提供按时间维度(自定义、本周、今日、本月、本年)快速筛选单据。
* 提供按业务类型(销售、进货、收银、资金、盘点)进行分类查看。
* **2.4.2 单据列表:**
* 在选定维度下,以列表形式展示所有相关单据。
* 提供搜索功能,支持通过单据号、客户/供应商名、品名、备注等关键字查询。
* 显示当前筛选条件下的总金额。
* 当无数据时,提供清晰的空状态提示。
* 提供“+”号,支持在当前分类下快速新建单据。
**2.5 报表统计模块**
* **2.5.1 资金报表:**
* **利润统计:** 分析指定时间范围内的收入、支出和利润。
* **营业员统计:** 按销售人员维度统计销售业绩。
* **经营业绩:** 提供综合性的经营状况分析。
* **导入导出模块:** 提供导入导出功能方便用户切换手机或账号后仍能将旧数据导入。
* **2.5.2 进销存报表:**
* **销售统计:** 按商品、客户、时间等维度分析销售数据。
* **进货统计:** 按商品、供应商、时间等维度分析采购数据。
* **库存统计:** 提供当前库存成本、数量及分布情况的报告。
* **应收/应付对账单:** 生成与客户和供应商的对账单据。
**2.6 “我的”(用户中心)模块**
* **2.6.1 用户信息:** 显示用户头像、店铺名称、注册手机号及“老板”身份标识。
* **2.6.2 会员与订单:**
* 提供**VIP会员**入口,展示会员特权。
* 提供**我的订单**入口,可能用于查看应用内服务订单。
* **2.6.3 基础管理:**
* **供应商管理**
* **客户管理**
* **客户报价**
* **店铺管理**
* **2.6.4 设置中心:**
* **账号与安全:**
* 修改个人信息(头像、姓名)。
* 修改登录密码。
* **商品设置:**
* **系统参数:**
* 提供多种业务逻辑开关,如:“销售价低于进货价时提示”、“销售单默认全部收款”、“启用单行折扣”、“启用客户/供应商双身份”。
* **关于与协议:** 包含“关于我们”、“隐私协议”、“个人信息安全投诉”等静态页面。
* **账号操作:** 提供“账号注销”和“退出登录”功能。
#### 3.0 全局性需求
* **3.1 导航:** 采用底部Tab栏导航包含“首页”、“货品”、“开单”、“明细”、“我的”五个主要模块。
* **3.2 统一的UI/UX:** 应用整体风格简洁、清晰,操作流程符合移动端使用习惯。
* **3.3 空状态页面:** 在列表、报表等数据为空的页面,需提供友好的空状态提示图和引导性文字。
* **3.4 数据同步:** 应用数据应在云端同步,保证用户更换设备或多设备使用时数据一致性。
* **3.5 多租户数据隔离:** 所有业务数据按店铺(租户)隔离,用户不可访问他人数据。
* 所有业务表需包含`user_id`并在读取/写入中强制按`user_id`过滤。
* 支持租户内角色与权限控制;导出仅限本租户数据。
* **3.6 公共SKU全局商品库众包与审核:** 全体用户共同补充、纠错SKU经审核发布为全局可选SKU。
* 用户可提交“新增SKU/编辑建议”,进入审核流(草稿/待审/驳回/发布/下架)。
* 全局SKU字段名称、品牌、规格、条码、主单位、图片、别名、分类标签等。
* 各用户通过“本地商品”引用全局SKU并保留本地私有字段价格、库存、分类、单位换算、条码别名等
* **3.7 商品模糊查询(增强):** 在货品列表、开单选品、对账等场景支持多字段模糊匹配。
* 支持名称/条码/别名/拼音/品牌/规格模糊匹配,并高亮命中片段。
* 支持全局SKU与本地商品联合检索优先展示本地商品结果可分页。
* 需满足大规模SKU下的性能目标可通过系统参数配置匹配策略。
* **3.8 客户端平台:** 提供移动App与小程序小程序不支持商品条形码扫描功能。
* **3.9 多列销售价格:** 销售价格分四列,即同一种商品有四个销售价格
### 配件查询
1. **数据查询功能**
- 多参数组合查询(分类、尺寸、型号等)
- 模糊匹配关键字
- 分页展示查询结果
- 一键导出Excel数据
2. **数据提交系统**
- 用户提交新配件数据
- 型号为唯一必填项
- 支持图片上传
- 提交后等待管理员审核
3. **审核管理系统**
- 管理员查看待审核列表
- 可编辑所有字段
- 支持图片更新和删除
- 一键批准或拒绝提交
4. **图片管理系统**
- 每条数据可关联多张图片
- 点击图片可放大查看
- 管理员可管理所有图片
- 自动处理文件名冲突
## 全局说明(必看)
由于这个文档写的还不是很完善,目前有存疑的部分先行参考小程序小程序“智慧记进销存”(功能和按钮可以参考,界面样式除外),管理端文档目前待定。
客户要求的是做双端应用app端+小程序端),需要考虑兼容性相关问题。
本程序和“智慧记进销存”大多一致,主要的区别在于客户有配件查询要求,即在产品页面中要额外加一个配件查询按钮或入口,且要求一个产品要有四个销售价格(先按零售价 分销价 批发价 大客户价),且要求能自定义添加各种规格(尺寸,孔径等)。
有疑惑的部分一定要及时沟通(如未提及的页面和功能需要确认的时候)