Browse Source

修改采购收货编辑

hella_vue3
lijuncheng 9 months ago
parent
commit
3b1fcc747d
  1. 4
      src/mycomponents/package/packageCard.vue
  2. 52
      src/mycomponents/package/packageList.vue
  3. 25
      src/mycomponents/qty/recommendQtyEdit.vue
  4. 10
      src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue
  5. 62
      src/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue

4
src/mycomponents/package/packageCard.vue

@ -1,5 +1,5 @@
<template>
<view :class="dataContent.scaned?'scan_view':''" style="background-color: #ffffff; ">
<view :class="dataContent.scaned?'scan_view':''" style="background-color: #fff; ">
<!-- border-bottom: 1upx solid #EEEEEE; -->
<view class="uni-flex uni-row space-between" style="align-items: center">
<!-- uni-inline-item 暂时拿掉-->
@ -23,7 +23,7 @@
</compare-qty>
<view class="uni-flex uni-row center" style="vertical-align:center ;" v-if="isDevlement()">
<text style="font-size: 25rpx;color: #2979ff; width: 10px; " @click="copy">复制</text>
<text style="font-size: 25rpx;color: #2979ff; width: 45rpx; " @click="copy">复制</text>
</view>
</view>
</view>

52
src/mycomponents/package/packageList.vue

@ -1,4 +1,6 @@
<template>
<view class="">
<view class="" v-for="(item,index) in dataContent" :key="item.id">
<uni-collapse ref="collapse2" @change="collapseChange">
<uni-collapse-item :disabled="false">
@ -6,34 +8,55 @@
<package-card :dataContent="item" :isShowLocation="false"
:isShowFromLocation="false"></package-card>
</template>
<view v-for="(pack,index) in item.packList" :key="pack.id" style=" width: 90%;">
<view v-for="(pack,index) in item.packList" :key="pack.id" style=" width: 100%; background-color: antiquewhite;">
<uni-swipe-action-item :right-options="(pack.scaned&&isEdit)?editAndRemoveOptions:removeOptions"
@click="swipeClick($event,pack)">
<package-card :dataContent="pack" :isShowLocation="false" :isShowFromLocation="false"
:isShowToLocation="false" :isShowBatch="false"></package-card>
</uni-swipe-action-item>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</recommend-qty-edit>
</view>
</template>
<script>
import config from '@/static/config.js'
import packageCard from '@/mycomponents/package/packageCard.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import {
getRemoveOption,
getEditRemoveOption
} from '@/common/array.js';
export default {
emits: ["collapseChange"],
components: {
packageCard
packageCard,
recommendQtyEdit
},
data() {
return {
editItem: {},
options: [],
removeOptions: [],
editAndRemoveOptions:[]
}
},
mounted() {
this.removeOptions = getRemoveOption();
this.editAndRemoveOptions =getEditRemoveOption()
},
props: {
dataContent: {
type: Object,
default: {}
default: null
},
isShowContainer: {
type: Boolean,
@ -64,12 +87,29 @@
type: String,
default: '库位'
},
settingParam: {
type: Object,
default: null
},
isEdit:{
type: Boolean,
default: false
}
},
watch: {
},
methods: {
swipeClick(e, item) {
if (e.content.text == "编辑") {
this.edit(item)
}
},
edit(item) {
this.editItem = item;
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
},
collapseChange() {
this.$emit("collapseChange");
this.resizeCollapse();
@ -139,7 +179,11 @@
},
isDevlement() {
return config.isDevelopment;
},
confirm(qty){
this.editItem.handleQty =qty;
}
}
}
</script>

25
src/mycomponents/qty/recommendQtyEdit.vue

@ -14,20 +14,19 @@
<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>
<text>个数 : </text>
<view class="uni-flex uni-row u-col-center">
<uni-number-box @change="calcQty($event,stdCount)" :value="stdCount">
<uni-number-box :min="0" @change="calcQty($event,stdCount)" :value="stdCount">
</uni-number-box>
<std-uom :uom="dataContent.packUnit"></std-uom>
{{getPackUnitName(dataContent.packUnit)}}
</view>
</view>
<u-line />
<view class="uni-flex uni-row space-between padding title u-col-center">
<text>标包量 : </text>
<text>包装规格 : </text>
<view class="uni-flex u-col-center uni-row">
<text>{{Number(dataContent.packQty)}}</text>
<uom :uom="dataContent.uom"></uom>
<packUnit :dataContent="dataContent"></packUnit>
</view>
</view>
@ -56,12 +55,18 @@
</template>
<script>
import {
getUomInfo,
getPackUnitName
} from '@/common/directory.js';
import uom from '@/mycomponents/qty/uom.vue'
import stdUom from '@/mycomponents/qty/stdUom.vue'
import packUnit from '@/mycomponents/qty/packUnit.vue'
export default {
components: {
uom,
stdUom,
packUnit
},
data() {
return {
@ -92,7 +97,7 @@
},
dataContent: {
type: Object,
default: {}
default: null
},
handleQty: {
type: Number,
@ -100,10 +105,14 @@
},
settingParam: {
type: Object,
default: {}
default: null
},
},
methods: {
getPackUnitName(packUnit) {
let unit = getPackUnitName(packUnit);
return unit;
},
checkNum(e) {
let value = e.detail.value;
let dot = value.indexOf('.'); //

10
src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue

@ -1,12 +1,12 @@
<template>
<view class="" style="background-color: #fff;">
<uni-collapse ref="collapse" @change="" style="height: 500px;">
<uni-collapse ref="collapse" style="height: 500px;">
<uni-collapse-item :open="true">
<template v-slot:title>
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowPackUnit="false"></itemCompareQty>
</template>
<package-list :dataContent="dataContent.subList" @collapseChange="collapseChange"></package-list>
<package-list :dataContent="dataContent.subList" :isEdit="settingParam.allowModifyQty=='TRUE'" :settingParam="settingParam" @collapseChange="collapseChange"></package-list>
</uni-collapse-item>
</uni-collapse>
@ -49,15 +49,15 @@
props: {
dataContent: {
type: Object,
default: {}
default: null
},
settingParam: {
type: Object,
default: {}
default: null
},
locationTypeList: {
type: Object,
default: {}
default: null
},

62
src/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue

@ -1,14 +1,12 @@
<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 }"
:style="{color}">-</text>
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{color}">-</text>
</view>
<input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" type="number"
:focus="focus" v-model="inputValue" :style="{background, color}" @input="checkNum" :maxlength="maxlength" />
v-model="inputValue" :style="{background, color}" />
<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 }"
:style="{color}">+</text>
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{color}">+</text>
</view>
</view>
</template>
@ -28,9 +26,7 @@
* @event {Function} focus 输入框聚焦时触发的事件参数为 event 对象
* @event {Function} blur 输入框失焦时触发的事件参数为 event 对象
*/
import {
Decimal
} from 'decimal.js'; //
export default {
name: "UniNumberBox",
emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'],
@ -66,63 +62,30 @@
disabled: {
type: Boolean,
default: false
},
focus: {
type: Boolean,
default: true
}
},
data() {
return {
inputValue: 0,
maxlength: 10
inputValue: 0
};
},
watch: {
value(val) {
this.inputValue = this.add(this.inputValue, val)
this.inputValue = +val;
},
modelValue(val) {
this.inputValue = this.add(this.inputValue, val)
this.inputValue = +val;
}
},
created() {
if (this.value === 1) {
this.inputValue = this.add(this.inputValue, this.modelValue)
this.inputValue = +this.modelValue;
}
if (this.modelValue === 1) {
this.inputValue = this.add(this.inputValue, this.value)
this.inputValue = +this.value;
}
},
methods: {
add(num1, num2) {
return new Decimal(num1).add(new Decimal(num2))
},
sub(num1, num2) {
return new Decimal(num1).sub(new Decimal(num2))
},
mul(num1,num2) {
return new Decimal(num1).mul(new Decimal(num2))
},
div(num1,num2) {
return new Decimal(num1).div(new Decimal(num2))
},
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;
}
},
_calcValue(type) {
if (this.disabled) {
return;
@ -131,7 +94,7 @@
let value = this.inputValue * scale;
let step = this.step * scale;
if (type === "minus") {
value = this.sub(value - step)
value -= step;
if (value < (this.min * scale)) {
return;
}
@ -141,8 +104,7 @@
}
if (type === "plus") {
value = this.add(value, step)
value += step;
if (value > (this.max * scale)) {
return;
}
@ -221,7 +183,7 @@
.uni-numbox__value {
margin: 0 2px;
background-color: $bg;
width: 100rpx;
width: 40px;
height: $box-height;
text-align: center;
font-size: 14px;

Loading…
Cancel
Save