Browse Source

修改采购收货编辑

hella_vue3
lijuncheng 8 months ago
parent
commit
3b1fcc747d
  1. 4
      src/mycomponents/package/packageCard.vue
  2. 54
      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> <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; --> <!-- border-bottom: 1upx solid #EEEEEE; -->
<view class="uni-flex uni-row space-between" style="align-items: center"> <view class="uni-flex uni-row space-between" style="align-items: center">
<!-- uni-inline-item 暂时拿掉--> <!-- uni-inline-item 暂时拿掉-->
@ -23,7 +23,7 @@
</compare-qty> </compare-qty>
<view class="uni-flex uni-row center" style="vertical-align:center ;" v-if="isDevlement()"> <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> </view>
</view> </view>

54
src/mycomponents/package/packageList.vue

@ -1,4 +1,6 @@
<template> <template>
<view class="">
<view class="" v-for="(item,index) in dataContent" :key="item.id"> <view class="" v-for="(item,index) in dataContent" :key="item.id">
<uni-collapse ref="collapse2" @change="collapseChange"> <uni-collapse ref="collapse2" @change="collapseChange">
<uni-collapse-item :disabled="false"> <uni-collapse-item :disabled="false">
@ -6,34 +8,55 @@
<package-card :dataContent="item" :isShowLocation="false" <package-card :dataContent="item" :isShowLocation="false"
:isShowFromLocation="false"></package-card> :isShowFromLocation="false"></package-card>
</template> </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" <package-card :dataContent="pack" :isShowLocation="false" :isShowFromLocation="false"
:isShowToLocation="false" :isShowBatch="false"></package-card> :isShowToLocation="false" :isShowBatch="false"></package-card>
</uni-swipe-action-item>
</view> </view>
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </uni-collapse>
</view> </view>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</recommend-qty-edit>
</view>
</template> </template>
<script> <script>
import config from '@/static/config.js' import config from '@/static/config.js'
import packageCard from '@/mycomponents/package/packageCard.vue' import packageCard from '@/mycomponents/package/packageCard.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import {
getRemoveOption,
getEditRemoveOption
} from '@/common/array.js';
export default { export default {
emits: ["collapseChange"], emits: ["collapseChange"],
components: { components: {
packageCard packageCard,
recommendQtyEdit
}, },
data() { data() {
return { return {
editItem: {},
options: [],
removeOptions: [],
editAndRemoveOptions:[]
} }
}, },
mounted() {
this.removeOptions = getRemoveOption();
this.editAndRemoveOptions =getEditRemoveOption()
},
props: { props: {
dataContent: { dataContent: {
type: Object, type: Object,
default: {} default: null
}, },
isShowContainer: { isShowContainer: {
type: Boolean, type: Boolean,
@ -64,12 +87,29 @@
type: String, type: String,
default: '库位' default: '库位'
}, },
settingParam: {
type: Object,
default: null
},
isEdit:{
type: Boolean,
default: false
}
}, },
watch: { watch: {
}, },
methods: { 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() { collapseChange() {
this.$emit("collapseChange"); this.$emit("collapseChange");
this.resizeCollapse(); this.resizeCollapse();
@ -139,13 +179,17 @@
}, },
isDevlement() { isDevlement() {
return config.isDevelopment; return config.isDevelopment;
},
confirm(qty){
this.editItem.handleQty =qty;
} }
} }
} }
</script> </script>
<style> <style>
.open{ .open {
/* background-color: green !important; */ /* background-color: green !important; */
padding-top: 0px !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" style="background-color: white; height:60%;">
<view class="uni-flex uni-column "> <view class="uni-flex uni-column ">
<view class="uni-flex uni-row space-between padding title "> <view class="uni-flex uni-row space-between padding title ">
<text>包个数 : </text> <text>个数 : </text>
<view class="uni-flex uni-row u-col-center"> <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> </uni-number-box>
<std-uom :uom="dataContent.packUnit"></std-uom> {{getPackUnitName(dataContent.packUnit)}}
</view> </view>
</view> </view>
<u-line /> <u-line />
<view class="uni-flex uni-row space-between padding title u-col-center"> <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"> <view class="uni-flex u-col-center uni-row">
<text>{{Number(dataContent.packQty)}}</text> <packUnit :dataContent="dataContent"></packUnit>
<uom :uom="dataContent.uom"></uom>
</view> </view>
</view> </view>
@ -56,12 +55,18 @@
</template> </template>
<script> <script>
import {
getUomInfo,
getPackUnitName
} from '@/common/directory.js';
import uom from '@/mycomponents/qty/uom.vue' import uom from '@/mycomponents/qty/uom.vue'
import stdUom from '@/mycomponents/qty/stdUom.vue' import stdUom from '@/mycomponents/qty/stdUom.vue'
import packUnit from '@/mycomponents/qty/packUnit.vue'
export default { export default {
components: { components: {
uom, uom,
stdUom, stdUom,
packUnit
}, },
data() { data() {
return { return {
@ -92,7 +97,7 @@
}, },
dataContent: { dataContent: {
type: Object, type: Object,
default: {} default: null
}, },
handleQty: { handleQty: {
type: Number, type: Number,
@ -100,10 +105,14 @@
}, },
settingParam: { settingParam: {
type: Object, type: Object,
default: {} default: null
}, },
}, },
methods: { methods: {
getPackUnitName(packUnit) {
let unit = getPackUnitName(packUnit);
return unit;
},
checkNum(e) { checkNum(e) {
let value = e.detail.value; let value = e.detail.value;
let dot = value.indexOf('.'); // let dot = value.indexOf('.'); //

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

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

Loading…
Cancel
Save