优化商品
This commit is contained in:
parent
2150cacf1c
commit
8d7d3c8ea1
|
|
@ -1,36 +1,68 @@
|
||||||
<!-- 新增耗材盘点 -->
|
<!-- 新增耗材盘点 -->
|
||||||
<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="耗材盘点"
|
||||||
<el-form-item label="账存数量">
|
:visible.sync="dialogVisible"
|
||||||
<el-input :value="detail.num" readonly style="width: 180px;"></el-input>
|
width="80%"
|
||||||
</el-form-item>
|
@open="form.note = ''"
|
||||||
<el-form-item label="实际数量">
|
>
|
||||||
<el-input-number v-model="form.lpNum" :min="0" :step="1" step-strictly
|
<el-form
|
||||||
style="width: 180px;"></el-input-number>
|
ref="form"
|
||||||
</el-form-item>
|
:model="form"
|
||||||
<el-form-item label="盈亏数量">
|
:rules="rules"
|
||||||
<el-input :value="profitNumber" readonly :class="{ lose: profitNumber < 0 }"
|
label-position="left"
|
||||||
style="width: 180px;"></el-input>
|
inline
|
||||||
</el-form-item>
|
>
|
||||||
<el-form-item label="单价">
|
<el-form-item label="账存数量">
|
||||||
<el-input v-model="detail.price" readonly></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 :value="profitPrice" readonly :class="{ lose: profitNumber < 0 }"
|
<el-input-number
|
||||||
style="width: 180px;"></el-input>
|
v-model="form.lpNum"
|
||||||
</el-form-item>
|
:min="0"
|
||||||
<!-- <el-form-item label="备注">
|
: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-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-form-item>
|
>确 定</el-button
|
||||||
</el-form>
|
>
|
||||||
<div class="head-container">
|
</el-form-item>
|
||||||
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe>
|
</el-form>
|
||||||
<!-- <el-table-column label="商品信息" width="150px">
|
<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">
|
<template v-slot="scope">
|
||||||
<div class="shop_info">
|
<div class="shop_info">
|
||||||
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
|
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
|
||||||
|
|
@ -42,169 +74,184 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column> -->
|
</el-table-column> -->
|
||||||
<el-table-column label="售价" prop="price">
|
<el-table-column label="售价" prop="price">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
¥{{ formatDecimal(scope.row.price) }}
|
¥{{ formatDecimal(scope.row.price) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="帐存库存" prop="stockNumber"></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="lpNum"></el-table-column>
|
||||||
<el-table-column label="盈亏金额" prop="lpAmount">
|
<el-table-column label="盈亏金额" prop="lpAmount">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
¥{{ 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
|
||||||
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
|
label="实际库存"
|
||||||
<!-- <el-table-column label="盘点备注" prop="note"></el-table-column> -->
|
prop="acStockNumber"
|
||||||
</el-table>
|
></el-table-column>
|
||||||
</div>
|
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
|
||||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]"
|
<!-- <el-table-column label="盘点备注" prop="note"></el-table-column> -->
|
||||||
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
|
</el-table>
|
||||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
</div>
|
||||||
</el-dialog>
|
<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>
|
</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,
|
||||||
size: 5,
|
size: 5,
|
||||||
total: 0,
|
total: 0,
|
||||||
loading: false,
|
loading: false,
|
||||||
list: []
|
list: []
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.resetForm = { ...this.form };
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
profitNumber() {
|
||||||
|
return formatDecimal(this.form.lpNum - this.detail.num, 2, true);
|
||||||
},
|
},
|
||||||
mounted() {
|
profitPrice() {
|
||||||
this.resetForm = { ...this.form }
|
return formatDecimal(
|
||||||
},
|
(this.form.lpNum - this.detail.num) * this.detail.price
|
||||||
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)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.lose {
|
.lose {
|
||||||
&::v-deep .el-input__inner {
|
&::v-deep .el-input__inner {
|
||||||
color: rgb(238, 29, 29);
|
color: rgb(238, 29, 29);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop_info {
|
.shop_info {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -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 = "";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue