Browse Source

修改采购收货编辑

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

80
src/mycomponents/package/packageList.vue

@ -1,17 +1,26 @@
<template> <template>
<view class="" v-for="(item,index) in dataContent" :key="item.id"> <view class="">
<uni-collapse ref="collapse2" @change="collapseChange">
<uni-collapse-item :disabled="false"> <view class="" v-for="(item,index) in dataContent" :key="item.id">
<template v-slot:title> <uni-collapse ref="collapse2" @change="collapseChange">
<package-card :dataContent="item" :isShowLocation="false" <uni-collapse-item :disabled="false">
:isShowFromLocation="false"></package-card> <template v-slot:title>
</template> <package-card :dataContent="item" :isShowLocation="false"
<view v-for="(pack,index) in item.packList" :key="pack.id" style=" width: 90%;"> :isShowFromLocation="false"></package-card>
<package-card :dataContent="pack" :isShowLocation="false" :isShowFromLocation="false" </template>
:isShowToLocation="false" :isShowBatch="false"></package-card> <view v-for="(pack,index) in item.packList" :key="pack.id" style=" width: 100%; background-color: antiquewhite;">
</view> <uni-swipe-action-item :right-options="(pack.scaned&&isEdit)?editAndRemoveOptions:removeOptions"
</uni-collapse-item> @click="swipeClick($event,pack)">
</uni-collapse> <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> </view>
</template> </template>
@ -19,21 +28,35 @@
<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();
@ -82,7 +122,7 @@
}) })
r.resize(); r.resize();
}) })
}); });
this.$forceUpdate(); this.$forceUpdate();
}, },
@ -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
}, },

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