CancelAfterVerification.vue
2.66 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
107
108
109
<template>
<GLDialog
mode="mid"
class="muti"
:title="cancelObj.title"
:before-close="handleClose"
@onOk="handleConfirm"
@onCancel="handleClose"
:visible.sync="cancelObj.show"
append-to-body
>
<el-form :model="form" ref="form" label-width="120px">
<!-- 基本信息 -->
<div v-for="(section, index) in cancelObj.infoSections" :key="index" class="form-section">
<h3 class="section-title">{{ section.title }}</h3>
<el-row :gutter="20">
<el-col v-for="(item, index) in section.items" :key="index" :span="12">
<div class="info-field">
<span class="label">{{ item.label }}:</span>
<span class="value" :title="item.value">{{ item.value }}</span>
</div>
</el-col>
</el-row>
</div>
<!-- 快递信息 -->
<div class="form-section">
<h3 class="section-title">核销信息</h3>
<el-form-item label="核销码" prop="cancelNumber" :rules="[{ required: true, message: '核销码不能为空', trigger: 'blur' }]">
<el-input v-model="form.cancelNumber" maxlength="50" show-word-limit></el-input>
</el-form-item>
</div>
</el-form>
</GLDialog>
</template>
<script>
import {afterRangePickerOptions} from "../../RedEnvelopeConfig/edit";
export default {
name: "CancelAfterVerification",
props: {
cancelObj: {
type: Object,
default: () => { }
},
},
data () {
return {
afterRangePickerOptions,
formItemWidth: 'width: 284px;',
size: 'small',
disabled: false,
form: {
cancelNumber: '',
}
}
},
methods:{
handleConfirm(){
this.validateForm().then(() => {
this.$emit('submit', {
...this.form,id:this.cancelObj.id
});
this.handleClose();
}).catch(error => {
this.$message.error(error.message);
});
},
validateForm() {
return new Promise((resolve, reject) => {
this.$refs.form.validate((valid) => {
if (valid) {
resolve();
} else {
reject(new Error('请填写核销码'));
}
});
});
},
handleClose(){
this.$emit('update:cancelObj', {show:false});
this.form = {
cancelNumber : ''
}
}
}
}
</script>
<style scoped lang="scss">
.info-field {
margin-bottom: 10px;
line-height: 16px;
font-size: 14px;
padding: 10px 40px;
border-radius: 4px;
display: flex;
.label {
color: #666666;
}
.value {
width: 170px;
white-space: nowrap; /* 防止内容换行 */
overflow: hidden;
text-overflow: ellipsis;
}
}
</style>