|
|
@@ -51,7 +51,13 @@
|
|
|
<el-tab-pane label="入库单" name="inbound">
|
|
|
<el-table :data="inboundList" v-loading="inboundLoading" border stripe max-height="500">
|
|
|
<el-table-column prop="orderNo" label="入库单号" width="180" />
|
|
|
- <el-table-column prop="supplierName" label="供应商" width="150" />
|
|
|
+ <el-table-column prop="supplierName" label="供应商" width="120" />
|
|
|
+ <el-table-column label="入库日期" width="100">
|
|
|
+ <template slot-scope="{ row }">{{ row.inboundDate || '-' }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="总金额" width="100">
|
|
|
+ <template slot-scope="{ row }">{{ row.totalAmount ? '¥' + (row.totalAmount / 100).toFixed(2) : '-' }}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="totalItems" label="商品项数" width="80" />
|
|
|
<el-table-column label="状态" width="90">
|
|
|
<template slot-scope="{ row }">
|
|
|
@@ -87,6 +93,23 @@
|
|
|
</el-table>
|
|
|
</el-tab-pane>
|
|
|
|
|
|
+ <!-- 出库单 -->
|
|
|
+ <el-tab-pane label="出库单" name="outbound">
|
|
|
+ <el-button type="primary" size="mini" @click="showCreateOutbound = true" style="margin-bottom:12px;">新建出库单</el-button>
|
|
|
+ <el-table :data="outboundList" v-loading="outboundLoading" border stripe max-height="500">
|
|
|
+ <el-table-column prop="id" label="ID" width="60" />
|
|
|
+ <el-table-column label="商品" min-width="150">
|
|
|
+ <template slot-scope="{ row }">{{ row.productName || 'ID:' + row.productId }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="数量" width="70">
|
|
|
+ <template slot-scope="{ row }"><span style="color:#f56c6c;">-{{ row.quantity }}</span></template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="出库原因" min-width="200" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="createdAt" label="时间" width="160" />
|
|
|
+ </el-table>
|
|
|
+ <el-pagination @size-change="outboundPageSize=$event;loadOutboundList()" @current-change="outboundPage=$event;loadOutboundList()" :current-page="outboundPage" :page-sizes="[10,20,50]" :page-size="outboundPageSize" :total="outboundTotal" layout="total, sizes, prev, pager, next, jumper" class="pagination-wrap" />
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
<!-- 盘点记录 -->
|
|
|
<el-tab-pane label="盘点记录" name="counting">
|
|
|
<el-button type="primary" size="mini" @click="showCreateCounting = true" style="margin-bottom:12px;">新建盘点</el-button>
|
|
|
@@ -136,6 +159,40 @@
|
|
|
</el-table>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- 新建出库弹窗 -->
|
|
|
+ <el-dialog title="新建出库单" :visible.sync="showCreateOutbound" width="500px">
|
|
|
+ <el-form label-width="100px">
|
|
|
+ <el-form-item label="商品">
|
|
|
+ <el-select v-model="outboundForm.productId" filterable remote placeholder="搜索商品" :remote-method="searchOutboundProduct" style="width:300px;">
|
|
|
+ <el-option v-for="p in outboundProductOptions" :key="p.id" :label="p.name + ' (库存:' + (p.stock || 0) + ')'" :value="p.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="SKU" v-if="outboundSkuOptions.length">
|
|
|
+ <el-select v-model="outboundForm.skuId" placeholder="选择规格" clearable style="width:200px;">
|
|
|
+ <el-option v-for="s in outboundSkuOptions" :key="s.id" :label="s.specs || '默认' + ' (库存:' + (s.stock || 0) + ')'" :value="s.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="数量">
|
|
|
+ <el-input v-model.number="outboundForm.quantity" type="number" min="1" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="出库原因">
|
|
|
+ <el-select v-model="outboundForm.reason" placeholder="选择原因" style="width:200px;">
|
|
|
+ <el-option label="赠品" value="赠品" />
|
|
|
+ <el-option label="损耗" value="损耗" />
|
|
|
+ <el-option label="样品" value="样品" />
|
|
|
+ <el-option label="其他" value="其他" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注">
|
|
|
+ <el-input v-model="outboundForm.remark" type="textarea" :rows="2" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer">
|
|
|
+ <el-button @click="showCreateOutbound = false">取消</el-button>
|
|
|
+ <el-button type="danger" @click="handleCreateOutbound">确认出库</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<!-- 新建盘点弹窗 -->
|
|
|
<el-dialog title="新建盘点" :visible.sync="showCreateCounting" width="450px">
|
|
|
<el-form label-width="100px">
|
|
|
@@ -161,7 +218,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getInventoryTransactions, getInboundOrderList, getInboundOrderDetail, confirmInbound, cancelInbound, getStockAlerts, getCountingList, createCountingRecord, confirmCounting } from '@/api/admin'
|
|
|
+import { getInventoryTransactions, getInboundOrderList, getInboundOrderDetail, confirmInbound, cancelInbound, getStockAlerts, getCountingList, createCountingRecord, confirmCounting, createManualOutbound, getManualOutboundList, getProductList, getProductSkuList } from '@/api/admin'
|
|
|
|
|
|
export default {
|
|
|
name: 'InventoryManage',
|
|
|
@@ -174,7 +231,10 @@ export default {
|
|
|
inboundDetail: null, detailDialogVisible: false,
|
|
|
alertList: [], alertLoading: false,
|
|
|
countingList: [], countingLoading: false, countingPage: 1, countingPageSize: 20, countingTotal: 0,
|
|
|
- showCreateCounting: false, countingForm: { productId: '', skuId: '', actualStock: '', remark: '' }
|
|
|
+ showCreateCounting: false, countingForm: { productId: '', skuId: '', actualStock: '', remark: '' },
|
|
|
+ outboundList: [], outboundLoading: false, outboundPage: 1, outboundPageSize: 20, outboundTotal: 0,
|
|
|
+ showCreateOutbound: false, outboundProductOptions: [], outboundSkuOptions: [],
|
|
|
+ outboundForm: { productId: '', skuId: '', quantity: 1, reason: '', remark: '' }
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -182,6 +242,7 @@ export default {
|
|
|
this.loadInboundOrders()
|
|
|
this.loadAlerts()
|
|
|
this.loadCountingRecords()
|
|
|
+ this.loadOutboundList()
|
|
|
},
|
|
|
methods: {
|
|
|
async loadTransactions() {
|
|
|
@@ -272,6 +333,41 @@ export default {
|
|
|
this.$message.success('盘点已确认')
|
|
|
this.loadCountingRecords()
|
|
|
} catch (e) { if (e !== 'cancel') this.$message.error('操作失败') }
|
|
|
+ },
|
|
|
+ async loadOutboundList() {
|
|
|
+ this.outboundLoading = true
|
|
|
+ try {
|
|
|
+ const res = await getManualOutboundList({ page: this.outboundPage, size: this.outboundPageSize })
|
|
|
+ this.outboundList = res.data.records || []
|
|
|
+ this.outboundTotal = res.data.total || 0
|
|
|
+ } catch (e) { this.$message.error('加载失败') }
|
|
|
+ finally { this.outboundLoading = false }
|
|
|
+ },
|
|
|
+ async searchOutboundProduct(query) {
|
|
|
+ if (!query || query.length < 1) return
|
|
|
+ try {
|
|
|
+ const res = await getProductList({ keyword: query, page: 1, size: 20 })
|
|
|
+ this.outboundProductOptions = res.data.records || []
|
|
|
+ } catch (e) { /* ignore */ }
|
|
|
+ },
|
|
|
+ async handleCreateOutbound() {
|
|
|
+ if (!this.outboundForm.productId || !this.outboundForm.quantity) {
|
|
|
+ return this.$message.warning('请填写必填项')
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ await this.$confirm('确认出库?库存将被扣减。', '提示')
|
|
|
+ await createManualOutbound({
|
|
|
+ productId: parseInt(this.outboundForm.productId),
|
|
|
+ skuId: this.outboundForm.skuId ? parseInt(this.outboundForm.skuId) : null,
|
|
|
+ quantity: parseInt(this.outboundForm.quantity),
|
|
|
+ reason: this.outboundForm.reason || null,
|
|
|
+ remark: this.outboundForm.remark || null
|
|
|
+ })
|
|
|
+ this.$message.success('出库成功')
|
|
|
+ this.showCreateOutbound = false
|
|
|
+ this.outboundForm = { productId: '', skuId: '', quantity: 1, reason: '', remark: '' }
|
|
|
+ this.loadOutboundList()
|
|
|
+ } catch (e) { if (e !== 'cancel') this.$message.error('操作失败') }
|
|
|
}
|
|
|
}
|
|
|
}
|