educode_sales 0.1.7 → 0.2.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 (89) 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 +7 -8
  14. data/app/models/educode_sales/teacher.rb +3 -2
  15. data/app/views/educode_sales/activities/index.html.erb +32 -10
  16. data/app/views/educode_sales/activities/show_teachers.html.erb +14 -12
  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_month.html.erb +4 -3
  35. data/app/views/educode_sales/operation_plans/edit_monthly.html.erb +3 -3
  36. data/app/views/educode_sales/operation_plans/edit_week.html.erb +4 -3
  37. data/app/views/educode_sales/operation_plans/edit_weekly.html.erb +3 -3
  38. data/app/views/educode_sales/operation_plans/new_month.html.erb +5 -4
  39. data/app/views/educode_sales/operation_plans/new_monthly.html.erb +3 -3
  40. data/app/views/educode_sales/operation_plans/new_week.html.erb +5 -4
  41. data/app/views/educode_sales/operation_plans/new_weekly.html.erb +3 -3
  42. data/app/views/educode_sales/operation_plans/show_monthly.html.erb +3 -3
  43. data/app/views/educode_sales/operation_plans/show_weekly.html.erb +3 -3
  44. data/app/views/educode_sales/operation_reports/audit.html.erb +2 -2
  45. data/app/views/educode_sales/operation_reports/edit.html.erb +3 -3
  46. data/app/views/educode_sales/operation_reports/show.html.erb +139 -27
  47. data/app/views/educode_sales/places/index.html.erb +6 -6
  48. data/app/views/educode_sales/plans/_monthPlan.html.erb +2 -1
  49. data/app/views/educode_sales/plans/_monthly.html.erb +2 -1
  50. data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -1
  51. data/app/views/educode_sales/plans/_weekly.html.erb +2 -1
  52. data/app/views/educode_sales/plans/audit_weekly.html.erb +3 -3
  53. data/app/views/educode_sales/plans/edit_monthly.html.erb +3 -3
  54. data/app/views/educode_sales/plans/edit_weekly.html.erb +1 -1
  55. data/app/views/educode_sales/plans/new_monthly.html.erb +1 -1
  56. data/app/views/educode_sales/plans/new_weekly.html.erb +1 -1
  57. data/app/views/educode_sales/plans/show_monthly.html.erb +3 -3
  58. data/app/views/educode_sales/plans/show_weekly.html.erb +1 -1
  59. data/app/views/educode_sales/roles/index.html.erb +2 -1
  60. data/app/views/educode_sales/sale_reports/audit.html.erb +1 -1
  61. data/app/views/educode_sales/sale_reports/edit.html.erb +3 -3
  62. data/app/views/educode_sales/sale_reports/show.html.erb +1 -1
  63. data/app/views/educode_sales/sale_trends/operations.html.erb +1 -1
  64. data/app/views/educode_sales/sales/index.html.erb +12 -7
  65. data/app/views/educode_sales/sales/index.json.jbuilder +1 -1
  66. data/app/views/educode_sales/sales/operations.html.erb +7 -5
  67. data/app/views/educode_sales/sales/operations.json.jbuilder +3 -2
  68. data/app/views/educode_sales/sales/school.html.erb +1 -2
  69. data/app/views/educode_sales/sales/xschool.html.erb +1 -2
  70. data/app/views/educode_sales/staffs/follow_up_departments.json.jbuilder +1 -2
  71. data/app/views/educode_sales/staffs/follow_up_schools.json.jbuilder +1 -2
  72. data/app/views/educode_sales/staffs/index.html.erb +6 -8
  73. data/app/views/educode_sales/staffs/new.html.erb +1 -1
  74. data/app/views/educode_sales/teachers/add_courses.html.erb +3 -3
  75. data/app/views/educode_sales/teachers/add_event.html.erb +1 -1
  76. data/app/views/educode_sales/teachers/add_keys.html.erb +11 -5
  77. data/app/views/educode_sales/teachers/course_list.json.jbuilder +1 -0
  78. data/app/views/educode_sales/teachers/index.html.erb +10 -8
  79. data/app/views/educode_sales/teachers/index.json.jbuilder +2 -1
  80. data/app/views/educode_sales/teachers/new.html.erb +3 -5
  81. data/app/views/educode_sales/teachers/new_follow_record.html.erb +1 -0
  82. data/app/views/educode_sales/teachers/search_new.html.erb +2 -2
  83. data/app/views/educode_sales/teachers/show_class.html.erb +7 -1
  84. data/app/views/educode_sales/teachers/show_follow.html.erb +11 -9
  85. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  86. data/app/views/layouts/educode_sales/application.html.erb +6 -9
  87. data/config/routes.rb +1 -0
  88. data/lib/educode_sales/version.rb +1 -1
  89. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0b586bc3b1634320b6fb34e4646577e51cd2eed
4
- data.tar.gz: a05dcbb55cc2e2e8f3e7dfbc7671d5f89c24fca5
3
+ metadata.gz: 50c6f58b4bfd8062d4c7f0101e43454793e7cd46
4
+ data.tar.gz: 5afbd0111144d83941dbe35219508d65eb3af65d
5
5
  SHA512:
6
- metadata.gz: 7099d303b654990b619fcad31ddf547c3412be01a359bb00c0fec6534f32a7764326d512916536d1dbd1710193bddb08b370096250c21fc5dedc976bfc786f12
7
- data.tar.gz: 17ac1d2f5b4b134147ca1b77b53c340c04389269e2f1b8b89c9b89c90893eed640c5cb5980f0be28a10e8ada7c18f927d2b326069d1a0f47d237902f13b5f832
6
+ metadata.gz: 2538da04fa510bafc20f14f527581059d6776484293b8f2a2b405a6132e970cc0c2f3e7e6a6d33398ee286e3e2dbfd40eba5fa97df6dd1973eed1cf061433667
7
+ data.tar.gz: 6695eb57a9c754999e9b0d0b4e68f038b58efc7801012faf288a3f9d067db1c039abf9582a7f1af35b7f2b426494fd800a6223bdb08903fa83a52ba428859598
@@ -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
@@ -4,14 +4,13 @@ module EducodeSales
4
4
  belongs_to :role, optional: true
5
5
 
6
6
  has_many :market_areas, dependent: :destroy
7
- has_many :follow_ups, dependent: :restrict_with_exception
8
- has_many :operation_plans, dependent: :restrict_with_exception
9
- has_many :operation_reports, dependent: :restrict_with_exception
10
- has_many :sale_reports, dependent: :restrict_with_exception
11
- has_many :follow_ups, dependent: :restrict_with_exception
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
7
+ has_many :follow_ups, dependent: :destroy
8
+ has_many :operation_plans, dependent: :destroy
9
+ has_many :operation_reports, dependent: :destroy
10
+ has_many :sale_reports, dependent: :destroy
11
+ has_many :teacher_follows, dependent: :destroy
12
+ has_many :teachers, dependent: :destroy
13
+ has_many :places, dependent: :destroy
15
14
  has_many :businesses
16
15
  has_many :activities
17
16
  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
 
@@ -22,7 +22,7 @@
22
22
  <a href="javascript:void(0);" lay-event="teachers" class="layui-table-link">{{ d.name}}</a>
23
23
  </script>
24
24
  <script type="text/html" id="teachers_count">
25
- <a href="javascript:void(0);" lay-event="teachers" class="layui-table-link">{{ d.teachers_count}}</a>
25
+ <a href="javascript:void(0);" lay-event="teachers_count" class="layui-table-link">{{ d.teachers_count}}</a>
26
26
  </script>
27
27
 
28
28
  <script>
@@ -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,
@@ -173,6 +173,28 @@
173
173
  });
174
174
  return false;
175
175
  }
176
+ else if (obj.event === 'teachers_count') {
177
+ activity_id = obj.data.id
178
+ content = miniPage.getHrefContent('/educode_sales/activities/show_teachers');
179
+ openWH = miniPage.getOpenWidthHeight();
180
+ index2 = layer.open({
181
+ title: '活动列表/' + data.name,
182
+ type: 1,
183
+ shade: 0.2,
184
+ maxmin: true,
185
+ shadeClose: true,
186
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
187
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
188
+ content: content,
189
+ success: function (layero, index) {
190
+ form.render('select');
191
+ },
192
+ });
193
+ $(window).on("resize", function () {
194
+ layer.full(index);
195
+ });
196
+ return false;
197
+ }
176
198
  });
177
199
 
178
200
  });
@@ -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',
@@ -247,10 +243,11 @@
247
243
  });
248
244
  return false;
249
245
  } else if (obj.event === 'delete') {
246
+ console.log(data);
250
247
  layer.confirm('确定删除' + data.name, function (index) {
251
- request.delete('educode_sales/businesses/' + data.id, {}, function (res) {
248
+ request.delete('educode_sales/teachers/' + data.id, {}, function (res) {
252
249
  layer.close(index);
253
- table.reload("teachers_table")
250
+ table.reload("show_teachers_table")
254
251
  })
255
252
  });
256
253
  } else if (obj.event === 'addWeek') {
@@ -288,7 +285,8 @@
288
285
  });
289
286
 
290
287
  } else if (obj.event === 'courses') {
291
- content = miniPage.getHrefContent('/educode_sales/teachers/add_courses');
288
+ teacher_id = data.id
289
+ content = miniPage.getHrefContent('/educode_sales/teachers/add_courses?id='+data.id);
292
290
  openWH = miniPage.getOpenWidthHeight();
293
291
  index = layer.open({
294
292
  title: '课程方向',
@@ -298,12 +296,16 @@
298
296
  shadeClose: true,
299
297
  area: [openWH[0] + 'px', openWH[1] + 'px'],
300
298
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
301
- content: content
299
+ content: content,
300
+ success: function (layero, index) {
301
+ // 重新渲染弹层中的下拉选择框select
302
+ // form.render('select');
303
+ }
302
304
  });
303
305
  $(window).on("resize", function () {
304
- layer.full(index);
306
+ layer.full(index);
305
307
  });
306
- } else if (obj.event === 'event') {
308
+ }else if (obj.event === 'event') {
307
309
  content = miniPage.getHrefContent('/educode_sales/teachers/add_event');
308
310
  openWH = miniPage.getOpenWidthHeight();
309
311
  teacher_id = obj.data.id
@@ -342,7 +344,7 @@
342
344
  layer.full(index);
343
345
  });
344
346
  } else if (obj.event === 'follow') {
345
- content = miniPage.getHrefContent('/educode_sales/teachers/show_follow');
347
+ content = miniPage.getHrefContent('/educode_sales/teachers/show_follow?id=' + data.id);
346
348
  openWH = miniPage.getOpenWidthHeight();
347
349
  index = layer.open({
348
350
  title: '跟进记录',
@@ -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 {