1.新增商品库存库存盘点
2.操作出入库新增耗材操作
This commit is contained in:
@@ -2,7 +2,18 @@
|
||||
<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="出库类型">
|
||||
<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"
|
||||
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
|
||||
@@ -38,7 +49,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="实收金额">
|
||||
<el-form-item label="实付金额">
|
||||
<el-input v-model="queryForm.paidAmount" placeholder="请输入实收金额"
|
||||
style="width: 220px;"></el-input>
|
||||
</el-form-item>
|
||||
@@ -67,17 +78,61 @@
|
||||
</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>
|
||||
<div class="head-container">
|
||||
<el-button type="primary" plain>
|
||||
<el-button type="primary" plain v-if="inTabValue == 'consumable'">
|
||||
共{{ tableData.list.length }}种耗材,金额合计<span style="color: red;">¥{{ queryForm.totalAmount }}</span>
|
||||
</el-button>
|
||||
<el-button type="primary" plain v-else>
|
||||
共{{ tableData.list.length }}种商品,金额合计<span style="color: red;">¥{{ queryForm.totalAmount }}</span>
|
||||
</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">
|
||||
@@ -123,7 +178,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 +199,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: [
|
||||
{
|
||||
@@ -207,7 +280,7 @@ export default {
|
||||
this.tableData.list.forEach(ele => {
|
||||
zong += ele.costPrice * ele.number
|
||||
})
|
||||
this.queryForm.totalAmount = parseFloat(zong.toFixed(2))
|
||||
this.queryForm.totalAmount = parseFloat(zong.toFixed(2))
|
||||
},
|
||||
// 提交
|
||||
submitHandle() {
|
||||
@@ -215,8 +288,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: 'in'
|
||||
})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.queryFormLoading = false
|
||||
this.showResult = true
|
||||
} catch (error) {
|
||||
@@ -226,6 +318,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 = []
|
||||
|
||||
Reference in New Issue
Block a user