Browse Source

修改扫描叫料

hella_online_20241024
lijuncheng 1 month ago
parent
commit
c6cbf5a026
  1. 1
      src/mycomponents/common/comBlankView.vue
  2. 219
      src/mycomponents/qty/numbeIntegerrBox.vue
  3. 53
      src/pages/issue/request/issueScanRequest.vue

1
src/mycomponents/common/comBlankView.vue

@ -27,6 +27,7 @@
},
methods: {
goScan(content) {
console.log("点击")
this.$emit("goScan", '');
}
}

219
src/mycomponents/qty/numbeIntegerrBox.vue

@ -0,0 +1,219 @@
<template>
<view class="uni-numbox">
<view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }">-</text>
</view>
<input :disabled="disabled" @input="onKeyInput" @blur="_onBlur" class="uni-numbox__value" type="number"
v-model="inputValue" />
<view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }">+</text>
</view>
</view>
</template>
<script>
/**
* NumberBox 数字输入框
* @description 带加减按钮的数字输入框
* @tutorial https://ext.dcloud.net.cn/plugin?id=31
* @property {Number} value 输入框当前值
* @property {Number} min 最小值
* @property {Number} max 最大值
* @property {Number} step 每次点击改变的间隔大小
* @property {String} background 背景色
* @property {Boolean} disabled = [true|false] 是否为禁用状态
* @event {Function} change 输入框值改变时触发的事件参数为输入框当前的 value
*/
export default {
name: "UniNumberBox",
emits: ['change'],
props: {
value: {
type: [Number, String],
default: 1
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
background: {
type: String,
default: '#f5f5f5'
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
inputValue: 0
};
},
watch: {
inputValue(newVal, oldVal) {
if (+newVal !== +oldVal) {
this.$emit("change", newVal);
}
}
},
created() {
this.inputValue = +this.value;
},
methods: {
setValue(value){
this.inputValue=value;
},
//
onKeyInput: function(event) {
//console.log( event.detail.value)
var hint = event.detail.value;
if (!Number.isInteger(hint)) {
//
this.inputValue = hint.toString().match(/^\d+/) || 0;
} else {
//
this.inputValue = hint;
}
},
//(minus:;plus:)
_calcValue(type) {
if (this.disabled) {
return;
}
const scale = this._getDecimalScale();
let value = this.inputValue * scale;
let step = this.step * scale;
if (type === "minus") {
value -= step;
if (value < (this.min * scale)) {
return;
}
if (value > (this.max * scale)) {
value = this.max * scale
}
} else if (type === "plus") {
value += step;
if (value > (this.max * scale)) {
return;
}
if (value < (this.min * scale)) {
value = this.min * scale
}
}
if ((value + '').length > 5) {
value = value.toFixed(0); //toFixed
}
this.inputValue = String(value / scale);
},
_getDecimalScale() {
let scale = 1;
//
// if (~~this.step !== this.step) {
// scale = Math.pow(10, (this.step + "").split(".")[1].length);
// }
return scale;
},
_onBlur(event) {
let value = event.detail.value;
if (!value) {
return;
}
value = +value;
if (value > this.max) {
value = this.max;
} else if (value < this.min) {
value = this.min;
}
this.inputValue = value;
/*小数点后保留四位*/
// if (value > 0) {
// event.detail.value =parseFloat(event.detail.value).toFixed(0)
// } else {
// event.detail.value =-parseFloat(event.detail.value).toFixed(0)
// }
//input
this.$nextTick(() => {
this.inputValue = event.detail.value;
})
}
}
};
</script>
<style lang="scss" scoped>
$box-height: 26px;
$bg: #f5f5f5;
$br: 2px;
$color: #333;
.uni-numbox {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.uni-numbox-btns {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0 8px;
background-color: $bg;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-numbox__value {
margin: 0 2px;
background-color: $bg;
width: 100px;
height: $box-height;
text-align: center;
font-size: 14px;
border-left-width: 0;
border-right-width: 0;
color: $color;
}
.uni-numbox__minus {
border-top-left-radius: $br;
border-bottom-left-radius: $br;
width: 64rpx;
}
.uni-numbox__plus {
border-top-right-radius: $br;
border-bottom-right-radius: $br;
width: 64rpx;
}
.uni-numbox--text {
// fix nvue
line-height: 20px;
font-size: 20px;
font-weight: 300;
color: $color;
}
.uni-numbox .uni-numbox--disabled {
color: #c0c0c0 !important;
/* #ifdef H5 */
cursor: not-allowed;
/* #endif */
}
</style>

53
src/pages/issue/request/issueScanRequest.vue

@ -1,11 +1,12 @@
<template>
<view class="page-wraper" style="background-color: gray;">
<view style="padding: 20rpx; font-size: 30rpx; color: red; background-color: #fff;">说明: 扫描成功后,如果10秒钟不修改数量,自动提交,如果修改数量,需手动点击提交按钮</view>
<view class="" v-if="subList.length==0" style="background-color: #fff;">
<com-blank-view @goScan='goScan()'></com-blank-view>
</view>
<view class="page-main">
<view class="" v-if="subList.length==0">
<com-blank-view @goScan='goScan()'></com-blank-view>
</view>
<scroll-view scroll-y="true" class="page-main-scroll" >
<view style="margin: 20rpx; font-size: 30rpx; color: red;">说明: 扫描成功后,如果10秒钟不修改数量,自动提交,如果修改数量,需手动点击提交按钮</view>
<view v-if="subList.length>0" class="" style="margin: 20rpx;border-radius: 20rpx; background-color: #DCDCE5">
<view class="" style="font-size: 38rpx; padding: 20rpx; padding-bottom: 0rpx;">
@ -32,7 +33,7 @@
物料代码 : {{item.itemCode}}
</view>
<view class="">
单位 : {{item.uom}}
单位 : {{getUomInfo(item.uom)}}
</view>
<view class="">
包装规格 : {{item.packUnit}}
@ -44,8 +45,8 @@
包装数量 :
</view>
<view class="" style="margin-top: 10rpx;">
<numberBox :min="1" :step="1" :max="9999999" @change="calcQty($event,countQty)" :value="item.countQty">
</numberBox>
<numbeIntegerrBox :min="1" :step="1" :max="9999999" @change="calcQty($event,countQty)" :value="item.countQty">
</numbeIntegerrBox>
</view>
</view>
@ -80,6 +81,10 @@
getCallmaterials
} from '@/api/request2.js';
import {
getUomInfo
} from '@/common/directory.js';
import {
calc
} from '@/common/calc.js';
@ -104,7 +109,7 @@
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue'
import winScanPackLevel from '@/mycomponents/scan/winScanPackLevel.vue'
import numberBox from '@/mycomponents/qty/numberBox.vue'
import numbeIntegerrBox from '@/mycomponents/qty/numbeIntegerrBox.vue'
export default {
@ -113,7 +118,7 @@
jobDetailPopup,
comIssueRequestCreator,
winScanPackLevel,
numberBox
numbeIntegerrBox
},
data() {
return {
@ -163,7 +168,16 @@
},
methods: {
getUomInfo(uom) {
let item = getUomInfo(uom);
if (item == '') {
return uom;
} else {
return item.label
}
},
goScan() {
this.stopRefresh();
this.subList=[]
this.detailSource={
subList: []
@ -210,7 +224,6 @@
this.closeScanPopup()
this.$forceUpdate()
this.timerRefresh();
}else {
this.showErrorMessage("未获取到物料信息")
}
@ -246,6 +259,10 @@
},
submit() {
if(this.subList[0].qty==0){
this.showErrorMessage("需求数量不能为0")
return
}
uni.showLoading({
title: "提交中....",
mask: true
@ -253,7 +270,6 @@
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
issueRequestSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成发料申请[" + res.data + "]")
@ -298,14 +314,15 @@
this.first=false
return;
}
console.log("calcQty"+val);
this.stopRefresh()
if (val == 0) {
this.showErrorMessage("数量必须大于0")
}else {
this.subList[0].countQty=val
this.subList[0].qty =this.subList[0].countQty*this.subList[0].callmaterialQty
}
this.subList[0].countQty=val
this.subList[0].qty =this.subList[0].countQty*this.subList[0].callmaterialQty
// if (val == 0) {
// this.showErrorMessage("0")
// }else {
// this.subList[0].countQty=val
// this.subList[0].qty =this.subList[0].countQty*this.subList[0].callmaterialQty
// }
},
}
}

Loading…
Cancel
Save