This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-31 08:54:40 +08:00
parent 189d0533ee
commit 70b1a6d39a
5 changed files with 1886 additions and 0 deletions

View File

@ -0,0 +1,88 @@
import request from '@/utils/request'
/**
* 订单
*/
export function getDamagePageApi(query) {
return request({
url: '/business/convenience/mtDamage/getListByPage',
method: 'get',
params: query
})
}
// 新增
export function addDamageApi(data) {
return request({
url: '/business/convenience/mtDamage',
method: 'post',
data: data
})
}
// 修改
export function editDamageApi(data) {
return request({
url: '/business/convenience/mtDamage',
method: 'put',
data: data
})
}
/**
* 订单详情
*/
export function getDamageDetailsPageApi(query) {
return request({
url: '/business/convenience/mtDamageDetails/getListByPage',
method: 'get',
params: query
})
}
export function delDetailsApi(query) {
return request({
url: '/business/convenience/mtDamageDetails',
method: 'delete',
params: query
})
}
export function batchProcessingApi(data) {
return request({
url: '/business/convenience/mtDamageDetails/batchProcessing',
method: 'post',
data: data
})
}
// 审核
export function auditDamageApi(data) {
return request({
url: 'business/convenience/mtDamage/audit',
method: 'get',
params: data
})
}
// 入库
export function storageDamageApi(data) {
return request({
url: 'business/convenience/mtDamage/storage',
method: 'get',
params: data
})
}
// 作废
export function abolitionDamageApi(data) {
return request({
url: 'business/convenience/mtDamage/abolition',
method: 'get',
params: data
})
}

View File

@ -0,0 +1,661 @@
<template>
<div class="app-container">
<el-card >
<div slot="header" class="clearfix">
<i class="el-icon-back" @click="goToAbout">返回 | </i>
<!-- <el-link icon="el-icon-edit" :underline="false" @click="goToAbout">编辑</el-link>-->
<span> 退货详情</span>
</div>
<div style="height: 90px; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 50%; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 70%; display: flex; justify-content: space-between;">
<div class="box">
<span>{{damageForm.totalAmount}}</span>
<span>报损总额</span>
</div>
<div class="box">
<span>{{damageForm.productQuantity}}</span>
<span>商品数量</span>
</div>
<div class="box">
<span>{{damageForm.damageQuantity}}</span>
<span>报损数量</span>
</div>
</div>
<div style="height: 100%; width: 30%; display: flex; flex-direction: column; justify-content: space-between;">
<el-form ref="myForm" label-width="100px">
<el-form-item label="报损单号">
<el-input v-model="damageForm.orderNumber"
:disabled="numberInput"
style="width: 220Px">
<el-button slot="append" @click="refresh()" icon="el-icon-refresh"></el-button>
</el-input>
</el-form-item>
<el-form-item label="报损时间" >
<el-date-picker
:disabled="numberInput"
style="width: 220Px"
v-model="damageForm.orderDate"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-form>
</div>
</div>
<div style="height: 100%; width: 30%; display: flex; align-items: center; justify-content: flex-end;">
<el-button type="primary" v-if="state=='await'" :disabled="saveFlag" @click="save()">保存</el-button>
<el-button type="success" v-if="state=='await'" :disabled="auditFlag" @click="audit()">保存并审核</el-button>
<el-button type="success" v-if="state=='ysh'" :disabled="storageFlag" @click="storage">退货处理库存</el-button>
<el-button type="warning" v-if="state =='await' || state=='ysh'" :disabled="voidFlag" @click="abolition()">作废</el-button>
</div>
</div>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="commodityAdd"
>添加报损商品</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="detailsList"
:default-sort="defaultSort">
<el-table-column label="商品名称" align="center" prop="commodityName"/>
<el-table-column label="分类名称" prop="cvsGoodId" align="center">
<template slot-scope="scope">
<span>{{ getName(cvsGoodList, scope.row.cvsGoodId) }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" prop="supplierId" align="center">
<template slot-scope="scope">
<span>{{ getName(supplierList, scope.row.supplierId) }}</span>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unit">
<template slot-scope="scope">
<span>{{ scope.row.unit == null?"-":scope.row.unit}}</span>
</template>
</el-table-column>
<el-table-column label="库存" align="center" prop="preInboundInventory"/>
<el-table-column label="报损数量" align="center" prop="damageQuantity">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.damageQuantity" @change="change(scope.row,1)" controls-position="right" :min="1" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="当前加权均进价" align="center" prop="weightedAverageCost"/>
<el-table-column label="小计金额" align="center" prop="subtotalAmount"/>
<el-table-column v-if="state =='await' || state=='ysh'" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="commodityDel(scope.row)"
>删除</el-button>
</template>
<!-- v-hasPermi="['']"-->
</el-table-column>
</el-table>
<!-- <pagination-->
<!-- v-show="total>0"-->
<!-- :total="total"-->
<!-- :page.sync="queryParams.page"-->
<!-- :limit.sync="queryParams.pageSize"-->
<!-- @pagination="getList"-->
<!-- />-->
</el-card>
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false">
<el-container>
<el-header style="">
<el-form ref="tankForm" :model="commodityForm" label-width="80px">
<el-row :gutter="24">
<el-col :span="6">
<el-form-item label="商品分类">
<el-select
v-model="commodityForm.cvsGoodId"
placeholder="全部"
clearable
>
<el-option v-for="item in cvsGoodList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="commodityForm.supplierId"
placeholder="全部"
clearable
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="详细信息">
<el-input v-model="commodityForm.detailed" placeholder="商品名称,拼音码,条形码等信息" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button type="primary" @click="inquire()">查询</el-button>
</el-col>
</el-row>
</el-form>
</el-header>
<el-main>
<el-table ref="tables"
v-loading="loading"
:data="commodityList"
@selection-change="handleSelectionChange"
border
:default-sort="defaultSort">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="商品名称" align="center" prop="name"/>
<el-table-column label="商品编码" align="center" prop="goodsNo"/>
<el-table-column label="分类名称" prop="cvsGoodId" align="center">
<template slot-scope="scope">
<span>{{ getName(cvsGoodList, scope.row.cvsGoodId) }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" prop="supplierId" align="center">
<template slot-scope="scope">
<span>{{ getName(supplierList, scope.row.supplierId) }}</span>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="当前库存" align="center" prop="stock"/>
</el-table>
</el-main>
</el-container>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="addCommodity"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getAuditPremApi} from "@/api/oilConfig/staff";
import {BigNumber} from "bignumber.js";
import {listLJGoods} from "@/api/convenienceStore/ljgoods";
import {getName,parseTime} from "../../../utils/fuint";
import {selectParentById, selectTree} from "@/api/convenienceStore/goods";
import {listSupplier} from "@/api/convenienceStore/supplier";
import {
getDamageDetailsPageApi,
delDetailsApi,
editDamageApi,
addDamageApi,
batchProcessingApi,
auditDamageApi,
storageDamageApi,
abolitionDamageApi
} from "@/api/convenienceStore/damage";
export default {
name: "details",
props:[
'PdamageId',
'PorderNumber',
'PorderDate',
'PapprovalStatus'
],
data() {
return {
detailsList: [],
commodityList: [],
damageId:null,
commodityForm:{
cvsGoodId: "",
cvsGood: "",
supplierId: "",
supplier: "",
detailed: "",
page: 1,
pageSize: 10,
isRecovery:0,
},
damageForm: {
orderNumber: null,
approvalStatus: "",
orderDate: null,
totalAmount: 0, //
productQuantity: 0, //
damageQuantity: 0 //
} ,
//
cvsGoodList:[],
//
supplierList:[],
state:'await',
saveFlag:false,
auditFlag:true,
voidFlag:true,
storageFlag:true,
multipleSelection:[], //
//
title:'选择商品',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
// supplierId: '',
damageId: null,
page:null,
pageSize:null
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
rules: {
supplierName: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
],
},
}
},
async created() {
this.damageForm.damageId = this.$props.PdamageId
this.damageId = this.$props.PdamageId
this.queryParams.damageId = this.$props.PdamageId
this.damageForm.orderNumber = this.$props.PorderNumber
this.damageForm.orderDate = this.$props.PorderDate
this.damageForm.approvalStatus = this.$props.PapprovalStatus
this.state = this.$props.PapprovalStatus
if ( this.state == null) {
this.state = 'await'
}
if (this.state=='await') {
this.numberInput = false
}else {
this.numberInput = true
}
console.log("this.damageForm",this.damageForm)
if (this.damageForm.orderNumber == null) {
this.refresh();
}
if (this.damageForm.orderDate == null) {
this.damageForm.orderDate =new Date()
}
this.getDetailsList();
this.getQueryList();
this.JudgmentButton();
},
methods: {
getDetailsList() {
let this_ = this
getDamageDetailsPageApi(this.queryParams).then(res=>{
this_.detailsList = res.data.records;
this.total = res.data.total;
this.sumMethod(res.data.records);
})
},
getCommodityList() {
let this_ = this
listLJGoods(this_.commodityForm).then(res=>{
this_.commodityList = res.data.records;
this_.sumMethod(res.data.records);
// this.total = response.data.total;
})
},
//
goToAbout() {
this.$router.push('/convenienceStore/damage/index');
},
commodityAdd() {
this.open = true;
},
commodityDel(data) {
if (data.id != null) {
delDetailsApi(data).then(res=>{
})
}
const index = this.detailsList.indexOf(data); //
if (index !== -1) {
this.detailsList.splice(index, 1); // 使splice
}
},
//
inquire() {
this.getCommodityList();
},
//
change(data,flag) {
let damageQuantity = new BigNumber(data.damageQuantity);
let weightedAverageCost = new BigNumber(data.weightedAverageCost);
let subtotalAmount = damageQuantity.times(weightedAverageCost);
data.subtotalAmount = subtotalAmount.toNumber();
// let damageQuantity = new BigNumber( data.damageQuantity);
// let weightedAverageCost = new BigNumber( data.weightedAverageCost);
// let subtotalAmount = new BigNumber(0);
// data.subtotalAmount = damageQuantity.times(weightedAverageCost)
// let subtotalAmount = damageQuantity.times(weightedAverageCost)
// console.log("this.detailsList",subtotalAmount)
// data.subtotalAmount = subtotalAmount
this.sumMethod(this.detailsList);
// console.log("this.detailsList",this.detailsList)
//
// this.detailsList = data
// this.edit()
},
// header
sumMethod(data) {
let this_ = this
// if (data.length>0) {
// this_.damageForm.totalAmount = data.length
// } else {
// this_.damageForm.totalAmount = 0
// }
console.log("qqqqqqqqqqq",data)
this.damageForm.productQuantity = data.length,
this_.damageForm.totalAmount = new BigNumber(0),
this_.damageForm.damageQuantity = new BigNumber(0),
data.forEach(da => {
if (da.damageQuantity != null) {
this_.damageForm.damageQuantity= this_.damageForm.damageQuantity.plus(da.damageQuantity)
}
if (da.subtotalAmount != null) {
this_.damageForm.totalAmount= this_.damageForm.totalAmount.plus(da.subtotalAmount)
}
})
},
addCommodity () {
let this_ = this
this.multipleSelection.forEach(mul=>{
let now = {
goodsId: mul.id,
commodityName: mul.name,
supplierId: mul.supplierId,
cvsGoodId: mul.cvsGoodId,
unit:mul.unit,
preInboundInventory:mul.stock,
damageQuantity: 1,
weightedAverageCost: mul.buyingPrice,
subtotalAmount: mul.buyingPrice
}
this_.detailsList.push(now)
})
this_.open = false
this_.sumMethod(this_.detailsList);
},
//
getQueryList(){
selectTree().then(response => {
this.cvsGoodList = response.data.records
});
listSupplier().then(response => {
this.supplierList = response.data.records
})
},
cancel() {
this.open = false;
},
//
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
refresh() {
let timestamp = new Date().getTime();
let min = 100; // 1000
let max = 999; // 9999
let randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
this.damageForm.orderNumber = timestamp+randomFourDigitNumber.toString();
},
//
async JudgmentButton(){
let judgmentPermissions1 = await this.judgmentPermissions("退货审核");
if (judgmentPermissions1 > 0){
this.auditFlag=false,
this.voidFlag=false
}
let judgmentPermissions2 = await this.judgmentPermissions("退货出库");
if (judgmentPermissions2 > 0){
this.storageFlag = false
}
let judgmentPermissions3 = await this.judgmentPermissions("退货废止");
if (judgmentPermissions3 > 0){
this.voidFlag=false
}else {
this.voidFlag=true
}
},
//
async judgmentPermissions(data) {
let fil ={
auditPrem:data
}
return await getAuditPremApi(fil).then(res => {
return res.data
});
},
async save(flag){
let this_ = this
//
if (this_.damageForm.orderNumber == null) {
this.$modal.msgError("退货单号不能为空");
return -1;
}else if (this_.damageForm.orderDate == null) {
this.$modal.msgError("退货时间不能为空");
return -1;
}else if(this_.detailsList.length<=0) {
this.$modal.msgError("退货单不能为空");
return -1;
}
if (this_.damageId == null) {
//
this_.damageForm.approvalStatus = 'await'
await addDamageApi(this_.damageForm).then(res=>{
this_.damageId = res.data.id
this.queryParams.damageId = res.data.id
}).catch(res=>{
this.$modal.msgError("保存失败");
return;
})
}else {
//
this_.damageForm.id = this_.damageId
this.queryParams.damageId = this_.damageId
await editDamageApi(this_.damageForm).then(res=> {
}).catch(res=>{
this.$modal.msgError("保存失败");
return;
})
}
//
this_.detailsList.forEach(data=>{
data.damageId = this_.damageId
})
await batchProcessingApi(this_.detailsList).then(res=>{
this.$modal.msgSuccess("保存成功");
if (flag != -1) {
this.goToAbout();
}
}).catch(res=>{
this.$modal.msgError("保存失败");
})
},
//
async audit(){
//
let number = await this.save(-1);
if (number != -1) {
//
let fil ={
id: this.damageId
}
console.log(" id: this.damageId",fil)
await auditDamageApi(fil).then(res => {
if (res.data) {
this.state = 'ysh'
this.$modal.msgWarning("审核成功");
}else {
this.$modal.msgWarning("暂无审核权限");
}
this.goToAbout()
})
}
},
//
storage() {
let this_ = this;
//
if (this_.damageForm.orderNumber == null) {damageIde/Damage
this.$modal.msgError("退货单号不能为空");
return -1;
}else if (this_.damageForm.orderDate == null) {
this.$modal.msgError("退货时间不能为空");
return -1;
}else if(this_.detailsList.length<=0) {
this.$modal.msgError("退货单不能为空");
return -1;
}
this.$confirm('确认后盘点中的对应油品入库油罐库存将发生变化,且不可逆,确认已按照盘点数量入库吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
let fil ={
id: this.damageId
}
storageDamageApi(fil).then(res => {
this.state = 'qrts'
this.$modal.msgWarning("入库成功");
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
//
abolition(){
if (this.damageId < 0) {
this.$modal.msgWarning("数据未保存,不可废弃");
return;
}
this.$confirm('确定要废弃盘点好的数据吗', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let fil ={
id: this.damageId
}
abolitionDamageApi(fil).then(res => {
if (res.data) {
this.state = 'yzf'
this.$modal.msgWarning("作废成功");
this.goToAbout()
} else {
this.$modal.msgWarning("暂无作废权限");
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
},
}
}
</script>
<style scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
.box {
height: 100%;
width: 50%;
margin-right: 10px;
background-color: rgba(204, 204, 204, 0.3);
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
</style>

View File

@ -0,0 +1,221 @@
<template>
<div class="app-container">
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="业务单号" prop="orderNumber">
<el-input v-model="queryParams.orderNumber" placeholder="请输入业务单号" />
</el-form-item>
<el-form-item label="供应商" v-model="queryParams.supplierId" prop="status">
<el-select
v-model="queryParams.supplierId"
placeholder="全部"
clearable
style="width: 230px"
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="状态" v-model="queryParams.approvalStatus" prop="status">
<el-select v-model="queryParams.approvalStatus" placeholder="请选择状态" style="150px">
<el-option
v-for="dict in dict.type.oilPurchasedStatus"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="日期选择" prop="status">
<el-date-picker
v-model="queryParams.dateRange"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="detailsAdd"
>新增报损单</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="damageList"
:default-sort="defaultSort">
<el-table-column label="业务单号" align="center" prop="orderNumber"/>
<el-table-column label="供应商" align="center" prop="supplierName"/>
<el-table-column label="报损数量" align="center" prop="damageQuantity"/>
<el-table-column label="合计金额" align="center" prop="totalAmount"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag v-if ="scope.row.approvalStatus == 'await'" size="medium">待审核</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'qrts'" type="success" size="medium">已审核入库</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'yzf'" type="danger" size="medium">已作废</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'ysh'" type="danger" size="medium">已审核</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="制单人" align="center" prop="createByName"/>
<el-table-column label="制单日期" align="center" prop="orderDate" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderDate) }}</span>
</template>
</el-table-column>
<el-table-column label="审核人" align="center" prop="approverName"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="dispose(scope.row)"
>处理单据</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import {getDamagePageApi} from "@/api/convenienceStore/damage";
import {listSupplier} from "@/api/convenienceStore/supplier";
export default {
name: "index",
dicts: ['oilPurchasedStatus'],
data() {
return {
damageList:[],
//
supplierList:[],
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
orderNumber: "",
approvalStatus: "",
status: '',
supplierId: '',
dateRange: '',
page: null,
pageSize: null,
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
}
},
async created() {
await this.getList();
this.getQueryList();
},
methods: {
//
getList(){
this.loading = true;
getDamagePageApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.damageList = response.data.records;
this.total = response.data.total;
})
this.loading = false;
},
//
getQueryList(){
listSupplier().then(response => {
this.supplierList = response.data.records
})
},
detailsAdd() {
this.$router.push({
name: 'damage-details'
});
},
//
dispose(data) {
this.$router.push({
name: 'damage-details',
params: {
PdamageId: data.id,
PorderNumber: data.orderNumber,
PorderDate: data.orderDate,
PapprovalStatus: data.approvalStatus
},
});
},
//
resetQuery() {
this.queryParams = {}
},
//
handleDel(data) {
delDamageApi(data).then(response => {
this.$modal.msgSuccess("删除成功");
this.getList();
})
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
}
}
</script>
<style scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
</style>

View File

@ -0,0 +1,641 @@
<template>
<div class="app-container">
<el-card >
<div slot="header" class="clearfix">
<i class="el-icon-back" @click="goToAbout">返回 | </i>
<!-- <el-link icon="el-icon-edit" :underline="false" @click="goToAbout">编辑</el-link>-->
<span> 退货详情</span>
</div>
<div style="height: 90px; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 40%; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 60%; display: flex; justify-content: space-between;">
<div class="box">
<span>{{inventoryForm.productQuantity}}</span>
<span>商品数量</span>
</div>
<div class="box">
<span>{{inventoryForm.inventoryQuantity}}</span>
<span>盘点数量</span>
</div>
</div>
<table class="container1">
<tr>
<td>制单人</td>
<td style="width: 10px;"> </td>
<td style=""><span class="underlined-text" >{{inventoryForm.creataByName}}</span></td>
</tr>
<tr>
<td>制单时间</td>
<td> </td>
<td><span class="underlined-text">{{parseTime(inventoryForm.orderDate)}}</span></td>
</tr>
<tr>
<td>盘点编号</td>
<td> </td>
<td><span class="underlined-text">{{inventoryForm.orderNumber}}</span></td>
</tr>
</table>
</div>
<div style="height: 100%; width: 30%; display: flex; align-items: center; justify-content: flex-end;">
<el-button type="primary" v-if="state=='await'" :disabled="saveFlag" @click="save()">保存</el-button>
<el-button type="success" v-if="state=='await'" :disabled="auditFlag" @click="audit()">生成差异单</el-button>
<el-button type="success" v-if="state=='ysh'" :disabled="storageFlag" @click="storage">退货处理库存</el-button>
<el-button type="warning" v-if="state =='await' || state=='ysh'" :disabled="voidFlag" @click="abolition()">作废</el-button>
</div>
</div>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="commodityAdd"
>添加盘点</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="detailsList"
:default-sort="defaultSort">
<el-table-column label="商品名称" align="center" prop="commodityName"/>
<el-table-column label="商品编码" align="center" prop="goodsNo"/>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="当前均进价" align="center" prop="purchasePrice"/>
<el-table-column label="库存数量" align="center" prop="stock"/>
<el-table-column label="盘点数量" align="center" prop="inventoryQuantity">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.inventoryQuantity" @change="change(scope.row,2)" controls-position="right" :min="1" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column v-if="state =='await' || state=='ysh'" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="commodityDel(scope.row)"
>删除</el-button>
</template>
<!-- v-hasPermi="['']"-->
</el-table-column>
</el-table>
<!-- <pagination-->
<!-- v-show="total>0"-->
<!-- :total="total"-->
<!-- :page.sync="queryParams.page"-->
<!-- :limit.sync="queryParams.pageSize"-->
<!-- @pagination="getList"-->
<!-- />-->
</el-card>
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false">
<el-container>
<el-header style="">
<el-form ref="tankForm" :model="commodityForm" label-width="80px">
<el-row :gutter="24">
<el-col :span="6">
<el-form-item label="商品分类">
<el-select
v-model="commodityForm.cvsGoodId"
placeholder="全部"
clearable
>
<el-option v-for="item in cvsGoodList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="commodityForm.supplierId"
placeholder="全部"
clearable
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="详细信息">
<el-input v-model="commodityForm.detailed" placeholder="商品名称,拼音码,条形码等信息" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button type="primary" @click="inquire()">查询</el-button>
</el-col>
</el-row>
</el-form>
</el-header>
<el-main>
<el-table ref="tables"
v-loading="loading"
:data="commodityList"
@selection-change="handleSelectionChange"
border
:default-sort="defaultSort">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="商品名称" align="center" prop="name"/>
<el-table-column label="商品编码" align="center" prop="goodsNo"/>
<el-table-column label="分类名称" prop="cvsGoodId" align="center">
<template slot-scope="scope">
<span>{{ getName(cvsGoodList, scope.row.cvsGoodId) }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" prop="supplierId" align="center">
<template slot-scope="scope">
<span>{{ getName(supplierList, scope.row.supplierId) }}</span>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="当前库存" align="center" prop="stock"/>
</el-table>
</el-main>
</el-container>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="addCommodity"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getAuditPremApi} from "@/api/oilConfig/staff";
import {BigNumber} from "bignumber.js";
import {listLJGoods} from "@/api/convenienceStore/ljgoods";
import {getName,parseTime} from "../../../utils/fuint";
import {selectParentById, selectTree} from "@/api/convenienceStore/goods";
import {listSupplier} from "@/api/convenienceStore/supplier";
import {
getInventoryDetailsPageApi,
delDetailsApi,
editInventoryApi,
addInventoryApi,
batchProcessingApi,
auditInventoryApi,
storageInventoryApi,
abolitionInventoryApi
} from "@/api/convenienceStore/inventory";
export default {
name: "details",
props:[
'PinventoryId',
'PorderNumber',
'PorderDate',
'PapprovalStatus',
'PcreataByName',
],
data() {
return {
detailsList: [],
commodityList: [],
commodityForm:{
cvsGoodId: "",
cvsGood: "",
supplierId: "",
supplier: "",
detailed: "",
page: 1,
pageSize: 10,
isRecovery:0,
},
inventoryForm: {
inventoryId:this.$props.PinventoryId,
id:this.$props.PinventoryId,
orderNumber: this.$props.PorderNumber,
approvalStatus: this.$props.PapprovalStatus,
orderDate: this.$props.PorderDate,
creataByName: this.$props.PcreataByName,
roductQuantity:0, //
inventoryQuantity: 0 //
},
inventoryId : this.$props.PinventoryId,
//
cvsGoodList:[],
//
supplierList:[],
state:this.$props.PapprovalStatus,
saveFlag:false,
auditFlag:true,
voidFlag:true,
storageFlag:true,
multipleSelection:[], //
//
title:'选择商品',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
// supplierId: '',
inventoryId: this.$props.PinventoryId,
page:null,
pageSize:null
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
rules: {
supplierName: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
],
},
}
},
async created() {
console.log("123123123",this.$props.PinventoryId)
console.log("123123123",this.$props)
// this.inventoryForm.inventoryId = this.$props.PinventoryId
// this.inventoryId = this.$props.PinventoryId
// this.queryParams.inventoryId = this.$props.PinventoryId
// this.inventoryForm.orderNumber = this.$props.PorderNumber
// this.inventoryForm.orderDate = this.$props.PorderDate
// this.inventoryForm.approvalStatus = this.$props.PapprovalStatus
this.state = this.$props.PapprovalStatus
if ( this.state == null) {
this.state = 'await'
}
if (this.state=='await') {
this.numberInput = false
}else {
this.numberInput = true
}
console.log("this.inventoryForm",this.inventoryForm)
if (this.inventoryForm.orderNumber == null) {
this.refresh();
}
if (this.inventoryForm.orderDate == null) {
this.inventoryForm.orderDate =new Date()
}
this.getDetailsList();
this.getQueryList();
this.JudgmentButton();
},
methods: {
getDetailsList() {
let this_ = this
getInventoryDetailsPageApi(this.queryParams).then(res=>{
this_.detailsList = res.data.records;
this.total = res.data.total;
this.inventoryForm.productQuantity = res.data.total;
this.sumMethod(res.data.records);
})
},
getCommodityList() {
let this_ = this
listLJGoods(this_.commodityForm).then(res=>{
this_.commodityList = res.data.records;
this_.sumMethod(res.data.records);
// this.total = response.data.total;
})
},
//
goToAbout() {
this.$router.push('/convenienceStore/inventory/index');
},
commodityAdd() {
this.open = true;
},
commodityDel(data) {
if (data.id != null) {
delDetailsApi(data).then(res=>{
})
}
const index = this.detailsList.indexOf(data); //
if (index !== -1) {
this.detailsList.splice(index, 1); // 使splice
}
this.inventoryForm.productQuantity--;
},
//
inquire() {
this.getCommodityList();
},
//
change(data,flag) {
this.sumMethod(this.detailsList)
},
// header
sumMethod(data) {
let this_ = this
// if (data.length>0) {
// this_.inventoryForm.productQuantity = data.length
// } else {
// this_.inventoryForm.productQuantity = 0
// }
this_.inventoryForm.productQuantity = data.length,
this_.inventoryForm.inventoryQuantity = new BigNumber(0),
data.forEach(da => {
if (da.inventoryQuantity != null) {
this_.inventoryForm.inventoryQuantity= this_.inventoryForm.inventoryQuantity.plus(da.inventoryQuantity)
}
})
},
addCommodity () {
let this_ = this
this.multipleSelection.forEach(mul=>{
let now = {
inventoryId: this.inventoryId,
goodsId: mul.id,
commodityName: mul.name,
cvsGoodId: mul.cvsGoodId,
unit:mul.unit,
stock:mul.stock,
purchasePrice: mul.buyingPrice,
goodsNo:mul.goodsNo,
inventoryQuantity:0
}
this_.detailsList.push(now)
})
this_.open = false
this_.inventoryForm.inventoryQuantity = this_.inventoryForm.inventoryQuantity + this_.multipleSelection.length
this_.sumMethod(this_.detailsList);
},
//
getQueryList(){
selectTree().then(response => {
this.cvsGoodList = response.data.records
});
listSupplier().then(response => {
this.supplierList = response.data.records
})
},
cancel() {
this.open = false;
},
//
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
refresh() {
let timestamp = new Date().getTime();
let min = 100; // 1000
let max = 999; // 9999
let randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
this.inventoryForm.orderNumber = timestamp+randomFourDigitNumber.toString();
},
//
async JudgmentButton(){
let judgmentPermissions1 = await this.judgmentPermissions("退货审核");
if (judgmentPermissions1 > 0){
this.auditFlag=false,
this.voidFlag=false
}
let judgmentPermissions2 = await this.judgmentPermissions("退货出库");
if (judgmentPermissions2 > 0){
this.storageFlag = false
}
let judgmentPermissions3 = await this.judgmentPermissions("退货废止");
if (judgmentPermissions3 > 0){
this.voidFlag=false
}else {
this.voidFlag=true
}
},
//
async judgmentPermissions(data) {
let fil ={
auditPrem:data
}
return await getAuditPremApi(fil).then(res => {
return res.data
});
},
async save(flag){
let this_ = this
// 退
// inventoryForm: {
// inventoryId:this.$props.PinventoryId,
// id:this.$props.PinventoryId,
// orderNumber: this.$props.PorderNumber,
// approvalStatus: this.$props.PapprovalStatus,
// orderDate: this.$props.PorderDate,
// creataByName: this.$props.PcreataByName,
// roductQuantity:0, //
// inventoryQuantity: 0 //
// },
await editInventoryApi(this.inventoryForm).then(res=>{
//
batchProcessingApi(this_.detailsList).then(res=>{
this.$modal.msgSuccess("保存成功");
if (flag != -1) {
this.goToAbout();
}
}).catch(res=>{
this.$modal.msgError("保存失败");
})
})
},
//
async audit(){
//
let number = await this.save(-1);
if (number != -1) {
//
let fil ={
id: this.inventoryId
}
console.log(" id: this.inventoryId",fil)
await auditinventoryApi(fil).then(res => {
if (res.data) {
this.state = 'ysh'
this.$modal.msgWarning("审核成功");
}else {
this.$modal.msgWarning("暂无审核权限");
}
this.goToAbout()
})
}
},
//
storage() {
let this_ = this;
//
if (this_.inventoryForm.orderNumber == null) {
this.$modal.msgError("退货单号不能为空");
return -1;
}else if (this_.inventoryForm.orderDate == null) {
this.$modal.msgError("退货时间不能为空");
return -1;
}else if(this_.detailsList.length<=0) {
this.$modal.msgError("退货单不能为空");
return -1;
}
this.$confirm('确认后盘点中的对应油品入库油罐库存将发生变化,且不可逆,确认已按照盘点数量入库吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
let fil ={
id: this.inventoryId
}
storageinventoryApi(fil).then(res => {
this.state = 'qrts'
this.$modal.msgWarning("入库成功");
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
//
abolition(){
if (this.inventoryId < 0) {
this.$modal.msgWarning("数据未保存,不可废弃");
return;
}
this.$confirm('确定要废弃盘点好的数据吗', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let fil ={
id: this.inventoryId
}
abolitioninventoryApi(fil).then(res => {
if (res.data) {
this.state = 'yzf'
this.$modal.msgWarning("作废成功");
this.goToAbout()
} else {
this.$modal.msgWarning("暂无作废权限");
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
},
}
}
</script>
<style scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
.box {
height: 100%;
width: 50%;
margin-right: 10px;
background-color: rgba(204, 204, 204, 0.3);
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
/* .underlined-text {
/* padding-bottom: 10px; /* 通过增加下边距来调整文本与下划线的间距 */
/* text-decoration: underline; 添加下划线 */
/* border-bottom: 1px solid; */
/* padding-bottom: 3px; */
/* } */
.container {
height: 100%;
width: 38%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.container p {
margin: 0; /* 重置段落的上下外边距 */
font-size: 15px; /* 调整文字大小 */
}
.underlined-text {
border-bottom: 1px solid;
padding-bottom: 3px;
/* text-decoration: underline; */
/* vertical-align: middle; */
}
</style>

View File

@ -0,0 +1,275 @@
<template>
<div class="app-container">
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="盘点批次号" prop="orderNumber">
<el-input v-model="queryParams.orderNumber" placeholder="请输入盘点批次号" />
</el-form-item>
<el-form-item label="状态" v-model="queryParams.approvalStatus" prop="status">
<el-select v-model="queryParams.approvalStatus" placeholder="请选择状态" style="150px">
<el-option
v-for="dict in dict.type.oilPurchasedStatus"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="日期选择" prop="status">
<el-date-picker
v-model="queryParams.dateRange"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="detailsAdd"
>新增盘点批次</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="inventoryList"
:default-sort="defaultSort">
<el-table-column label="盘点批次" align="center" prop="orderNumber">
</el-table-column>
<el-table-column label="盘点数量" align="center" prop="inventoryQuantity">
<template slot-scope="scope">
<span>{{scope.row.inventoryQuantity==null?"-":scope.row.inventoryQuantity}}</span>
</template>
</el-table-column>
<el-table-column label="库存差异" align="center" prop="inventoryDiscrepancy">
<template slot-scope="scope">
<span>{{scope.row.inventoryDiscrepancy==null?"-":scope.row.inventoryDiscrepancy}}</span>
</template>
</el-table-column>
<el-table-column label="盈亏金额" align="center" prop="profitLossAmount">
<template slot-scope="scope">
<span>{{scope.row.profitLossAmount==null?"-":scope.row.profitLossAmount}}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag v-if ="scope.row.approvalStatus == 'await'" size="medium">待审核</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'qrts'" type="success" size="medium">已审核入库</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'yzf'" type="danger" size="medium">已作废</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'ysh'" type="danger" size="medium">已审核</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="制单人" align="center" prop="createByName">
<template slot-scope="scope">
<span>{{scope.row.createByName==null?"-":scope.row.createByName}}</span>
</template>
</el-table-column>
<!-- <el-table-column label="制单日期" align="center" prop="orderDate" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderDate) }}</span>
</template>
</el-table-column> -->
<el-table-column label="审核人" align="center" prop="approverName">
<template slot-scope="scope">
<span>{{scope.row.approverName==null?"-":scope.row.approverName}}</span>
</template>
</el-table-column>
<el-table-column label="确认人" align="center" prop="confirmerName">
<template slot-scope="scope">
<span>{{scope.row.confirmerName==null?"-":scope.row.confirmerName}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="dispose(scope.row)"
>处理单据</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import {getInventoryPageApi,delInventoryApi,addInventoryApi} from "@/api/convenienceStore/inventory";
import {listSupplier} from "@/api/convenienceStore/supplier";
export default {
name: "index",
dicts: ['oilPurchasedStatus'],
data() {
return {
inventoryList:[],
//
supplierList:[],
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
orderNumber: "",
approvalStatus: "",
status: '',
supplierId: '',
dateRange: '',
page: null,
pageSize: null,
},
//
inventoryForm: {
orderNumber: null,
approvalStatus: "",
orderDate: new Date(),
} ,
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
}
},
async created() {
await this.getList();
this.getQueryList();
},
methods: {
//
getList(){
this.loading = true;
getInventoryPageApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.inventoryList = response.data.records;
this.total = response.data.total;
})
this.loading = false;
},
//
getQueryList(){
listSupplier().then(response => {
this.supplierList = response.data.records
})
},
async detailsAdd() {
try {
await this.$confirm('您确定要新增盘点批次吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
this.inventoryForm.approvalStatus = 'await';
this.refresh();
const res = await addInventoryApi(this.inventoryForm);
if (res) {
this.$modal.msgSuccess("新建批次成功");
this.getList();
} else {
this.$modal.msgError("新建批次失败");
}
} catch (error) {
this.$message({
type: 'info',
message: '已取消'
});
}
},
//
refresh() {
let timestamp = new Date().getTime();
let min = 100; // 1000
let max = 999; // 9999
let randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
this.inventoryForm.orderNumber = timestamp+randomFourDigitNumber.toString();
},
//
dispose(data) {
this.$router.push({
name: 'inventory-details',
params: {
PinventoryId: data.id,
PorderNumber: data.orderNumber,
PorderDate: data.orderDate,
PapprovalStatus: data.approvalStatus,
PcreataByName: data.createByName
},
});
},
//
resetQuery() {
this.queryParams = {}
},
//
handleDel(data) {
delInventoryApi(data).then(response => {
this.$modal.msgSuccess("删除成功");
this.getList();
})
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
}
}
</script>
<style scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
</style>