You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
7.3 KiB

1 year ago
<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>
<u-line />
<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>
<view class="uni-flex uni-row u-col-center">
<uni-number-box @change="calcQty($event,stdCount)" :value="stdCount">
</uni-number-box>
<view class="std_pack">
{{getStdPackUnitInfo(dataContent.stdPackUnit)}}
</view>
</view>
</view>
<u-line />
<view class="uni-flex uni-row space-between padding title u-col-center">
<text>标包量 : </text>
<view class="uni-flex u-col-center uni-row">
<text>{{Number(dataContent.stdPackQty)}}</text>
<uom :uom="dataContent.uom"></uom>
</view>
</view>
<u-line />
<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"
@mousedown="mousedown" />
<uom :uom="dataContent.uom"></uom>
</view>
</view>
<u-line />
<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;">
<text class="text_recommend">{{Number(dataContent.balanceQty)}}</text>
<uom :uom="dataContent.uom"></uom>
</view>
</view>
<u-line />
<view v-if="isShowStatus" class="uni-flex uni-row space-between title"
style="align-items: center; padding-left: 20rpx;">
<text>库存状态 : </text>
<view class="uni-flex uni-row uni-center" style="align-items: center;">
<balanceStatus ref="balanceStatus" :status="inventoryStatus" :allowEdit='false'
@updateStatus="updateStatus" @onOpen="clickState">
</balanceStatus>
</view>
</view>
<u-line />
</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 v-if="showConfirmCountdown" class="btn_edit_big_confirm" hover-class="btn_edit_big_after"
@click="confirm()">确认({{seconds}}s关闭)</button>
<button v-else 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 balanceStatus from '@/mycomponents/status/balanceStatus.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import {
getStdPackUnitInfo
} from "@/common/directory.js"
import {
getInventoryStatusName
} from '@/common/directory.js';
export default {
components: {
uom,
balanceStatus,
comMessage
},
data() {
return {
allQty: 0,
stdCount: 1,
stateData: 0,
balanceQty: 0,
inventoryStatus: "",
originalInventoryStatus: "",
dataContent: {},
handleQty: 0,
seconds: 0,
timer: {},
showConfirmCountdown: false,
detaiList: []
}
},
watch: {
},
created() {
},
props: {
title: {
type: String,
default: "编辑数量"
},
settingParam: {
type: Object,
default: {}
},
isShowStatus: {
type: Boolean,
default: true
},
allowEditStatus: {
type: Boolean,
default: false
},
},
methods: {
openEditPopup(item, detaiList) {
this.dataContent = item
// this.originalInventoryStatus = this.dataContent.inventoryStatus
// this.inventoryStatus = this.dataContent.toInventoryStatus
this.inventoryStatus = this.dataContent.inventoryStatus;
this.allQty = Number(this.dataContent.qty)
this.showConfirmCountdown = false;
this.detaiList = detaiList
this.$refs.popup.open('bottom')
clearInterval(this.timer)
},
openEditPopupShowSeconds(item, detaiList) {
this.dataContent = item;
// this.originalInventoryStatus = this.dataContent.inventoryStatus
// this.inventoryStatus = this.dataContent.toInventoryStatus
this.inventoryStatus = this.dataContent.inventoryStatus;
this.allQty = Number(this.dataContent.qty);
this.showConfirmCountdown = true;
this.detaiList = detaiList;
this.$refs.popup.open('bottom')
this.startTimer()
},
mousedown() {
this.showConfirmCountdown = false;
clearInterval(this.timer)
},
clickState() {
this.showConfirmCountdown = false;
clearInterval(this.timer)
},
closeEditPopup() {
clearInterval(this.timer)
this.$refs.popup.close()
},
confirm() {
this.setValue();
},
cancel() {
this.dataContent.inventoryStatus = this.originalInventoryStatus;
this.closeEditPopup();
},
startTimer() {
this.seconds = 3;
clearInterval(this.timer)
this.timer = setInterval(() => {
this.seconds--
if (this.seconds <= 0) {
this.cancel()
return
}
}, 1000)
},
calcQty(val) {
this.allQty = val * this.dataContent.stdPackQty;
},
setValue() {
this.dataContent.qty = Number(this.allQty)
this.$emit("confirm");
this.closeEditPopup();
// this.callback();
},
callback() {
//查询列表中是否存在
var item = this.detaiList.find(
detail => {
if (detail.record == undefined) {
if (detail.packingNumber == this.dataContent.packingNumber &&
detail.batch == this.dataContent.batch &&
detail.inventoryStatus == this.inventoryStatus) {
return detail;
}
} else {
if (detail.record.packingNumber == this.dataContent.packingNumber &&
detail.record.batch == this.dataContent.batch &&
detail.record.inventoryStatus == this.inventoryStatus) {
return detail;
}
}
})
if (item == undefined) {
this.dataContent.inventoryStatus = this.inventoryStatus
this.dataContent.qty = Number(this.allQty)
this.$emit("confirm");
this.closeEditPopup();
} else {
this.$refs.comMessage.showErrorMessage("箱码[" + item.packingNumber + "]批次[" + item.batch + "]" + "状态[" +
getInventoryStatusName(item.inventoryStatus) + "]已经在列表中", res => {
})
}
},
updateStatus(value) {
this.inventoryStatus = value
console.log(this.inventoryStatus)
},
getStdPackUnitInfo(value) {
return getStdPackUnitInfo(value).name
}
}
}
</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>