1.新增商品库存库存盘点

2.操作出入库新增耗材操作
This commit is contained in:
gyq
2024-07-04 10:05:17 +08:00
parent 06101c6ed2
commit 7a3fd61550
7 changed files with 410 additions and 37 deletions

View File

@@ -2,6 +2,17 @@
<div class="app-container">
<div class="head-container">
<el-form ref="queryForm" :model="queryForm" :rules="queryRules" label-position="left" label-width="80px">
<el-form-item label="出库内容">
<div class="shop_type_box">
<div class="item" v-for="item in inTabs" :key="item.value"
:class="{ active: inTabValue == item.value }" @click="inTabValue = item.value">
<div class="s_title">{{ item.label }}</div>
<div class="active_dot">
<i class="el-icon-check"></i>
</div>
</div>
</div>
</el-form-item>
<el-form-item label="出库类型">
<div class="shop_type_box">
<div class="item" v-for="(item, index) in shopTypes" :key="index"
@@ -67,7 +78,9 @@
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)">选择商品</el-button>
<el-button type="primary" @click="$refs.ConsumableList.show()"
v-if="inTabValue == 'consumable'">选择耗材</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>选择商品</el-button>
</el-form-item>
</el-form>
</div>
@@ -77,7 +90,47 @@
</el-button>
</div>
<div class="head-container">
<el-table :data="tableData.list">
<el-table :data="tableData.list" v-if="inTabValue == 'consumable'">
<el-table-column label="耗材名称" prop="conName">
<template v-slot="scope">
{{ scope.row.conName }}
</template>
</el-table-column>
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.price" :min="0" controls-position="right"
@change="e => { queryForm.totalAmount = formatDecimal(e * scope.row.stockNumber) }"></el-input-number>
<div class="tips">原价{{ scope.row.costPrice }}/{{ scope.row.conUnit }}</div>
</template>
</el-table-column>
<el-table-column label="数量">
<template v-slot="scope">
<el-input-number v-model="scope.row.stockNumber" :min="0" controls-position="right"
@change="e => { queryForm.totalAmount = formatDecimal(e * scope.row.price) }"></el-input-number>
<div class="tips">出库前{{ scope.row.number }}{{ scope.row.conUnit }}</div>
</template>
</el-table-column>
<el-table-column label="小计">
<template v-slot="scope">
<!-- <el-input-number v-model="scope.row.totalAmount" :min="0"
controls-position="right"></el-input-number> -->
<el-input :value="formatDecimal(scope.row.price * scope.row.stockNumber)" readonly
style="width: 100px;" />
</template>
</el-table-column>
<!-- <el-table-column label="变动后剩余库存">
<template v-slot="scope">
{{ scope.row.stockNumber - scope.row.number }}{{ scope.row.conUnit }}
</template>
</el-table-column> -->
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-table :data="tableData.list" v-else>
<el-table-column type="index" width="50"></el-table-column>
<el-table-column label="商品名称" prop="name">
<template v-slot="scope">
@@ -90,14 +143,14 @@
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right"
@change="e => { modifyPrice(); scope.row.costPrice = e }"></el-input-number>
@change="e => { modifyPrice(); scope.row.costPrice = e }"></el-input-number>
<div class="tips">成本价{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div>
</template>
</el-table-column>
<el-table-column label="数量">
<template v-slot="scope">
<el-input-number v-model="scope.row.number" :min="0" controls-position="right"
@change="e => { modifyPrice(); scope.row.totalAmount = e }"></el-input-number>
@change="e => { modifyPrice(); scope.row.totalAmount = e }"></el-input-number>
<div class="tips">出库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
</template>
</el-table-column>
@@ -123,7 +176,10 @@
<div>
<el-button type="primary" @click="submitHandle" :loading="queryFormLoading">确定</el-button>
</div>
<!-- 选择商品 -->
<shopList ref="shopList" @success="selectShop" />
<!-- 选择耗材 -->
<ConsumableList ref="ConsumableList" @success="selectConsumable" />
<el-dialog :visible.sync="showResult" :show-close="false" :close-on-press-escape="false"
:close-on-click-modal="false">
<el-result icon="success" title="出库提交成功" :subTitle="`共操作${tableData.list.length}件商品`">
@@ -141,13 +197,28 @@
<script>
import dayjs from 'dayjs'
import shopList from './components/shopList'
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn } from '@/api/invoicing'
import ConsumableList from './components/consumableList'
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn, stockInOut } from '@/api/invoicing'
import { formatDecimal } from '@/utils'
export default {
components: {
shopList
shopList,
ConsumableList
},
data() {
return {
formatDecimal,
inTabValue: 'goods',
inTabs: [
{
label: '商品出库',
value: 'goods'
},
{
label: '耗材出库',
value: 'consumable'
}
],
shopTypesActive: 0,
shopTypes: [
{
@@ -215,8 +286,27 @@ export default {
if (valid) {
try {
this.queryFormLoading = true
this.queryForm.list = this.tableData.list
await tbProductStockOperateOutAndOn(this.queryForm)
switch (this.inTabValue) {
case 'goods':
this.queryForm.list = this.tableData.list
await tbProductStockOperateOutAndOn(this.queryForm)
break;
case 'consumable':
const con = { ...this.tableData.list[0] }
await stockInOut({
accountsPayable: this.queryForm.totalAmount,
actualPayment: this.queryForm.paidAmount,
conInfoId: con.id,
paymentTime: this.queryForm.paidAt,
price: con.price,
stockNumber: con.stockNumber,
supplierId: this.queryForm.purveyorId,
type: 'out'
})
break;
default:
break;
}
this.queryFormLoading = false
this.showResult = true
} catch (error) {
@@ -226,6 +316,14 @@ export default {
}
})
},
// 选择耗材
selectConsumable(res) {
const n_res = { ...res }
res.costPrice = n_res.price
res.number = n_res.stockNumber
this.tableData.list = [res]
this.queryForm.totalAmount = formatDecimal(res.price * res.stockNumber)
},
// 选择商品
selectShop(res) {
let arr = []