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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
| <template>
| <!--
| 作者:luoyiming
| 时间:2020-07-10
| 描述:插件中心-砍价-活动列表-修改砍价活动
| -->
| <div class="product-add">
| <!--form表单-->
| <el-form size="small" ref="form" :model="form" label-width="200px">
|
| <!--基本信息-->
| <Basic></Basic>
|
| <!--活动时间-->
| <Datetime></Datetime>
|
| <!--其它设置-->
| <Other></Other>
|
| </el-form>
|
| <!--提交-->
| <div class="common-button-wrapper">
| <el-button size="small" @click="cancelFunc">取消</el-button>
| <el-button size="small" type="primary" @click="onSubmit" :disabled="loading">提交</el-button>
| </div>
|
| </div>
| </template>
|
| <script>
| import BargainApi from '@/api/bargain.js';
| import Basic from './part/Basic.vue';
| import Datetime from './part/Datetime.vue';
| import Other from './part/Other.vue';
| import {mergeTable} from '@/utils/table.js'
| export default {
| components: {
| Basic,
| Datetime,
| Other
| },
| data() {
| return {
| /*是否正在加载*/
| loading:false,
| /*form表单对象*/
| form: {
| /*活动名称*/
| title: '',
| /*广告图片ID*/
| image_id: 0,
| /*活动广告图*/
| file_path: '',
| /*活动时间*/
| active_time: '',
| /*报名截止日期*/
| join_end_time: '',
| /*砍价有效期*/
| together_time: 0,
| /*状态*/
| status: 1,
| /*购买条件*/
| conditions: 1,
| /*活动排序*/
| sort: 1,
| }
| };
| },
| provide: function() {
| return {
| form: this.form,
| type:'edit'
| };
| },
| created() {
| this.form.bargain_activity_id = this.$route.query.bargain_activity_id;
| this.getData();
| },
| methods: {
|
| /*获取编辑数据*/
| getData() {
| let self = this;
| self.loading = true;
| BargainApi.editActive(
| {
| bargain_activity_id: self.form.bargain_activity_id
| },
| true
| )
| .then(res => {
| let tempForm=res.data.detail;
| tempForm.bargain_activity_id=self.form.bargain_activity_id;
| Object.assign(self.form, tempForm);
| self.loading = false;
| })
| .catch(error => {
| self.loading = false;
| });
| },
|
| /*修改*/
| onSubmit() {
| let self = this;
| self.$refs.form.validate(valid => {
| if (valid) {
| let params = self.form;
| self.loading = true;
| BargainApi.saveActive(params, true)
| .then(data => {
| self.$message({
| message: '恭喜你,砍价活动修改成功',
| type: 'success'
| });
| self.$router.push('/plus/bargain/index');
| })
| .catch(error => {});
| }
| });
| },
| /*取消*/
| cancelFunc() {
| this.$router.back(-1);
| }
| }
| };
| </script>
|
| <style lang="scss" scoped>
| .product-add {
| padding-bottom: 50px;
| }
|
| .tips {
| color: #ccc;
| }
|
| .img {
| margin-top: 10px;
| }
| </style>
|
|