From 7d7a4a694cdf6df6dd49381c6d7f00d37c786b90 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Fri, 01 Jul 2022 16:36:07 +0800
Subject: [PATCH] 1、库存损耗接口对接
---
src/views/farmplant/farmproductstock.vue | 124 ++++++++++++++++++++++++++++++++---------
src/api/sale/sale.js | 8 ++
2 files changed, 104 insertions(+), 28 deletions(-)
diff --git a/src/api/sale/sale.js b/src/api/sale/sale.js
index 568f71f..7cbf713 100644
--- a/src/api/sale/sale.js
+++ b/src/api/sale/sale.js
@@ -40,6 +40,14 @@
})
}
+export const addKC = (row) => {
+ return request({
+ url: '/api/inventory/inventory/submit',
+ method: 'post',
+ data: row
+ })
+}
+
export const update = (row) => {
return request({
url: '/api/sale/sale/submit',
diff --git a/src/views/farmplant/farmproductstock.vue b/src/views/farmplant/farmproductstock.vue
index add5293..9eafde4 100644
--- a/src/views/farmplant/farmproductstock.vue
+++ b/src/views/farmplant/farmproductstock.vue
@@ -34,15 +34,15 @@
</el-button
>
</div>
-<!-- <div class="btn">-->
-<!-- <el-button style="width: 65px;" plain size="small"-->
-<!-- ><span style="color: #5abf78">出库</span></el-button-->
-<!-- >-->
-<!-- <el-button style="width: 65px;" plain size="small">-->
-<!-- 加工-->
-<!-- </el-button-->
-<!-- >-->
-<!-- </div>-->
+ <!-- <div class="btn">-->
+ <!-- <el-button style="width: 65px;" plain size="small"-->
+ <!-- ><span style="color: #5abf78">出库</span></el-button-->
+ <!-- >-->
+ <!-- <el-button style="width: 65px;" plain size="small">-->
+ <!-- 加工-->
+ <!-- </el-button-->
+ <!-- >-->
+ <!-- </div>-->
</div>
</div>
</div>
@@ -129,13 +129,16 @@
</template>
<template slot-scope="{disabled,size}" slot="saleNum">
<div style="margin-bottom: -20px">
- <el-input type="number" placeholder="请输入销售数量" v-model="form.saleNum"><i slot="suffix"style="font-style:normal;margin-right: 5px;">公斤</i></el-input>
+ <el-input type="number" placeholder="请输入销售数量" v-model="form.saleNum"><i slot="suffix"
+ style="font-style:normal;margin-right: 5px;">公斤</i>
+ </el-input>
<div style="text-align: right;color: #ffb218">可销售量:{{form.weight}}公斤</div>
</div>
</template>
<template slot-scope="{disabled,size}" slot="salePrice">
<div style="margin-bottom: -20px">
- <el-input type="number" placeholder="请输入销售价格" v-model="form.salePrice"><i slot="suffix"style="font-style:normal;margin-right: 5px;">元/公斤</i>
+ <el-input type="number" placeholder="请输入销售价格" v-model="form.salePrice"><i slot="suffix"
+ style="font-style:normal;margin-right: 5px;">元/公斤</i>
</el-input>
</div>
</template>
@@ -155,25 +158,27 @@
:close-on-click-modal="false"
@close="close"
width="30%"
+ :before-close="cleanKCData"
:visible.sync="visibleKC"
center
>
- <avue-form ref="form" v-model="form" :option="optionKC">
+ <avue-form ref="form" v-model="formKC" :option="optionKC">
<template slot-scope="{disabled,size}" slot="name">
<div>
- <el-tag type="success">{{form.name}}</el-tag>
+ <el-tag type="success">{{formKC.name}}</el-tag>
</div>
</template>
<template slot-scope="{disabled,size}" slot="saleNum">
<div style="margin-bottom: -20px">
- <el-input type="number" placeholder="请输入损耗数量" v-model="form.saleNum"><i slot="suffix"style="font-style:normal;margin-right: 5px;">公斤</i></el-input>
- <div style="text-align: right;color: #ffb218">库存量:{{form.weight}}公斤</div>
+ <el-input type="number" placeholder="请输入损耗数量" v-model="formKC.saleNum"><i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
+ </el-input>
+ <div style="text-align: right;color: #ffb218">库存量:{{formKC.weight}}公斤</div>
</div>
</template>
<template slot="menuForm">
<div style="text-align: center">
- <el-button style="width: 80px" plain >取消</el-button>
- <el-button style="width: 80px" type="success" plain >确认</el-button>
+ <el-button style="width: 80px" plain @click="cleanKCData">取消</el-button>
+ <el-button style="width: 80px" type="success" plain @click="submitKCloss">确认</el-button>
</div>
</template>
</avue-form>
@@ -192,7 +197,7 @@
} from "@/api/farmplant/farmproductstock";
import {
- add
+ add,addKC
} from "@/api/sale/sale";
import {getStrainList} from "@/api/farmplant/strain";
@@ -217,7 +222,16 @@
county: "",
salePrice: "",
createUser: "",
- saleBrand: ""
+ saleBrand: "",
+ },
+ //损耗字段
+ formKC:{
+ name: "",
+ strainId: "",
+ saleNum: "",
+ remarks:"",
+ reason:"0",
+ lossTime:"",
},
visible: false,
visibleKC: false,
@@ -330,7 +344,7 @@
},
{
label: "损耗时间",
- prop: "saleTime",
+ prop: "lossTime",
type: "date",
span: 24,
format: "yyyy-MM-dd",
@@ -357,8 +371,27 @@
],
},
{
+ label: "损耗原因",
+ prop: "reason",
+ span: 24,
+ type: "select",
+ value: "0",
+ dicData: [
+ {
+ label: "库存损耗",
+ value: "0",
+ }],
+ rules: [
+ {
+ required: true,
+ message: "请选择损耗原因",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
label: "备注",
- prop: "bz",
+ prop: "remarks",
span: 24,
},
{
@@ -423,6 +456,31 @@
done();
}, error => {
window.console.log(error);
+ //提交失败,关闭窗口清空数据
+ that.cleanData();
+ done();
+ });
+ }
+ })
+ },
+ submitKCloss() {
+ var that = this;
+ this.$refs.form.validate((vaild, done) => {
+ if (vaild) {
+ addKC(this.formKC).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ //提交完成,关闭窗口清空数据
+ that.cleanKCData();
+ done();
+ }, error => {
+ window.console.log(error);
+ //提交失败,关闭窗口清空数据
+ that.cleanKCData();
+ done();
});
}
})
@@ -446,23 +504,33 @@
// });
},
openWindow(index, data) {
- this.form.name = this.userInfo.nick_name;
- this.form.createUser = this.userInfo.user_id;
- this.form.weight = data.weight;
- this.form.strainId = data.strainId;
- this.form.strainName = data.strainName;
if (index == 0) {
+ this.form.name = this.userInfo.nick_name;
+ this.form.createUser = this.userInfo.user_id;
+ this.form.weight = data.weight;
+ this.form.strainId = data.strainId;
+ this.form.strainName = data.strainName;
this.visible = true;
- }else if(index == 1){
+ } else if (index == 1) {
+ this.formKC.name = this.userInfo.nick_name;
+ this.formKC.createUser = this.userInfo.user_id;
+ this.formKC.weight = data.weight;
+ this.formKC.strainId = data.strainId;
+ this.formKC.strainName = data.strainName;
this.visibleKC = true;
}
},
- cleanData(){
+ cleanData() {
var that = this;
that.form.saleDestination = "";
that.$refs.form.resetFields();
that.visible = false;
},
+ cleanKCData() {
+ var that = this;
+ that.$refs.form.resetFields();
+ that.visibleKC = false;
+ },
handleSizeChange(val) {
this.page.pageSize = val;
this.onLoad(this.page);
--
Gitblit v1.9.3