庄逸洲 5 лет назад
Родитель
Сommit
ccdcb32fdb

+ 20 - 0
src/api/activity/activity.js Просмотреть файл

@@ -54,4 +54,24 @@ export function fetchActivitySignupUsers(activity_id, keyword, page) {
54 54
       page: page,
55 55
     }
56 56
   })
57
+}
58
+
59
+export function deleteActivity(activity_id) {
60
+  return request({
61
+    url: "/api/activity/delete",
62
+    method: "post",
63
+    params: {
64
+      id: activity_id,
65
+    }
66
+  })
67
+}
68
+
69
+export function publishActivity(activity_id) {
70
+  return request({
71
+    url: "/api/activity/publish",
72
+    method: "post",
73
+    params: {
74
+      id: activity_id,
75
+    }
76
+  })
57 77
 }

+ 1 - 0
src/lang/en.js Просмотреть файл

@@ -119,6 +119,7 @@ export default {
119 119
     activityDetail: "activity detail",
120 120
     activityShare: "activity share",
121 121
     activityPreview: "activity preview",
122
+    activitySignupList: "activity sign up list",
122 123
   },
123 124
   navbar: {
124 125
     logOut: 'Log Out',

+ 1 - 0
src/lang/zh.js Просмотреть файл

@@ -168,6 +168,7 @@ export default {
168 168
     activityDetail: "活动详情",
169 169
     activityShare: "活动分享",
170 170
     activityPreview: "活动预览",
171
+    activitySignupList: "报名列表",
171 172
   },
172 173
   navbar: {
173 174
     logOut: '退出登录',

+ 11 - 0
src/router/modules/marketing_tool.js Просмотреть файл

@@ -72,5 +72,16 @@ export default {
72 72
         noCache: true,
73 73
       }
74 74
     },
75
+    {
76
+      path: "/activity/signupusers",
77
+      hidden: true,
78
+      is_menu: false,
79
+      component: () => import("@/scrm_pages/marketing_tool/activity_signup_users"),
80
+      name: "activitySignupList",
81
+      meta: {
82
+        title: "activitySignupList",
83
+        noCache: true,
84
+      }
85
+    },
75 86
   ]
76 87
 }

+ 20 - 5
src/scrm_pages/marketing_tool/activity_detail.vue Просмотреть файл

@@ -16,7 +16,7 @@
16 16
                 </div>
17 17
                 <div class="action-panel">
18 18
                     <el-button type="primary" v-if="show_share_btn" @click="$router.push({ path: '/activity/share', query: { id: activity_id } })">再次分享</el-button>
19
-                    <el-button type="primary" v-if="show_publish_btn">发布</el-button>
19
+                    <el-button type="primary" v-if="show_publish_btn" @click="publishActivity" :loading="publishing">发布</el-button>
20 20
                 </div>
21 21
             </div>
22 22
             <div class="times-statistics">
@@ -41,9 +41,7 @@
41 41
                     <el-button type="primary" icon="el-icon-search" :loading="loading_search" @click="fetchSignupUsers">搜索</el-button>
42 42
                 </div>
43 43
                 <div class="all-btn">
44
-                    <router-link to="/">
45
-                        <el-button type="primary">查看全部</el-button>
46
-                    </router-link>
44
+                    <el-button type="primary" @click="$router.push({ path: '/activity/signupusers', query: { id: activity_id } })">查看全部</el-button>
47 45
                 </div>
48 46
             </div>
49 47
             <div class="signup-table-panel">
@@ -64,7 +62,7 @@
64 62
 
65 63
 <script>
66 64
 import BreadCrumb from "@/scrm_pages/components/bread-crumb"
67
-import { fetchActivityDetailViewData, fetchActivitySignupUsers } from "@/api/activity/activity"
65
+import { fetchActivityDetailViewData, fetchActivitySignupUsers, publishActivity } from "@/api/activity/activity"
68 66
 import { parseTime } from "@/utils"
69 67
 
70 68
 export default {
@@ -86,6 +84,7 @@ export default {
86 84
             signup_users: [],
87 85
 
88 86
             loading_search: false,
87
+            publishing: false,
89 88
         }
90 89
     },
91 90
     computed: {
@@ -149,6 +148,22 @@ export default {
149 148
                 this.loading_search = false
150 149
                 this.$message.error(err)
151 150
             })
151
+        },
152
+        publishActivity: function() {
153
+            this.publishing = true
154
+            publishActivity(this.activity_id).then(rs => {
155
+                this.publishing = false
156
+                var resp = rs.data
157
+                if (resp.state == 1) {
158
+                    this.activity.status = 1
159
+                } else {
160
+                    this.$message.error(resp.msg)
161
+                } 
162
+
163
+            }).catch(rs => {
164
+                this.publishing = false
165
+                this.$message.error(err)
166
+            })
152 167
         }
153 168
     },
154 169
 }

+ 22 - 3
src/scrm_pages/marketing_tool/activity_list.vue Просмотреть файл

@@ -34,8 +34,10 @@
34 34
       <div>
35 35
         <template v-for="(activity, index) in activities">
36 36
           <published-cell v-if="activity.status == 1 || activity.status == 4" :key="index" :activity="activity"></published-cell>
37
-          <unapproved-cell v-else-if="activity.status == 3" :key="index" :activity="activity"></unapproved-cell>
38
-          <drafts-cell v-else-if="activity.status == 2" :key="index" :activity="activity"></drafts-cell>
37
+
38
+          <unapproved-cell v-else-if="activity.status == 3" :key="index" :activity="activity" @delete="deleteActivity(activity.id, index)"></unapproved-cell>
39
+
40
+          <drafts-cell v-else-if="activity.status == 2" :key="index" :activity="activity" @delete="deleteActivity(activity.id, index)"></drafts-cell>
39 41
         </template>
40 42
       </div>
41 43
       <div class="cell clearfix" style="padding-top: 15px;">
@@ -50,7 +52,7 @@ import BreadCrumb from "@/scrm_pages/components/bread-crumb"
50 52
 import PublishedCell from "@/scrm_pages/marketing_tool/components/published_cell"
51 53
 import UnapprovedCell from "@/scrm_pages/marketing_tool/components/unapproved_cell"
52 54
 import DraftsCell from "@/scrm_pages/marketing_tool/components/drafts_cell"
53
-import { fetchActivities } from "@/api/activity/activity"
55
+import { fetchActivities, deleteActivity } from "@/api/activity/activity"
54 56
 
55 57
 export default {
56 58
   name: "ActivityList",
@@ -102,6 +104,23 @@ export default {
102 104
         this.$message.error(err)
103 105
       })
104 106
     },
107
+
108
+    deleteActivity(id, index) {
109
+      this.loading_activities = true
110
+      deleteActivity(id).then(rs => {
111
+        this.loading_activities = false
112
+        var resp = rs.data
113
+        if (resp.state == 1) {
114
+          this.activities.splice(index, 1)
115
+        } else {
116
+          this.$message.error(resp.msg)
117
+        }
118
+      }).catch(err => {
119
+        this.loading_activities = false
120
+        this.$message.error(err)
121
+        return err
122
+      })
123
+    }
105 124
   },
106 125
 };
107 126
 </script>

+ 107 - 0
src/scrm_pages/marketing_tool/activity_signup_users.vue Просмотреть файл

@@ -0,0 +1,107 @@
1
+<template>
2
+    <div class="main-contain">
3
+        <div class="position">
4
+            <bread-crumb :crumbs="crumbs"></bread-crumb>
5
+        </div>
6
+        <div class="app-container" style="padding-top: 0; background-color: #f6f8f9;">
7
+            <div style="display: flex;">
8
+                <div style="flex: 1;">
9
+                    <router-link to="/activity/list">
10
+                        <el-button type="primary">返回列表</el-button>
11
+                    </router-link>
12
+                </div>
13
+                <el-button type="primary" @click="printAction">导出</el-button>
14
+            </div>
15
+            <div style="margin-top: 10px;" id="table-panel">
16
+                <el-table id="table" border :data="signup_users" empty-text="暂无人报名">
17
+                    <el-table-column label="报名号" align="center" prop="id"></el-table-column>
18
+                    <el-table-column label="手机号" align="center" prop="mobile"></el-table-column>
19
+                    <el-table-column label="客户姓名" align="center" prop="real_name"></el-table-column>
20
+                    <el-table-column label="报名时间" align="center">
21
+                        <template slot-scope="scope">
22
+                            <span>{{ parseTime(scope.row.ctime, "{y}-{m}-{d} {h}:{i}") }}</span>
23
+                        </template>
24
+                    </el-table-column>
25
+                </el-table>
26
+            </div>
27
+            <div style="margin-top: 10px;">
28
+                <el-pagination :total="total" :current-page.sync="current_page" :page-size="10" layout="total, prev, pager, next" @current-change="getActivities()"></el-pagination>
29
+            </div>
30
+            <div id="print-table" style="width:960px; display: none;">
31
+                <el-table border :data="signup_users" empty-text="暂无人报名">
32
+                    <el-table-column label="报名号" align="center" prop="id"></el-table-column>
33
+                    <el-table-column label="手机号" align="center" prop="mobile"></el-table-column>
34
+                    <el-table-column label="客户姓名" align="center" prop="real_name"></el-table-column>
35
+                    <el-table-column label="报名时间" align="center">
36
+                        <template slot-scope="scope">
37
+                            <span>{{ parseTime(scope.row.ctime, "{y}-{m}-{d} {h}:{i}") }}</span>
38
+                        </template>
39
+                    </el-table-column>
40
+                </el-table>
41
+            </div>
42
+        </div>
43
+    </div>
44
+</template>
45
+
46
+<script>
47
+import BreadCrumb from "@/scrm_pages/components/bread-crumb"
48
+import { fetchActivitySignupUsers } from "@/api/activity/activity"
49
+import { parseTime } from "@/utils"
50
+import printJS from "print-js"
51
+
52
+export default {
53
+    name: "ActivitySignupUsers",
54
+    components: {
55
+        BreadCrumb,
56
+    },
57
+    data() {
58
+        return {
59
+            crumbs: [
60
+                { path: false, name: "活动详情" },
61
+                { path: false, name: "报名列表" },
62
+            ],
63
+
64
+            activity_id: 0,
65
+
66
+            signup_users: [],
67
+            loading_search: false,
68
+            total: 0,
69
+            current_page: 1,
70
+        }
71
+    },
72
+    mounted() {
73
+        this.activity_id = this.$route.query.id
74
+
75
+        this.fetchSignupUsers()
76
+    },
77
+    methods: {
78
+        parseTime,
79
+        fetchSignupUsers: function() {
80
+            this.loading_search = true
81
+            fetchActivitySignupUsers(this.activity_id, "", this.current_page).then(rs => {
82
+                this.loading_search = false
83
+                var resp = rs.data
84
+                if (resp.state == 1) {
85
+                    this.signup_users = resp.data.users
86
+                    this.total = resp.data.total
87
+                } else {
88
+                    this.$message.error(resp.msg)
89
+                }
90
+            }).catch(err => {
91
+                this.loading_search = false
92
+                this.$message.error(err)
93
+            })
94
+        },
95
+        printAction: function() {
96
+            printJS({
97
+                printable: 'table',
98
+                type: "html",
99
+                scanStyles: false,
100
+                css: ['https://unpkg.com/element-ui/lib/theme-chalk/index.css'],
101
+                // maxWidth: 960,
102
+            })
103
+        },
104
+    },
105
+}
106
+</script>
107
+

+ 6 - 1
src/scrm_pages/marketing_tool/components/drafts_cell.vue Просмотреть файл

@@ -13,7 +13,7 @@
13 13
             </h3>
14 14
             <div class="operation">
15 15
                 <el-button type="primary" size="small" icon="el-icon-edit-outline" @click="$router.push({ path: '/activity/modify', query: {id: activity.id} })">编辑</el-button>
16
-                <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
16
+                <el-button type="danger" size="small" icon="el-icon-delete" @click="deleteActivity">删除</el-button>
17 17
             </div>
18 18
         </div>
19 19
     </div>
@@ -39,6 +39,11 @@ export default {
39 39
             return "/activity?id=" + this.activity.id
40 40
         }
41 41
     },
42
+    methods: {
43
+        deleteActivity() {
44
+            this.$emit("delete")
45
+        }
46
+    }
42 47
 }
43 48
 </script>
44 49
 

+ 6 - 1
src/scrm_pages/marketing_tool/components/unapproved_cell.vue Просмотреть файл

@@ -14,7 +14,7 @@
14 14
             </div>
15 15
             <div class="operation">
16 16
                 <el-button type="primary" size="small" icon="el-icon-edit-outline" @click="$router.push({ path: '/activity/modify', query: {id: activity.id} })">编辑</el-button>
17
-                <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
17
+                <el-button type="danger" size="small" icon="el-icon-delete" @click="deleteActivity">删除</el-button>
18 18
             </div>
19 19
         </div>
20 20
         <div class="activity-time-panel">
@@ -45,6 +45,11 @@ export default {
45 45
             return parseTime(this.activity.start_time, "{y}-{m}-{d} {h}:{i}")
46 46
         },
47 47
     },
48
+    methods: {
49
+        deleteActivity() {
50
+            this.$emit("delete")
51
+        }
52
+    }
48 53
 }
49 54
 </script>
50 55