Browse Source

mycomponents/qty 文件迁移 8/8-10/25

hella_vue3
王志国 4 weeks ago
parent
commit
5f53730dec
  1. 18
      src/mycomponents/qty/balanceQtyEdit.vue
  2. 2
      src/mycomponents/qty/countQtyEdit.vue
  3. 161
      src/mycomponents/qty/qtyEdit.vue
  4. 12
      src/mycomponents/qty/recommendQty.vue

18
src/mycomponents/qty/balanceQtyEdit.vue

@ -23,7 +23,7 @@
<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> <text>{{ Number(dataContent.packQty) || 0}}</text>
<uomCom :uom="dataContent.uom"></uomCom> <uomCom :uom="dataContent.uom"></uomCom>
</view> </view>
</view> </view>
@ -32,7 +32,9 @@
<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 uni-row uni-center" style="align-items: center"> <view class="uni-flex uni-row uni-center" style="align-items: center">
<input class="qty_input" v-model="allQty" :focus="true" type="number" @confirm="confirm()" @input="checkNum" :maxlength="maxlength" disabled :style="{background:'#f5f5f5',color:'#bbbbbb'}" /> <input class="qty_input" v-model="allQty" :focus="true" type="number"
@confirm="confirm()" @input="checkNum" :maxlength="maxlength"
:disabled="!allowEditQty" :style="allowEditQty?{}:{background:'#f5f5f5',color:'#bbbbbb'}"/>
<uomCom :uom="dataContent.uom"></uomCom> <uomCom :uom="dataContent.uom"></uomCom>
</view> </view>
</view> </view>
@ -86,7 +88,15 @@ const props = defineProps({
allowEditStatus: { allowEditStatus: {
type: Boolean, type: Boolean,
default: false default: false
} },
queryBalance: {
type: Boolean,
default: true
},
allowEditQty: {
type: Boolean,
default: true
},
}) })
const allQty = ref(0) const allQty = ref(0)
const stdCount = ref(0) const stdCount = ref(0)
@ -148,7 +158,7 @@ const calcQty = (e) => {
} }
const setValue = () => { const setValue = () => {
const balanceQty = Number(dataContent.value.balanceQty) const balanceQty = Number(dataContent.value.balanceQty)
if (allQty.value < 0) { if (allQty.value <= 0) {
comMessageRef.value.showErrorMessage('数量必须等于0', (res) => { comMessageRef.value.showErrorMessage('数量必须等于0', (res) => {
if (res) { if (res) {
allQty.value = balanceQty allQty.value = balanceQty

2
src/mycomponents/qty/countQtyEdit.vue

@ -27,7 +27,7 @@
<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> <text>{{ Number(dataContent.packQty) || 0}}</text>
<uom :uom="dataContent.uom"></uom> <uom :uom="dataContent.uom"></uom>
</view> </view>
</view> </view>

161
src/mycomponents/qty/qtyEdit.vue

@ -0,0 +1,161 @@
<template>
<view class="">
<uni-popup ref="popup">
<view class="uni-flex uni-column pop_customer">
<view class="" style="padding:10rpx">
<view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx">
<view class="" style="font-size: 35rpx;">
{{title}}
</view>
<image style="width: 35rpx;height: 35rpx;" src="/static/icons/icons_close.svg"
@click="closeEditPopup"></image>
</view>
<view class='split_line'></view>
<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 u-col-center">
<text>数量 : </text>
<view class="uni-flex uni-row uni-center" style="align-items: center;">
<input class="qty_input" v-model="allQty" :focus="true" type="number"
@confirm="confirm()" />
<uom :uom="dataContent.uom"></uom>
</view>
</view>
</view>
</view>
</view>
<view class="uni-flex uni-row hide_border">
<button class="btn_edit_big_cancle" hover-class="btn_edit_big_after" @click="cancel()">取消</button>
<button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button>
</view>
</view>
</uni-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import uom from '@/mycomponents/qty/uom.vue'
import StdUom from '@/mycomponents/qty/StdUom.vue'
import balanceStatus from '@/mycomponents/status/balanceStatus.vue'
// import {
// getInspectReasonList
// } from '@/common/directory.js';
export default {
components: {
uom,
StdUom,
balanceStatus,
},
data() {
return {
allQty: 0,
stdCount: 1,
stateData: 0,
balanceQty: 0,
inventoryStatus: "",
originalInventoryStatus: "",
dataContent: {},
handleQty: 0,
FailedQty: 0,
reasonList: [],
reason: ""
}
},
watch: {
},
created() {
// this.reasonList = getInspectReasonList();
},
props: {
title: {
type: String,
default: "编辑数量"
},
settingParam: {
type: Object,
default: {}
},
isShowStatus: {
type: Boolean,
default: true
},
allowEditStatus: {
type: Boolean,
default: false
}
},
methods: {
openEditPopup(item, handleQty) {
this.dataContent = item
this.allQty = Number(handleQty)
setTimeout(res => {
this.$refs.popup.open('bottom')
}, 100)
},
closeEditPopup() {
this.$refs.popup.close()
},
confirm() {
this.setValue();
},
cancel() {
this.dataContent.inventoryStatus = this.originalInventoryStatus;
this.closeEditPopup();
},
calcQty(val) {
this.allQty = val * Number(this.dataContent.packQty);
},
setValue() {
var balanceQty = Number(this.dataContent.qty);
if (this.allQty == 0) {
this.$refs.comMessage.showConfirmWarningModal('数量必须大于0',
res => {
this.allQty = balanceQty;
})
} else if (this.allQty > balanceQty) {
this.$refs.comMessage.showConfirmWarningModal('数量[' + this.allQty + ']不允许大于库存数量[' + balanceQty + ']',
res => {
this.allQty = balanceQty;
})
} else {
console.log(33,this.allQty)
this.$emit("confirm", Number(this.allQty));
this.closeEditPopup();
}
},
updateStatus(value) {
this.inventoryStatus = value
console.log(this.inventoryStatus)
}
}
}
</script>
<style lang="scss">
.uni-popup .uni-popup__wrapper {
width: 100% !important;
padding: 30rpx;
}
.hide_border {
button {
border: none;
}
button::after {
border: none;
}
}
.title {
font-size: 30rpx;
}
</style>

12
src/mycomponents/qty/recommendQty.vue

@ -2,7 +2,7 @@
<view> <view>
<status v-if="isShowStatus" :status="dataContent.inventoryStatus"></status> <status v-if="isShowStatus" :status="dataContent.inventoryStatus"></status>
<view class="u-flex u-row center"> <view class="u-flex u-row center" v-if="isShowCount">
<view class="text_recommend"> <view class="text_recommend">
{{ Number(dataContent.qty) }} {{ Number(dataContent.qty) }}
</view> </view>
@ -58,10 +58,18 @@ const props = defineProps({
isShowPackCount: { isShowPackCount: {
type: Boolean, type: Boolean,
default: true default: true
},
isShowCount: {
type: Boolean,
default: true
} }
}) })
const calc = (qty, packQty) => { const calc = (qty, packQty) => {
return Math.ceil(Number(qty) / Number(packQty)) if(qty&&packQty){
return Math.ceil(Number(qty) / Number(packQty));
}else{
return 0
}
} }
</script> </script>

Loading…
Cancel
Save