You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
5.7 KiB

12 months ago
<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>
12 months ago
<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" />
12 months ago
<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,
11 months ago
stdCount: 0,
12 months ago
labelQty: 0,
recommendQty: 0,
maxlength: 10
12 months ago
}
},
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;
}
},
12 months ago
openEditPopup() {
this.$refs.popup.open('bottom')
},
11 months ago
openTaskEditPopup(recommendQty, handleQty, labelQty) {
12 months ago
this.recommendQty = Number(recommendQty);
this.labelQty = Number(labelQty);
this.allQty = Number(handleQty)
11 months ago
setTimeout(res => {
12 months ago
this.$refs.popup.open('bottom')
11 months ago
}, 500)
12 months ago
},
openRecordEditPopup(labelQty) {
this.recommendQty = 0;
this.labelQty = Number(labelQty);
11 months ago
this.allQty = Number(labelQty)
12 months ago
this.$refs.popup.open('bottom')
},
closeEditPopup() {
this.$refs.popup.close()
},
confirm() {
this.setValue();
},
cancel() {
this.closeEditPopup();
},
calcQty(val) {
11 months ago
if (val > 0) {
this.allQty = val * this.dataContent.stdPackQty;
}
12 months ago
},
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") {
12 months ago
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") {
12 months ago
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>