fix: 挂账管理更新,邀请列表更新,店铺配置更新

This commit is contained in:
2025-03-10 18:33:42 +08:00
parent 34068cf8dd
commit 89fe9b7639
31 changed files with 3292 additions and 202 deletions

View File

@@ -1,13 +1,13 @@
<!-- 耗材列表的新增耗材盘点 -->
<template>
<el-dialog title="耗材盘点" v-model="dialogVisible" width="80%">
<el-dialog title="耗材盘点" v-model="dialogVisible" width="80%" @close="reset">
<el-form ref="form" :model="form" :rules="rules" label-position="left" inline>
<el-form-item label="账存数量">
<el-input v-model="form.balance" readonly style="width: 180px"></el-input>
<el-input v-model="form.stockNumber" readonly style="width: 180px"></el-input>
</el-form-item>
<el-form-item label="实际数量">
<el-input-number
v-model="form.stockNumber"
v-model="form.actualNumber"
:min="0"
:step="1"
step-strictly
@@ -60,8 +60,8 @@
<el-table-column label="售价" prop="price">
<template v-slot="scope">{{ scope.row.price }}</template>
</el-table-column>
<el-table-column label="账存数量" prop="stockNumber"></el-table-column>
<el-table-column label="盈亏数量" prop="lpNum"></el-table-column>
<el-table-column label="账存数量" prop="actualNumber"></el-table-column>
<el-table-column label="盈亏数量" prop="winLossNumber"></el-table-column>
<el-table-column label="盈亏金额" prop="lpAmount">
<template v-slot="scope">{{ scope.row.lpAmount }}</template>
</el-table-column>
@@ -97,8 +97,8 @@ export default {
stocktakinNum: "", // 必传
price: "", // 商品价格 非必传 为空盘点价格为商品价格
remark: "", // 盘点备注 非必传
stockNumber: 0,
balance: "",
actualNumber: 0,
stockNumber: "",
},
rules: {
stocktakinNum: [
@@ -129,29 +129,36 @@ export default {
},
computed: {
profitNumber() {
if (this.form.balance == undefined) {
return this.form.stockNumber - 0;
if (this.form.stockNumber == undefined) {
return this.form.actualNumber - 0;
} else {
return this.form.stockNumber - this.form.balance;
return this.form.actualNumber - this.form.stockNumber;
}
},
profitPrice() {
return formatDecimal((this.form.stockNumber - this.form.balance) * this.form.price);
return formatDecimal((this.form.actualNumber - this.form.stockNumber) * this.form.price);
},
},
methods: {
reset() {
this.form = { ...this.resetForm };
},
onSubmitHandle() {
this.$refs.form.validate(async (valid) => {
if (valid) {
try {
this.form.lpNum = this.profitNumber;
this.form.balance = this.form.stockNumber;
this.form.winLossNumber = this.profitNumber;
this.form.stockNumber = this.form.actualNumber;
this.loading = true;
this.form.conInfoId = this.form.id;
delete this.form["id"];
console.log(this.form);
let res = await tbConCheck(this.form);
console.log(this.form);
let res = await stockApi.check({
conId: this.form.id,
conName: this.form.conName,
stockNumber: this.form.stockNumber,
actualNumber: this.form.actualNumber,
winLossNumber: this.form.winLossNumber,
price: this.form.price,
remark: this.form.remark,
});
this.$emit("success", res);
this.dialogVisible = false;
this.loading = false;
@@ -169,22 +176,21 @@ export default {
});
},
async show(obj) {
console.log(obj, 111);
console.log(obj);
let res = await hasPermission("允许耗材盘点");
if (!res) {
return;
}
this.form.remark = "";
this.form.stocktakinNum = 0;
this.form.lpNum = 0;
// this.form.stockNumber = 0
this.form.winLossNumber = 0;
this.form = Object.assign(this.form, obj);
this.dialogVisible = true;
this.form.conInfoId = obj.consId;
this.form.stockNumber = obj.balance < 0 ? 0 : obj.balance;
// this.form.balance = obj.stockNumber
this.form.balance = obj.balance;
this.form.actualNumber = obj.stockNumber < 0 ? 0 : obj.stockNumber;
// this.form.stockNumber = obj.actualNumber
this.form.stockNumber = obj.stockNumber;
this.form.price == null ? 0 : this.form.price;
this.searhForm.productId = obj.id;
this.getTableData();

View File

@@ -154,6 +154,10 @@ function handleToolbarClick(name: string) {
router.push({ path: "/inventory/operation_in" });
return;
}
if (name == "chuku") {
router.push({ path: "/inventory/operation_in", query: { type: "out" } });
return;
}
}
// 其他操作列
async function handleOperatClick(data: IOperatData) {

View File

@@ -8,11 +8,19 @@
label-position="left"
label-width="80px"
>
<el-row>
<el-form-item label="类型">
<el-radio-group :model-value="type">
<el-radio-button label="in">入库</el-radio-button>
<el-radio-button label="out">出库</el-radio-button>
</el-radio-group>
</el-form-item>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="供应商">
<el-select
v-model="queryForm.purveyorId"
v-model="queryForm.vendorId"
placeholder="请选择供应商"
clearable
style="width: 220px"
@@ -29,9 +37,9 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="入库时间" prop="time">
<el-form-item label="入库时间" prop="inOutDate">
<el-date-picker
v-model="queryForm.time"
v-model="queryForm.inOutDate"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
@@ -45,7 +53,7 @@
<el-col :span="8">
<el-form-item label="应付金额">
<el-input
v-model="queryForm.totalAmount"
v-model="queryForm.amountPayable"
placeholder="请输入应收金额"
style="width: 220px"
></el-input>
@@ -54,7 +62,7 @@
<el-col :span="8">
<el-form-item label="实付金额">
<el-input
v-model="queryForm.paidAmount"
v-model="queryForm.actualPaymentAmount"
placeholder="请输入实收金额"
style="width: 220px"
></el-input>
@@ -65,7 +73,7 @@
<el-col :span="8">
<el-form-item label="付款时间">
<el-date-picker
v-model="queryForm.paidAt"
v-model="queryForm.paymentDate"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
@@ -77,7 +85,7 @@
<el-col :span="8">
<el-form-item label="批号">
<el-input
v-model="queryForm.batchNumber"
v-model="queryForm.batchNo"
placeholder="请输入批号"
style="width: 220px"
></el-input>
@@ -95,32 +103,33 @@
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-form-item label="选择耗材">
<div></div>
<el-button type="primary" @click="showHaocai" v-if="inTabValue == 'consumable'">
选择耗材
</el-button>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)" v-else>
选择商品
</el-button>
<el-autocomplete
v-model="autocompletename"
:fetch-suggestions="querySearchAsync"
:value-key="inTabValue == 'goods' ? 'name' : 'conName'"
:placeholder="inTabValue == 'goods' ? '商品搜索' : '耗材搜索'"
@select="handleSelect"
style="width: 200px; margin-left: 20px"
></el-autocomplete>
</el-form-item>
<el-autocomplete
v-model="autocompletename"
:fetch-suggestions="querySearchAsync"
:value-key="inTabValue == 'goods' ? 'name' : 'conName'"
:placeholder="inTabValue == 'goods' ? '商品搜索' : '耗材搜索'"
@select="handleSelect"
style="width: 500px"
></el-autocomplete>
</el-form>
</div>
<div class="head-container">
<el-button type="primary" plain v-if="inTabValue == 'consumable'">
{{ tableData.list.length }}种耗材金额合计
<span style="color: red">{{ queryForm.totalAmount }}</span>
<span style="color: red">{{ queryForm.amountPayable }}</span>
</el-button>
<el-button type="primary" plain v-else>
{{ tableData.list.length }}种商品金额合计
<span style="color: red">{{ queryForm.totalAmount }}</span>
<span style="color: red">{{ queryForm.amountPayable }}</span>
</el-button>
</div>
<div class="head-container">
@@ -196,7 +205,7 @@
</el-table-column>
<el-table-column label="小计">
<template v-slot="scope">
<!-- <el-input-number v-model="scope.row.totalAmount" :min="0" scope.row.price , scope.row.stockNumber
<!-- <el-input-number v-model="scope.row.amountPayable" :min="0" scope.row.price , scope.row.stockNumber
controls-position="right"></el-input-number> -->
<el-input :value="formatDecimal(testform(scope.row))" readonly style="width: 100px" />
</template>
@@ -244,7 +253,7 @@
:step="1"
step-strictly
controls-position="right"
@change="modifyPrice($event, scope.row, 'number', 'totalAmount')"
@change="modifyPrice($event, scope.row, 'number', 'amountPayable')"
></el-input-number>
<div class="tips" style="font-size: 16px">
入库前
@@ -273,7 +282,7 @@
</el-table-column>
<el-table-column label="小计">
<template v-slot="scope">
<!-- <el-input-number v-model="scope.row.totalAmount" :min="0"
<!-- <el-input-number v-model="scope.row.amountPayable" :min="0"
controls-position="right"></el-input-number> -->
<el-input
:value="scope.row.costPrice * scope.row.number"
@@ -328,6 +337,9 @@
</template>
<script>
import { ElMessage, ElMessageBox } from "element-plus";
import consApi from "@/api/product/cons";
import vendorApi from "@/api/product/vendor";
import stockApi from "@/api/product/stock";
import dayjs from "dayjs";
@@ -342,6 +354,7 @@ export default {
},
data() {
return {
type: "in", //in 入库 out出库
formatDecimal,
inTabValue: "consumable",
inTabs: [
@@ -376,27 +389,27 @@ export default {
resetForm: "",
queryFormLoading: false,
queryForm: {
batchNumber: "",
list: [],
paidAmount: 0,
paidAt: "",
purveyorId: "",
batchNo: "",
bodyList: [],
actualPaymentAmount: 0,
paymentDate: "",
vendorId: "",
purveyorName: "",
remark: "",
time: dayjs().format("YYYY-MM-DD"),
totalAmount: 0,
inOutDate: dayjs().format("YYYY-MM-DD"),
amountPayable: 0,
type: "in",
shopId: localStorage.getItem("shopId"),
},
queryRules: {
purveyorId: [
vendorId: [
{
required: true,
message: "请选择供应商",
trigger: "change",
},
],
time: [
inOutDate: [
{
required: true,
message: " ",
@@ -415,6 +428,7 @@ export default {
};
},
mounted() {
this.type = this.$route.query.type || "in";
this.resetForm = { ...this.queryForm };
this.tbShopPurveyorGet();
},
@@ -434,17 +448,16 @@ export default {
sort: "id",
});
} else {
res = await tbConsInfoGet({
res = await consApi.getList({
page: 0,
size: 20,
shopId: localStorage.getItem("shopId"),
conName: queryString ? queryString : "",
});
}
this.restaurants = res.content;
if (res.content.length == 0) {
this.restaurants = res.records;
if (res.records.length == 0) {
//给个提示没有搜到
this.$message("无此商品");
ElMessage("无此商品");
return false;
}
var uniqueArray = this.restaurants.filter(
@@ -487,7 +500,7 @@ export default {
zong += ele.price * ele.stockNumber * p;
});
}
this.queryForm.totalAmount = formatDecimal(zong);
this.queryForm.amountPayable = formatDecimal(zong);
},
// 选择商品
selectShop(res) {
@@ -499,7 +512,7 @@ export default {
unitName: item.unitName,
productId: item.id,
number: 0,
totalAmount: "",
amountPayable: "",
...i,
});
});
@@ -528,7 +541,7 @@ export default {
return false;
}
//商品入库是否显示应付实付
if (this.queryForm.purveyorId) {
if (this.queryForm.vendorId) {
this.shopTypesActive = 0;
} else {
this.shopTypesActive = 1;
@@ -544,7 +557,7 @@ export default {
this.tableData.list.forEach((ele) => {
zong += ele.price * ele.stockNumber;
});
this.queryForm.totalAmount = formatDecimal(zong);
this.queryForm.amountPayable = formatDecimal(zong);
}, 10);
} else {
row[key1] = cvalue;
@@ -556,7 +569,7 @@ export default {
}
zong += ele.price * ele.stockNumber * p;
});
this.queryForm.totalAmount = formatDecimal(zong);
this.queryForm.amountPayable = formatDecimal(zong);
}
},
// 计算商品总价
@@ -570,7 +583,7 @@ export default {
this.tableData.list.forEach((ele) => {
zong += ele.costPrice * ele.number;
});
this.queryForm.totalAmount = formatDecimal(zong);
this.queryForm.amountPayable = formatDecimal(zong);
}, 10);
} else {
row[key1] = cvalue;
@@ -579,7 +592,7 @@ export default {
this.tableData.list.forEach((ele) => {
zong += ele.costPrice * ele.number;
});
this.queryForm.totalAmount = formatDecimal(zong);
this.queryForm.amountPayable = formatDecimal(zong);
}
},
// 提交
@@ -587,10 +600,10 @@ export default {
if (this.tableData.list.length == 0) {
switch (this.inTabValue) {
case "goods":
this.$message("请先选择商品!");
ElMessage("请先选择商品!");
break;
case "consumable":
this.$message("请先选择耗材!");
ElMessage("请先选择耗材!");
break;
default:
break;
@@ -603,23 +616,38 @@ export default {
this.queryFormLoading = true;
switch (this.inTabValue) {
case "goods":
this.queryForm.list = this.tableData.list;
this.queryForm.bodyList = this.tableData.list;
await tbProductStockOperateOutAndOn(this.queryForm);
break;
case "consumable":
this.queryForm.accountsPayable = this.queryForm.totalAmount;
this.queryForm.actualPayment = this.queryForm.paidAmount;
this.queryForm.paymentTime = this.queryForm.paidAt;
this.queryForm.supplierId = this.queryForm.purveyorId;
this.queryForm.list = this.tableData.list;
await stockApi.in(this.queryForm);
this.queryForm.accountsPayable = this.queryForm.amountPayable;
this.queryForm.actualPayment = this.queryForm.actualPaymentAmount;
this.queryForm.paymentTime = this.queryForm.paymentDate;
this.queryForm.supplierId = this.queryForm.vendorId;
const bodyList = this.tableData.list.map((v) => {
console.log(v);
return {
conId: v.id,
conName: v.conName,
purchasePrice: v.price,
unitName: v.conUnit,
inOutNumber: v.stockNumber,
subTotal: v.price * v.stockNumber,
};
});
if (this.type == "in") {
await stockApi.in({ ...this.queryForm, bodyList });
} else {
await stockApi.out({ ...this.queryForm, bodyList });
}
break;
default:
break;
}
this.queryFormLoading = false;
this.$message({
message: "入库提交成功",
const title = this.type == "in" ? "入库" : "出库";
ElMessage({
message: title + "提交成功",
type: "success",
});
this.resetHandle(); //初始化