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
| <template>
| <div>
| <el-dialog title="添加" width="600px" class="icon-dialog" :visible.sync="show" @open="open" :before-close="closeForm" append-to-body>
| <el-form :size="size" ref="form" :model="form" :rules="rules" :label-width="$store.getters.device == 'mobile'?'90px':'16%'">
| <el-row >
| <el-col :span="24">
| <el-form-item label="可兑次数" prop="num">
| <el-input v-model="form.num" autoComplete="off" clearable placeholder="请输入可兑次数"></el-input>
| </el-form-item>
| </el-col>
| </el-row>
| </el-form>
| <div slot="footer" class="dialog-footer">
| <el-button :size="size" :loading="loading" type="primary" @click="submit" >
| <span v-if="!loading">确 定</span>
| <span v-else>提 交 中...</span>
| </el-button>
| <el-button :size="size" @click="closeForm">取 消</el-button>
| </div>
| </el-dialog>
| </div>
| </template>
|
| <script>
| export default {
| components:{
| },
| props: {
| show: {
| type: Boolean,
| default: false
| },
| size: {
| type: String,
| default: 'small'
| },
| },
| data(){
| return {
| form: {
| code:'',
| num:'',
| },
| loading:false,
| rules: {
| }
| }
| },
| methods: {
| open(){
| },
| submit(){
| this.$refs['form'].validate(valid => {
| if(valid) {
| this.loading = true
| this.$axios.post('/admin/Redemption/add',this.form).then(res => {
| if(res.data.status == 200){
| this.$message({message: res.data.msg, type: 'success'})
| this.$emit('refesh_list')
| this.closeForm()
| }else{
| this.loading = false
| this.$message.error(res.data.msg)
| }
| }).catch(()=>{
| this.loading = false
| })
| }
| })
| },
| closeForm(){
| this.$emit('update:show', false)
| this.loading = false
| if (this.$refs['form']!==undefined) {
| this.$refs['form'].resetFields()
| }
| },
| }
| }
| </script>
|
| <style lang="scss">
| @import '@/assets/scss/common.scss'
| </style>
|
|