优化商品

This commit is contained in:
gyq 2024-07-11 10:35:03 +08:00
parent 2150cacf1c
commit 8d7d3c8ea1
2 changed files with 256 additions and 183 deletions

View File

@ -1,36 +1,68 @@
<!-- 新增耗材盘点 -->
<template>
<el-dialog title="耗材盘点" :visible.sync="dialogVisible" width="80%" @open="form.note = ''">
<el-form ref="form" :model="form" :rules="rules" label-position="left" inline>
<el-form-item label="账存数量">
<el-input :value="detail.num" readonly style="width: 180px;"></el-input>
</el-form-item>
<el-form-item label="实际数量">
<el-input-number v-model="form.lpNum" :min="0" :step="1" step-strictly
style="width: 180px;"></el-input-number>
</el-form-item>
<el-form-item label="盈亏数量">
<el-input :value="profitNumber" readonly :class="{ lose: profitNumber < 0 }"
style="width: 180px;"></el-input>
</el-form-item>
<el-form-item label="单价">
<el-input v-model="detail.price" readonly></el-input>
</el-form-item>
<el-form-item label="盈亏金额">
<el-input :value="profitPrice" readonly :class="{ lose: profitNumber < 0 }"
style="width: 180px;"></el-input>
</el-form-item>
<!-- <el-form-item label="备注">
<el-dialog
title="耗材盘点"
:visible.sync="dialogVisible"
width="80%"
@open="form.note = ''"
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-position="left"
inline
>
<el-form-item label="账存数量">
<el-input :value="detail.num" readonly style="width: 180px;"></el-input>
</el-form-item>
<el-form-item label="实际数量">
<el-input-number
v-model="form.lpNum"
:min="0"
:step="1"
step-strictly
style="width: 180px;"
></el-input-number>
</el-form-item>
<el-form-item label="盈亏数量">
<el-input
:value="profitNumber"
readonly
:class="{ lose: profitNumber < 0 }"
style="width: 180px;"
></el-input>
</el-form-item>
<el-form-item label="单价">
<el-input v-model="detail.price" readonly></el-input>
</el-form-item>
<el-form-item label="盈亏金额">
<el-input
:value="profitPrice"
readonly
:class="{ lose: profitNumber < 0 }"
style="width: 180px;"
></el-input>
</el-form-item>
<!-- <el-form-item label="备注">
<el-input v-model="form.note" placeholder="请输入备注" style="width: 300px;"></el-input>
</el-form-item> -->
<el-form-item>
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button>
</el-form-item>
</el-form>
<div class="head-container">
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe>
<!-- <el-table-column label="商品信息" width="150px">
<el-form-item>
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" :loading="loading" @click="onSubmitHandle"
> </el-button
>
</el-form-item>
</el-form>
<div class="head-container">
<el-table
ref="table"
:data="tableData.list"
v-loading="tableData.loading"
border
stripe
>
<!-- <el-table-column label="商品信息" width="150px">
<template v-slot="scope">
<div class="shop_info">
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
@ -42,169 +74,184 @@
</div>
</template>
</el-table-column> -->
<el-table-column label="售价" prop="price">
<template v-slot="scope">
{{ formatDecimal(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="lpAmount">
<template v-slot="scope">
{{ formatDecimal(scope.row.lpAmount) }}
</template>
</el-table-column>
<el-table-column label="实际库存" prop="acStockNumber"></el-table-column>
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
<!-- <el-table-column label="盘点备注" prop="note"></el-table-column> -->
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]"
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</el-dialog>
<el-table-column label="售价" prop="price">
<template v-slot="scope">
{{ formatDecimal(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="lpAmount">
<template v-slot="scope">
{{ formatDecimal(scope.row.lpAmount) }}
</template>
</el-table-column>
<el-table-column
label="实际库存"
prop="acStockNumber"
></el-table-column>
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
<!-- <el-table-column label="盘点备注" prop="note"></el-table-column> -->
</el-table>
</div>
<el-pagination
:total="tableData.total"
:current-page="tableData.page + 1"
:page-sizes="[5, 10, 30, 50]"
:page-size="tableData.size"
@current-change="paginationChange"
@size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
</el-dialog>
</template>
<script>
import { formatDecimal } from '@/utils'
import { tbConCheck, tbConCheckGet } from '@/api/invoicing'
import { formatDecimal } from "@/utils";
import { tbConCheck, tbConCheckGet } from "@/api/invoicing";
export default {
data() {
return {
formatDecimal,
dialogVisible: false,
loading: false,
detail: '',
form: {
conInfoId: '',
lpNum: 0
},
rules: {
stocktakinNum: [
{
required: true,
message: '请输入盘点数量',
trigger: 'blur'
}
]
},
resetForm: '',
searhForm: {
name: '',
skuId: '',
productId: ''
},
tableData: {
page: 0,
size: 5,
total: 0,
loading: false,
list: []
}
}
data() {
return {
formatDecimal,
dialogVisible: false,
loading: false,
detail: "",
form: {
conInfoId: "",
lpNum: 0
},
rules: {
stocktakinNum: [
{
required: true,
message: "请输入盘点数量",
trigger: "blur"
}
]
},
resetForm: "",
searhForm: {
name: "",
skuId: "",
productId: ""
},
tableData: {
page: 0,
size: 5,
total: 0,
loading: false,
list: []
}
};
},
mounted() {
this.resetForm = { ...this.form };
},
computed: {
profitNumber() {
return formatDecimal(this.form.lpNum - this.detail.num, 2, true);
},
mounted() {
this.resetForm = { ...this.form }
},
computed: {
profitNumber() {
return this.form.lpNum - this.detail.num
},
profitPrice() {
return formatDecimal((this.form.lpNum - this.detail.num) * this.detail.price)
}
},
methods: {
onSubmitHandle() {
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.loading = true
let res = await tbConCheck({
conInfoId: this.form.conInfoId,
lpNum: this.profitNumber
})
this.detail.num = this.form.lpNum
this.form.lpNum = 0
this.form.lpNum = this.detail.num
this.$emit('success', res)
this.loading = false
this.$message({
title: '注意',
message: `添加成功`,
type: 'success'
});
this.getTableData()
} catch (error) {
this.loading = false
console.log(error)
}
}
})
},
show(obj) {
// console.log(obj);
this.detail = { ...obj }
this.detail.num = formatDecimal(obj.stockNumber - obj.stockConsume, 2, false)
this.dialogVisible = true
this.form.conInfoId = obj.id
this.form.lpNum = this.detail.num
this.searhForm.skuId = obj.productId
this.searhForm.productId = obj.proId
this.tableData.page = 0
this.tableData.total = 0
this.tableData.list = []
this.getTableData()
},
//
sizeChange(e) {
this.tableData.size = e
this.getTableData()
},
//
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
//
async getTableData() {
try {
this.tableData.loading = true
const res = await tbConCheckGet({
page: this.tableData.page,
size: this.tableData.size,
conInfoId: this.form.conInfoId,
sort: 'id,desc',
})
this.tableData.list = res.content
this.tableData.total = res.totalElements
setTimeout(() => {
this.tableData.loading = false
}, 500);
} catch (error) {
console.log(error)
}
},
profitPrice() {
return formatDecimal(
(this.form.lpNum - this.detail.num) * this.detail.price
);
}
}
},
methods: {
onSubmitHandle() {
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.loading = true;
let res = await tbConCheck({
conInfoId: this.form.conInfoId,
lpNum: this.profitNumber
});
this.detail.num = this.form.lpNum;
this.form.lpNum = 0;
this.form.lpNum = this.detail.num;
this.$emit("success", res);
this.loading = false;
this.$message({
title: "注意",
message: `添加成功`,
type: "success"
});
this.getTableData();
} catch (error) {
this.loading = false;
console.log(error);
}
}
});
},
show(obj) {
// console.log(obj);
this.detail = { ...obj };
this.detail.num = formatDecimal(
obj.stockNumber - obj.stockConsume,
2,
false
);
this.dialogVisible = true;
this.form.conInfoId = obj.id;
this.form.lpNum = this.detail.num;
this.searhForm.skuId = obj.productId;
this.searhForm.productId = obj.proId;
this.tableData.page = 0;
this.tableData.total = 0;
this.tableData.list = [];
this.getTableData();
},
//
sizeChange(e) {
this.tableData.size = e;
this.getTableData();
},
//
paginationChange(e) {
this.tableData.page = e - 1;
this.getTableData();
},
//
async getTableData() {
try {
this.tableData.loading = true;
const res = await tbConCheckGet({
page: this.tableData.page,
size: this.tableData.size,
conInfoId: this.form.conInfoId,
sort: "id,desc"
});
this.tableData.list = res.content;
this.tableData.total = res.totalElements;
setTimeout(() => {
this.tableData.loading = false;
}, 500);
} catch (error) {
console.log(error);
}
}
}
};
</script>
<style scoped lang="scss">
.lose {
&::v-deep .el-input__inner {
color: rgb(238, 29, 29);
}
&::v-deep .el-input__inner {
color: rgb(238, 29, 29);
}
}
.shop_info {
display: flex;
align-items: center;
display: flex;
align-items: center;
span {
margin-left: 10px;
}
span {
margin-left: 10px;
}
}
</style>
</style>

View File

@ -222,6 +222,14 @@
></el-input-number>
</template>
</el-table-column>
<el-table-column label="起售数量" prop="suit">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.suit"
controls-position="right"
></el-input-number>
</template>
</el-table-column>
<el-table-column label="库存数量" prop="stockNumber">
<template v-slot="scope">
<el-input-number
@ -454,6 +462,18 @@
></el-input-number>
</template>
</el-table-column>
<el-table-column label="起售数量" prop="suit">
<template slot="header" slot-scope="scope">
<span>起售数量</span>
<i class="icon el-icon-edit" @click="batchNumber('suit')"></i>
</template>
<template slot-scope="scope">
<el-input-number
v-model="scope.row.suit"
controls-position="right"
></el-input-number>
</template>
</el-table-column>
<el-table-column label="库存数量" prop="stockNumber">
<template slot="header" slot-scope="scope">
<span>库存数量</span>
@ -466,7 +486,7 @@
<template slot-scope="scope">
<el-input-number
v-model="scope.row.stockNumber"
:disabled="!!form.id"
:disabled="!!scope.row.id"
controls-position="right"
></el-input-number>
</template>
@ -657,7 +677,8 @@ export default {
originPrice: 0,
stockNumber: 0,
firstShared: 0,
barCode: `${localStorage.getItem("shopId")}${dayjs().valueOf()}`
barCode: `${localStorage.getItem("shopId")}${dayjs().valueOf()}`,
suit: 1
},
tableAddShopIndex: null,
isEditor: false,
@ -992,10 +1013,15 @@ export default {
this.form.skuList = newarr.map(item => {
this.originSkuList.map(val => {
if (item.specSnap == val.specSnap) {
for (let key in item) {
for (let key in val) {
item[key] = val[key];
}
item.id = val.id;
} else {
item.productId = this.$route.query.goods_id;
item.realSalesNumber = "";
item.shopId = localStorage.getItem("shopId");
item.warnLine = "";
}
});