educode_sales 0.5.8 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales//345/256/242/346/210/267/347/256/241/347/220/206.png +0 -0
  3. data/app/controllers/educode_sales/businesses_controller.rb +4 -2
  4. data/app/controllers/educode_sales/customer_extensions_controller.rb +17 -0
  5. data/app/controllers/educode_sales/customer_follows_controller.rb +41 -0
  6. data/app/controllers/educode_sales/customers_controller.rb +204 -0
  7. data/app/controllers/educode_sales/places_controller.rb +5 -1
  8. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  9. data/app/controllers/educode_sales/sale_trends_controller.rb +16 -1
  10. data/app/controllers/educode_sales/teachers_controller.rb +13 -2
  11. data/app/models/educode_sales/customer.rb +4 -0
  12. data/app/models/educode_sales/customer_extension.rb +7 -0
  13. data/app/models/educode_sales/customer_follow.rb +5 -0
  14. data/app/models/educode_sales/permission.rb +3 -2
  15. data/app/models/educode_sales/role_area.rb +1 -0
  16. data/app/views/educode_sales/businesses/_follows.html.erb +10 -4
  17. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +2 -2
  18. data/app/views/educode_sales/businesses/index.html.erb +25 -18
  19. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
  20. data/app/views/educode_sales/businesses/new.html.erb +3 -0
  21. data/app/views/educode_sales/businesses/new_follow_record.html.erb +2 -2
  22. data/app/views/educode_sales/businesses/show_follow.html.erb +7 -2
  23. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  24. data/app/views/educode_sales/businesses/time_line.html.erb +1 -1
  25. data/app/views/educode_sales/customers/edit.html.erb +94 -0
  26. data/app/views/educode_sales/customers/edit_department.html.erb +54 -0
  27. data/app/views/educode_sales/customers/edit_follow_record.html.erb +50 -0
  28. data/app/views/educode_sales/customers/give.html.erb +51 -0
  29. data/app/views/educode_sales/customers/index.html.erb +493 -0
  30. data/app/views/educode_sales/customers/index.json.jbuilder +24 -0
  31. data/app/views/educode_sales/customers/new.html.erb +96 -0
  32. data/app/views/educode_sales/customers/new_department.html.erb +56 -0
  33. data/app/views/educode_sales/customers/new_follow_record.html.erb +54 -0
  34. data/app/views/educode_sales/customers/show_department.json.jbuilder +13 -0
  35. data/app/views/educode_sales/customers/show_follow.html.erb +442 -0
  36. data/app/views/educode_sales/customers/show_follow.json.jbuilder +13 -0
  37. data/app/views/educode_sales/customers/show_follow_record.html.erb +18 -0
  38. data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -0
  39. data/app/views/educode_sales/places/index.html.erb +64 -0
  40. data/app/views/educode_sales/places/index.json.jbuilder +1 -1
  41. data/app/views/educode_sales/roles/edit.html.erb +9 -1
  42. data/app/views/educode_sales/sale_trends/trends.html.erb +20 -0
  43. data/app/views/educode_sales/sales/index.html.erb +63 -21
  44. data/app/views/educode_sales/sales/index.json.jbuilder +32 -5
  45. data/app/views/educode_sales/teachers/index.html.erb +4 -11
  46. data/app/views/educode_sales/teachers/index.json.jbuilder +3 -3
  47. data/app/views/educode_sales/teachers/show_follow.html.erb +10 -5
  48. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  49. data/app/views/layouts/educode_sales/application.html.erb +8 -1
  50. data/config/routes.rb +25 -0
  51. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +15 -0
  52. data/db/migrate/20211214100803_create_customer_extensions.rb +9 -0
  53. data/db/migrate/20211215025029_create_educode_sales_customer_follows.rb +12 -0
  54. data/db/migrate/20211220102720_add_position_to_commons.rb +12 -0
  55. data/db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb +8 -0
  56. data/lib/educode_sales/version.rb +1 -1
  57. metadata +26 -2
@@ -272,6 +272,19 @@
272
272
 
273
273
  </div>
274
274
  </div>
275
+ <br>
276
+ <br>
277
+ <div class="layui-tab layui-tab-card " id="销售额分析" lay-filter="test1">
278
+ <ul class="layui-tab-title">
279
+ <li class="layui-this">商机区域分布</li>
280
+ </ul>
281
+ <div class="layui-tab-content" style="padding-right: 50px">
282
+ <div class="layui-tab-item layui-show" style="padding-left: 20px">
283
+ <canvas id="myChart3" width="960" height="200"></canvas>
284
+ </div>
285
+
286
+ </div>
287
+ </div>
275
288
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/chart.js@2.9.1/dist/Chart.min.css">
276
289
  <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.1/dist/Chart.min.js"></script>
277
290
  <script>
@@ -498,5 +511,12 @@
498
511
  data: <%=raw @goal_count_data.to_json %>,
499
512
  options: opt
500
513
  });
514
+
515
+ var ctx = document.getElementById('myChart3');
516
+ var myChart3 = new Chart(ctx, {
517
+ type: 'bar',
518
+ data: <%=raw @business_data.to_json %>,
519
+ options: opt
520
+ });
501
521
  })
502
522
  </script>
@@ -1,11 +1,10 @@
1
1
  <div class="section">
2
- <form class="layui-form" action="">
2
+ <form class="layui-form select_year" action="">
3
3
  <span>销售人员列表</span>
4
- <div style="float:right;">年度
5
- <div class="layui-input-inline">
4
+ <div class="layui-input-inline" style="float: right">
6
5
  <%= select_tag "years", options_for_select(@years,@year), {'lay-filter': 'year' } %>
7
6
  </div>
8
- </div>
7
+ <span style="float: right;padding-right: 10px">年度</span>
9
8
  </form>
10
9
  <hr>
11
10
  <table class="layui-hide" id="table" lay-filter="table" ></table>
@@ -45,6 +44,15 @@
45
44
  <a href="/missions/businesses?clazz_id={{d.o_clazz_id}}&staff_id={{d.id}}">{{d.business_o}}</a>
46
45
  </div>
47
46
  </script>
47
+ <script type="text/html" id="school_count">
48
+ <div class="layui-text">
49
+ <a href="/missions/customers?staff_id={{d.id}}">{{d.school_count}}</a>
50
+ </div>
51
+ </script>
52
+ <script type="text/html" id="bussinessBar">
53
+ <div class="layui-btn-container">
54
+ </div>
55
+ </script>
48
56
  <script>
49
57
  layui.use('table', function () {
50
58
  var form = layui.form,
@@ -59,7 +67,9 @@
59
67
  table.render({
60
68
  elem: '#table',
61
69
  url: '/missions/sales?year=<%= @year %>',
62
- cellMinWidth: 80,
70
+ defaultToolbar: ['filter'],
71
+ cellMinWidth: 80,
72
+ toolbar: '#bussinessBar',
63
73
  totalRow:true,
64
74
  cols: [
65
75
  [{
@@ -74,6 +84,7 @@
74
84
  }, {
75
85
  field: 'area',
76
86
  title: '负责区域',
87
+ width: 100,
77
88
  templet:'<div><span title="{{d.area}}">{{d.area}}</span></div>'
78
89
  }, {
79
90
  field: 'business_a',
@@ -123,12 +134,49 @@
123
134
  title: '中标金额',
124
135
  totalRow:true,sort:true,
125
136
  width: 120
126
- }, {
137
+ },
138
+ {
127
139
  field: 'return_money',
128
140
  title: '回款金额',
129
141
  totalRow:true,sort:true,
130
142
  width: 120
131
- }
143
+ },
144
+ {
145
+ field: 'school_count',
146
+ title: '负责学校数',
147
+ sort:true,
148
+ totalRow:true,
149
+ templet: "#school_count",
150
+ width: 120
151
+ },
152
+ {
153
+ field: 'follow_school_count',
154
+ title: '跟进学校数',
155
+ sort:true,
156
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
157
+ width: 120
158
+ },
159
+ {
160
+ field: 'follow_school_counts',
161
+ title: '跟进学校次数',
162
+ sort:true,
163
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
164
+ width: 130
165
+ },
166
+ {
167
+ field: 'follow_school_rate',
168
+ title: '学校覆盖率',
169
+ sort:true,
170
+ totalRow:true,
171
+ width: 120
172
+ },
173
+ {
174
+ field: 'follow_department_rate',
175
+ title: '学院覆盖率',
176
+ sort:true,
177
+ totalRow:true,
178
+ width: 120
179
+ },
132
180
  ]
133
181
  ],
134
182
  limit: 20,
@@ -136,19 +184,13 @@
136
184
  page: true
137
185
  });
138
186
 
139
- // var sort = {}, search = {};
140
- // table.on('sort(table)', function (obj) {
141
- // sort.field = obj.field;
142
- // sort.order = obj.type;
143
- // table.reload('table', {
144
- // initSort: obj,
145
- // where: {
146
- // sort: sort,
147
- // q: search
148
- // }
149
- // });
150
- // })
151
-
152
187
 
153
188
  });
154
- </script>
189
+ </script>
190
+ <style>
191
+ .select_year .layui-form-select .layui-input {
192
+ padding-right: 30px;
193
+ cursor: pointer;
194
+ height: 22px;
195
+ }
196
+ </style>
@@ -4,6 +4,9 @@ businesses_c_count = 0
4
4
  businesses_d_count = 0
5
5
  businesses_e_count = 0
6
6
  businesses_o_count = 0
7
+ school_counts = 0
8
+ follow_school_rates = 0
9
+ follow_department_rates = 0
7
10
  area_ids = EducodeSales::Common.where(clazz: 'area').ids.sort.to_s
8
11
  json.data do
9
12
  json.array! @staffs do |d|
@@ -33,8 +36,17 @@ json.data do
33
36
  business_d = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @d_clazz&.id).count
34
37
  business_e = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @e_clazz&.id).count
35
38
  business_o = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @o_clazz&.id).count
39
+ school_count = EducodeSales::CustomerExtension.where(customer_staff_id: d.id).size
36
40
  json.goal @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.stage_id in (?)", @x, @step_ids).sum(:total_amount).round(2)
37
- json.return_money @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ?", @x).sum("educode_sales_businesses.return_money").round(2)
41
+ json.return_money @businesses.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", @x).where.not("educode_sales_money_plans.clazz!= ?", 1).sum(:amount).round(2)
42
+ json.school_count school_count
43
+ follow_school_count = (EducodeSales::CustomerFollow.where(staff_id: d.id).pluck(:school_id) + EducodeSales::Business.where(id: EducodeSales::FollowUp.where(staff_id: d.id).pluck(:business_id).uniq).pluck(:school_id)).uniq.size
44
+ json.follow_school_count follow_school_count
45
+ json.follow_school_counts EducodeSales::CustomerFollow.where(staff_id: d.id).size + EducodeSales::FollowUp.where(staff_id: d.id).size
46
+ follow_school_rate = (follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0).round(2)
47
+ json.follow_school_rate follow_school_rate.to_s + '%'
48
+ follow_department_rate = (follow_school_count!=0 ? school_count.to_f * 110 / follow_school_count : 0).round(2)
49
+ json.follow_department_rate follow_department_rate.to_s + '%'
38
50
  else
39
51
  business_a = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @a_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
40
52
  business_b = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @b_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
@@ -42,15 +54,24 @@ json.data do
42
54
  business_d = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @d_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
43
55
  business_e = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @e_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
44
56
  business_o = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @o_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
45
- json.goal @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.stage_id in (?)", @x, @step_ids).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
46
- json.return_money @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.year = ?", @year).sum("educode_sales_businesses.return_money").round(2)
57
+ school_count = EducodeSales::CustomerExtension.where(customer_staff_id: d.id).size
58
+ json.goal @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.stage_id in (?)", @x, @step_ids).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ?", "#{@year}-01-01", "#{@year}-12-31").sum(:total_amount).round(2)
59
+ json.return_money @businesses.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", @x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{@year}-01-01 00:00:00", "#{@year}-12-31 23:59:59").sum(:amount).round(2)
60
+ json.school_count school_count
61
+ follow_school_count = (EducodeSales::CustomerFollow.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").pluck(:school_id) + EducodeSales::Business.where(id: EducodeSales::FollowUp.where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").where(staff_id: d.id).pluck(:business_id).uniq).pluck(:school_id)).uniq.size
62
+ json.follow_school_count follow_school_count
63
+ json.follow_school_counts EducodeSales::CustomerFollow.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").size + EducodeSales::FollowUp.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").size
64
+ follow_school_rate = (follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0).round(2)
65
+ json.follow_school_rate follow_school_rate.to_s + '%'
66
+ follow_department_rate = (follow_school_count!=0 ? school_count.to_f * 110 / follow_school_count : 0).round(2)
67
+ json.follow_department_rate follow_department_rate.to_s + '%'
47
68
  end
48
69
 
49
70
  json.business_a business_a
50
71
  json.business_b business_b
51
72
  json.business_c business_c
52
- json.business_d business_b
53
- json.business_e business_b
73
+ json.business_d business_d
74
+ json.business_e business_e
54
75
  json.business_o business_o
55
76
 
56
77
  json.a_clazz_id @a_clazz&.id
@@ -65,6 +86,9 @@ json.data do
65
86
  businesses_d_count += business_d
66
87
  businesses_e_count += business_e
67
88
  businesses_o_count += business_o
89
+ school_counts += school_count
90
+ follow_school_rates += follow_school_rate
91
+ follow_department_rates += follow_department_rate
68
92
  end
69
93
  end
70
94
 
@@ -75,6 +99,9 @@ json.totalRow do
75
99
  json.business_d businesses_d_count.to_s
76
100
  json.business_e businesses_e_count.to_s
77
101
  json.business_o businesses_o_count.to_s
102
+ json.school_count school_counts.to_s
103
+ json.follow_school_rate (follow_school_rates.to_f / @staffs.size).to_s + '%'
104
+ json.follow_department_rate (follow_department_rates.to_f / @staffs.size).to_s + '%'
78
105
  end
79
106
  json.code 0
80
107
  json.count @staffs.total_count
@@ -88,16 +88,6 @@
88
88
  <table class="layui-hide" id="teachers_table" style="min-height: 300px;" lay-filter="teachers_table"></table>
89
89
  </div>
90
90
  <script type="text/html" id="currentTableBar">
91
- <%# if can? :create, EducodeSales::OperationPlan %>
92
- <!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addWeek">添加周计划</a>-->
93
- <!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addMonth">添加月计划</a>-->
94
- <%# end %>
95
- <%# if can? :update, EducodeSales::Teacher %>
96
- <!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>-->
97
- <%# end %>
98
- <%# if can? :destroy, EducodeSales::Teacher %>
99
- <!-- <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>-->
100
- <%# end %>
101
91
  <% if can? :create, EducodeSales::TeacherFollow %>
102
92
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_event">添加跟进记录</a>
103
93
  <% end %>
@@ -243,19 +233,22 @@
243
233
  templet: "#event"
244
234
  },
245
235
  {
246
- field: 'regist_at',
236
+ field: 'created_on',
247
237
  width: 120,
248
238
  title: '注册时间',
239
+ sort: true,
249
240
  },
250
241
  {
251
242
  field: 'last_login_on',
252
243
  width: 120,
253
244
  title: '最近登录',
245
+ sort: true,
254
246
  },
255
247
  {
256
248
  field: 'created_at',
257
249
  width: 120,
258
250
  title: '添加时间',
251
+ sort: true,
259
252
  },
260
253
  {
261
254
  field: 'wechat',
@@ -4,8 +4,8 @@ json.data do
4
4
  json.array! @teachers do |d|
5
5
  json.id d.id
6
6
  json.name d.name
7
- json.department d.department&.name
8
- json.school d.department&.school&.name
7
+ json.department d.department&.name || ""
8
+ json.school d.department&.school&.name || ""
9
9
  json.professional_title d.professional_title
10
10
  json.job d.job
11
11
  json.user_id d.user_id
@@ -18,7 +18,7 @@ json.data do
18
18
  json.courses_count d.courses_count
19
19
  json.actives d.actives
20
20
  json.students d.students_count
21
- json.regist_at d.user.present? ? d.user.created_on.to_s(:date) : ''
21
+ json.created_on d.user.present? ? d.user.created_on.to_s(:date) : ''
22
22
  json.last_login_on (d.user.present? && d.user.last_login_on.present?) ? d.user.last_login_on.to_s(:date) : ''
23
23
  json.teacher_used d.teacher_used
24
24
  json.wechat d.wechat
@@ -42,7 +42,7 @@
42
42
  [
43
43
  {
44
44
  field: 'id',
45
- width: 100,
45
+ width: 60,
46
46
  title:'序号',type: 'numbers',
47
47
  },
48
48
  {
@@ -53,26 +53,31 @@
53
53
  },
54
54
  {
55
55
  field: 'teacher_attitude',
56
- width: 120,
56
+ width: 100,
57
57
  title: '教师态度',
58
58
  },
59
59
  {
60
60
  field: 'contact',
61
- width: 120,
61
+ width: 100,
62
62
  title: '跟进手段',
63
63
  // templet: '#showchance'
64
64
  },
65
65
  {
66
66
  field: 'course_plan',
67
- width: 150,
67
+ width: 100,
68
68
  title: '开课计划',
69
69
  // templet: '#add_keys'
70
70
  },
71
71
  {
72
72
  field: 'course_build',
73
- width: 120,
73
+ width: 100,
74
74
  title: '课堂建设',
75
75
  },
76
+ {
77
+ field: 'content',
78
+ width: 200,
79
+ title: '跟进小结',
80
+ },
76
81
  {
77
82
  field: 'students_count',
78
83
  width: 120,
@@ -15,6 +15,7 @@ json.data do
15
15
  json.course_shixuns_count d.course_shixuns_count
16
16
  json.shixuns_count d.shixuns_count
17
17
  json.is_latest d.id == @latest.id
18
+ json.content d.description
18
19
  end
19
20
  end
20
21
 
@@ -13,10 +13,13 @@
13
13
  <body class="" id="body">
14
14
  <div class="layui-layout layui-layout-admin " >
15
15
  <div class="layui-header">
16
- <div class="layui-hide-xs layui-bg-black layuimini-logo layui-logo">
16
+ <a href="/missions">
17
+ <div class="layui-hide-xs layui-bg-black layuimini-logo layui-logo">
17
18
  <%= image_tag "educode_sales/logo.png", class: 'header-logo' %>
18
19
  <span class="app-title">营销系统</span>
19
20
  </div>
21
+ </a>
22
+
20
23
 
21
24
  <ul class="layui-nav i_class" style="left: 200px">
22
25
  <li class="layui-nav-item layui-show-xs-inline-block " lay-header-event="menuLeft">
@@ -63,6 +66,10 @@
63
66
  <dd><a href="/missions/businesses" class="<%= current?('layui-this', businesses_path) %>"><i style="padding-right: 35px"></i><%= image_tag "educode_sales/4.商机管理.png",size:"15"%><i style="font-size: 25px; padding-right: 15px"></i>商机管理</a>
64
67
  </dd>
65
68
  <% end %>
69
+ <% if can? :read, EducodeSales::Customer %>
70
+ <dd><a href="/missions/customers" class="<%= current?('layui-this', customers_path) %>"><i style="padding-right: 35px"></i><%= image_tag "educode_sales/客户管理.png",size:"15"%><i style="font-size: 25px; padding-right: 15px"></i>客户管理</a>
71
+ </dd>
72
+ <% end %>
66
73
  <% if can? :read, EducodeSales::Place %>
67
74
  <dd><a href="/missions/places" class="<%= current?('layui-this', places_path) %>"><i style="padding-right: 35px"></i><%= image_tag "educode_sales/5.渠道管理.png",size:"15"%><i style="font-size: 25px; padding-right: 15px"></i>渠道管理</a></dd>
68
75
  <% end %>
data/config/routes.rb CHANGED
@@ -16,6 +16,31 @@ EducodeSales::Engine.routes.draw do
16
16
  resources :sessions do
17
17
  end
18
18
 
19
+ resources :customer_extensions do
20
+ end
21
+ resources :customer_follows do
22
+ end
23
+
24
+ resources :customers do
25
+ collection do
26
+ get :show_follow
27
+ get :show_department
28
+ get :new_follow_record
29
+ get :show_follow_record
30
+ get :edit_follow_record
31
+ get :new_department
32
+ get :edit_department
33
+ get :give
34
+ end
35
+
36
+ member do
37
+ post :create_follow_up
38
+ put :update_follow_up
39
+ post :create_department
40
+ put :update_department
41
+ end
42
+ end
43
+
19
44
  resources :operation_reports do
20
45
  member do
21
46
  get :plans
@@ -7,6 +7,21 @@ class CreateEducodeSalesRolePermissions < ActiveRecord::Migration[5.2]
7
7
  t.timestamps
8
8
  end
9
9
  if EducodeSales::Permission.last.nil?
10
+
11
+ #客户管理权限
12
+ EducodeSales::Permission.create(name: '查看客户', subject: 'Customer', action: 'read', clazz: 'customer')
13
+ EducodeSales::Permission.create(name: '添加客户', subject: 'Customer', action: 'create', clazz: 'customer')
14
+ EducodeSales::Permission.create(name: '编辑客户', subject: 'Customer', action: 'update', clazz: 'customer')
15
+ EducodeSales::Permission.create(name: '分配/移交', subject: 'Customer', action: 'give', clazz: 'customer')
16
+ EducodeSales::Permission.create(name: '查看部门', subject: 'Customer', action: 'read_department', clazz: 'customer')
17
+ EducodeSales::Permission.create(name: '添加部门', subject: 'Customer', action: 'create_department', clazz: 'customer')
18
+ EducodeSales::Permission.create(name: '编辑部门', subject: 'Customer', action: 'update_department', clazz: 'customer')
19
+ EducodeSales::Permission.create(name: '查看跟进记录', subject: 'Customer', action: 'read_follow', clazz: 'customer')
20
+ EducodeSales::Permission.create(name: '添加跟进记录', subject: 'Customer', action: 'create_follow', clazz: 'customer')
21
+ EducodeSales::Permission.create(name: '编辑跟进记录', subject: 'Customer', action: 'update_follow', clazz: 'customer')
22
+ EducodeSales::Permission.create(name: '删除跟进记录', subject: 'Customer', action: 'destroy_follow', clazz: 'customer')
23
+
24
+
10
25
  EducodeSales::Permission.create(name: '查看数据', subject: 'SaleTrend', action: 'trends', clazz: 'market')
11
26
  EducodeSales::Permission.create(name: '编辑目标', subject: 'SaleTrend', action: 'sale_trends', clazz: 'market')
12
27
 
@@ -0,0 +1,9 @@
1
+ class CreateCustomerExtensions < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :educode_sales_customer_extensions do |t|
4
+ t.references :staff
5
+ t.references :school
6
+ t.integer :customer_staff_id
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ class CreateEducodeSalesCustomerFollows < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :educode_sales_customer_follows do |t|
4
+ t.integer :school_id
5
+ t.integer :department_id
6
+ t.references :staff
7
+ t.text :content
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class AddPositionToCommons < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :educode_sales_permissions, :position, :integer
4
+ EducodeSales::Permission.all.each_with_index do |d,index|
5
+ if d.clazz == '销售态势' || d.clazz == '销售分工' || d.clazz == '商机管理' || d.clazz == '客户管理'
6
+ d.update(position: index)
7
+ else
8
+ d.update(position: index * 10)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ class AddSchoolIdToEducodeSalesBusinesses < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :educode_sales_businesses, :school_id, :integer
4
+ EducodeSales::Business.all.each do |business|
5
+ business.update(school_id: business.department.school.id)
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.5.8'
2
+ VERSION = '0.6.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: educode_sales
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -110,6 +110,7 @@ files:
110
110
  - app/assets/images/educode_sales/loginbg.png
111
111
  - app/assets/images/educode_sales/logo.png
112
112
  - app/assets/images/educode_sales/回收站.png
113
+ - app/assets/images/educode_sales/客户管理.png
113
114
  - app/assets/javascripts/educode_sales/application.js
114
115
  - app/assets/javascripts/educode_sales/extent/miniPage.js
115
116
  - app/assets/javascripts/educode_sales/extent/request.js
@@ -137,6 +138,9 @@ files:
137
138
  - app/controllers/educode_sales/application_controller.rb
138
139
  - app/controllers/educode_sales/businesses_controller.rb
139
140
  - app/controllers/educode_sales/commons_controller.rb
141
+ - app/controllers/educode_sales/customer_extensions_controller.rb
142
+ - app/controllers/educode_sales/customer_follows_controller.rb
143
+ - app/controllers/educode_sales/customers_controller.rb
140
144
  - app/controllers/educode_sales/follow_ups_controller.rb
141
145
  - app/controllers/educode_sales/home_controller.rb
142
146
  - app/controllers/educode_sales/import_teachers_controller.rb
@@ -173,6 +177,9 @@ files:
173
177
  - app/models/educode_sales/business.rb
174
178
  - app/models/educode_sales/common.rb
175
179
  - app/models/educode_sales/course_subject.rb
180
+ - app/models/educode_sales/customer.rb
181
+ - app/models/educode_sales/customer_extension.rb
182
+ - app/models/educode_sales/customer_follow.rb
176
183
  - app/models/educode_sales/follow_up.rb
177
184
  - app/models/educode_sales/key_person.rb
178
185
  - app/models/educode_sales/market_area.rb
@@ -220,6 +227,19 @@ files:
220
227
  - app/views/educode_sales/commons/index.json.jbuilder
221
228
  - app/views/educode_sales/commons/new.html.erb
222
229
  - app/views/educode_sales/commons/show.json.jbuilder
230
+ - app/views/educode_sales/customers/edit.html.erb
231
+ - app/views/educode_sales/customers/edit_department.html.erb
232
+ - app/views/educode_sales/customers/edit_follow_record.html.erb
233
+ - app/views/educode_sales/customers/give.html.erb
234
+ - app/views/educode_sales/customers/index.html.erb
235
+ - app/views/educode_sales/customers/index.json.jbuilder
236
+ - app/views/educode_sales/customers/new.html.erb
237
+ - app/views/educode_sales/customers/new_department.html.erb
238
+ - app/views/educode_sales/customers/new_follow_record.html.erb
239
+ - app/views/educode_sales/customers/show_department.json.jbuilder
240
+ - app/views/educode_sales/customers/show_follow.html.erb
241
+ - app/views/educode_sales/customers/show_follow.json.jbuilder
242
+ - app/views/educode_sales/customers/show_follow_record.html.erb
223
243
  - app/views/educode_sales/follow_ups/index.json.jbuilder
224
244
  - app/views/educode_sales/follow_ups/money_plans.json.jbuilder
225
245
  - app/views/educode_sales/follow_ups/teachers.json.jbuilder
@@ -383,6 +403,10 @@ files:
383
403
  - db/migrate/20211109015617_create_educode_sales_recycles.rb
384
404
  - db/migrate/20211201023750_create_educode_sales_teacher_assign_follows.rb
385
405
  - db/migrate/20211206054756_add_year_to_follow_ups.rb
406
+ - db/migrate/20211214100803_create_customer_extensions.rb
407
+ - db/migrate/20211215025029_create_educode_sales_customer_follows.rb
408
+ - db/migrate/20211220102720_add_position_to_commons.rb
409
+ - db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb
386
410
  - lib/educode_sales.rb
387
411
  - lib/educode_sales/engine.rb
388
412
  - lib/educode_sales/version.rb