educode_sales 0.2.0 → 0.2.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales/indexlogo.png +0 -0
  3. data/app/assets/stylesheets/educode_sales/app.css +23 -0
  4. data/app/assets/stylesheets/educode_sales/public.css +4 -0
  5. data/app/controllers/educode_sales/businesses_controller.rb +12 -1
  6. data/app/controllers/educode_sales/follow_ups_controller.rb +13 -0
  7. data/app/controllers/educode_sales/home_controller.rb +7 -7
  8. data/app/controllers/educode_sales/operation_reports_controller.rb +3 -3
  9. data/app/controllers/educode_sales/staffs_controller.rb +3 -2
  10. data/app/controllers/educode_sales/teacher_follows_controller.rb +1 -0
  11. data/app/controllers/educode_sales/teachers_controller.rb +1 -0
  12. data/app/models/educode_sales/activity.rb +1 -1
  13. data/app/models/educode_sales/staff.rb +3 -3
  14. data/app/models/educode_sales/teacher.rb +3 -2
  15. data/app/views/educode_sales/activities/index.html.erb +11 -11
  16. data/app/views/educode_sales/activities/show_teachers.html.erb +1 -5
  17. data/app/views/educode_sales/businesses/edit_plan.html.erb +7 -2
  18. data/app/views/educode_sales/businesses/index.html.erb +18 -10
  19. data/app/views/educode_sales/businesses/index.json.jbuilder +3 -1
  20. data/app/views/educode_sales/businesses/new.html.erb +1 -1
  21. data/app/views/educode_sales/businesses/new_follow_record.html.erb +12 -2
  22. data/app/views/educode_sales/businesses/show_follow.html.erb +23 -19
  23. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  24. data/app/views/educode_sales/businesses/show_keys.html.erb +1 -1
  25. data/app/views/educode_sales/commons/edit.html.erb +1 -1
  26. data/app/views/educode_sales/commons/index.html.erb +2 -3
  27. data/app/views/educode_sales/home/index.html.erb +1 -1
  28. data/app/views/educode_sales/home/search_teacher.json.jbuilder +2 -2
  29. data/app/views/educode_sales/home/statistics.html.erb +1 -0
  30. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +2 -3
  31. data/app/views/educode_sales/operation_plans/_monthly.html.erb +2 -2
  32. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +2 -3
  33. data/app/views/educode_sales/operation_plans/_weekly.html.erb +2 -1
  34. data/app/views/educode_sales/operation_plans/edit_monthly.html.erb +3 -3
  35. data/app/views/educode_sales/operation_plans/edit_weekly.html.erb +3 -3
  36. data/app/views/educode_sales/operation_plans/new_month.html.erb +1 -1
  37. data/app/views/educode_sales/operation_plans/new_monthly.html.erb +3 -3
  38. data/app/views/educode_sales/operation_plans/new_week.html.erb +1 -1
  39. data/app/views/educode_sales/operation_plans/new_weekly.html.erb +3 -3
  40. data/app/views/educode_sales/operation_plans/show_monthly.html.erb +3 -3
  41. data/app/views/educode_sales/operation_plans/show_weekly.html.erb +3 -3
  42. data/app/views/educode_sales/operation_reports/audit.html.erb +2 -2
  43. data/app/views/educode_sales/operation_reports/edit.html.erb +3 -3
  44. data/app/views/educode_sales/operation_reports/show.html.erb +139 -27
  45. data/app/views/educode_sales/places/index.html.erb +6 -6
  46. data/app/views/educode_sales/plans/_monthPlan.html.erb +2 -1
  47. data/app/views/educode_sales/plans/_monthly.html.erb +2 -1
  48. data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -1
  49. data/app/views/educode_sales/plans/_weekly.html.erb +2 -1
  50. data/app/views/educode_sales/plans/audit_weekly.html.erb +3 -3
  51. data/app/views/educode_sales/plans/edit_monthly.html.erb +3 -3
  52. data/app/views/educode_sales/plans/edit_weekly.html.erb +1 -1
  53. data/app/views/educode_sales/plans/new_monthly.html.erb +1 -1
  54. data/app/views/educode_sales/plans/new_weekly.html.erb +1 -1
  55. data/app/views/educode_sales/plans/show_monthly.html.erb +3 -3
  56. data/app/views/educode_sales/plans/show_weekly.html.erb +1 -1
  57. data/app/views/educode_sales/roles/index.html.erb +2 -1
  58. data/app/views/educode_sales/sale_reports/audit.html.erb +1 -1
  59. data/app/views/educode_sales/sale_reports/edit.html.erb +3 -3
  60. data/app/views/educode_sales/sale_reports/show.html.erb +1 -1
  61. data/app/views/educode_sales/sale_trends/operations.html.erb +1 -1
  62. data/app/views/educode_sales/sales/index.html.erb +12 -7
  63. data/app/views/educode_sales/sales/index.json.jbuilder +1 -1
  64. data/app/views/educode_sales/sales/operations.html.erb +7 -5
  65. data/app/views/educode_sales/sales/operations.json.jbuilder +3 -2
  66. data/app/views/educode_sales/sales/school.html.erb +1 -2
  67. data/app/views/educode_sales/sales/xschool.html.erb +1 -2
  68. data/app/views/educode_sales/staffs/follow_up_departments.json.jbuilder +1 -2
  69. data/app/views/educode_sales/staffs/follow_up_schools.json.jbuilder +1 -2
  70. data/app/views/educode_sales/staffs/index.html.erb +6 -8
  71. data/app/views/educode_sales/staffs/new.html.erb +1 -1
  72. data/app/views/educode_sales/teachers/add_courses.html.erb +3 -3
  73. data/app/views/educode_sales/teachers/add_event.html.erb +1 -1
  74. data/app/views/educode_sales/teachers/add_keys.html.erb +11 -5
  75. data/app/views/educode_sales/teachers/index.html.erb +8 -6
  76. data/app/views/educode_sales/teachers/new_follow_record.html.erb +1 -0
  77. data/app/views/educode_sales/teachers/search_new.html.erb +2 -2
  78. data/app/views/educode_sales/teachers/show_class.html.erb +1 -1
  79. data/app/views/educode_sales/teachers/show_follow.html.erb +11 -9
  80. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  81. data/app/views/layouts/educode_sales/application.html.erb +6 -9
  82. data/config/routes.rb +1 -0
  83. data/lib/educode_sales/version.rb +1 -1
  84. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32ccbb45cc443858202f0e53c3f30a5545100930
4
- data.tar.gz: 1fa4454eb41cf3c2a554859251d5484e487aa9ec
3
+ metadata.gz: 502c9e7e4d9ee833267a0437e118c4f91bc17cd6
4
+ data.tar.gz: 6b1cd1a51cc2aaa8de78ab2bb81cb251e7a015d4
5
5
  SHA512:
6
- metadata.gz: 0f4bdf23a11199467f92acb3dd4f2eac20c2500130bc5838eb69bf85984f42b2399f5d6854bf8afb20e7b85fedea6e1557e8b4cc8a0191fec627faa75a4cf8e8
7
- data.tar.gz: bc4ae21970c1e12ab3ad7ec78b053fb1a90d431a8a6cbe0022e53f36befc6a25ea7e6fbcc5ace7b1c4f43761f8f3936e9519448b295cb0a4fe3b4d38eacc4e4d
6
+ metadata.gz: 64df20ba0bfad8e1771a8b6b36a0dbcf12367ec372f1b63a5ca655655a8a0469bf9f5b82443f823332bc46d99288b21d5e815ff0e59dd3e910ccc313d15e2c38
7
+ data.tar.gz: be53e1e0259e68a32eb92fb7278494ec5029278cbb2b73473ca86f4d9b3a4808f6ddc92e96211c06e56ec57e141beae594009cb8d4c8cfd7b3716a10e501a339
@@ -255,4 +255,27 @@ td .layui-table-cell .layui-form-select {
255
255
 
256
256
  .large-select .layui-form-select dl {
257
257
  max-height: 220px;
258
+ }
259
+
260
+ .layui-form input::-webkit-input-placeholder,
261
+ .layui-form textarea::-webkit-input-placeholder {
262
+ color: #ccc;
263
+ }
264
+
265
+ .layui-form input:-moz-placeholder,
266
+ .layui-form textarea:-moz-placeholder {
267
+ /* Mozilla Firefox 4 to 18 */
268
+ color: #ccc;
269
+ }
270
+
271
+ .layui-form input::-moz-placeholder,
272
+ .layui-form textarea::-moz-placeholder {
273
+ /* Mozilla Firefox 19+ */
274
+ color: #ccc;
275
+ }
276
+
277
+ .layui-form input:-ms-input-placeholder,
278
+ .layui-form textarea:-ms-input-placeholder {
279
+ /* Internet Explorer 10+ */
280
+ color: #ccc;
258
281
  }
@@ -45,3 +45,7 @@
45
45
  padding: 10px 20px 5px 20px;
46
46
  color: #6b6b6b;
47
47
  }
48
+
49
+ input::placeholder {
50
+ font-size: 6px;
51
+ }
@@ -7,7 +7,8 @@ module EducodeSales
7
7
  authorize! :read, Business
8
8
  respond_to do |format|
9
9
  format.html do
10
- @staffs = Staff.joins(:user).map { |d| [d.user.real_name, d.id]}
10
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
11
+ @staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
11
12
  end
12
13
  format.json do
13
14
  if @current_admin.is_admin?
@@ -115,6 +116,15 @@ module EducodeSales
115
116
  end
116
117
  end
117
118
 
119
+ def updateMoney
120
+ business = Business.find(params[:id])
121
+ if business.update(return_money: params[:return_money])
122
+ render_success
123
+ else
124
+ render_failure business
125
+ end
126
+ end
127
+
118
128
  def destroy
119
129
  business = Business.find(params[:id])
120
130
  business.destroy
@@ -145,6 +155,7 @@ module EducodeSales
145
155
  @follow_ups = @follow_ups.order("created_at desc")
146
156
  end
147
157
  @follow_ups = @follow_ups.page(params[:page]).per(params[:limit])
158
+ @latest = @follow_ups.order(created_at: :desc).first
148
159
  end
149
160
  end
150
161
  end
@@ -9,6 +9,19 @@ module EducodeSales
9
9
  follow_up.staff = @current_admin
10
10
  follow_up.profit_amount = follow_up.actual_amount * (100-follow_up.divide_rate.to_i) * 0.01 if follow_up.actual_amount
11
11
  if follow_up.save
12
+ if @business.last_follow_up.present?
13
+ @business.last_follow_up.key_person.each do |d|
14
+ key_person = d.dup
15
+ key_person.follow_up_id = follow_up.id
16
+ key_person.save
17
+ end
18
+ @business.last_follow_up.money_plans.each do |d|
19
+ money = d.dup
20
+ money.staff = @current_admin
21
+ money.follow_up_id = follow_up.id
22
+ money.save
23
+ end
24
+ end
12
25
  @business.update(last_follow_up_id: follow_up.id)
13
26
  render_success
14
27
  else
@@ -12,28 +12,28 @@ module EducodeSales
12
12
  end
13
13
 
14
14
  def search_users
15
- @users = User.where("lastname like ? OR login like ?", "%#{params[:q]}%", "%#{params[:q]}%").limit(10)
15
+ @users = User.where("lastname like :q OR login like :q OR phone like :q or mail like :q", q: "%#{params[:q]}%").limit(20)
16
16
  end
17
17
 
18
18
  def search
19
19
  if params[:type] == 'department'
20
- @data = Department.where("name like ?", "%#{params[:q]}%").limit(10)
20
+ @data = Department.where("name like ?", "%#{params[:q]}%").limit(20)
21
21
  unless @data.present?
22
- @data = Department.joins(:school).where("schools.name like ?", "%#{params[:q]}%").limit(10)
22
+ @data = Department.joins(:school).where("schools.name like ?", "%#{params[:q]}%").limit(20)
23
23
  end
24
24
  elsif params[:type] == "school"
25
- data = School.where("name like ? ", "%#{params[:q]}%").limit(10)
25
+ data = School.where("name like ? ", "%#{params[:q]}%").limit(20)
26
26
  end
27
27
  end
28
28
 
29
29
  def search_teacher
30
- @data = Teacher.where("name like ? and is_key = false", "%#{params[:q]}%").limit(10)
30
+ @data = Teacher.where("name like ? and is_key = false", "%#{params[:q]}%").limit(20)
31
31
  user_ids = @data.pluck(:user_id).compact.uniq
32
- @data += User.joins(:user_extension).where.not(id: user_ids).where("identity='teacher'", user_ids).where("lastname like ?", "%#{params[:q]}%").limit(10)
32
+ @data += User.joins(:user_extension).where.not(id: user_ids).where("identity='teacher'", user_ids).where("lastname like ?", "%#{params[:q]}%").limit(20)
33
33
  end
34
34
 
35
35
  def search_edu_teacher
36
- @data = User.joins(:user_extension).where("identity='teacher'").where("lastname like ? OR phone like ? OR mail like ?", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").limit(10)
36
+ @data = User.joins(:user_extension).where("identity='teacher'").where("lastname like ? OR phone like ? OR mail like ?", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").limit(20)
37
37
  end
38
38
 
39
39
  end
@@ -71,18 +71,18 @@ module EducodeSales
71
71
  end
72
72
 
73
73
  def destroy
74
- sale_report = @current_admin.operation_reports.find(params[:id])
74
+ sale_report = OperationReport.find(params[:id])
75
75
  sale_report.destroy
76
76
  render_success
77
77
  end
78
78
 
79
79
  def edit
80
- @sale_report = @current_admin.operation_reports.find(params[:id])
80
+ @sale_report = OperationReport.find(params[:id])
81
81
  render layout: false
82
82
  end
83
83
 
84
84
  def update
85
- sale_report = @current_admin.operation_reports.find(params[:id])
85
+ sale_report = OperationReport.find(params[:id])
86
86
  sale_report.content = params[:content]
87
87
  if sale_report.save
88
88
  render_success
@@ -67,13 +67,14 @@ module EducodeSales
67
67
 
68
68
  def follow_up_schools
69
69
  staff = Staff.find(params[:id])
70
- @schools = EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("school_id").select("school_id, max(educode_sales_follow_ups.updated_at) AS updated_at").page(params[:page]).per(params[:limit])
70
+ # @schools = EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("school_id").select("school_id, max(educode_sales_follow_ups.updated_at) AS updated_at").page(params[:page]).per(params[:limit])
71
+ @schools = EducodeSales::Teacher.joins(:follow_up, :department).where("educode_sales_teacher_follows.staff_id = #{staff.id}").group("school_id").select("school_id, max(educode_sales_teacher_follows.updated_at) AS updated_at")+EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("school_id").select("school_id, max(educode_sales_follow_ups.updated_at) AS updated_at")
71
72
  @count = EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("school_id").count
72
73
  end
73
74
 
74
75
  def follow_up_departments
75
76
  staff = Staff.find(params[:id])
76
- @schools = EducodeSales::Business.joins(:last_follow_up, [department: :school]).where("educode_sales_follow_ups.staff_id = #{staff.id}").select("departments.name, schools.name AS school, educode_sales_follow_ups.updated_at").page(params[:page]).per(params[:limit])
77
+ @schools = EducodeSales::Business.joins(:last_follow_up, [department: :school]).where("educode_sales_follow_ups.staff_id = #{staff.id}").select("departments.name, schools.name AS school, educode_sales_follow_ups.updated_at")+EducodeSales::Teacher.joins(:follow_up, [department: :school]).where("educode_sales_teacher_follows.staff_id = #{staff.id}").select("departments.name, schools.name AS school, educode_sales_teacher_follows.updated_at")
77
78
  end
78
79
 
79
80
 
@@ -15,6 +15,7 @@ module EducodeSales
15
15
  follow_up.courses_count = course_ids.size
16
16
  end
17
17
  if follow_up.save
18
+ @teacher.update(follow_up_id: follow_up.id)
18
19
  render_success
19
20
  else
20
21
  render_failure follow_up
@@ -207,6 +207,7 @@ module EducodeSales
207
207
  @follow_ups = @follow_ups.order("created_at desc")
208
208
  end
209
209
  @follow_ups = @follow_ups.page(params[:page]).per(params[:limit])
210
+ @latest = @follow_ups.order(created_at: :desc).first.created_at.to_s
210
211
  end
211
212
  end
212
213
  end
@@ -1,7 +1,7 @@
1
1
  module EducodeSales
2
2
  class Activity < ApplicationRecord
3
3
  belongs_to :staff
4
- has_many :activity_teachers
4
+ has_many :activity_teachers, dependent: :destroy
5
5
  has_many :teachers, through: :activity_teachers, dependent: :restrict_with_exception
6
6
  end
7
7
  end
@@ -7,11 +7,11 @@ module EducodeSales
7
7
  has_many :follow_ups, dependent: :restrict_with_exception
8
8
  has_many :operation_plans, dependent: :restrict_with_exception
9
9
  has_many :operation_reports, dependent: :restrict_with_exception
10
- has_many :sale_reports, dependent: :restrict_with_exception
10
+ has_many :sale_reports, dependent: :destroy
11
11
  has_many :follow_ups, dependent: :restrict_with_exception
12
12
  has_many :teacher_follows, dependent: :restrict_with_exception
13
- has_many :teachers, dependent: :restrict_with_exception
14
- has_many :places, dependent: :restrict_with_exception
13
+ has_many :teachers, dependent: :destroy
14
+ has_many :places, dependent: :destroy
15
15
  has_many :businesses
16
16
  has_many :activities
17
17
  has_many :sale_plans, dependent: :destroy
@@ -5,11 +5,12 @@ module EducodeSales
5
5
  has_many :teacher_follows, dependent: :destroy
6
6
  has_many :operation_plans, dependent: :destroy
7
7
  has_many :course_subjects, dependent: :destroy
8
+ has_many :key_person, dependent: :destroy
8
9
  belongs_to :department, optional: true
9
10
  belongs_to :staff
10
11
  belongs_to :user, optional: true
11
- belongs_to :follow_up, counter_cache: true, optional: true
12
-
12
+ # belongs_to :follow_up, counter_cache: true, optional: true
13
+ belongs_to :follow_up, class_name: 'TeacherFollow', optional: true
13
14
  validates :user_id, uniqueness: { allow_blank: true, message: '已存在老师列表'}
14
15
 
15
16
 
@@ -42,45 +42,45 @@
42
42
  [
43
43
  {
44
44
  field: 'id',
45
- title: '序号',
45
+ title:'序号',type: 'numbers',
46
46
  width: 60
47
47
  },
48
48
  {
49
49
  field: 'name',
50
- width: 300,
51
50
  title: '活动名称',
52
51
  templet: '#teachers'
53
52
  },
54
53
  {
55
54
  field: 'start_at',
56
- width: 180,
55
+ width: 200,
57
56
  title: '时间',
58
57
  sort: true,
59
58
  },
60
59
  {
61
60
  field: 'days',
62
61
  title: '天数',
63
- width: 100
62
+ width: 200
64
63
  },
65
64
  {
66
65
  field: 'teachers_count',
67
66
  title: '教师数',
68
- width: 100,
67
+ width: 200,
69
68
  templet: '#teachers_count'
70
69
  },
71
70
  {
72
71
  field: 'students_count',
73
72
  title: '学生数',
74
- width: 100
73
+ width: 200
75
74
  },
76
75
  {
77
76
  title: '操作',
78
- minWidth: 150,
77
+ width: 120,
79
78
  toolbar: '#currentTableBar',
80
79
  align: "center"
81
80
  }
82
81
  ]
83
82
  ],
83
+ limit: 20,
84
84
  page: true
85
85
  });
86
86
 
@@ -152,9 +152,9 @@
152
152
  })
153
153
  });
154
154
  } else if (obj.event === 'teachers') {
155
- var content = miniPage.getHrefContent('/educode_sales/activities/show_teachers');
155
+ activity_id = obj.data.id
156
+ var content = miniPage.getHrefContent('/educode_sales/activities/show_teachers');
156
157
  openWH = miniPage.getOpenWidthHeight();
157
- activity_id = obj.data.id;
158
158
  index = layer.open({
159
159
  title: '活动列表/' + data.name,
160
160
  type: 1,
@@ -174,10 +174,10 @@
174
174
  return false;
175
175
  }
176
176
  else if (obj.event === 'teachers_count') {
177
- activity_id = obj.data.id;
177
+ activity_id = obj.data.id
178
178
  content = miniPage.getHrefContent('/educode_sales/activities/show_teachers');
179
179
  openWH = miniPage.getOpenWidthHeight();
180
- index = layer.open({
180
+ index2 = layer.open({
181
181
  title: '活动列表/' + data.name,
182
182
  type: 1,
183
183
  shade: 0.2,
@@ -1,7 +1,6 @@
1
1
  <script type="text/html" id="teacher_toolbar">
2
2
  <div class="layui-btn-container">
3
3
  <span class="table-label">教师列表</span>
4
- <!-- <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 手动添加</button> -->
5
4
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="search_new"> 添加
6
5
  </button>
7
6
  </div>
@@ -10,9 +9,6 @@
10
9
  <table class="layui-hide" id="show_teachers_table" style="min-height: 300px;" lay-filter="teachers_table"></table>
11
10
  </div>
12
11
  <script type="text/html" id="show_teachersTableBar">
13
- <!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addWeek">添加周计划</a>
14
- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addMonth">添加月计划</a> -->
15
- <!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a> -->
16
12
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
17
13
  </script>
18
14
  <script type="text/html" id="name">
@@ -63,7 +59,7 @@
63
59
  {
64
60
  field: 'id',
65
61
  width: 120,
66
- title: '序号',
62
+ title:'序号',type: 'numbers',
67
63
  },
68
64
  {
69
65
  field: 'name',
@@ -1,6 +1,6 @@
1
1
  <%= Gon::Base.render_data %>
2
2
  <div class="layuimini-main edit-table">
3
- <div class="layui-form layuimini-form" lay-filter="teacher_form">
3
+ <div class="layui-form layuimini-form" lay-filter="teacher_form" id="show_plan_box">
4
4
  <fieldset class="table-search-fieldset">
5
5
  <legend>添加回款计划</legend>
6
6
  <div class="layui-form-item">
@@ -56,10 +56,15 @@
56
56
  </div>
57
57
  </script>
58
58
  <script type="text/html" id="return_money_tabar">
59
+ {{# if(parent.is_latest){ }}
59
60
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">保存</a>
60
61
  <a class="layui-btn layui-btn-danger layui-btn-xs data-count-edit" lay-event="delete">删除</a>
62
+ {{# } }}
61
63
  </script>
62
64
  <script>
65
+ if(!parent.is_latest){
66
+ document.getElementById("show_plan_box").style.display="none";//隐藏
67
+ }
63
68
  layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'laydate'], function () {
64
69
  var form = layui.form,
65
70
  layer = layui.layer,
@@ -97,7 +102,7 @@
97
102
  [{
98
103
  field: 'id',
99
104
  width: 80,
100
- title: 'ID',
105
+ title:'序号',type: 'numbers',
101
106
  sort: true
102
107
  }, {
103
108
  field: 'date_at',
@@ -115,7 +115,7 @@
115
115
  {
116
116
  field: 'id',
117
117
  width: 60,
118
- title: '序号',
118
+ title:'序号',type: 'numbers',
119
119
  },
120
120
  {
121
121
  field: 'name',
@@ -138,15 +138,15 @@
138
138
  width: 60,
139
139
  templet: '#show_follow'
140
140
  },
141
- {
142
- field: 'teachers_count',
143
- width: 100,
144
- title: '关键人',
145
- templet: '#show_keys'
146
- },
141
+ // {
142
+ // field: 'teachers_count',
143
+ // width: 100,
144
+ // title: '关键人',
145
+ // templet: '#show_keys'
146
+ // },
147
147
  {
148
148
  field: 'clazz',
149
- width: 80,
149
+ width: 60,
150
150
  title: '类型'
151
151
  },
152
152
  {
@@ -156,13 +156,13 @@
156
156
  },
157
157
  {
158
158
  field: 'invitation_at',
159
- width: 120,
159
+ width: 105,
160
160
  title: '招标时间',
161
161
  sort: true
162
162
  },
163
163
  {
164
164
  field: 'reception_at',
165
- width: 120,
165
+ width: 105,
166
166
  title: '验收时间',
167
167
  sort: true
168
168
  },
@@ -183,6 +183,11 @@
183
183
  width: 110,
184
184
  title: '渠道'
185
185
  },
186
+ {
187
+ field: 'last_follow_person',
188
+ width: 120,
189
+ title: '跟进人'
190
+ },
186
191
  {
187
192
  title: '操作',
188
193
  minWidth: 300,
@@ -192,6 +197,7 @@
192
197
  }
193
198
  ]
194
199
  ],
200
+ limit: 20,
195
201
  page: true,
196
202
  skin: 'line'
197
203
  });
@@ -317,6 +323,7 @@
317
323
  });
318
324
 
319
325
  } else if (obj.event === 'show_keys') {
326
+ business_id = obj.data.id
320
327
  follow_up_id = obj.data.follow_up_id;
321
328
  content = miniPage.getHrefContent('/educode_sales/businesses/show_keys');
322
329
  openWH = miniPage.getOpenWidthHeight();
@@ -338,6 +345,7 @@
338
345
  layer.full(index);
339
346
  });
340
347
  } else if (obj.event === 'show_follow') {
348
+ business_id = obj.data.id
341
349
  content = miniPage.getHrefContent('/educode_sales/businesses/show_follow?id=' + id);
342
350
  openWH = miniPage.getOpenWidthHeight();
343
351
  index = layer.open({
@@ -6,7 +6,8 @@ json.data do
6
6
  json.school d.department.school.name
7
7
  json.follow_ups_count d.follow_ups_count
8
8
  json.follow_up_id d.last_follow_up_id
9
- json.teachers_count d.follow_ups.sum(:key_people_count)
9
+ # json.teachers_count d.follow_ups.sum(:key_people_count)
10
+ # json.teachers_count EducodeSales::FollowUp.order(created_at: :desc).find_by(business_id: d.id).present? ? EducodeSales::FollowUp.order(created_at: :desc).find_by(business_id: d.id).key_people_count : 0
10
11
  json.clazz d.last_follow_up&.clazz&.name
11
12
  json.stage d.last_follow_up&.stage&.name
12
13
  json.invitation_at d.last_follow_up&.invitation_at.to_s
@@ -14,6 +15,7 @@ json.data do
14
15
  json.total_amount d.last_follow_up&.total_amount
15
16
  json.return_money d.return_money
16
17
  json.place d.last_follow_up&.place&.name
18
+ json.last_follow_person d.last_follow_up_id.present? ? EducodeSales::Staff.find(EducodeSales::Business.find_by(last_follow_up_id: d.last_follow_up_id).staff_id).user.real_name : ''
17
19
  end
18
20
  end
19
21
  json.code 0
@@ -1,7 +1,7 @@
1
1
  <div class="layui-form layuimini-form">
2
2
  <div class="layui-form-item" style="padding: 25px">
3
3
  <div class="layui-inline">
4
- <label class="layui-form-label required">名称</label>
4
+ <label class="layui-form-label required">商机名称</label>
5
5
  <div class="layui-input-block">
6
6
  <input type="text" name="name" autocomplete="off" lay-verify="required" class="layui-input" style="width: 300px;">
7
7
  </div>
@@ -124,8 +124,18 @@
124
124
  form.render();
125
125
 
126
126
  form.on('submit(add_follow_up)', function (data) {
127
- data.field.business_id = "<%= @business.id %>";
128
- request.authPost("educode_sales/follow_ups", data.field, function (res) {
127
+ console.log(data);
128
+ data.field.business_id = "<%= @business.id %>";
129
+ console.log(data.field.business_id);
130
+ request.authPut("educode_sales/businesses/" + data.field.business_id +"/updateMoney/", {
131
+ return_money: 0
132
+ }, function (res) {
133
+ if (res.success == false) {
134
+ layer.alert(res.msg)
135
+ } else {
136
+ }
137
+ })
138
+ request.authPost("educode_sales/follow_ups", data.field, function (res) {
129
139
  if (res.success == false) {
130
140
  layer.alert(res.msg)
131
141
  } else {