Commit dced34e1 by zhangzhen

其他入库完善

parent 21834119
......@@ -67,6 +67,147 @@
</view>
</view>
<view class="flex-col content-part-1 content-part-2">
<view class="flex-row header">
<text class="text-lg text-bold text-black">入库明细</text>
</view>
<view class="form-content-box ">
<view v-for="(item,k) in formList" :key="k" class="sub-item-box">
<form>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>存货类型:</text>
</view>
<view class="">
<picker @change="onInventTypeChange($event,k)" :value="item.inventTypeIndex"
:range="inventTypeBoxList" range-key="label">
<view class="uni-input form-item-label">
<text
class="text-blue">{{ item.inventTypeIndex >= 0 ? inventTypeBoxList[item.inventTypeIndex].label:'请选择存货类型'}}</text>
<text class="cuIcon-right text-blue"></text>
</view>
</picker>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>存货名称:</text>
</view>
<view class="text-blue">
<picker @change="onInventRecordChange($event,k)" :value="item.inventRecordIndex"
:range="item.inventRecordList" range-key="label">
<view class="uni-input form-item-label">
<text
class="text-blue">{{item.inventRecordIndex>=0 && item.inventRecordList.length ? item.inventRecordList[item.inventRecordIndex].label:'请选择存货名称'}}</text>
<text class="cuIcon-right text-blue"></text>
</view>
</picker>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>规格:</text>
</view>
<view class="">
<text>{{item.prdtSpec || '-'}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>长:</text>
</view>
<view class="">
<text>{{Number(item.prdtLength) || 0}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>宽:</text>
</view>
<view class="">
<text>{{Number(item.prdtWidth) || 0}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>厚:</text>
</view>
<view class="">
<text>{{Number(item.prdtThick) || 0}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>系数:</text>
</view>
<view class="">
<text>{{Number(item.prdtCoefficient) || 0}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>数量:</text>
</view>
<view class="text-blue">
<u-input v-model="item.invQty" color="#0081ff" inputAlign="right"
@change="onNumChange($event,k)" type="text" :border="border" placeholder="请输入数量" />
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>单重:</text>
</view>
<view class="">
<text>{{Number(item.invUnitWeight) || 0 }}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>总重:</text>
</view>
<view class="">
<text>{{Number(item.invWeight) || 0 }}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>单价:</text>
</view>
<view class="text-blue">
<u-input v-model="item.price" color="#0081ff" inputAlign="right"
@change="onPriceChange($event,k)" type="text" :border="border"
placeholder="请输入单价" />
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>总价:</text>
</view>
<view class="">
<text>{{Number(item.amount) || 0 }}</text>
</view>
</view>
</form>
</view>
</view>
<view class="" style="margin-bottom: 140upx;">
<button class="cu-btn bg-gradual-green" @tap="onAddSub">
<text class="cuIcon-add"></text>
<text>新增明细</text>
</button>
</view>
</view>
<view class="footer-box">
<button class="cu-btn block bg-blue" @tap="onSubmit">提交</button>
</view>
......@@ -87,13 +228,20 @@
getParamsData
} from "@/api/product-warehousing.js";
import {updateInfo} from "@/api/other-warehousing.js";
import {
updateInfo,
getSubList,
getInventRecord,
getInventInfo,
saveSubList
} from "@/api/other-warehousing.js";
export default {
data() {
return {
show: false,
show2: false,
border: "none",
minDate: moment().subtract(2, 'M').format("YYYY-MM-DD"),
content: "请确认是否进行新增入库?",
addStatus: false,
......@@ -115,7 +263,11 @@
projectIndex: -1,
otherEnterDate: [],
subList: [],
formList: [],
inventRecordList: [],
inventRecordIndex: -1,
inventTypeBoxList: [],
inventTypeIndex: -1
};
},
onLoad() {
......@@ -123,6 +275,81 @@
this.onLoading();
},
methods: {
onNumChange(e, i) {
this.formList[i].invWeight = Number(e) * Number(this.formList[i].invUnitWeight);
},
onPriceChange(e, i) {
this.formList[i].amount = Number(e) * Number(this.formList[i].invQty);
},
onInventTypeChange(e, i) {
let index = Number(e.target.value);
if (this.formList[i].inventTypeIndex === index) return
this.formList[i].inventTypeIndex = index;
this.formList[i].inventRecordIndex = -1;
this.onGetInventRecord(i);
},
onInventRecordChange(e, i) {
let index = Number(e.target.value);
if (this.formList[i].inventRecordIndex === index) return
this.formList[i].inventRecordIndex = index;
getInventInfo({
inventType: this.inventTypeBoxList[this.formList[i].inventTypeIndex].value,
inventCode: this.formList[i].inventRecordList[index].value
}).then(res => {
uni.hideLoading()
let list = toJsonData(res.data.__blocks__.invent_spec_box_block_id.rows, res.data.__blocks__
.invent_spec_box_block_id.meta.columns)
this.formList[i].prdtSpec = list[0].textField;
this.formList[i].prdtLength = list[0].param1Field;
this.formList[i].prdtWidth = list[0].param2Field;
this.formList[i].prdtThick = list[0].param3Field;
this.formList[i].prdtCoefficient = list[0].param4Field;
this.formList[i].invUnitWeight = this.onSumUnitWeight(this.formList[i].prdtLength, this
.formList[i].prdtWidth, this.formList[i].prdtThick, this.formList[i].prdtCoefficient)
this.$forceUpdate();
})
},
onSumUnitWeight(l, w, t, x) {
let num = 0;
let length = Number(l) || 0;
let width = Number(w) || 0;
let thick = Number(t) || 0;
let coefficient = Number(x) || 0;
return length * width * thick * coefficient / 1000000
},
onAddSub() {
if (this.factoryIndex < 0) {
uni.showToast({
icon: "none",
title: "请先选择公司"
})
return
}
if (this.projectIndex < 0) {
uni.showToast({
icon: "none",
title: "请先选择仓库"
})
return
}
this.onGetSubList();
this.formList.push({
invQty: 0,
invUnitWeight: 0,
prdtSpec: '',
prdtLength: '',
prdtWidth: '',
prdtThick: '',
prdtCoefficient: '',
invUnitWeight: '',
inventRecordIndex: -1,
inventTypeIndex: -1,
inventRecordList: []
})
},
onSubmit() {
this.show = true
},
......@@ -139,14 +366,14 @@
},
onSave() {
this.show = false;
if (this.factoryIndex < 0){
if (this.factoryIndex < 0) {
uni.showToast({
icon: "none",
title: "请选择公司"
})
return
}
if (this.projectIndex < 0){
if (this.projectIndex < 0) {
uni.showToast({
icon: "none",
title: "请选择仓库"
......@@ -154,27 +381,63 @@
return
}
uni.showLoading({
title:"加载中..."
title: "加载中..."
})
updateInfo({
...this.orderInfo,
companyCode: this.factoryList[this.factoryIndex].value,
companyName: this.factoryList[this.factoryIndex].label,
whCode: this.projectList[this.projectIndex].value,
whName: this.projectList[this.projectIndex].label,
otherEnterDate: moment(this.otherEnterDate[0]).format("YYYYMMDD")
}).then(res => {
uni.hideLoading();
if (res.data.__sys__.status === 0) {
uni.showToast({
icon:"success",
title:"新增成功"
updateInfo({
...this.orderInfo,
companyCode: this.factoryList[this.factoryIndex].value,
companyName: this.factoryList[this.factoryIndex].label,
whCode: this.projectList[this.projectIndex].value,
whName: this.projectList[this.projectIndex].label,
otherEnterDate: moment(this.otherEnterDate[0]).format("YYYYMMDD")
}).then(res => {
if (res.data.__sys__.status === 0) {
if(this.formList&&this.formList.length){
let l= toJsonData(res.data.__blocks__.entity.rows, res.data.__blocks__.entity.meta.columns)
if(l.length){
this.formList = this.formList.map(item => {
return {
...item,
primaryId: l[0].id,
whCode:this.projectList[this.projectIndex].value,
companyCode:this.factoryList[this.factoryIndex].value,
inventType: this.inventTypeBoxList[item.inventTypeIndex].value,
inventCode: item.inventRecordList[item.inventRecordIndex].value,
inventName: item.inventRecordList[item.inventRecordIndex].name
}
})
this.onSubSave(0)
}
}else{
uni.hideLoading();
uni.showToast({
icon: "success",
title: "新增成功"
})
setTimeout(()=>{
setTimeout(() => {
this.onBack();
},1500)
}, 1500)
}
}
})
},
onSubSave(i = 0) {
if (i >= this.formList.length) {
uni.hideLoading();
uni.showToast({
icon: "success",
title: "提交成功"
})
setTimeout(() => {
this.onBack();
}, 1500)
return;
}
saveSubList(this.formList[i]).then(res => {
if (res.data.__sys__.status === 0) {
this.onSubSave(++i);
}
})
},
onChange(e) {
let index = Number(e.target.value);
......@@ -212,6 +475,33 @@
}
});
})
},
onGetSubList() {
getSubList().then(res => {
this.inventTypeBoxList = toJsonData(res.data.__blocks__.invent_type_box_block_id.rows, res.data
.__blocks__.invent_type_box_block_id.meta.columns).map(item => {
return {
label: item.textField,
value: item.valueField
}
});
console.log(this.inventTypeBoxList, "存货类型")
})
},
onGetInventRecord(i) {
getInventRecord({
inventType: this.inventTypeBoxList[this.formList[i].inventTypeIndex].value
}).then(res => {
this.formList[i].inventRecordList = toJsonData(res.data.__blocks__.invent_record_block_id.rows,
res.data
.__blocks__.invent_record_block_id.meta.columns).map(item => {
return {
label: `[${item.valueField}]${item.textField}[${item.param1Field}]`,
value: item.valueField,
name: item.textField
}
});
})
}
}
}
......@@ -447,7 +737,8 @@
width: 200upx;
align-items: center;
}
.text-blue{
.text-blue {
white-space: normal;
}
}
......@@ -593,7 +884,8 @@
}
}
}
.cu-form-group uni-picker::after{
.cu-form-group uni-picker::after {
color: transparent;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment