inventoryNumDialog.vue
2.38 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!-- 盘点 -->
<template>
<d2-dialog title="盘点"
:is-visible="inventoryNumVisible"
class="inventoryNumDailog"
width="30%"
@closeDialog="handleClose"
@confirmDialog="handleAddConfirm">
<el-form ref="inventoryNumForm"
:model="infoForm"
:rules="formRules"
label-width="120px">
<el-form-item label="盘点数量:"
prop="inventoryNum">
<el-input placeholder="请输入盘点数量"
v-model="infoForm.inventoryNum"
style="width:250px"
clearable
@input="handleUpgradeNum">
</el-input>
</el-form-item>
</el-form>
</d2-dialog>
</template>
<script>
import { queryGoodsCategoryBySceneId, editFeaturedGoods } from '@api/sceneCategory'
import { deepClone } from '@/common/util'
import { limitPrice } from '@/common/format'
import BigNumber from 'bignumber.js'
export default {
name: 'InventoryNumDialog',
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
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>