|
@@ -0,0 +1,200 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="subPage">
|
|
3
|
+ <div class="content">
|
|
4
|
+ <div class="input-div">
|
|
5
|
+ <div style="float: left; font-size: 20px;">
|
|
6
|
+ 活动名称:
|
|
7
|
+ </div>
|
|
8
|
+ <div style="float: left; margin-left: 30px;">
|
|
9
|
+ <template>
|
|
10
|
+ <el-input v-model="activityName" placeholder="请输入内容" style="width: 300px;"></el-input>
|
|
11
|
+ </template>
|
|
12
|
+ </div>
|
|
13
|
+ </div>
|
|
14
|
+ <div class="input-div">
|
|
15
|
+ <div style="float: left; font-size: 20px;">
|
|
16
|
+ 活动类型:
|
|
17
|
+ </div>
|
|
18
|
+ <div style="float: left; margin-left: 30px;">
|
|
19
|
+ <template>
|
|
20
|
+ <el-select v-model="regValue" placeholder="请选择" style="width: 300px;">
|
|
21
|
+ <el-option
|
|
22
|
+ v-for="item in regOptions"
|
|
23
|
+ :key="item.regValue"
|
|
24
|
+ :label="item.label"
|
|
25
|
+ :value="item.regValue">
|
|
26
|
+ </el-option>
|
|
27
|
+ </el-select>
|
|
28
|
+ </template>
|
|
29
|
+ </div>
|
|
30
|
+ </div>
|
|
31
|
+ <div class="input-div">
|
|
32
|
+ <div style="float: left; font-size: 20px;">
|
|
33
|
+ 赠券卡券:
|
|
34
|
+ </div>
|
|
35
|
+ <div style="float: left; margin-left: 30px;">
|
|
36
|
+ <template>
|
|
37
|
+ <el-select v-model="giftValue" placeholder="请选择" style="width: 300px;">
|
|
38
|
+ <el-option
|
|
39
|
+ v-for="item in giftOptions"
|
|
40
|
+ :key="item.giftValue"
|
|
41
|
+ :label="item.label"
|
|
42
|
+ :value="item.giftValue">
|
|
43
|
+ </el-option>
|
|
44
|
+ </el-select>
|
|
45
|
+ </template>
|
|
46
|
+ </div>
|
|
47
|
+ </div>
|
|
48
|
+ <div class="input-div">
|
|
49
|
+ <div style="float: left; font-size: 20px;">
|
|
50
|
+ 赠券数量:
|
|
51
|
+ </div>
|
|
52
|
+ <div style="float: left; margin-left: 30px;">
|
|
53
|
+ <template>
|
|
54
|
+ <el-input v-model="giftNum" placeholder="请输入内容" style="width: 300px;"></el-input>
|
|
55
|
+ </template>
|
|
56
|
+ </div>
|
|
57
|
+ </div>
|
|
58
|
+ <div class="input-div">
|
|
59
|
+ <div style="float: left; font-size: 20px;">
|
|
60
|
+ 活动描述:
|
|
61
|
+ </div>
|
|
62
|
+ <div style="float: left; margin-left: 30px;">
|
|
63
|
+ <template>
|
|
64
|
+ <el-input
|
|
65
|
+ type="textarea"
|
|
66
|
+ :rows="10"
|
|
67
|
+ placeholder="请输入内容"
|
|
68
|
+ v-model="desc" style="width: 300px; height: 200px;">
|
|
69
|
+ </el-input>
|
|
70
|
+ </template>
|
|
71
|
+ </div>
|
|
72
|
+ </div>
|
|
73
|
+ <div class="input-div">
|
|
74
|
+ <el-row>
|
|
75
|
+ <el-button type="warning" style="float: right;" @click="redirection('activitiesList')">返回</el-button>
|
|
76
|
+ <el-button type="primary" style="float: right; margin-right: 10px;" @click="submitData">提交</el-button>
|
|
77
|
+ </el-row>
|
|
78
|
+ </div>
|
|
79
|
+ </div>
|
|
80
|
+ </div>
|
|
81
|
+</template>
|
|
82
|
+<script>
|
|
83
|
+import { mapState } from 'vuex'
|
|
84
|
+
|
|
85
|
+export default {
|
|
86
|
+ data () {
|
|
87
|
+ return {
|
|
88
|
+ msg: '添加活动',
|
|
89
|
+ postData: {
|
|
90
|
+ TableId: '', // 桌位id
|
|
91
|
+ AreaId: '', // 区域id
|
|
92
|
+ CaseId: '', // 案场id
|
|
93
|
+ OrgId: '', // 机构id
|
|
94
|
+ TableNo: '', // 桌位编号
|
|
95
|
+ Order: '', // 排序
|
|
96
|
+ },
|
|
97
|
+ regOptions: [{
|
|
98
|
+ regValue: '1',
|
|
99
|
+ label: '注册类型'
|
|
100
|
+ }],
|
|
101
|
+ regValue: '',
|
|
102
|
+ giftOptions: [], // [{giftValue: '1',label: '饮品通用券'}, {giftValue: '2',label: '课程通用券'}, {giftValue: '3',label: '小小外交官体验券'}]
|
|
103
|
+ giftValue: '',
|
|
104
|
+ giftLabel: '',
|
|
105
|
+ activityName: '', // 活动名称
|
|
106
|
+ activityType: this.regValue, // 活动类型
|
|
107
|
+ resourceDesc: '', // 存储JSON (赠券类型,赠送数量,活动描述)
|
|
108
|
+ giftNum: 0, // 赠送数量
|
|
109
|
+ desc: '', // 活动描述
|
|
110
|
+ giftList: [] // 赠券卡券数据体
|
|
111
|
+ }
|
|
112
|
+ },
|
|
113
|
+ mounted () {
|
|
114
|
+ this.getCouponList()
|
|
115
|
+ },
|
|
116
|
+ computed: {
|
|
117
|
+ ...mapState({
|
|
118
|
+ defaultCaseId: x => x.app.cases.default,
|
|
119
|
+ }),
|
|
120
|
+ giftData: {
|
|
121
|
+ get () {
|
|
122
|
+ let jsonData = this.$data.giftList
|
|
123
|
+ console.log('请求到的:' + this.$data.giftList)
|
|
124
|
+ let data = []
|
|
125
|
+ for (let i = 0; i < jsonData.length; i++) {
|
|
126
|
+ let tempData = []
|
|
127
|
+ tempData.giftValue = jsonData[i].CouponId
|
|
128
|
+ tempData.label = jsonData[i].CouponName
|
|
129
|
+ console.log('卡券编号:' + tempData.giftValue + ' ' + tempData.label)
|
|
130
|
+ data.push(tempData)
|
|
131
|
+ }
|
|
132
|
+ console.log('giftData 数据:')
|
|
133
|
+ return data
|
|
134
|
+ }
|
|
135
|
+ }
|
|
136
|
+ },
|
|
137
|
+ methods: {
|
|
138
|
+ redirection (pathName) { // 重定向
|
|
139
|
+ this.$router.push({ name: pathName })
|
|
140
|
+ },
|
|
141
|
+ submitData () { // 提交数据
|
|
142
|
+ // 判断是否提交成功
|
|
143
|
+ // 提交成功,跳转页面
|
|
144
|
+ // let subData = []
|
|
145
|
+ // subData.activityName = this.$data.activityName
|
|
146
|
+ // subData.activityType = this.$data.regValue
|
|
147
|
+ // let obj = []
|
|
148
|
+ // obj.giftValue = this.$data.giftValue
|
|
149
|
+ // obj.giftNum = this.$data.giftNum
|
|
150
|
+ // obj.desc = this.$data.desc
|
|
151
|
+ // subData.resourceDesc = obj
|
|
152
|
+
|
|
153
|
+ // console.log(subData)
|
|
154
|
+
|
|
155
|
+ // let obj = []
|
|
156
|
+ // obj.giftValue = this.$data.giftValue
|
|
157
|
+ // obj.giftNum = this.$data.giftNum
|
|
158
|
+ // obj.desc = this.$data.desc
|
|
159
|
+
|
|
160
|
+ let tempGiftOptions = this.$data.giftOptions
|
|
161
|
+ let tempGiftValue = this.$data.giftValue
|
|
162
|
+ for (let i = 0; i < tempGiftOptions.length; i++) {
|
|
163
|
+ if (tempGiftOptions[i].giftValue === tempGiftValue) {
|
|
164
|
+ this.$data.giftLabel = tempGiftOptions[i].label
|
|
165
|
+ break
|
|
166
|
+ }
|
|
167
|
+ }
|
|
168
|
+ let jsonString = '{"giftValue":"' + this.$data.giftValue + '","giftLabel":"' + this.$data.giftLabel + '","giftNum":"' + this.$data.giftNum + '","desc":"' + this.$data.desc + '"}'
|
|
169
|
+
|
|
170
|
+ this.$ajax(this.$api.marketingActivities.addMarketing.url, {
|
|
171
|
+ method: this.$api.marketingActivities.addMarketing.method,
|
|
172
|
+ queryData: {activityName: this.$data.activityName, activityType: this.$data.regValue, resourceDesc: jsonString, CaseId: this.defaultCaseId}
|
|
173
|
+ }).then(res => {
|
|
174
|
+ // console.log(res)
|
|
175
|
+ this.$message({
|
|
176
|
+ type: 'success',
|
|
177
|
+ message: '操作成功'
|
|
178
|
+ })
|
|
179
|
+ // 跳转路由
|
|
180
|
+ this.redirection('activitiesList')
|
|
181
|
+ })
|
|
182
|
+ },
|
|
183
|
+ getCouponList () {
|
|
184
|
+ this.$ajax(this.$api.marketingActivities.getCouponList.url, {
|
|
185
|
+ method: this.$api.marketingActivities.getCouponList.method,
|
|
186
|
+ queryData: {}
|
|
187
|
+ }).then(res => {
|
|
188
|
+ // console.log(res)
|
|
189
|
+ this.giftList = res.list
|
|
190
|
+ this.giftOptions = this.giftData
|
|
191
|
+ })
|
|
192
|
+ },
|
|
193
|
+ }
|
|
194
|
+}
|
|
195
|
+</script>
|
|
196
|
+
|
|
197
|
+<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
198
|
+<style lang="scss" scoped>
|
|
199
|
+@import "page.scss";
|
|
200
|
+</style>
|