Browse Source

修改采购收货编辑

hella_vue3
lijuncheng 6 months ago
parent
commit
3b1fcc747d
  1. 4
      src/mycomponents/package/packageCard.vue
  2. 78
      src/mycomponents/package/packageList.vue
  3. 25
      src/mycomponents/qty/recommendQtyEdit.vue
  4. 10
      src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue
  5. 142
      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>

78
src/mycomponents/package/packageList.vue

@ -1,17 +1,26 @@
<template>
<view class="" v-for="(item,index) in dataContent" :key="item.id">
<uni-collapse ref="collapse2" @change="collapseChange">
<uni-collapse-item :disabled="false">
<template v-slot:title>
<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%;">
<package-card :dataContent="pack" :isShowLocation="false" :isShowFromLocation="false"
:isShowToLocation="false" :isShowBatch="false"></package-card>
</view>
</uni-collapse-item>
</uni-collapse>
<view class="">
<view class="" v-for="(item,index) in dataContent" :key="item.id">
<uni-collapse ref="collapse2" @change="collapseChange">
<uni-collapse-item :disabled="false">
<template v-slot:title>
<package-card :dataContent="item" :isShowLocation="false"
:isShowFromLocation="false"></package-card>
</template>
<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>
@ -19,21 +28,35 @@
<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,13 +179,17 @@
},
isDevlement() {
return config.isDevelopment;
},
confirm(qty){
this.editItem.handleQty =qty;
}
}
}
</script>
<style>
.open{
.open {
/* background-color: green !important; */
padding-top: 0px !important;
}

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
},

142
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,54 +104,53 @@
}
if (type === "plus") {
value = this.add(value, step)
value += step;
if (value > (this.max * scale)) {
return;
}
if (value < (this.min * scale)) {
value = this.min * scale
}
}
if (value > (this.max * scale)) {
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
// TODO vue2
this.$emit("input", +this.inputValue);
// TODO vue3
this.$emit("update:modelValue", +this.inputValue);
},
_getDecimalScale() {
let scale = 1;
//
if (~~this.step !== this.step) {
scale = Math.pow(10, String(this.step).split(".")[1].length);
}
return scale;
},
_onBlur(event) {
this.$emit('blur', event)
let value = event.detail.value;
if (!value) {
// this.inputValue = 0;
return;
}
if (value < (this.min * scale)) {
value = this.min * scale
value = +value;
if (value > this.max) {
value = this.max;
} else if (value < this.min) {
value = this.min;
}
const scale = this._getDecimalScale();
this.inputValue = value.toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
this.$emit("input", +this.inputValue);
},
_onFocus(event) {
this.$emit('focus', event)
}
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
// TODO vue2
this.$emit("input", +this.inputValue);
// TODO vue3
this.$emit("update:modelValue", +this.inputValue);
},
_getDecimalScale() {
let scale = 1;
//
if (~~this.step !== this.step) {
scale = Math.pow(10, String(this.step).split(".")[1].length);
}
return scale;
},
_onBlur(event) {
this.$emit('blur', event)
let value = event.detail.value;
if (!value) {
// this.inputValue = 0;
return;
}
value = +value;
if (value > this.max) {
value = this.max;
} else if (value < this.min) {
value = this.min;
}
const scale = this._getDecimalScale();
this.inputValue = value.toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
this.$emit("input", +this.inputValue);
},
_onFocus(event) {
this.$emit('focus', event)
}
}
};
</script>
<style lang="scss" scoped>
@ -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