diff --git a/src/api/stock.js b/src/api/stock.js
new file mode 100644
index 0000000..42fa3b0
--- /dev/null
+++ b/src/api/stock.js
@@ -0,0 +1,41 @@
+import api from './index'
+
+/**
+ * 库存相关API
+ */
+export default {
+ /**
+ * 获取库存列表
+ */
+ getStockList(params) {
+ return api.request('/stock', 'GET', params)
+ },
+
+ /**
+ * 获取单商品库存
+ */
+ getStock(productId) {
+ return api.request(`/stock/${productId}`, 'GET')
+ },
+
+ /**
+ * 入库
+ */
+ stockIn(data) {
+ return api.request('/stock/in', 'POST', null, data)
+ },
+
+ /**
+ * 库存调整
+ */
+ adjustStock(data) {
+ return api.request('/stock/adjust', 'POST', null, data)
+ },
+
+ /**
+ * 获取库存流水
+ */
+ getStockFlow(params) {
+ return api.request('/stock/flow', 'GET', params)
+ }
+}
diff --git a/src/pages.json b/src/pages.json
index 5ea2792..26c0109 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -35,6 +35,24 @@
"style": {
"navigationBarTitleText": "订单列表"
}
+ },
+ {
+ "path": "pages/stock/list",
+ "style": {
+ "navigationBarTitleText": "库存管理"
+ }
+ },
+ {
+ "path": "pages/stock/in",
+ "style": {
+ "navigationBarTitleText": "入库"
+ }
+ },
+ {
+ "path": "pages/stock/flow",
+ "style": {
+ "navigationBarTitleText": "库存流水"
+ }
}
],
"globalStyle": {
@@ -57,6 +75,10 @@
"pagePath": "pages/product/list",
"text": "商品"
},
+ {
+ "pagePath": "pages/stock/list",
+ "text": "库存"
+ },
{
"pagePath": "pages/order/list",
"text": "订单"
diff --git a/src/pages/stock/flow.vue b/src/pages/stock/flow.vue
new file mode 100644
index 0000000..605c704
--- /dev/null
+++ b/src/pages/stock/flow.vue
@@ -0,0 +1,252 @@
+
+
+
+
+
+
+ {{ selectedTypeLabel }}
+
+
+
+
+ {{ selectedProduct ? selectedProduct.name : '全部商品' }}
+
+
+
+
+
+
+
+
+
+ {{ item.type === 1 ? '入库' : item.type === 2 ? '出库' : '调整' }}
+
+ {{ item.productName || '商品' + item.productId }}
+ {{ formatTime(item.createdAt) }}
+
+
+
+ {{ item.type === 1 ? '+' : '-' }}{{ item.quantity }}
+
+
+
+
+
+
+ 暂无流水记录
+
+
+
+
+
+
+
+
diff --git a/src/pages/stock/in.vue b/src/pages/stock/in.vue
new file mode 100644
index 0000000..eee09c1
--- /dev/null
+++ b/src/pages/stock/in.vue
@@ -0,0 +1,162 @@
+
+
+
+
+ 商品
+
+
+ {{ selectedProduct ? selectedProduct.name : '请选择商品' }}
+
+
+
+
+
+ 入库数量
+
+
+
+
+ 备注
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/stock/list.vue b/src/pages/stock/list.vue
new file mode 100644
index 0000000..45bd468
--- /dev/null
+++ b/src/pages/stock/list.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.productName || '商品' + item.productId }}
+ 仓库: {{ item.warehouseId || '默认' }}
+
+
+ {{ item.quantity || 0 }}
+ 库存
+ 锁定: {{ item.lockedQuantity }}
+
+
+
+
+ 暂无库存数据
+
+
+
+
+
+
+
+
+
+
+
+
+
+