Browse Source

活动列表

庄逸洲 6 years ago
parent
commit
2556ebdb45

+ 14 - 0
src/api/activity/activity.js View File

@@ -0,0 +1,14 @@
1
+import request from "@/utils/request"
2
+
3
+export function fetchActivities(page, keyword, status) {
4
+  const params = {
5
+    page: page,
6
+    keyword: keyword,
7
+    status: status,
8
+  }
9
+  return request({
10
+    url: '/api/activities',
11
+    method: 'get',
12
+    params: params,
13
+  })
14
+}

BIN
src/assets/img/activity_poster_photo_default.png View File


BIN
src/assets/img/sa_06.png View File


BIN
src/assets/img/sa_13.png View File


BIN
src/assets/img/sa_21.png View File


BIN
src/assets/img/sa_24.png View File


BIN
src/assets/img/sa_25.png View File


BIN
src/assets/img/sa_26.png View File


BIN
src/assets/img/sa_52.png View File


BIN
src/assets/img/sa_7.png View File


+ 40 - 16
src/scrm_pages/marketing_tool/activity_list.vue View File

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <div class="main-contain">
2
+  <div class="main-contain" v-loading="loading_activities">
3 3
     <div class="position">
4 4
       <bread-crumb :crumbs="crumbs"></bread-crumb>
5 5
       <el-button
@@ -15,7 +15,7 @@
15 15
     <div class="app-container">
16 16
       <div class="cell clearfix">
17 17
         <el-input v-model="keyword" placeholder="请输入您要搜索的活动" class="keyword_input"></el-input>
18
-        <el-button type="primary" icon="el-icon-search">搜索</el-button>
18
+        <el-button type="primary" icon="el-icon-search" @click="getActivities()">搜索</el-button>
19 19
       </div>
20 20
       <div class="cell clearfix">
21 21
         <label class="title">
@@ -23,21 +23,23 @@
23 23
         </label>
24 24
         <div class="time">
25 25
           <ul>
26
-            <li :class="{ active: selecting_status == 0 }">全部</li>
27
-            <li :class="{ active: selecting_status == 1 }">已发布</li>
28
-            <li :class="{ active: selecting_status == 2 }">待发布</li>
29
-            <li :class="{ active: selecting_status == 3 }">未通过</li>
30
-            <li :class="{ active: selecting_status == 4 }">已结束</li>
26
+            <li :class="{ active: selecting_status == 0 }" @click="changeSelectingStatus(0)">全部</li>
27
+            <li :class="{ active: selecting_status == 1 }" @click="changeSelectingStatus(1)">已发布</li>
28
+            <li :class="{ active: selecting_status == 2 }" @click="changeSelectingStatus(2)">待发布</li>
29
+            <li :class="{ active: selecting_status == 3 }" @click="changeSelectingStatus(3)">未通过</li>
30
+            <li :class="{ active: selecting_status == 4 }" @click="changeSelectingStatus(4)">已结束</li>
31 31
           </ul>
32 32
         </div>
33 33
       </div>
34 34
       <div>
35
-          <published-cell></published-cell>
36
-          <unapproved-cell></unapproved-cell>
37
-          <drafts-cell></drafts-cell>
35
+        <template v-for="(activity, index) in activities">
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>
39
+        </template>
38 40
       </div>
39 41
       <div class="cell clearfix" style="padding-top: 15px;">
40
-          <el-pagination :total="activity_total" :current-page.sync="current_page" :page-size="10" layout="total, prev, pager, next"></el-pagination>
42
+          <el-pagination :total="activity_total" :current-page.sync="current_page" :page-size="10" layout="total, prev, pager, next" @current-change="getActivities()"></el-pagination>
41 43
       </div>
42 44
     </div>
43 45
   </div>
@@ -48,6 +50,7 @@ import BreadCrumb from "@/scrm_pages/components/bread-crumb";
48 50
 import PublishedCell from "@/scrm_pages/marketing_tool/components/published_cell"
49 51
 import UnapprovedCell from "@/scrm_pages/marketing_tool/components/unapproved_cell"
50 52
 import DraftsCell from "@/scrm_pages/marketing_tool/components/drafts_cell"
53
+import { fetchActivities } from "@/api/activity/activity"
51 54
 
52 55
 export default {
53 56
   name: "ActivityList",
@@ -65,16 +68,40 @@ export default {
65 68
       ],
66 69
       keyword: "",
67 70
       selecting_status: 0,
68
-      
69 71
       activity_total: 0,
70 72
       current_page: 1,
73
+
74
+      loading_activities: false,
75
+      activities: [],
71 76
     };
72 77
   },
73 78
   mounted() {
74
-      
79
+      this.getActivities()
75 80
   },
76 81
   methods: {
82
+    changeSelectingStatus(status) {
83
+      this.selecting_status = status
84
+      this.getActivities()
85
+    },
86
+
87
+    getActivities() {
88
+      this.loading_activities = true
89
+      fetchActivities(this.current_page, this.keyword, this.selecting_status).then(rs => {
90
+        this.loading_activities = false
91
+        var resp = rs.data
92
+        if (resp.state == 1) {
93
+          this.activities = resp.data.activities
94
+          this.activity_total = resp.data.total
95
+          console.log(this.activities)
77 96
 
97
+        } else {
98
+          this.$message.error(resp.msg)
99
+        }
100
+      }).catch(err => {
101
+        this.loading_activities = false
102
+        this.$message.error(err)
103
+      })
104
+    },
78 105
   },
79 106
 };
80 107
 </script>
@@ -85,7 +112,4 @@ export default {
85 112
 }
86 113
 </style>
87 114
 
88
-<style scoped rel="stylesheet/scss" lang="scss">
89
-</style>
90
-
91 115
 

+ 50 - 2
src/scrm_pages/marketing_tool/activity_publish.vue View File

@@ -1,13 +1,61 @@
1 1
 <template>
2
-    <div></div>    
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: 0 20px; background-color: #f6f8f9;">
7
+            <div class="edit-main">
8
+                <div class="preview-panel">
9
+                    <preview-form></preview-form>
10
+                </div>
11
+                <div class="edit-panel">
12
+                    <edit-form></edit-form>
13
+                </div>
14
+            </div>
15
+        </div>
16
+    </div>
3 17
 </template>
4 18
 
5 19
 <script>
20
+import BreadCrumb from "@/scrm_pages/components/bread-crumb";
21
+import PreviewForm from "@/scrm_pages/marketing_tool/components/edit_activity_preview_form"
22
+import EditForm from "@/scrm_pages/marketing_tool/components/edit_activity_edit_form"
23
+
6 24
 export default {
7 25
     name: "ActivityPublish",
26
+    components: {
27
+        BreadCrumb,
28
+        PreviewForm,
29
+        EditForm,
30
+    },
31
+    data() {
32
+        return {
33
+            crumbs: [
34
+                { path: false, name: "营销工具" },
35
+                { path: false, name: "发布活动" }
36
+            ],
37
+        }
38
+    },
8 39
 }
9 40
 </script>
10 41
 
11
-<style scoped>
42
+<style scoped rel="stylesheet/scss" lang="scss">
43
+.edit-main {
44
+    width: 100%;
45
+    display: flex;
46
+    min-height: 600px;
47
+    height: auto;
48
+    box-sizing: border-box;
12 49
 
50
+    .preview-panel {
51
+        flex: 3;
52
+        margin-right: 1rem;
53
+        background-color: #fff;
54
+    }
55
+    .edit-panel {
56
+        flex: 4;
57
+        padding-bottom: 80px;
58
+        background-color: #fff;
59
+    }
60
+}
13 61
 </style>

+ 9 - 3
src/scrm_pages/marketing_tool/components/drafts_cell.vue View File

@@ -3,11 +3,11 @@
3 3
     <div class="drafts-cell">
4 4
         <div class="activity-image-panel">
5 5
             <span class="status-text">待发布</span>
6
-            <img src="https://images.shengws.com/2019/6/12/activity_223718617.png" />
6
+            <img :src="activity.poster_photo" />
7 7
         </div>
8 8
         <div class="activity-info-panel">
9 9
             <h3 class="title">
10
-                <a href="http://www.baidu.com">哈哈哈哈哈哈哈</a>
10
+                <a href="/">{{ activity.title }}</a>
11 11
             </h3>
12 12
             <div class="operation">
13 13
                 <el-button type="primary" size="small" icon="el-icon-edit-outline">编辑</el-button>
@@ -21,6 +21,12 @@
21 21
 <script>
22 22
 export default {
23 23
     name: "DraftsActivityCell",
24
+    props: {
25
+        activity: {
26
+            type: Object,
27
+            required: true,
28
+        }
29
+    },
24 30
     data() {
25 31
         return {
26 32
             
@@ -94,7 +100,7 @@ export default {
94 100
 
95 101
             a {
96 102
                 color: #495060;
97
-                font-size: 19px;
103
+                font-size: 20px;
98 104
                 max-width: 100%;
99 105
                 font-weight: 500;
100 106
                 overflow: hidden;

+ 14 - 0
src/scrm_pages/marketing_tool/components/edit_activity_edit_form.vue View File

@@ -0,0 +1,14 @@
1
+<template>
2
+    <div></div>
3
+</template>
4
+
5
+<script>
6
+export default {
7
+    name: "EditActivityEditForm",
8
+}
9
+</script>
10
+
11
+<style lang="scss" scoped>
12
+
13
+</style>
14
+

+ 206 - 0
src/scrm_pages/marketing_tool/components/edit_activity_preview_form.vue View File

@@ -0,0 +1,206 @@
1
+<template>
2
+    <div class="preview-main">
3
+        <div class="form-title">
4
+            <img class="icon" src="@/assets/img/sa_06.png" />
5
+            <span>预览</span>
6
+        </div>
7
+        <div class="form-content">
8
+            <div class="preview-cell-poster-photo border">
9
+                <img class="poster-photo" :src="poster_photo" />
10
+                <div class="title-panel">
11
+                    <p class="title">{{ title }}</p>
12
+                    <p class="subtitle">{{ subtitle }}</p>
13
+                </div>
14
+            </div>
15
+            <div class="org-info-cell border">
16
+                <div class="logo">
17
+                    <img :src="poster_photo" />
18
+                </div>
19
+                <div class="text-info">
20
+                    <p class="name">测试机构</p>
21
+                    <p class="address">地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址</p>
22
+                </div>
23
+                <div class="arrow-panel">
24
+                    <img src="@/assets/img/sa_52.png" />
25
+                </div>
26
+            </div>
27
+            <div class="simple-cell border">
28
+                <div class="icon">
29
+                    <img src="@/assets/img/sa_21.png" />
30
+                </div>
31
+                <div class="text">
32
+                    <p>2019-01-01</p>
33
+                </div>
34
+                <div class="arrow-panel">
35
+                    <img src="@/assets/img/sa_52.png" />
36
+                </div>
37
+            </div>
38
+            <div class="simple-cell border">
39
+                <div class="icon">
40
+                    <img src="@/assets/img/sa_24.png" />
41
+                </div>
42
+                <div class="text">
43
+                    <p>0755-86879866</p>
44
+                </div>
45
+                <div class="arrow-panel">
46
+                    <img src="@/assets/img/sa_52.png" />
47
+                </div>
48
+            </div>
49
+        </div>
50
+    </div>
51
+</template>
52
+
53
+<script>
54
+export default {
55
+    name: "EditActivityPreviewForm",
56
+    data() {
57
+        return {
58
+            
59
+        }
60
+    },
61
+    computed: {
62
+        poster_photo: function() {
63
+            return require("@/assets/img/activity_poster_photo_default.png")
64
+        },
65
+        title: function() {
66
+            return "与孩子一起挑选采摘新鲜有机马陆葡萄,体验采摘乐趣"
67
+        },
68
+        subtitle: function() {
69
+            return "亲子采摘活动"
70
+        },
71
+    },
72
+}
73
+</script>
74
+
75
+<style lang="scss" scoped>
76
+.preview-main {
77
+    .form-title {
78
+        width: 100%;
79
+        padding: 20px 0 20px 30px;
80
+        border-bottom: 1px #dee2e5 solid;
81
+
82
+        .icon {
83
+            margin-top: -4px;
84
+            vertical-align: middle;
85
+        }
86
+
87
+        span {
88
+            font-size: 18px;
89
+            font-weight: 500;
90
+            color: #485b6d;
91
+            margin-left: 10px;
92
+        }
93
+    }
94
+
95
+    .form-content {
96
+        width: 100%;
97
+        padding: 14px 30px 0 30px;
98
+
99
+        .preview-cell-poster-photo {
100
+            .poster-photo {
101
+                width: 100%;
102
+            }
103
+
104
+            .title-panel {
105
+                padding: 15px 15px 16px 20px;
106
+
107
+                .title {
108
+                    font-size: 18px;
109
+                    color: #485b6d;
110
+                    font-weight: bold;
111
+                    line-height: 28px;
112
+                }
113
+
114
+                .subtitle {
115
+                    margin-top: 6px;
116
+                    color: #a6a6a6;
117
+                    font-size: 14px;
118
+                }
119
+            }
120
+        }
121
+
122
+        .org-info-cell {
123
+            padding: 20px 20px;
124
+            margin-top: 15px;
125
+            position: relative;
126
+            display: flex;
127
+            -webkit-box-align: center;
128
+            align-items: center;
129
+
130
+            .logo {
131
+                img {
132
+                    width: 40px;
133
+                    height: 40px;
134
+                    border-radius: 20px;
135
+                }
136
+            }
137
+            .text-info {
138
+                flex: 1;
139
+                padding-left: 17px;
140
+                color: #485b6d;
141
+
142
+                .name {
143
+                    font-size: 16px;
144
+                    line-height: 22px;
145
+                    font-weight: 500;
146
+                }
147
+                .address {
148
+                    font-size: 14px;
149
+                    line-height: 20px;
150
+                    margin-top: 5px;
151
+                }
152
+            }
153
+            .arrow-panel {
154
+                width: 20px;
155
+                position: relative;
156
+
157
+                img {
158
+                    width: 8px;
159
+                    float: right;
160
+                    vertical-align: middle;
161
+                }
162
+            }
163
+        }
164
+
165
+        .simple-cell {
166
+            padding: 20px 20px;
167
+            margin-top: 15px;
168
+            position: relative;
169
+            display: flex;
170
+            -webkit-box-align: center;
171
+            align-items: center;
172
+
173
+            .icon {
174
+                img {
175
+                    width: 20px;
176
+                    height: 20px;
177
+                    vertical-align: middle;
178
+                }
179
+            }
180
+            .text {
181
+                flex: 1;
182
+                padding-left: 17px;
183
+                color: #485b6d;
184
+                line-height: 20px;
185
+            }
186
+            .arrow-panel {
187
+                width: 20px;
188
+                position: relative;
189
+
190
+                img {
191
+                    width: 8px;
192
+                    float: right;
193
+                    vertical-align: middle;
194
+                }
195
+            }
196
+        }
197
+    }
198
+}
199
+</style>
200
+
201
+<style scoped>
202
+.border {
203
+    border: solid 1px #dee2e5;
204
+    border-radius: 4px;
205
+}
206
+</style>

+ 44 - 9
src/scrm_pages/marketing_tool/components/published_cell.vue View File

@@ -3,32 +3,40 @@
3 3
     <div class="published-cell">
4 4
         <div class="activity-image-panel">
5 5
             <span class="status-text">{{ status_text }}</span>
6
-            <img src="https://images.shengws.com/2019/6/12/activity_223718617.png" />
6
+            <img :src="activity.poster_photo" />
7 7
         </div>
8 8
         <div class="activity-info-panel">
9 9
             <h3 class="title">
10
-                <a href="http://www.baidu.com">哈哈哈哈哈哈哈</a>
10
+                <a href="">{{ activity.title }}</a>
11 11
             </h3>
12 12
             <div class="statistics">
13
-                阅读:0 丨 评论:0 丨 点赞:0
13
+                阅读:{{ activity.read_num }} 丨 评论:{{ activity.comment_num }} 丨 点赞:{{ activity.star_num }}
14 14
             </div>
15 15
             <div class="progress">
16 16
                 <div class="progress-bar">
17
-                    <el-progress :percentage="80" :stroke-width="5" color="#409eff" :show-text="false" ></el-progress>
17
+                    <el-progress :percentage="progress_percent" :stroke-width="5" color="#409eff" :show-text="false" ></el-progress>
18 18
                 </div>
19
-                <span class="progress-text">0 / 10</span>
19
+                <span class="progress-text">{{ progress_text }}</span>
20 20
             </div>
21 21
         </div>
22 22
         <div class="activity-time-panel">
23
-            <span class="time">2019-01-01</span>
23
+            <span class="time">{{ start_time }}</span>
24 24
         </div>
25 25
     </div>
26 26
 </div>
27 27
 </template>
28 28
 
29 29
 <script>
30
+import { parseTime } from "@/utils"
31
+
30 32
 export default {
31 33
     name: "PublishedActivityCell",
34
+    props: {
35
+        activity: {
36
+            type: Object,
37
+            required: true,
38
+        }
39
+    },
32 40
     data() {
33 41
         return {
34 42
             
@@ -36,8 +44,35 @@ export default {
36 44
     },
37 45
     computed: {
38 46
         status_text: function() {
39
-            return "已发布"
40
-        }
47
+            if (this.activity.status == 4) {
48
+                return "已结束"
49
+            } else if (this.activity.is_recommend == true) {
50
+                return "已推荐"
51
+            } else {
52
+                return "已发布"
53
+            }
54
+        },
55
+        progress_percent: function() {
56
+            if (this.activity.limit_num > 0) {
57
+                return (this.activity.join_num / this.activity.limit_num) * 100
58
+            } else {
59
+                return 100
60
+            }
61
+        },
62
+        progress_text: function() {
63
+            if (this.activity.limit_num > 0) {
64
+                if (this.activity.join_num >= this.activity.limit_num) {
65
+                    return "已报满"
66
+                } else {
67
+                    return this.activity.join_num + " / " + this.activity.limit_num
68
+                }
69
+            } else {
70
+                return "无限制"
71
+            }
72
+        },
73
+        start_time: function() {
74
+            return parseTime(this.activity.start_time, "{y}-{m}-{d}")
75
+        },
41 76
     },
42 77
 }
43 78
 </script>
@@ -107,7 +142,7 @@ export default {
107 142
 
108 143
             a {
109 144
                 color: #495060;
110
-                font-size: 19px;
145
+                font-size: 20px;
111 146
                 max-width: 100%;
112 147
                 font-weight: 500;
113 148
                 overflow: hidden;

+ 18 - 5
src/scrm_pages/marketing_tool/components/unapproved_cell.vue View File

@@ -3,14 +3,14 @@
3 3
     <div class="unapproved-cell">
4 4
         <div class="activity-image-panel">
5 5
             <span class="status-text">未通过</span>
6
-            <img src="https://images.shengws.com/2019/6/12/activity_223718617.png" />
6
+            <img :src="activity.poster_photo" />
7 7
         </div>
8 8
         <div class="activity-info-panel">
9 9
             <h3 class="title">
10
-                <a href="http://www.baidu.com">哈哈哈哈哈哈哈</a>
10
+                <a href="/">{{ activity.title }}</a>
11 11
             </h3>
12 12
             <div class="reason">
13
-                审核未通过:不给过
13
+                审核未通过:{{ activity.reason }}
14 14
             </div>
15 15
             <div class="operation">
16 16
                 <el-button type="primary" size="small" icon="el-icon-edit-outline">编辑</el-button>
@@ -18,20 +18,33 @@
18 18
             </div>
19 19
         </div>
20 20
         <div class="activity-time-panel">
21
-            <span class="time">2019-01-01</span>
21
+            <span class="time">{{ start_time }}</span>
22 22
         </div>
23 23
     </div>
24 24
 </div>
25 25
 </template>
26 26
 
27 27
 <script>
28
+import { parseTime } from "@/utils"
29
+
28 30
 export default {
29 31
     name: "UnapprovedActivityCell",
32
+    props: {
33
+        activity: {
34
+            type: Object,
35
+            required: true,
36
+        }
37
+    },
30 38
     data() {
31 39
         return {
32 40
             
33 41
         }
34 42
     },
43
+    computed: {
44
+        start_time: function() {
45
+            return parseTime(this.activity.start_time, "{y}-{m}-{d}")
46
+        },
47
+    },
35 48
 }
36 49
 </script>
37 50
 
@@ -100,7 +113,7 @@ export default {
100 113
 
101 114
             a {
102 115
                 color: #495060;
103
-                font-size: 19px;
116
+                font-size: 20px;
104 117
                 max-width: 100%;
105 118
                 font-weight: 500;
106 119
                 overflow: hidden;