耗材列表盘点
This commit is contained in:
@@ -13,7 +13,8 @@
|
|||||||
<el-radio-button label="custom">自定义</el-radio-button>
|
<el-radio-button label="custom">自定义</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期" :clearable="false" :default-time="['00:00:00', '23:59:59']" value-format="yyyyMMdd">
|
end-placeholder="结束日期" :clearable="false" :default-time="['00:00:00', '23:59:59']"
|
||||||
|
value-format="yyyyMMdd">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||||
@@ -49,9 +50,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="">
|
<el-table-column label="" width='120px'>
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button type="primary" @click="clicksee(scope.row)">查看</el-button>
|
<el-button type="text" @click="clicksee(scope.row)">查看</el-button>
|
||||||
|
<el-button type="text" @click="clickexport(scope.row)">导出</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -62,9 +64,9 @@
|
|||||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog title="商品销量" :visible.sync="dialogshow">
|
<el-dialog title="商品销量" :visible.sync="dialogshow">
|
||||||
<el-table :data="tableDatainfo.data" style="width: 100%">
|
<el-table :data="tableDatainfo.data" style="width: 100%;height: 500px;overflow: auto;">
|
||||||
<el-table-column prop="productName" label="商品名称"/>
|
<el-table-column prop="productName" label="商品名称" />
|
||||||
<el-table-column prop="num" label="数量"/>
|
<el-table-column prop="num" label="数量" />
|
||||||
<el-table-column prop="amount" label="金额" />
|
<el-table-column prop="amount" label="金额" />
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -73,6 +75,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { tbHandoverGet } from '@/api/homes/record.js'
|
import { tbHandoverGet } from '@/api/homes/record.js'
|
||||||
|
import XLSX from 'xlsx';
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -239,8 +242,23 @@ export default {
|
|||||||
// 查看
|
// 查看
|
||||||
clicksee(e) {
|
clicksee(e) {
|
||||||
this.dialogshow = true
|
this.dialogshow = true
|
||||||
console.log(JSON.parse(e.productInfos))
|
// console.log(JSON.parse(e.productInfos))
|
||||||
this.tableDatainfo.data = JSON.parse(e.productInfos)
|
this.tableDatainfo.data = JSON.parse(e.productInfos)
|
||||||
|
},
|
||||||
|
|
||||||
|
clickexport(e) {
|
||||||
|
const arr = JSON.parse(e.productInfos)
|
||||||
|
let data = [
|
||||||
|
['商品名称', '数量', '金额'],
|
||||||
|
]
|
||||||
|
arr.forEach(element => {
|
||||||
|
data.push([element.productName, element.num, element.amount])
|
||||||
|
});
|
||||||
|
|
||||||
|
const ws = XLSX.utils.aoa_to_sheet(data);
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
|
XLSX.writeFile(wb, 'data.xlsx');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,33 +1,36 @@
|
|||||||
<!-- 新增耗材盘点 -->
|
<!-- 耗材列表的新增耗材盘点 -->
|
||||||
<template>
|
<template>
|
||||||
<el-dialog title="耗材盘点" :visible.sync="dialogVisible" width="80%" @open="form.note = ''">
|
<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 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 v-model="form.balance" 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 style="width: 180px;"></el-input-number>
|
<el-input-number v-model="form.stocktakinNum" :min="0" :step="1" step-strictly
|
||||||
</el-form-item>
|
style="width: 180px;"></el-input-number>
|
||||||
<el-form-item label="盈亏数量">
|
</el-form-item>
|
||||||
<el-input :value="profitNumber" readonly :class="{ lose: profitNumber < 0 }" style="width: 180px;"></el-input>
|
<el-form-item label="盈亏数量">
|
||||||
</el-form-item>
|
<el-input v-model="profitNumber" readonly :class="{ lose: profitNumber < 0 }"
|
||||||
<el-form-item label="单价">
|
style="width: 180px;"></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 v-model="form.price" readonly></el-input>
|
||||||
<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="profitPrice" readonly :class="{ lose: profitNumber < 0 }"
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注" style="width: 180px;"></el-input>
|
style="width: 180px;"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item label="备注">
|
||||||
<el-button @click="dialogVisible = false; form.remark = ''">取 消</el-button>
|
<el-input v-model="form.remark" placeholder="请输入备注" style="width: 300px;"></el-input>
|
||||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item>
|
||||||
</el-form>
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
<div class="head-container">
|
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||||
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe>
|
</el-form-item>
|
||||||
<!-- <el-table-column label="商品信息" width="150px">
|
</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">
|
<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;">
|
||||||
@@ -35,183 +38,165 @@
|
|||||||
<i class="icon el-icon-document-delete"></i>
|
<i class="icon el-icon-document-delete"></i>
|
||||||
</div>
|
</div>
|
||||||
</el-image>
|
</el-image>
|
||||||
<span>{{ scope.row.name }}</span>
|
<span>{{ scope.row.conName }}</span>
|
||||||
</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) }}
|
¥{{ 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) }}
|
¥{{ 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="remark"></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="remark"></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 :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]"
|
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
|
||||||
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
|
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||||
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,
|
dialogVisible: false,
|
||||||
dialogVisible: false,
|
loading: false,
|
||||||
loading: false,
|
form: {
|
||||||
detail: "",
|
skuId: '', // sku商品必传
|
||||||
form: {
|
productId: '', // 必传
|
||||||
conInfoId: "",
|
stocktakinNum: '', // 必传
|
||||||
lpNum: 0
|
price: '', // 商品价格 非必传 为空盘点价格为商品价格
|
||||||
},
|
note: "" // 盘点备注 非必传
|
||||||
rules: {
|
},
|
||||||
stocktakinNum: [
|
rules: {
|
||||||
{
|
stocktakinNum: [
|
||||||
required: true,
|
{
|
||||||
message: "请输入盘点数量",
|
required: true,
|
||||||
trigger: "blur"
|
message: '请输入盘点数量',
|
||||||
}
|
trigger: 'blur'
|
||||||
]
|
}
|
||||||
},
|
]
|
||||||
resetForm: "",
|
},
|
||||||
searhForm: {
|
resetForm: '',
|
||||||
name: "",
|
searhForm: {
|
||||||
skuId: "",
|
name: '',
|
||||||
productId: ""
|
skuId: '',
|
||||||
},
|
productId: ''
|
||||||
tableData: {
|
},
|
||||||
page: 0,
|
tableData: {
|
||||||
size: 5,
|
page: 0,
|
||||||
total: 0,
|
size: 5,
|
||||||
loading: false,
|
total: 0,
|
||||||
list: []
|
loading: false,
|
||||||
}
|
list: []
|
||||||
};
|
}
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.resetForm = { ...this.form };
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
profitNumber() {
|
|
||||||
return formatDecimal(this.form.lpNum - this.detail.num, 2, true);
|
|
||||||
},
|
|
||||||
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,
|
|
||||||
remark: this.form.remark,
|
|
||||||
stockNumber: this.form.lpNum
|
|
||||||
});
|
|
||||||
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.form.remark = ''
|
|
||||||
this.getTableData();
|
|
||||||
} catch (error) {
|
|
||||||
this.loading = false;
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
show(obj) {
|
mounted() {
|
||||||
// console.log(obj);
|
this.resetForm = { ...this.form }
|
||||||
this.detail = { ...obj };
|
},
|
||||||
this.detail.num = formatDecimal(
|
computed: {
|
||||||
obj.stockNumber - obj.stockConsume,
|
profitNumber() {
|
||||||
2,
|
return this.form.stocktakinNum - this.form.balance
|
||||||
false
|
},
|
||||||
);
|
profitPrice() {
|
||||||
this.dialogVisible = true;
|
return formatDecimal(this.profitNumber * this.form.price && 0)
|
||||||
this.form.conInfoId = obj.id;
|
}
|
||||||
this.form.lpNum = this.detail.num;
|
},
|
||||||
|
methods: {
|
||||||
|
onSubmitHandle() {
|
||||||
|
this.$refs.form.validate(async valid => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
this.form.lpNum = this.profitNumber
|
||||||
|
this.loading = true
|
||||||
|
let res = await tbConCheck(this.form)
|
||||||
|
this.$emit('success', res)
|
||||||
|
// this.dialogVisible = false
|
||||||
|
this.loading = false
|
||||||
|
this.$notify({
|
||||||
|
title: '注意',
|
||||||
|
message: `添加成功`,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
this.getTableData()
|
||||||
|
} catch (error) {
|
||||||
|
this.loading = false
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
show(obj) {
|
||||||
|
this.form = Object.assign(this.form, obj)
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.form.conInfoId = obj.consId
|
||||||
|
this.form.stockNumber = obj.balance
|
||||||
|
|
||||||
this.searhForm.skuId = obj.productId;
|
this.searhForm.skuId = obj.productId
|
||||||
this.searhForm.productId = obj.proId;
|
this.searhForm.productId = obj.consId
|
||||||
|
this.getTableData()
|
||||||
this.tableData.page = 0;
|
},
|
||||||
this.tableData.total = 0;
|
// 分页大小改变
|
||||||
this.tableData.list = [];
|
sizeChange(e) {
|
||||||
this.getTableData();
|
this.tableData.size = e
|
||||||
},
|
this.getTableData()
|
||||||
// 分页大小改变
|
},
|
||||||
sizeChange(e) {
|
// 分页回调
|
||||||
this.tableData.size = e;
|
paginationChange(e) {
|
||||||
this.getTableData();
|
this.tableData.page = e - 1
|
||||||
},
|
this.getTableData()
|
||||||
// 分页回调
|
},
|
||||||
paginationChange(e) {
|
// 商品列表
|
||||||
this.tableData.page = e - 1;
|
async getTableData() {
|
||||||
this.getTableData();
|
try {
|
||||||
},
|
this.tableData.loading = true
|
||||||
// 商品列表
|
const res = await tbConCheckGet({
|
||||||
async getTableData() {
|
page: this.tableData.page,
|
||||||
try {
|
size: this.tableData.size,
|
||||||
this.tableData.loading = true;
|
name: this.searhForm.name,
|
||||||
const res = await tbConCheckGet({
|
skuId: this.searhForm.category,
|
||||||
page: this.tableData.page,
|
productId: this.searhForm.productId,
|
||||||
size: this.tableData.size,
|
sort: 'id,desc',
|
||||||
conInfoId: this.form.conInfoId,
|
})
|
||||||
sort: "id,desc"
|
this.tableData.list = res.content
|
||||||
});
|
this.tableData.total = res.totalElements
|
||||||
this.tableData.list = res.content;
|
setTimeout(() => {
|
||||||
this.tableData.total = res.totalElements;
|
this.tableData.loading = false
|
||||||
setTimeout(() => {
|
}, 500);
|
||||||
this.tableData.loading = false;
|
} catch (error) {
|
||||||
}, 500);
|
console.log(error)
|
||||||
} 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>
|
||||||
@@ -29,6 +29,11 @@
|
|||||||
<el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
|
<el-option :label="item.label" :value="item.value" v-for="item in typeEnums" :key="item.label" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="width: 300px;">
|
||||||
|
<el-select clearable v-model="query.sort" placeholder="排序">
|
||||||
|
<el-option label="按数量排序" value="balance,desc" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||||
<el-button @click="resetHandle">重置</el-button>
|
<el-button @click="resetHandle">重置</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,17 +53,13 @@
|
|||||||
<div class="head-container" id="table_drag">
|
<div class="head-container" id="table_drag">
|
||||||
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
|
||||||
<!-- <el-table-column prop="id" label="ID" width="50px" /> -->
|
<!-- <el-table-column prop="id" label="ID" width="50px" /> -->
|
||||||
<el-table-column label="耗材名称" prop="conName" />
|
<el-table-column label="耗材名称" prop="conName" align="center" />
|
||||||
<el-table-column label="耗材代码" prop="conCode" />
|
<!-- <el-table-column label="耗材代码" prop="conCode" /> -->
|
||||||
<el-table-column label="分类名称" prop="conTypeName" />
|
<el-table-column label="分类名称" prop="conTypeName" align="center" />
|
||||||
<el-table-column label="单位" prop="conUnit" />
|
<el-table-column label="单位" prop="conUnit" align="center" />
|
||||||
<el-table-column label="创建时间" prop="createTime" width="200">
|
|
||||||
<template v-slot="scope">
|
|
||||||
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="现有库存">
|
|
||||||
|
<el-table-column label="现有库存" align="center">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<span :class="[computedClass(scope.row.balance)]"> {{ scope.row.balance }}</span>
|
<span :class="[computedClass(scope.row.balance)]"> {{ scope.row.balance }}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -80,30 +81,41 @@
|
|||||||
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
|
<!-- <el-table-column label="正负号标识" prop="bizType" /> -->
|
||||||
<!-- <el-table-column label="耗材id" prop="consId" /> -->
|
<!-- <el-table-column label="耗材id" prop="consId" /> -->
|
||||||
<!-- <el-table-column label="创建时间" prop="createTime"></el-table-column> -->
|
<!-- <el-table-column label="创建时间" prop="createTime"></el-table-column> -->
|
||||||
<el-table-column label="所属商品" width="320" align="center">
|
<!-- <el-table-column label="所属商品" width="320" align="center">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<!-- <el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
|
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
|
||||||
item.productName }}</el-button> -->
|
item.productName }}</el-button>
|
||||||
{{ scope.row.productId }}
|
{{ scope.row.productId }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
|
<el-table-column label="所属商品" width="320" align="center">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button v-for="(item) in scope.row.product" @click="toGoods(item)" :key="item.productId" type="text">{{
|
||||||
|
item.productName }}</el-button>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<!-- <el-table-column label="最近入库量" prop="lasterInStock" /> -->
|
<!-- <el-table-column label="最近入库量" prop="lasterInStock" /> -->
|
||||||
<el-table-column label="库存数量" prop="stockNumber">
|
<el-table-column label="库存数量" align="center" prop="stockNumber">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ (scope.row.balance).toFixed(2) }}
|
{{ (scope.row.balance).toFixed(2) }}
|
||||||
<!-- {{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }} -->
|
<!-- {{ (scope.row.stockNumber - scope.row.stockConsume).toFixed(2) }} -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="预警值" prop="conWarning" />
|
<el-table-column label="预警值" align="center" prop="conWarning" />
|
||||||
<!-- <el-table-column label="单位耗材值" prop="surplusStock" /> -->
|
<!-- <el-table-column label="单位耗材值" prop="surplusStock" /> -->
|
||||||
<!-- <el-table-column label="排序" prop="sort" sortable /> -->
|
<!-- <el-table-column label="排序" prop="sort" sortable /> -->
|
||||||
<el-table-column label="更新时间" prop="updateTime" width="200">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
||||||
<!-- <template v-slot="scope">
|
<!-- <template v-slot="scope">
|
||||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
{{ dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
|
||||||
</template> -->
|
</template> -->
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<!-- <el-table-column label="更新时间" prop="updateTime" width="200"> -->
|
||||||
|
<!-- <template v-slot="scope">
|
||||||
|
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
</template> -->
|
||||||
|
<!-- </el-table-column> -->
|
||||||
<el-table-column label="操作" width="250" fixed="right">
|
<el-table-column label="操作" width="250" fixed="right">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button type="text" @click="editorHandle(scope.row)">编辑</el-button>
|
<el-button type="text" @click="editorHandle(scope.row)">编辑</el-button>
|
||||||
@@ -528,6 +540,15 @@ export default {
|
|||||||
this.$message({ type: "error", message: "至少保留一种耗材" });
|
this.$message({ type: "error", message: "至少保留一种耗材" });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
toGoods(data) {
|
||||||
|
|
||||||
|
this.$router.push({
|
||||||
|
path: '/product/product',
|
||||||
|
query: {
|
||||||
|
productId: data.productId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
//添加耗材弹窗增加
|
//添加耗材弹窗增加
|
||||||
ruleFormsAdd() {
|
ruleFormsAdd() {
|
||||||
console.log('add')
|
console.log('add')
|
||||||
@@ -612,9 +633,24 @@ export default {
|
|||||||
shopId: localStorage.getItem("shopId")
|
shopId: localStorage.getItem("shopId")
|
||||||
});
|
});
|
||||||
this.tableData.loading = false;
|
this.tableData.loading = false;
|
||||||
this.tableData.data = res.content;
|
// this.tableData.data = res.content;
|
||||||
this.tableData.total = res.totalElements;
|
this.tableData.total = res.totalElements;
|
||||||
|
|
||||||
|
this.tableData.data = res.content.map(v => {
|
||||||
|
const productIds = v.productId ? v.productId.split(',') : []
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
product: productIds.map((str, index) => {
|
||||||
|
const startIndex = str.indexOf('_')
|
||||||
|
const productId = str.slice(0, startIndex)
|
||||||
|
const productName = str.slice(startIndex + 1, str.length)
|
||||||
|
return {
|
||||||
|
productId,
|
||||||
|
productName: productName + `${(index == productIds.length - 1) ? '' : ','}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,10 +33,23 @@
|
|||||||
<el-radio :label="0">禁用</el-radio>
|
<el-radio :label="0">禁用</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="" v-if="form.useTime == 1" prop="saleTime">
|
<el-form-item label="" v-if="form.useTime == 1">
|
||||||
<el-time-picker is-range v-model="form.saleTime" value-format="HH:mm" format="HH:mm"
|
<!-- <el-time-picker is-range v-model="form.saleTime" value-format="HH:mm" format="HH:mm"
|
||||||
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围">
|
:picker-options="pickerOptions" range-separator="至" start-placeholder="开始时间"
|
||||||
|
end-placeholder="结束时间" placeholder="选择时间范围">
|
||||||
|
</el-time-picker> -->
|
||||||
|
|
||||||
|
<el-time-picker placeholder="起始时间" v-model="form.saleStartTime" :picker-options="{
|
||||||
|
selectableRange: '00:00:00 - 23:59:59',
|
||||||
|
format: 'HH:mm'
|
||||||
|
}" format="HH:mm" value-format="HH:mm">
|
||||||
</el-time-picker>
|
</el-time-picker>
|
||||||
|
<el-time-picker placeholder="结束时间" v-model="form.saleEndTime" :picker-options="{
|
||||||
|
selectableRange: '00:00:00 - 23:59:59',
|
||||||
|
}" format="HH:mm" value-format="HH:mm">
|
||||||
|
</el-time-picker>
|
||||||
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分组排序" v-if="form.id">
|
<el-form-item label="分组排序" v-if="form.id">
|
||||||
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
|
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
|
||||||
@@ -44,7 +57,7 @@
|
|||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button @click="quxiaodialogVisible">取 消</el-button>
|
||||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -73,6 +86,15 @@ export default {
|
|||||||
useTime: 0,
|
useTime: 0,
|
||||||
shopId: localStorage.getItem('shopId')
|
shopId: localStorage.getItem('shopId')
|
||||||
},
|
},
|
||||||
|
pickerOptions: {
|
||||||
|
selectableRange: '00:00:00 - 23:59:59'
|
||||||
|
// disabledDate(time) {
|
||||||
|
// // return time.getTime() < Date.now() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的
|
||||||
|
// // return time.getTime() < Date.now(); //只可以选择今天之后
|
||||||
|
// return time.getTime() < Date.now() - 8.64e7;//只可以选择今天之后包括今天
|
||||||
|
|
||||||
|
// }
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{
|
{
|
||||||
@@ -93,6 +115,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
quxiaodialogVisible() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$emit('success', null)
|
||||||
|
|
||||||
|
},
|
||||||
slectShop(res) {
|
slectShop(res) {
|
||||||
if (this.productIds.length) {
|
if (this.productIds.length) {
|
||||||
res.map(async item => {
|
res.map(async item => {
|
||||||
@@ -115,14 +142,12 @@ export default {
|
|||||||
return falg
|
return falg
|
||||||
},
|
},
|
||||||
onSubmitHandle() {
|
onSubmitHandle() {
|
||||||
console.log(this.form.saleTime)
|
|
||||||
this.$refs.form.validate(async valid => {
|
this.$refs.form.validate(async valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
this.form.productIds = this.productIds.map(item => item.id);
|
this.form.productIds = this.productIds.map(item => item.id);
|
||||||
this.form.saleStartTime = this.form.saleTime[0]
|
|
||||||
this.form.saleEndTime = this.form.saleTime[1]
|
|
||||||
let res = null
|
let res = null
|
||||||
if (!this.form.id) {
|
if (!this.form.id) {
|
||||||
await tbProductGroupPost(this.form)
|
await tbProductGroupPost(this.form)
|
||||||
@@ -152,6 +177,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
show(obj) {
|
show(obj) {
|
||||||
|
// if()
|
||||||
|
this.form.useTime = 0
|
||||||
if (obj && obj.id) {
|
if (obj && obj.id) {
|
||||||
this.form = obj
|
this.form = obj
|
||||||
this.form.id = obj.id
|
this.form.id = obj.id
|
||||||
@@ -159,12 +186,11 @@ export default {
|
|||||||
this.form.name = obj.name
|
this.form.name = obj.name
|
||||||
this.form.sort = obj.sort
|
this.form.sort = obj.sort
|
||||||
this.form.productIds = obj.productIds
|
this.form.productIds = obj.productIds
|
||||||
if (obj.saleStartTime != null) {
|
// if (obj.saleStartTime != null) {
|
||||||
this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
|
// this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
|
||||||
}
|
// }
|
||||||
this.getProduts()
|
this.getProduts()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
|||||||
@@ -12,7 +12,12 @@
|
|||||||
<el-table-column label="分组名称" prop="name"></el-table-column>
|
<el-table-column label="分组名称" prop="name"></el-table-column>
|
||||||
<el-table-column label="售卖时间管控" prop="useTime">
|
<el-table-column label="售卖时间管控" prop="useTime">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ scope.row.useTime==1? scope.row.saleStartTime +'-'+scope.row.saleEndTime:'' }}
|
<template v-if="scope.row.useTime == 1">
|
||||||
|
|
||||||
|
<!-- {{ scope.row.saleStartTime + '-' + (scope.row.saleEndTime) }} -->
|
||||||
|
{{ saleEndTimeFilter(scope.row.saleStartTime, scope.row.saleEndTime) }}
|
||||||
|
<!-- {{ new Date(scope.row.saleEndTime+'').getTime() }} -->
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态">
|
<el-table-column label="状态">
|
||||||
@@ -66,8 +71,22 @@ export default {
|
|||||||
this.tableDrag()
|
this.tableDrag()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
saleEndTimeFilter: (a, b) => {
|
||||||
|
|
||||||
|
var currentDate = new Date(); // 当前日期对象
|
||||||
|
var dateString = currentDate.toDateString(); // 获取当前日期的字符串表示(不包含时分秒)
|
||||||
|
var dateTimeString = dateString + ' ' + a; // 拼接日期和时分秒字符串
|
||||||
|
var dateTimeStringb = dateString + ' ' + b; // 拼接日期和时分秒字符串
|
||||||
|
var timestamp = Date.parse(dateTimeString); // 将日期时间字符串转换为时间戳
|
||||||
|
var timestamp2 = Date.parse(dateTimeStringb); // 将日期时间字符串转换为时间戳
|
||||||
|
let ciri = timestamp > timestamp2 ? '次日' : ''
|
||||||
|
return a + ' - ' + ciri + b
|
||||||
|
},
|
||||||
//表格拖拽
|
//表格拖拽
|
||||||
tableDrag() {
|
tableDrag() {
|
||||||
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
|
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
console.log(this.$route.query.productId,'tiaoshi1')
|
||||||
if (this.$route.query.productId) {
|
if (this.$route.query.productId) {
|
||||||
this.query.productId = this.$route.query.productId
|
this.query.productId = this.$route.query.productId
|
||||||
}
|
}
|
||||||
@@ -206,11 +207,11 @@ export default {
|
|||||||
try {
|
try {
|
||||||
let localQuery = JSON.parse(localStorage.getItem('shopIndexQuery'))
|
let localQuery = JSON.parse(localStorage.getItem('shopIndexQuery'))
|
||||||
if (localQuery != null && localQuery.hasOwnProperty('productId')) {
|
if (localQuery != null && localQuery.hasOwnProperty('productId')) {
|
||||||
this.query = localQuery
|
// this.query = localQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tableData.loading = true
|
this.tableData.loading = true
|
||||||
console.log(this.query)
|
console.log(this.query,'调试2')
|
||||||
const res = await tbProduct({
|
const res = await tbProduct({
|
||||||
page: this.tableData.page,
|
page: this.tableData.page,
|
||||||
size: this.tableData.size,
|
size: this.tableData.size,
|
||||||
|
|||||||
Reference in New Issue
Block a user