许成详 6 年之前
父節點
當前提交
1cf4b86982

+ 4
- 0
config/index.js 查看文件

@@ -13,7 +13,11 @@ module.exports = {
13 13
       '/api': {
14 14
         // target: 'https://dp.huiju360.com.cn/hj_operations',
15 15
         // target: 'http://192.168.0.62:8080', //wf
16
+<<<<<<< HEAD
16 17
         target: 'http://192.168.0.125:8080', //hyq
18
+=======
19
+        target: 'http://localhost:8080', 
20
+>>>>>>> 77c104f3b4b5c9d9999f0bd14073609bbbbf38cb
17 21
         // target: 'http://192.168.0.11', //ys
18 22
         // target: 'http://dev.ycjcjy.com/', //frp
19 23
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置

+ 1
- 1
src/pages/system/caseManager/signinManager/index.vue 查看文件

@@ -101,7 +101,7 @@ export default {
101 101
         page: 1, // 当前页码
102 102
         pageSize: 10, // 请求数据量
103 103
       },
104
-      total: '', // 总数
104
+      total: 0, // 总数
105 105
       // 数据体
106 106
       // {date: '2016-05-02',name: '王小虎',address: '上海市普陀区金沙江路 1518 弄'}
107 107
       tableData: [],

+ 214
- 0
src/pages/system/marketingActivities/activitiesList/index.vue 查看文件

@@ -0,0 +1,214 @@
1
+<template>
2
+  <div class="subPage">
3
+    <div class="title">
4
+      活动列表
5
+    </div>
6
+    <div class="head-div">
7
+      每页数量/条
8
+      <template>
9
+        <el-select v-model="postData.pageSize" placeholder="请选择">
10
+          <el-option
11
+            v-for="item in options"
12
+            :key="item.value"
13
+            :label="item.label"
14
+            :value="item.value">
15
+          </el-option>
16
+        </el-select>
17
+      </template>
18
+    </div>
19
+    <!-- 包含 按钮的div -->
20
+    <div class="button-div">
21
+      <el-row>
22
+        <el-button type="warning" style="float: right;">重置</el-button>
23
+        <el-button type="primary" style="float: right; margin-right: 10px;" @click="clickList">查询</el-button>
24
+        <el-button type="success" style="float: right;" @click="redirection('addActivities')">新增</el-button>
25
+      </el-row>
26
+    </div>
27
+    <div class="content">
28
+      <template>
29
+        <el-table
30
+          :data="tableData"
31
+          border
32
+          style="width: 100%">
33
+          <el-table-column
34
+            prop="CaseName"
35
+            label="案场"
36
+            width="180">
37
+          </el-table-column>
38
+          <el-table-column
39
+            prop="ActivityName"
40
+            label="活动名称"
41
+            width="180">
42
+          </el-table-column>
43
+          <el-table-column
44
+            prop="ActivityType"
45
+            label="活动类型">
46
+            <template slot-scope="scope">
47
+              <span>{{getActivitName(scope.row.ActivityType)}}</span>
48
+            </template>
49
+          </el-table-column>
50
+          <el-table-column
51
+            prop="giftLabel"
52
+            label="卡券名称">
53
+            <template slot-scope="scope">
54
+              <span>{{getGiftLabel(scope.row.ResourceDesc)}}</span>
55
+            </template>
56
+          </el-table-column>
57
+          <el-table-column
58
+            prop="address"
59
+            label="赠送数量">
60
+            <template slot-scope="scope">
61
+              <span>{{getNum(scope.row.ResourceDesc)}}</span>
62
+            </template>
63
+          </el-table-column>
64
+          <el-table-column
65
+            prop="Status"
66
+            label="状态">
67
+            <template slot-scope="scope">
68
+              <span>{{scope.row.Status === 0 ? '启用' : '停用'}}</span>
69
+            </template>
70
+          </el-table-column>
71
+          <el-table-column
72
+            prop="address"
73
+            label="操作">
74
+            <template slot-scope="scope">
75
+              <div v-if="scope.row.Status === 0">
76
+                <a href="#" @click="disable(scope.row.ActivityId)">停用</a>&nbsp;&nbsp;<a href="#" @click="delet(scope.row.ActivityId)">删除</a>
77
+              </div>
78
+              <div v-else>
79
+                <a href="#" @click="normal(scope.row.ActivityId)">启用</a>
80
+              </div>
81
+            </template>
82
+          </el-table-column>
83
+        </el-table>
84
+      </template>
85
+    </div>
86
+    <div class="block">
87
+      <el-pagination
88
+        @size-change="handleSizeChange"
89
+        @current-change="handleCurrentChange"
90
+        :current-page.sync="currentPage2"
91
+        :page-size="Number(value)"
92
+        layout="prev, pager, next, jumper"
93
+        :total="total">
94
+      </el-pagination>
95
+    </div>
96
+  </div>
97
+</template>
98
+<script>
99
+export default {
100
+  data () {
101
+    return {
102
+      options: [{ // 下拉框数数据,分页的每页多少
103
+        value: '5',
104
+        label: '5'
105
+      }, {
106
+        value: '10',
107
+        label: '10'
108
+      }, {
109
+        value: '20',
110
+        label: '20'
111
+      }],
112
+      value: '10', // 一页多少数据
113
+      tableData: [],
114
+      postData: { // 表格搜索条件 //caseid: '', // 案场id
115
+        page: 1, // 当前页码
116
+        pageSize: 10, // 请求数据量
117
+      },
118
+      currentPage2: 1,
119
+      total: 0 // 数据条数
120
+    }
121
+  },
122
+  mounted () {
123
+    this.getList()
124
+  },
125
+  methods: {
126
+    getNum (desc) {
127
+      if (desc === '') {
128
+        return 0
129
+      }
130
+      const descjson = JSON.parse(desc)
131
+      return descjson.giftNum
132
+    },
133
+    getActivitName (desc) { // 根据活动类型编号,获取活动名称
134
+      if (desc === '1') {
135
+        return '注册类型'
136
+      }
137
+      return '未知类型'
138
+    },
139
+    getGiftLabel (desc) {
140
+      if (desc === '') {
141
+        return '未知卡券'
142
+      }
143
+      const descjson = JSON.parse(desc)
144
+      return descjson.giftLabel
145
+    },
146
+    handleSizeChange (val) {
147
+      console.log(`每页 ${val} 条`)
148
+    },
149
+    handleCurrentChange (val) {
150
+      console.log(`当前页: ${val}`)
151
+      this.$data.postData.page = val
152
+      this.getList()
153
+    },
154
+    redirection (pathName) { // 重定向
155
+      this.$router.push({ name: pathName })
156
+    },
157
+    getList () { // 获取数据列表
158
+      this.$ajax(this.$api.marketingActivities.getMarketingList.url, {
159
+        method: this.$api.marketingActivities.getMarketingList.method,
160
+        queryData: { ...this.postData }
161
+      }).then(res => {
162
+        this.tableData = res.list
163
+        this.postData.page = res.page
164
+        this.total = res.pagenum
165
+      })
166
+    },
167
+    disable (ActivityId) { // 停用
168
+      this.$ajax(this.$api.marketingActivities.delMarketingDisable.url, {
169
+        method: this.$api.marketingActivities.delMarketingDisable.method,
170
+        urlData: { activityId: ActivityId }
171
+      }).then(res => {
172
+        this.$message({
173
+          type: 'success',
174
+          message: '操作成功'
175
+        })
176
+        this.getList()
177
+      })
178
+    },
179
+    normal (ActivityId) { // 启用
180
+      this.$ajax(this.$api.marketingActivities.delMarketingNormal.url, {
181
+        method: this.$api.marketingActivities.delMarketingNormal.method,
182
+        urlData: { activityId: ActivityId }
183
+      }).then(res => {
184
+        this.$message({
185
+          type: 'success',
186
+          message: '操作成功'
187
+        })
188
+        this.getList()
189
+      })
190
+    },
191
+    delet (ActivityId) { // 删除
192
+      this.$ajax(this.$api.marketingActivities.delMarketing.url, {
193
+        method: this.$api.marketingActivities.delMarketing.method,
194
+        urlData: { activityId: ActivityId }
195
+      }).then(res => {
196
+        this.$message({
197
+          type: 'success',
198
+          message: '操作成功'
199
+        })
200
+        this.getList()
201
+      })
202
+    },
203
+    clickList () { // 点击查询按钮
204
+      this.$data.postData.page = 1
205
+      this.getList()
206
+    }
207
+  },
208
+}
209
+</script>
210
+
211
+<!-- Add "scoped" attribute to limit CSS to this component only -->
212
+<style lang="scss" scoped>
213
+@import "page.scss";
214
+</style>

+ 33
- 0
src/pages/system/marketingActivities/activitiesList/page.scss 查看文件

@@ -0,0 +1,33 @@
1
+
2
+// 活动列表 标题
3
+.title{
4
+  font-size: 28px;
5
+  color: darkgray;
6
+  width: 100%;
7
+  border-bottom: 1px solid darkgray;
8
+  padding-left: 30px;
9
+  padding-top: 20px;
10
+  padding-bottom: 20px;
11
+}
12
+
13
+// 头部div
14
+.head-div {
15
+  width: 100%;
16
+  margin-left: 30px;
17
+  margin-right: 30px;
18
+  padding-top: 30px;
19
+}
20
+
21
+.button-div {
22
+  width: 100%;
23
+  margin-left: 30px;
24
+  margin-right: 30px;
25
+  margin-bottom: 30px;
26
+  float: right;
27
+}
28
+// 表格 div
29
+.content {
30
+  width: 100%;
31
+  margin-left: 30px;
32
+  margin-right: 30px;
33
+}

+ 200
- 0
src/pages/system/marketingActivities/addActivities/index.vue 查看文件

@@ -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>

+ 39
- 0
src/pages/system/marketingActivities/addActivities/page.scss 查看文件

@@ -0,0 +1,39 @@
1
+
2
+.content {
3
+  margin-left: auto;
4
+  margin-right: auto;
5
+  width: 800px;
6
+  height: 100%;
7
+  position: relative;
8
+}
9
+
10
+.input-div {
11
+  position: absolute;
12
+  margin-top: 20px;
13
+  width: 490px;
14
+}
15
+
16
+.input-div:nth-child(1) {
17
+  margin-top: 20px;
18
+}
19
+
20
+.input-div:nth-child(2) {
21
+  margin-top: 80px;
22
+}
23
+
24
+.input-div:nth-child(3) {
25
+  margin-top: 140px;
26
+}
27
+
28
+.input-div:nth-child(4) {
29
+  margin-top: 200px;
30
+}
31
+
32
+.input-div:nth-child(5) {
33
+  margin-top: 260px;
34
+}
35
+
36
+.input-div:nth-child(6) {
37
+  margin-top: 560px;
38
+  margin-left: -80px;
39
+}

+ 19
- 0
src/pages/system/marketingActivities/index.vue 查看文件

@@ -0,0 +1,19 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <router-view></router-view>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: '',
10
+  data () {
11
+    return {}
12
+  },
13
+  components: {}
14
+}
15
+</script>
16
+
17
+<!-- Add "scoped" attribute to limit CSS to this component only -->
18
+<style lang="scss" scoped>
19
+</style>

+ 19
- 0
src/pages/system/page.js 查看文件

@@ -101,6 +101,10 @@ import activateVip from './cardAndCouponManager/vipManager/activateVip' // 激
101 101
 
102 102
 import caseRecord from './newOrder/caseRecord/index' // 月记录
103 103
 
104
+import marketingActivities from './marketingActivities/index' // 营销活动
105
+import activitiesList from './marketingActivities/activitiesList/index' // 活动列表
106
+import addActivities from './marketingActivities/addActivities/index' // 添加活动
107
+
104 108
 export default {
105 109
   router: [
106 110
     {
@@ -546,6 +550,21 @@ export default {
546 550
             component: activateVip,
547 551
             children: []
548 552
           }]
553
+        }, { // 营销活动
554
+          path: 'marketingActivities',
555
+          name: 'marketingActivities',
556
+          component: marketingActivities,
557
+          children: [{
558
+            path: 'activitiesList',
559
+            name: 'activitiesList',
560
+            component: activitiesList,
561
+            children: [{ // 添加活动
562
+              path: 'addActivities',
563
+              name: 'addActivities',
564
+              component: addActivities,
565
+              children: []
566
+            }]
567
+          }]
549 568
         }]
550 569
       }]
551 570
     },

+ 8
- 3
src/util/ajax.js 查看文件

@@ -3,6 +3,7 @@ import qs from 'qs'
3 3
 import router from '../router'
4 4
 import { Message } from 'element-ui'
5 5
 
6
+var JWT = localStorage.getItem('JWT')
6 7
 const Axios = axios.create({
7 8
   timeout: 60000,
8 9
   responseType: 'json',
@@ -10,7 +11,8 @@ const Axios = axios.create({
10 11
   queryData: {},
11 12
   urlData: {},
12 13
   headers: {
13
-    'Content-Type': 'multipart/form-data'
14
+    'Content-Type': 'multipart/form-data',
15
+    'authorization': JWT
14 16
   }
15 17
 })
16 18
 
@@ -68,8 +70,11 @@ Axios.interceptors.request.use((config) => {
68 70
 
69 71
 const ajax = (...args) => {
70 72
   return new Promise((resolve, reject) => {
71
-    Axios(...args).then(({ data }) => {
72
-      // console.log(111)
73
+    Axios(...args).then(({ data, headers }) => {
74
+      if (headers.authorization) {
75
+        localStorage.setItem('JWT', headers.authorization)
76
+        JWT = headers.authorization
77
+      }
73 78
       const { code, message, result } = data
74 79
       if (code === 200) {
75 80
         resolve(result)

+ 26
- 0
src/util/api.js 查看文件

@@ -660,5 +660,31 @@ const $api = {
660 660
       url: `${baseUrl}${common}/customer`
661 661
     }
662 662
   },
663
+  marketingActivities: { // 营销活动
664
+    getMarketingList: { // 查询所有
665
+      method: 'get',
666
+      url: `${baseUrl}${common}/marketing/list`
667
+    },
668
+    addMarketing: { // 添加
669
+      method: 'post',
670
+      url: `${baseUrl}${common}/marketing`
671
+    },
672
+    delMarketing: { // 删除
673
+      method: 'delete',
674
+      url: `${baseUrl}${common}/marketing/:activityId`
675
+    },
676
+    delMarketingNormal: { // 启用
677
+      method: 'put',
678
+      url: `${baseUrl}${common}/marketing/normal/:activityId`
679
+    },
680
+    delMarketingDisable: { // 停用
681
+      method: 'put',
682
+      url: `${baseUrl}${common}/marketing/disable/:activityId`
683
+    },
684
+    getCouponList: { // 获取赠券卡券类型
685
+      method: 'get',
686
+      url: `${baseUrl}${common}/coupon`
687
+    }
688
+  }
663 689
 }
664 690
 export default $api