优化商品
This commit is contained in:
parent
2150cacf1c
commit
8d7d3c8ea1
|
|
@ -1,35 +1,67 @@
|
|||
<!-- 新增耗材盘点 -->
|
||||
<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-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-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-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-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-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
|
||||
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">
|
||||
|
|
@ -54,45 +86,54 @@
|
|||
¥{{ formatDecimal(scope.row.lpAmount) }}
|
||||
</template>
|
||||
</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="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-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: '',
|
||||
detail: "",
|
||||
form: {
|
||||
conInfoId: '',
|
||||
conInfoId: "",
|
||||
lpNum: 0
|
||||
},
|
||||
rules: {
|
||||
stocktakinNum: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入盘点数量',
|
||||
trigger: 'blur'
|
||||
message: "请输入盘点数量",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
resetForm: '',
|
||||
resetForm: "",
|
||||
searhForm: {
|
||||
name: '',
|
||||
skuId: '',
|
||||
productId: ''
|
||||
name: "",
|
||||
skuId: "",
|
||||
productId: ""
|
||||
},
|
||||
tableData: {
|
||||
page: 0,
|
||||
|
|
@ -101,17 +142,19 @@ export default {
|
|||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
this.resetForm = { ...this.form };
|
||||
},
|
||||
computed: {
|
||||
profitNumber() {
|
||||
return this.form.lpNum - this.detail.num
|
||||
return formatDecimal(this.form.lpNum - this.detail.num, 2, true);
|
||||
},
|
||||
profitPrice() {
|
||||
return formatDecimal((this.form.lpNum - this.detail.num) * this.detail.price)
|
||||
return formatDecimal(
|
||||
(this.form.lpNum - this.detail.num) * this.detail.price
|
||||
);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -119,77 +162,81 @@ export default {
|
|||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
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()
|
||||
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)
|
||||
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.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.searhForm.skuId = obj.productId;
|
||||
this.searhForm.productId = obj.proId;
|
||||
|
||||
this.tableData.page = 0
|
||||
this.tableData.total = 0
|
||||
this.tableData.list = []
|
||||
this.getTableData()
|
||||
this.tableData.page = 0;
|
||||
this.tableData.total = 0;
|
||||
this.tableData.list = [];
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
this.tableData.size = e;
|
||||
this.getTableData();
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
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
|
||||
sort: "id,desc"
|
||||
});
|
||||
this.tableData.list = res.content;
|
||||
this.tableData.total = res.totalElements;
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
this.tableData.loading = false;
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -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 = "";
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue