inventoryNumDialog.vue
2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!-- 盘点 -->
<template>
<GLDialog title="盘点" :visible.sync="inventoryNumVisible" class="inventoryNumDailog" @onCancel="handleClose"
@onOk="handleAddConfirm">
<div class="gl-form-page gl-form-min">
<el-form ref="inventoryNumForm" :model="infoForm" :rules="formRules" label-width="154px" size="small">
<el-form-item label="盘点数量:" prop="inventoryNum">
<el-input placeholder="请输入盘点数量" v-model="infoForm.inventoryNum" clearable @input="handleUpgradeNum"></el-input>
</el-form-item>
</el-form>
</div>
</GLDialog>
</template>
<script>
import { limitPrice } from '@/common/format'
import BigNumber from 'bignumber.js'
export default {
name: 'InventoryNumDialog',
data() {
return {
infoForm: {
inventoryNum: ''
},
oldVal: {
inventoryNum: ''
},
formRules: {
inventoryNum: [{ required: true, message: '请输入盘点数量', trigger: 'change' }]
},
selectLoading: false,
// 基本数据
baseData: {
noRelatcategoryList: []
}
}
},
props: {
inventoryNumVisible: {
type: Boolean,
default: false
},
recordInfo: {
type: Object,
default: () => { }
}
},
watch: {},
created() { },
components: {},
computed: {},
mounted() { },
methods: {
handleUpgradeNum(newVal) {
this.infoForm.inventoryNum = limitPrice(newVal, this.oldVal.inventoryNum, 8, 2)
this.oldVal.inventoryNum = this.infoForm.inventoryNum
},
handleAddConfirm() {
this.$refs.inventoryNumForm.validate(valid => {
if (valid) {
this.recordInfo.checkStock = parseFloat(this.infoForm.inventoryNum)
this.recordInfo.profitAndLoss = BigNumber(parseFloat(this.infoForm.inventoryNum)).minus(parseFloat(this.recordInfo.stock)).toString()
this.handleClose(this.recordInfo)
}
})
},
handleClose(info) {
this.$emit('dialogClose', info)
}
}
}
</script>
<style ></style>