|
|
|
<template>
|
|
|
|
<view class="">
|
|
|
|
<uni-popup ref="popup">
|
|
|
|
<view class="uni-flex uni-column pop_customer">
|
|
|
|
<view class="" style="padding:10rpx">
|
|
|
|
<view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx">
|
|
|
|
<view class="" style="font-size: 35rpx;">
|
|
|
|
{{title}}
|
|
|
|
</view>
|
|
|
|
<image style="width: 35rpx;height: 35rpx;" src="/static/icons/icons_close.svg"
|
|
|
|
@click="closeEditPopup"></image>
|
|
|
|
</view>
|
|
|
|
<u-line />
|
|
|
|
<view class="uni-flex uni-column" style="background-color: white; height:60%;">
|
|
|
|
<view class="uni-flex uni-column ">
|
|
|
|
<view class="uni-flex uni-row space-between padding title ">
|
|
|
|
<text>标包个数 : </text>
|
|
|
|
<view class="uni-flex uni-row u-col-center">
|
|
|
|
<uni-number-box @change="calcQty($event,stdCount)" :value="stdCount">
|
|
|
|
</uni-number-box>
|
|
|
|
<std-uom :uom="dataContent.stdPackUnit"></std-uom>
|
|
|
|
<!-- <uom :uom="dataContent.stdPackUnit"></uom> -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-line />
|
|
|
|
<view class="uni-flex uni-row space-between padding title u-col-center">
|
|
|
|
<text>标包量 : </text>
|
|
|
|
<view class="uni-flex u-col-center uni-row">
|
|
|
|
<text>{{Number(dataContent.stdPackQty)}}</text>
|
|
|
|
<uom :uom="dataContent.uom"></uom>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<u-line />
|
|
|
|
<view class="uni-flex uni-row space-between padding title u-col-center">
|
|
|
|
<text>数量 : </text>
|
|
|
|
<view class="uni-flex uni-row uni-center" style="align-items: center;">
|
|
|
|
<input class="qty_input" v-model="allQty" :focus="true" type="number"
|
|
|
|
@confirm="confirm()" @input="checkNum" :maxlength="maxlength" />
|
|
|
|
<uom :uom="dataContent.uom"></uom>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-line />
|
|
|
|
<view class="uni-flex uni-row space-between padding title u-col-center">
|
|
|
|
<text>库存数量 : </text>
|
|
|
|
<view class="uni-flex uni-row uni-center" style="align-items: center;">
|
|
|
|
<text class="text_recommend">{{Number(dataContent.balanceQty)}}</text>
|
|
|
|
<uom :uom="dataContent.uom"></uom>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-line />
|
|
|
|
<view v-if="isShowStatus" class="uni-flex uni-row space-between title u-col-center"
|
|
|
|
style="padding-left: 30rpx;">
|
|
|
|
<text>库存状态 : </text>
|
|
|
|
<view class="uni-flex uni-row uni-center" style="align-items: center;">
|
|
|
|
<balanceStatus ref="balanceStatus" :status="inventoryStatus"
|
|
|
|
:allowEdit='allowEditStatus' @updateStatus="updateStatus">
|
|
|
|
</balanceStatus>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-line />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="uni-flex uni-row hide_border">
|
|
|
|
<button class="btn_edit_big_cancle" hover-class="btn_edit_big_after" @click="cancel()">取消</button>
|
|
|
|
<button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</uni-popup>
|
|
|
|
<com-message ref="comMessage"></com-message>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import uom from '@/mycomponents/qty/uom.vue'
|
|
|
|
import StdUom from '@/mycomponents/qty/StdUom.vue'
|
|
|
|
import balanceStatus from '@/mycomponents/status/balanceStatus.vue'
|
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
uom,
|
|
|
|
StdUom,
|
|
|
|
balanceStatus,
|
|
|
|
comMessage
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
allQty: 0,
|
|
|
|
stdCount: 0,
|
|
|
|
stateData: 0,
|
|
|
|
balanceQty: 0,
|
|
|
|
inventoryStatus: "",
|
|
|
|
originalInventoryStatus: "",
|
|
|
|
dataContent: {},
|
|
|
|
handleQty: 0,
|
|
|
|
maxlength: 10
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: "编辑数量"
|
|
|
|
},
|
|
|
|
settingParam: {
|
|
|
|
type: Object,
|
|
|
|
default: {}
|
|
|
|
},
|
|
|
|
isShowStatus: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
allowEditStatus: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
checkNum(e) {
|
|
|
|
let value = e.detail.value;
|
|
|
|
let dot = value.indexOf('.'); //包含小数点
|
|
|
|
let reg = /^[0-9]+$/; //正整数
|
|
|
|
if (dot > -1) {
|
|
|
|
this.maxlength = dot + 7; //长度是小数点后两位
|
|
|
|
if (value.length > dot + 7) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (reg.test(value)) { //如果是正整数不包含小数点
|
|
|
|
this.maxlength = 10;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
openEditPopup(item, handleQty) {
|
|
|
|
this.dataContent = item
|
|
|
|
this.inventoryStatus = this.dataContent.inventoryStatus
|
|
|
|
this.toInventoryStatus = this.dataContent.toInventoryStatus
|
|
|
|
this.allQty = Number(handleQty)
|
|
|
|
setTimeout(res => {
|
|
|
|
this.$refs.popup.open('bottom')
|
|
|
|
}, 500)
|
|
|
|
},
|
|
|
|
closeEditPopup() {
|
|
|
|
this.$refs.popup.close()
|
|
|
|
},
|
|
|
|
confirm() {
|
|
|
|
this.setValue();
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
this.dataContent.inventoryStatus = this.originalInventoryStatus;
|
|
|
|
this.closeEditPopup();
|
|
|
|
},
|
|
|
|
calcQty(val) {
|
|
|
|
if (val > 0) {
|
|
|
|
this.allQty = val * Number(this.dataContent.stdPackQty);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setValue() {
|
|
|
|
var balanceQty = Number(this.dataContent.balanceQty);
|
|
|
|
if (this.allQty == 0) {
|
|
|
|
this.$refs.comMessage.showConfirmWarningModal('数量必须大于0',
|
|
|
|
res => {
|
|
|
|
this.allQty = balanceQty;
|
|
|
|
})
|
|
|
|
} else if (this.allQty > balanceQty) {
|
|
|
|
this.$refs.comMessage.showConfirmWarningModal('数量[' + this.allQty + ']不允许大于库存数量[' + balanceQty + ']',
|
|
|
|
res => {
|
|
|
|
this.allQty = balanceQty;
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.callback();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
callback() {
|
|
|
|
let qty = Number(this.allQty);
|
|
|
|
this.dataContent.handleQty = qty;
|
|
|
|
if (this.allowEditStatus) //只有编辑了库存状态,才给库存状态赋值
|
|
|
|
{
|
|
|
|
this.dataContent.toInventoryStatus = this.inventoryStatus;
|
|
|
|
}
|
|
|
|
this.$emit("confirm", qty);
|
|
|
|
this.closeEditPopup();
|
|
|
|
},
|
|
|
|
updateStatus(value) {
|
|
|
|
this.inventoryStatus = value
|
|
|
|
console.log(this.inventoryStatus)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.uni-popup .uni-popup__wrapper {
|
|
|
|
width: 100% !important;
|
|
|
|
padding: 30rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.hide_border {
|
|
|
|
button {
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
button::after {
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
font-size: 30rpx;
|
|
|
|
}
|
|
|
|
</style>
|