educode_sales 0.5.8 → 0.5.9

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 (46) 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 +1 -0
  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/roles_controller.rb +4 -1
  8. data/app/models/educode_sales/customer.rb +4 -0
  9. data/app/models/educode_sales/customer_extension.rb +7 -0
  10. data/app/models/educode_sales/customer_follow.rb +5 -0
  11. data/app/models/educode_sales/permission.rb +2 -1
  12. data/app/models/educode_sales/role_area.rb +1 -0
  13. data/app/views/educode_sales/businesses/_follows.html.erb +7 -4
  14. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +2 -2
  15. data/app/views/educode_sales/businesses/index.html.erb +3 -2
  16. data/app/views/educode_sales/businesses/new.html.erb +3 -0
  17. data/app/views/educode_sales/businesses/new_follow_record.html.erb +2 -2
  18. data/app/views/educode_sales/businesses/show_follow.html.erb +6 -1
  19. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  20. data/app/views/educode_sales/customers/edit.html.erb +60 -0
  21. data/app/views/educode_sales/customers/edit_department.html.erb +52 -0
  22. data/app/views/educode_sales/customers/edit_follow_record.html.erb +50 -0
  23. data/app/views/educode_sales/customers/give.html.erb +51 -0
  24. data/app/views/educode_sales/customers/index.html.erb +485 -0
  25. data/app/views/educode_sales/customers/index.json.jbuilder +25 -0
  26. data/app/views/educode_sales/customers/new.html.erb +89 -0
  27. data/app/views/educode_sales/customers/new_department.html.erb +53 -0
  28. data/app/views/educode_sales/customers/new_follow_record.html.erb +54 -0
  29. data/app/views/educode_sales/customers/show_department.json.jbuilder +13 -0
  30. data/app/views/educode_sales/customers/show_follow.html.erb +439 -0
  31. data/app/views/educode_sales/customers/show_follow.json.jbuilder +13 -0
  32. data/app/views/educode_sales/customers/show_follow_record.html.erb +17 -0
  33. data/app/views/educode_sales/places/index.json.jbuilder +1 -1
  34. data/app/views/educode_sales/roles/edit.html.erb +8 -0
  35. data/app/views/educode_sales/sales/index.html.erb +44 -20
  36. data/app/views/educode_sales/sales/index.json.jbuilder +7 -5
  37. data/app/views/educode_sales/teachers/index.json.jbuilder +2 -2
  38. data/app/views/educode_sales/teachers/show_follow.html.erb +10 -5
  39. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  40. data/app/views/layouts/educode_sales/application.html.erb +8 -1
  41. data/config/routes.rb +25 -0
  42. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +15 -0
  43. data/db/migrate/20211214100803_create_customer_extensions.rb +9 -0
  44. data/db/migrate/20211215025029_create_educode_sales_customer_follows.rb +12 -0
  45. data/lib/educode_sales/version.rb +1 -1
  46. metadata +24 -2
@@ -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>
@@ -123,12 +122,43 @@
123
122
  title: '中标金额',
124
123
  totalRow:true,sort:true,
125
124
  width: 120
126
- }, {
125
+ },
126
+ {
127
127
  field: 'return_money',
128
128
  title: '回款金额',
129
129
  totalRow:true,sort:true,
130
130
  width: 120
131
- }
131
+ },
132
+ {
133
+ field: 'school_count',
134
+ title: '负责学校数',
135
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
136
+ width: 120
137
+ },
138
+ {
139
+ field: 'follow_school_count',
140
+ title: '跟进学校数',
141
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
142
+ width: 120
143
+ },
144
+ {
145
+ field: 'follow_school_counts',
146
+ title: '跟进学校次数',
147
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
148
+ width: 120
149
+ },
150
+ {
151
+ field: 'follow_school_rate',
152
+ title: '学校覆盖率',
153
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
154
+ width: 120
155
+ },
156
+ {
157
+ field: 'follow_department_rate',
158
+ title: '学院覆盖率',
159
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
160
+ width: 120
161
+ },
132
162
  ]
133
163
  ],
134
164
  limit: 20,
@@ -136,19 +166,13 @@
136
166
  page: true
137
167
  });
138
168
 
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
169
 
153
170
  });
154
- </script>
171
+ </script>
172
+ <style>
173
+ .select_year .layui-form-select .layui-input {
174
+ padding-right: 30px;
175
+ cursor: pointer;
176
+ height: 22px;
177
+ }
178
+ </style>
@@ -34,7 +34,8 @@ json.data do
34
34
  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
35
  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
36
36
  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)
37
+ 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)
38
+ json.school_count EducodeSales::CustomerExtension.where(customer_staff_id: d.id).size
38
39
  else
39
40
  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
41
  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 +43,16 @@ json.data do
42
43
  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
44
  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
45
  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)
46
+ 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)
47
+ 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)
48
+ json.school_count EducodeSales::CustomerExtension.where(customer_staff_id: d.id).size
47
49
  end
48
50
 
49
51
  json.business_a business_a
50
52
  json.business_b business_b
51
53
  json.business_c business_c
52
- json.business_d business_b
53
- json.business_e business_b
54
+ json.business_d business_d
55
+ json.business_e business_e
54
56
  json.business_o business_o
55
57
 
56
58
  json.a_clazz_id @a_clazz&.id
@@ -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,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.8'
2
+ VERSION = '0.5.9'
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.5.9
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-16 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,8 @@ 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
386
408
  - lib/educode_sales.rb
387
409
  - lib/educode_sales/engine.rb
388
410
  - lib/educode_sales/version.rb