educode_sales 0.5.7 → 0.6.1

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 (65) 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 +20 -3
  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 +194 -0
  7. data/app/controllers/educode_sales/follow_ups_controller.rb +9 -9
  8. data/app/controllers/educode_sales/home_controller.rb +9 -4
  9. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  10. data/app/controllers/educode_sales/sale_trends_controller.rb +18 -7
  11. data/app/controllers/educode_sales/sales_controller.rb +3 -0
  12. data/app/controllers/educode_sales/teachers_controller.rb +5 -0
  13. data/app/models/educode_sales/customer.rb +4 -0
  14. data/app/models/educode_sales/customer_extension.rb +7 -0
  15. data/app/models/educode_sales/customer_follow.rb +5 -0
  16. data/app/models/educode_sales/permission.rb +2 -1
  17. data/app/models/educode_sales/role_area.rb +1 -0
  18. data/app/views/educode_sales/businesses/_follows.html.erb +43 -18
  19. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +13 -0
  20. data/app/views/educode_sales/businesses/index.html.erb +27 -6
  21. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -1
  22. data/app/views/educode_sales/businesses/new.html.erb +3 -0
  23. data/app/views/educode_sales/businesses/new_follow_record.html.erb +13 -0
  24. data/app/views/educode_sales/businesses/show_follow.html.erb +6 -1
  25. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  26. data/app/views/educode_sales/businesses/show_follow_record.html.erb +8 -0
  27. data/app/views/educode_sales/customers/edit.html.erb +60 -0
  28. data/app/views/educode_sales/customers/edit_department.html.erb +54 -0
  29. data/app/views/educode_sales/customers/edit_follow_record.html.erb +50 -0
  30. data/app/views/educode_sales/customers/give.html.erb +51 -0
  31. data/app/views/educode_sales/customers/index.html.erb +493 -0
  32. data/app/views/educode_sales/customers/index.json.jbuilder +25 -0
  33. data/app/views/educode_sales/customers/new.html.erb +89 -0
  34. data/app/views/educode_sales/customers/new_department.html.erb +56 -0
  35. data/app/views/educode_sales/customers/new_follow_record.html.erb +54 -0
  36. data/app/views/educode_sales/customers/show_department.json.jbuilder +13 -0
  37. data/app/views/educode_sales/customers/show_follow.html.erb +442 -0
  38. data/app/views/educode_sales/customers/show_follow.json.jbuilder +13 -0
  39. data/app/views/educode_sales/customers/show_follow_record.html.erb +18 -0
  40. data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -0
  41. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +6 -0
  42. data/app/views/educode_sales/operation_plans/_monthly.html.erb +2 -0
  43. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +6 -0
  44. data/app/views/educode_sales/operation_plans/_weekly.html.erb +2 -0
  45. data/app/views/educode_sales/places/index.json.jbuilder +1 -1
  46. data/app/views/educode_sales/plans/_monthPlan.html.erb +5 -0
  47. data/app/views/educode_sales/plans/_monthly.html.erb +1 -0
  48. data/app/views/educode_sales/plans/_weekPlan.html.erb +5 -0
  49. data/app/views/educode_sales/plans/_weekly.html.erb +1 -0
  50. data/app/views/educode_sales/roles/edit.html.erb +8 -0
  51. data/app/views/educode_sales/sales/index.html.erb +70 -19
  52. data/app/views/educode_sales/sales/index.json.jbuilder +46 -16
  53. data/app/views/educode_sales/sales/operations.html.erb +1 -0
  54. data/app/views/educode_sales/teachers/index.html.erb +6 -1
  55. data/app/views/educode_sales/teachers/index.json.jbuilder +2 -2
  56. data/app/views/educode_sales/teachers/show_follow.html.erb +10 -5
  57. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  58. data/app/views/layouts/educode_sales/application.html.erb +8 -1
  59. data/config/routes.rb +25 -0
  60. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +15 -0
  61. data/db/migrate/20211206054756_add_year_to_follow_ups.rb +5 -0
  62. data/db/migrate/20211214100803_create_customer_extensions.rb +9 -0
  63. data/db/migrate/20211215025029_create_educode_sales_customer_follows.rb +12 -0
  64. data/lib/educode_sales/version.rb +1 -1
  65. metadata +25 -2
@@ -121,6 +121,7 @@
121
121
  field: 'content',
122
122
  width: 300,
123
123
  title: '个人总结',
124
+ templet:'<div><span title="{{d.content}}">{{d.content}}</span></div>'
124
125
  },
125
126
  {
126
127
  field: 'level1_score',
@@ -36,6 +36,14 @@
36
36
  <%= radio_button_tag("business", "全部", @areas.include?("商机管理-全部"), {title: '全部列表', id: 3}) %>
37
37
  </div>
38
38
  </div>
39
+ <div class="layui-form-item">
40
+ <label class="layui-form-label">客户管理</label>
41
+ <div class="layui-input-block">
42
+ <%= radio_button_tag("customer", "自己", @areas.include?("客户管理-自己"), {title: '本人负责列表', id: 13}) %>
43
+ <%= radio_button_tag("customer", "区域", @areas.include?("客户管理-区域"), {title: '本人负责区域列表', id:14}) %>
44
+ <%= radio_button_tag("customer", "全部", @areas.include?("客户管理-全部"), {title: '全部列表', id: 15}) %>
45
+ </div>
46
+ </div>
39
47
  <div class="layui-form-item">
40
48
  <label class="layui-form-label">销售计划</label>
41
49
  <div class="layui-input-block">
@@ -1,5 +1,11 @@
1
1
  <div class="section">
2
- <h4><span>销售人员列表</span></h4>
2
+ <form class="layui-form select_year" action="">
3
+ <span>销售人员列表</span>
4
+ <div class="layui-input-inline" style="float: right">
5
+ <%= select_tag "years", options_for_select(@years,@year), {'lay-filter': 'year' } %>
6
+ </div>
7
+ <span style="float: right;padding-right: 10px">年度</span>
8
+ </form>
3
9
  <hr>
4
10
  <table class="layui-hide" id="table" lay-filter="table" ></table>
5
11
  </div>
@@ -38,13 +44,25 @@
38
44
  <a href="/missions/businesses?clazz_id={{d.o_clazz_id}}&staff_id={{d.id}}">{{d.business_o}}</a>
39
45
  </div>
40
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>
41
52
  <script>
42
53
  layui.use('table', function () {
43
- var table = layui.table;
54
+ var form = layui.form,
55
+ table = layui.table;
56
+
57
+ form.on('select(year)', function(data){
58
+ console.log(data, )
59
+ year = data.value
60
+ window.location.href = "/missions/sales?year=" + data.value
61
+ })
44
62
 
45
63
  table.render({
46
64
  elem: '#table',
47
- url: '/missions/sales',
65
+ url: '/missions/sales?year=<%= @year %>',
48
66
  cellMinWidth: 80,
49
67
  totalRow:true,
50
68
  cols: [
@@ -60,6 +78,8 @@
60
78
  }, {
61
79
  field: 'area',
62
80
  title: '负责区域',
81
+ width: 100,
82
+ templet:'<div><span title="{{d.area}}">{{d.area}}</span></div>'
63
83
  }, {
64
84
  field: 'business_a',
65
85
  title: 'A类商机',
@@ -108,12 +128,49 @@
108
128
  title: '中标金额',
109
129
  totalRow:true,sort:true,
110
130
  width: 120
111
- }, {
131
+ },
132
+ {
112
133
  field: 'return_money',
113
134
  title: '回款金额',
114
135
  totalRow:true,sort:true,
115
136
  width: 120
116
- }
137
+ },
138
+ {
139
+ field: 'school_count',
140
+ title: '负责学校数',
141
+ sort:true,
142
+ totalRow:true,
143
+ templet: "#school_count",
144
+ width: 120
145
+ },
146
+ {
147
+ field: 'follow_school_count',
148
+ title: '跟进学校数',
149
+ sort:true,
150
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
151
+ width: 120
152
+ },
153
+ {
154
+ field: 'follow_school_counts',
155
+ title: '跟进学校次数',
156
+ sort:true,
157
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
158
+ width: 130
159
+ },
160
+ {
161
+ field: 'follow_school_rate',
162
+ title: '学校覆盖率',
163
+ sort:true,
164
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
165
+ width: 120
166
+ },
167
+ {
168
+ field: 'follow_department_rate',
169
+ title: '学院覆盖率',
170
+ sort:true,
171
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
172
+ width: 120
173
+ },
117
174
  ]
118
175
  ],
119
176
  limit: 20,
@@ -121,19 +178,13 @@
121
178
  page: true
122
179
  });
123
180
 
124
- // var sort = {}, search = {};
125
- // table.on('sort(table)', function (obj) {
126
- // sort.field = obj.field;
127
- // sort.order = obj.type;
128
- // table.reload('table', {
129
- // initSort: obj,
130
- // where: {
131
- // sort: sort,
132
- // q: search
133
- // }
134
- // });
135
- // })
136
-
137
181
 
138
182
  });
139
- </script>
183
+ </script>
184
+ <style>
185
+ .select_year .layui-form-select .layui-input {
186
+ padding-right: 30px;
187
+ cursor: pointer;
188
+ height: 22px;
189
+ }
190
+ </style>
@@ -4,6 +4,7 @@ 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
7
8
  area_ids = EducodeSales::Common.where(clazz: 'area').ids.sort.to_s
8
9
  json.data do
9
10
  json.array! @staffs do |d|
@@ -26,32 +27,60 @@ json.data do
26
27
  else
27
28
  json.area ''
28
29
  end
29
- 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).count
30
- businesses_a_count += business_a
30
+ if @year == "全部"
31
+ 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).count
32
+ 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).count
33
+ business_c = @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 = ?", @c_clazz&.id).count
34
+ 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
35
+ 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
36
+ 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
37
+ school_count = EducodeSales::CustomerExtension.where(customer_staff_id: d.id).size
38
+ 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)
39
+ 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)
40
+ json.school_count school_count
41
+ follow_school_count = EducodeSales::CustomerFollow.where(staff_id: d.id).pluck(:school_id).uniq.size
42
+ json.follow_school_count follow_school_count
43
+ json.follow_school_counts EducodeSales::CustomerFollow.where(staff_id: d.id).size + EducodeSales::FollowUp.where(staff_id: d.id).size
44
+ json.follow_school_rate follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0
45
+ json.follow_department_rate follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0
46
+ else
47
+ 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
48
+ 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
49
+ business_c = @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 = ?", @c_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
50
+ 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
51
+ 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
52
+ 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
53
+ school_count = EducodeSales::CustomerExtension.where(customer_staff_id: d.id).size
54
+ 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)
55
+ 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)
56
+ json.school_count school_count
57
+ 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).uniq.size || 0
58
+ json.follow_school_count follow_school_count
59
+ 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
60
+ json.follow_school_rate follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0
61
+ json.follow_department_rate follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0
62
+ end
63
+
31
64
  json.business_a business_a
32
- 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).count
33
- businesses_b_count += business_b
34
65
  json.business_b business_b
35
- business_c = @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 = ?", @c_clazz&.id).count
36
- businesses_c_count += business_c
37
66
  json.business_c business_c
38
- 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
39
- businesses_d_count += business_d
40
- json.business_d business_b
41
- 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
42
- businesses_e_count += business_e
43
- json.business_e business_b
44
- 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
45
- businesses_o_count += business_o
67
+ json.business_d business_d
68
+ json.business_e business_e
46
69
  json.business_o business_o
47
- 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)
48
- 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)
70
+
49
71
  json.a_clazz_id @a_clazz&.id
50
72
  json.b_clazz_id @b_clazz&.id
51
73
  json.c_clazz_id @c_clazz&.id
52
74
  json.d_clazz_id @d_clazz&.id
53
75
  json.e_clazz_id @e_clazz&.id
54
76
  json.o_clazz_id @o_clazz&.id
77
+ businesses_a_count += business_a
78
+ businesses_b_count += business_b
79
+ businesses_c_count += business_c
80
+ businesses_d_count += business_d
81
+ businesses_e_count += business_e
82
+ businesses_o_count += business_o
83
+ school_counts += school_count
55
84
  end
56
85
  end
57
86
 
@@ -62,6 +91,7 @@ json.totalRow do
62
91
  json.business_d businesses_d_count.to_s
63
92
  json.business_e businesses_e_count.to_s
64
93
  json.business_o businesses_o_count.to_s
94
+ json.school_count school_counts.to_s
65
95
  end
66
96
  json.code 0
67
97
  json.count @staffs.total_count
@@ -46,6 +46,7 @@
46
46
  }, {
47
47
  field: 'area',
48
48
  title: '负责区域',
49
+ templet:'<div><span title="{{d.area}}">{{d.area}}</span></div>'
49
50
  }, {
50
51
  field: 'schools',
51
52
  title: '跟进学校',
@@ -160,6 +160,7 @@
160
160
  width: 60,
161
161
  title:'序号',type: 'numbers',
162
162
  totalRowText:'合计',
163
+
163
164
  },
164
165
  {
165
166
  field: 'name',
@@ -171,11 +172,15 @@
171
172
  field: 'school',
172
173
  width: 160,
173
174
  title: '单位',
175
+ templet:'<div><span title="{{d.school}}">{{d.school}}</span></div>'
176
+
174
177
  },
175
178
  {
176
179
  field: 'department',
177
180
  width: 130,
178
- title: '部门'
181
+ title: '部门',
182
+ templet:'<div><span title="{{d.department}}">{{d.department}}</span></div>'
183
+
179
184
  },
180
185
  {
181
186
  field: 'professional_title',
@@ -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
@@ -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,5 @@
1
+ class AddYearToFollowUps < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :educode_sales_follow_ups, :year, :integer
4
+ end
5
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.5.7'
2
+ VERSION = '0.6.1'
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.7
4
+ version: 0.6.1
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-03 00:00:00.000000000 Z
11
+ date: 2021-12-17 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
@@ -382,6 +402,9 @@ files:
382
402
  - db/migrate/20211102085743_add_bidded_date_educode_sales_follow_ups.rb
383
403
  - db/migrate/20211109015617_create_educode_sales_recycles.rb
384
404
  - db/migrate/20211201023750_create_educode_sales_teacher_assign_follows.rb
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
385
408
  - lib/educode_sales.rb
386
409
  - lib/educode_sales/engine.rb
387
410
  - lib/educode_sales/version.rb