|
|
|
<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>
|
|
|
|
</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="false" type="number"
|
|
|
|
@input="checkNum" @confirm="confirm()" :maxlength="maxlength" />
|
|
|
|
<uom :uom="dataContent.uom"></uom>
|
|
|
|
</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>
|
|
|
|
<comMessage ref="comMessage"></comMessage>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import uom from '@/mycomponents/qty/uom.vue'
|
|
|
|
import stdUom from '@/mycomponents/qty/stdUom.vue'
|
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue'
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
uom,
|
|
|
|
stdUom,
|
|
|
|
comMessage
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
allQty: 0,
|
|
|
|
stdCount: 0,
|
|
|
|
labelQty: 0,
|
|
|
|
recommendQty: 0,
|
|
|
|
maxlength: 10
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
// handleQty: {
|
|
|
|
// handler(newval, oldval) {
|
|
|
|
// this.allQty = Number(this.handleQty)
|
|
|
|
// },
|
|
|
|
// immediate: true,
|
|
|
|
// deep: true
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: "编辑数量"
|
|
|
|
},
|
|
|
|
dataContent: {
|
|
|
|
type: Object,
|
|
|
|
default: {}
|
|
|
|
},
|
|
|
|
handleQty: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
settingParam: {
|
|
|
|
type: Object,
|
|
|
|
default: {}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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() {
|
|
|
|
this.$refs.popup.open('bottom')
|
|
|
|
},
|
|
|
|
openTaskEditPopup(recommendQty, handleQty, labelQty) {
|
|
|
|
this.recommendQty = Number(recommendQty);
|
|
|
|
this.labelQty = Number(labelQty);
|
|
|
|
this.allQty = Number(handleQty)
|
|
|
|
setTimeout(res => {
|
|
|
|
this.$refs.popup.open('bottom')
|
|
|
|
}, 500)
|
|
|
|
},
|
|
|
|
openRecordEditPopup(labelQty) {
|
|
|
|
this.recommendQty = 0;
|
|
|
|
this.labelQty = Number(labelQty);
|
|
|
|
this.allQty = Number(labelQty)
|
|
|
|
this.$refs.popup.open('bottom')
|
|
|
|
},
|
|
|
|
closeEditPopup() {
|
|
|
|
this.$refs.popup.close()
|
|
|
|
},
|
|
|
|
confirm() {
|
|
|
|
this.setValue();
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
this.closeEditPopup();
|
|
|
|
},
|
|
|
|
calcQty(val) {
|
|
|
|
if (val > 0) {
|
|
|
|
this.allQty = val * this.dataContent.stdPackQty;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setValue() {
|
|
|
|
// var recommendQty = Number(this.dataContent.qty);
|
|
|
|
// var labelQty = Number(this.dataContent.record.label.qty);
|
|
|
|
if (this.allQty > this.labelQty) {
|
|
|
|
this.$refs.comMessage.showErrorMessage('数量[' + this.allQty + ']不允许大于标签数量[' +
|
|
|
|
this.labelQty +
|
|
|
|
']',
|
|
|
|
res => {
|
|
|
|
this.allQty = this.labelQty;
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
if (this.recommendQty != 0) {
|
|
|
|
if (this.allQty > this.recommendQty) {
|
|
|
|
if (this.settingParam.allowBiggerQty != null && this.settingParam.allowBiggerQty ==
|
|
|
|
"TRUE") {
|
|
|
|
this.callback();
|
|
|
|
} else {
|
|
|
|
this.$refs.comMessage.showErrorMessage('数量[' + this.allQty + ']不允许大于推荐数量[' +
|
|
|
|
this.recommendQty +
|
|
|
|
']',
|
|
|
|
res => {
|
|
|
|
this.allQty = this.labelQty;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else if (this.allQty < this.recommendQty) {
|
|
|
|
if (this.settingParam.allowSmallerQty != null && this.settingParam.allowSmallerQty ==
|
|
|
|
"TRUE") {
|
|
|
|
this.callback();
|
|
|
|
} else {
|
|
|
|
this.$refs.comMessage.showErrorMessage('数量[' + this.allQty + ']不允许小于推荐数量[' +
|
|
|
|
this.recommendQty +
|
|
|
|
']',
|
|
|
|
res => {
|
|
|
|
this.allQty = this.labelQty;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.callback();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.callback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
callback() {
|
|
|
|
this.$emit("confirm", Number(this.allQty));
|
|
|
|
this.closeEditPopup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</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>
|