优化商品

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,35 +1,67 @@
<!-- 新增耗材盘点 --> <!-- 新增耗材盘点 -->
<template> <template>
<el-dialog title="耗材盘点" :visible.sync="dialogVisible" width="80%" @open="form.note = ''"> <el-dialog
<el-form ref="form" :model="form" :rules="rules" label-position="left" inline> 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-form-item label="账存数量">
<el-input :value="detail.num" readonly style="width: 180px;"></el-input> <el-input :value="detail.num" readonly style="width: 180px;"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="实际数量"> <el-form-item label="实际数量">
<el-input-number v-model="form.lpNum" :min="0" :step="1" step-strictly <el-input-number
style="width: 180px;"></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>
<el-form-item label="盈亏数量"> <el-form-item label="盈亏数量">
<el-input :value="profitNumber" readonly :class="{ lose: profitNumber < 0 }" <el-input
style="width: 180px;"></el-input> :value="profitNumber"
readonly
:class="{ lose: profitNumber < 0 }"
style="width: 180px;"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="单价"> <el-form-item label="单价">
<el-input v-model="detail.price" readonly></el-input> <el-input v-model="detail.price" readonly></el-input>
</el-form-item> </el-form-item>
<el-form-item label="盈亏金额"> <el-form-item label="盈亏金额">
<el-input :value="profitPrice" readonly :class="{ lose: profitNumber < 0 }" <el-input
style="width: 180px;"></el-input> :value="profitPrice"
readonly
:class="{ lose: profitNumber < 0 }"
style="width: 180px;"
></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="备注"> <!-- <el-form-item label="备注">
<el-input v-model="form.note" placeholder="请输入备注" style="width: 300px;"></el-input> <el-input v-model="form.note" placeholder="请输入备注" style="width: 300px;"></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button> <el-button type="primary" :loading="loading" @click="onSubmitHandle"
> </el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="head-container"> <div class="head-container">
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe> <el-table
ref="table"
:data="tableData.list"
v-loading="tableData.loading"
border
stripe
>
<!-- <el-table-column label="商品信息" width="150px"> <!-- <el-table-column label="商品信息" width="150px">
<template v-slot="scope"> <template v-slot="scope">
<div class="shop_info"> <div class="shop_info">
@@ -54,45 +86,54 @@
{{ formatDecimal(scope.row.lpAmount) }} {{ formatDecimal(scope.row.lpAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际库存" prop="acStockNumber"></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="createTime"></el-table-column>
<!-- <el-table-column label="盘点备注" prop="note"></el-table-column> --> <!-- <el-table-column label="盘点备注" prop="note"></el-table-column> -->
</el-table> </el-table>
</div> </div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]" <el-pagination
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange" :total="tableData.total"
layout="total, sizes, prev, pager, next, jumper"></el-pagination> :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-dialog>
</template> </template>
<script> <script>
import { formatDecimal } from '@/utils' import { formatDecimal } from "@/utils";
import { tbConCheck, tbConCheckGet } from '@/api/invoicing' import { tbConCheck, tbConCheckGet } from "@/api/invoicing";
export default { export default {
data() { data() {
return { return {
formatDecimal, formatDecimal,
dialogVisible: false, dialogVisible: false,
loading: false, loading: false,
detail: '', detail: "",
form: { form: {
conInfoId: '', conInfoId: "",
lpNum: 0 lpNum: 0
}, },
rules: { rules: {
stocktakinNum: [ stocktakinNum: [
{ {
required: true, required: true,
message: '请输入盘点数量', message: "请输入盘点数量",
trigger: 'blur' trigger: "blur"
} }
] ]
}, },
resetForm: '', resetForm: "",
searhForm: { searhForm: {
name: '', name: "",
skuId: '', skuId: "",
productId: '' productId: ""
}, },
tableData: { tableData: {
page: 0, page: 0,
@@ -101,17 +142,19 @@ export default {
loading: false, loading: false,
list: [] list: []
} }
} };
}, },
mounted() { mounted() {
this.resetForm = { ...this.form } this.resetForm = { ...this.form };
}, },
computed: { computed: {
profitNumber() { profitNumber() {
return this.form.lpNum - this.detail.num return formatDecimal(this.form.lpNum - this.detail.num, 2, true);
}, },
profitPrice() { profitPrice() {
return formatDecimal((this.form.lpNum - this.detail.num) * this.detail.price) return formatDecimal(
(this.form.lpNum - this.detail.num) * this.detail.price
);
} }
}, },
methods: { methods: {
@@ -119,77 +162,81 @@ export default {
this.$refs.form.validate(async valid => { this.$refs.form.validate(async valid => {
if (valid) { if (valid) {
try { try {
this.loading = true this.loading = true;
let res = await tbConCheck({ let res = await tbConCheck({
conInfoId: this.form.conInfoId, conInfoId: this.form.conInfoId,
lpNum: this.profitNumber 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() 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) { } catch (error) {
this.loading = false this.loading = false;
console.log(error) console.log(error);
} }
} }
}) });
}, },
show(obj) { show(obj) {
// console.log(obj); // console.log(obj);
this.detail = { ...obj } this.detail = { ...obj };
this.detail.num = formatDecimal(obj.stockNumber - obj.stockConsume, 2, false) this.detail.num = formatDecimal(
this.dialogVisible = true obj.stockNumber - obj.stockConsume,
this.form.conInfoId = obj.id 2,
this.form.lpNum = this.detail.num false
);
this.dialogVisible = true;
this.form.conInfoId = obj.id;
this.form.lpNum = this.detail.num;
this.searhForm.skuId = obj.productId this.searhForm.skuId = obj.productId;
this.searhForm.productId = obj.proId this.searhForm.productId = obj.proId;
this.tableData.page = 0 this.tableData.page = 0;
this.tableData.total = 0 this.tableData.total = 0;
this.tableData.list = [] this.tableData.list = [];
this.getTableData() this.getTableData();
}, },
// 分页大小改变 // 分页大小改变
sizeChange(e) { sizeChange(e) {
this.tableData.size = e this.tableData.size = e;
this.getTableData() this.getTableData();
}, },
// 分页回调 // 分页回调
paginationChange(e) { paginationChange(e) {
this.tableData.page = e - 1 this.tableData.page = e - 1;
this.getTableData() this.getTableData();
}, },
// 商品列表 // 商品列表
async getTableData() { async getTableData() {
try { try {
this.tableData.loading = true this.tableData.loading = true;
const res = await tbConCheckGet({ const res = await tbConCheckGet({
page: this.tableData.page, page: this.tableData.page,
size: this.tableData.size, size: this.tableData.size,
conInfoId: this.form.conInfoId, conInfoId: this.form.conInfoId,
sort: 'id,desc', sort: "id,desc"
}) });
this.tableData.list = res.content this.tableData.list = res.content;
this.tableData.total = res.totalElements this.tableData.total = res.totalElements;
setTimeout(() => { setTimeout(() => {
this.tableData.loading = false this.tableData.loading = false;
}, 500); }, 500);
} catch (error) { } catch (error) {
console.log(error) console.log(error);
} }
},
} }
} }
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

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