educode_sales 0.4.0 → 0.4.4

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales/1./351/224/200/345/224/256/346/264/273/345/212/250.png +0 -0
  3. data/app/assets/images/educode_sales/10./346/225/231/345/270/210/350/277/220/350/220/245.png +0 -0
  4. data/app/assets/images/educode_sales/11./346/264/273/345/212/250/350/277/220/350/220/245.png +0 -0
  5. data/app/assets/images/educode_sales/12./350/277/220/350/220/245/350/256/241/345/210/222.png +0 -0
  6. data/app/assets/images/educode_sales/13./347/263/273/347/273/237/350/256/276/347/275/256.png +0 -0
  7. data/app/assets/images/educode_sales/14./350/247/222/350/211/262/347/256/241/347/220/206.png +0 -0
  8. data/app/assets/images/educode_sales/15./344/272/272/345/221/230/347/256/241/347/220/206.png +0 -0
  9. data/app/assets/images/educode_sales/16./345/255/227/345/205/270/345/210/227/350/241/250.png +0 -0
  10. data/app/assets/images/educode_sales/2./345/270/202/345/234/272/346/200/201/345/212/277.png +0 -0
  11. data/app/assets/images/educode_sales/3./351/224/200/345/224/256/345/210/206/345/267/245.png +0 -0
  12. data/app/assets/images/educode_sales/4./345/225/206/346/234/272/347/256/241/347/220/206.png +0 -0
  13. data/app/assets/images/educode_sales/5./346/270/240/351/201/223/347/256/241/347/220/206.png +0 -0
  14. data/app/assets/images/educode_sales/6./351/224/200/345/224/256/350/256/241/345/210/222.png +0 -0
  15. data/app/assets/images/educode_sales/7./350/277/220/350/220/245/346/264/273/345/212/250.png +0 -0
  16. data/app/assets/images/educode_sales/8./350/277/220/350/220/245/346/200/201/345/212/277.png +0 -0
  17. data/app/assets/images/educode_sales/9./350/277/220/350/220/245/345/210/206/345/267/245.png +0 -0
  18. data/app/assets/images/educode_sales/a.png +0 -0
  19. data/app/assets/images/educode_sales/logo.png +0 -0
  20. data/app/controllers/educode_sales/businesses_controller.rb +17 -2
  21. data/app/controllers/educode_sales/follow_ups_controller.rb +3 -3
  22. data/app/controllers/educode_sales/operation_plans_controller.rb +2 -2
  23. data/app/controllers/educode_sales/operation_reports_controller.rb +2 -2
  24. data/app/controllers/educode_sales/places_controller.rb +1 -1
  25. data/app/controllers/educode_sales/plans_controller.rb +2 -2
  26. data/app/controllers/educode_sales/sale_reports_controller.rb +2 -2
  27. data/app/controllers/educode_sales/sale_trends_controller.rb +3 -3
  28. data/app/controllers/educode_sales/sales_controller.rb +1 -1
  29. data/app/controllers/educode_sales/teacher_follows_controller.rb +1 -1
  30. data/app/controllers/educode_sales/teachers_controller.rb +1 -1
  31. data/app/models/educode_sales/common.rb +2 -0
  32. data/app/models/educode_sales/teacher.rb +1 -1
  33. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +7 -8
  34. data/app/views/educode_sales/businesses/index.html.erb +38 -3
  35. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
  36. data/app/views/educode_sales/businesses/new_follow_record.html.erb +7 -8
  37. data/app/views/educode_sales/businesses/show_follow.html.erb +10 -10
  38. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +2 -2
  39. data/app/views/educode_sales/businesses/show_follow_record.html.erb +16 -4
  40. data/app/views/educode_sales/operation_reports/audit.html.erb +40 -13
  41. data/app/views/educode_sales/operation_reports/edit.html.erb +4 -2
  42. data/app/views/educode_sales/operation_reports/show.html.erb +46 -15
  43. data/app/views/educode_sales/sale_reports/audit.html.erb +40 -13
  44. data/app/views/educode_sales/sale_reports/edit.html.erb +4 -2
  45. data/app/views/educode_sales/sale_reports/show.html.erb +39 -13
  46. data/app/views/educode_sales/teachers/index.json.jbuilder +1 -3
  47. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +3 -2
  48. data/app/views/layouts/educode_sales/application.html.erb +174 -41
  49. data/db/migrate/20211018054256_add_extras_to_commons.rb +6 -0
  50. data/lib/educode_sales/version.rb +1 -1
  51. metadata +20 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beaaef9ad85e45c39ff91fc919a392c864872b7c3c6b5ad40cbff4ca931ab7b8
4
- data.tar.gz: c99241524289cd79e31c992e85921aa706962253a60d08ecb10dece9215d9120
3
+ metadata.gz: bbb707c74c7909b2a42a4cc3eaf395677a436c8a210db16ba31cfb5abb0c9cdd
4
+ data.tar.gz: 7c08a37d777b84396fc415076c6fa768eb0bd9dc56d9e6307451832212141a71
5
5
  SHA512:
6
- metadata.gz: 7abc3483c8e33f0385e1a77edaed2c60b8db9dbf06ae41679cbd379a74a168a3f5869b2a5bd49e2e5e95dd0c90fea504668433841970239ca453031a1ba04bc5
7
- data.tar.gz: fe192afb0f2a09d6b924c5901c2aac1bc1d83046ffe4cd3fe20152df2084b19afc5bba62dc71816f68d30418ca2b35c060037b7acf5ab44b3d86f5d45a647d9e
6
+ metadata.gz: d96671e32dfe8e9469c6f93927cf453d86861004d123bbbc01b1118295e7827fd37a1b039ac629a51803d1132341afed7b58fb630919387251253481377d7720
7
+ data.tar.gz: '0628d9062d5c4b72851dc9cbb0f997169cb395713c3e20263c7b32df369ef323c79370955dffb428b88ff33d9cb297e0ebd3720b1c6bb1f04fdeeb198fbf49ad'
@@ -40,6 +40,18 @@ module EducodeSales
40
40
  end
41
41
  end
42
42
 
43
+ if params[:q].present? && params[:q][:all].present?
44
+ @businesses = @businesses
45
+ end
46
+
47
+ if params[:q].present? && params[:q][:mine].present?
48
+ ids = AssignFollowUp.where(staff_id: @current_admin.id).pluck(:follow_up_id)
49
+ ids1 = FollowUp.where(id: ids).pluck(:business_id)
50
+ # ids2 = Business.where(staff_id: @current_admin.id).pluck(:id)
51
+ # @businesses = Business.where(id: ids1+ids2)
52
+ @businesses =@businesses.where("educode_sales_businesses.id in (?) or educode_sales_businesses.staff_id = ?", ids1, @current_admin.id)
53
+ end
54
+
43
55
  @businesses = @businesses
44
56
  if params[:q].present? && params[:q][:name].present?
45
57
  @businesses = @businesses.where("educode_sales_businesses.name like ?", "%#{params[:q][:name]}%")
@@ -80,7 +92,6 @@ module EducodeSales
80
92
  @businesses = @businesses.where("educode_sales_businesses.created_at > ? AND educode_sales_businesses.created_at < ?", date[0], date[1])
81
93
  end
82
94
 
83
-
84
95
  if params[:sort].present? && params[:sort][:field]
85
96
  @businesses = @businesses.order("#{params[:sort][:field]} #{params[:sort][:order]}")
86
97
  else
@@ -89,6 +100,8 @@ module EducodeSales
89
100
 
90
101
  @business_count = @businesses.count
91
102
 
103
+
104
+
92
105
  @businesses = @businesses.select("
93
106
  educode_sales_businesses.*,
94
107
  last_follow.invitation_at,
@@ -177,6 +190,7 @@ module EducodeSales
177
190
 
178
191
  def new_follow_record
179
192
  load_business
193
+ @o_name = EducodeSales::Common.find_by(extras: EducodeSales::Common::OTYPE)&.name
180
194
  @clazz = Common.where(clazz: 'business_type').order("position").pluck(:name, :id)
181
195
  @stages = Common.where(clazz: 'business_step').order("position").pluck(:name, :id)
182
196
  @places = Place.order("created_at desc").pluck(:name, :id)
@@ -201,6 +215,7 @@ module EducodeSales
201
215
  end
202
216
 
203
217
  def edit_follow_record
218
+ @o_name = EducodeSales::Common.find_by(extras: EducodeSales::Common::OTYPE)&.name
204
219
  @follow_up = FollowUp.find(params[:follow_up_id])
205
220
  @clazz = Common.where(clazz: 'business_type').order("position").pluck(:name, :id)
206
221
  @stages = Common.where(clazz: 'business_step').order("position").pluck(:name, :id)
@@ -222,7 +237,7 @@ module EducodeSales
222
237
  end
223
238
 
224
239
  def follow_up_params
225
- params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_rate, :description, :advise, :place_id)
240
+ params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_amount, :description, :advise, :place_id)
226
241
  end
227
242
 
228
243
  end
@@ -11,7 +11,7 @@ module EducodeSales
11
11
  follow_up.assign_follow_ups.build(staff_id: d)
12
12
  end
13
13
 
14
- follow_up.profit_amount = follow_up.actual_amount * (100-follow_up.divide_rate.to_i) * 0.01 if follow_up.actual_amount
14
+ follow_up.profit_amount = follow_up.actual_amount - (follow_up.divide_amount.to_i) if follow_up.actual_amount
15
15
  if follow_up.save
16
16
  if @business.last_follow_up.present?
17
17
  @business.last_follow_up.key_person.each do |d|
@@ -54,7 +54,7 @@ module EducodeSales
54
54
  assign_follow_ups << follow_up.assign_follow_ups.find_or_initialize_by(staff_id: d)
55
55
  end
56
56
  follow_up.assign_follow_ups = assign_follow_ups
57
- follow_up.profit_amount = follow_up.actual_amount * (100-follow_up.divide_rate.to_i) * 0.01 if follow_up.actual_amount
57
+ follow_up.profit_amount = follow_up.actual_amount - (follow_up.divide_amount.to_i) * 0.01 if follow_up.actual_amount
58
58
  if follow_up.save
59
59
  render_success
60
60
  else
@@ -156,7 +156,7 @@ module EducodeSales
156
156
  end
157
157
 
158
158
  def follow_up_params
159
- params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_rate, :description, :advise, :place_id)
159
+ params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_amount, :description, :advise, :place_id)
160
160
  end
161
161
 
162
162
  def teacher_params
@@ -20,8 +20,8 @@ module EducodeSales
20
20
  when '自己'
21
21
  @sale_plans = OperationPlan.where(staff_id: @current_admin.id)
22
22
  when '区域'
23
- staff_ids = Staff.joins(department: :school).where("school.province in ?", @current_admin.areas.pluck(:name)).pluck(:id)
24
- @sale_plans = OperationPlan.where("staff_id in ?", staff_ids)
23
+ staff_ids = Staff.joins(user: [user_extension: [department: :school]]).where("schools.province in (?)", @current_admin.areas.pluck(:name)).pluck(:id)
24
+ @sale_plans = OperationPlan.where("staff_id in (?)", staff_ids)
25
25
  else
26
26
  @sale_plans = OperationPlan
27
27
  end
@@ -17,8 +17,8 @@ module EducodeSales
17
17
  when '自己'
18
18
  @sale_reports = OperationReport.where(staff_id: @current_admin.id)
19
19
  when '区域'
20
- staff_ids = Staff.joins(department: :school).where("school.province in ?", staff.areas.pluck(:name)).pluck(:id)
21
- @sale_reports = OperationReport.where("staff_id in ?", staff_ids)
20
+ staff_ids = Staff.joins(user: [user_extension: [department: :school]]).where("schools.province in (?)", @current_admin.areas.pluck(:name)).pluck(:id)
21
+ @sale_reports = OperationReport.where("staff_id in (?)", staff_ids)
22
22
  else
23
23
  @sale_reports = OperationReport
24
24
  end
@@ -9,7 +9,7 @@ module EducodeSales
9
9
  end
10
10
  format.json do
11
11
  @places = Place.page(params[:page]).per(params[:limit])
12
- @x = Common.find_by(clazz: '商机类型', name: 'X类')&.id
12
+ @x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
13
13
  @stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
14
14
  end
15
15
  end
@@ -21,8 +21,8 @@ module EducodeSales
21
21
  when '自己'
22
22
  @sale_plans = SalePlan.where(staff_id: @current_admin.id)
23
23
  when '区域'
24
- staff_ids = Staff.joins(department: :school).where("school.province in ?", staff.areas.pluck(:name)).pluck(:id)
25
- @sale_plans = SalePlan.where("staff_id in ?", staff_ids)
24
+ staff_ids = Staff.joins(user: [user_extension: [department: :school]]).where("schools.province in (?)", @current_admin.areas.pluck(:name)).pluck(:id)
25
+ @sale_plans = SalePlan.where("staff_id in (?)", staff_ids)
26
26
  else
27
27
  @sale_plans = SalePlan
28
28
  end
@@ -50,8 +50,8 @@ module EducodeSales
50
50
  when '自己'
51
51
  @sale_reports = SaleReport.where(staff_id: @current_admin.id)
52
52
  when '区域'
53
- staff_ids = Staff.joins(department: :school).where("school.province in ?", staff.areas.pluck(:name)).pluck(:id)
54
- @sale_reports = SaleReport.where("staff_id in ?", staff_ids)
53
+ staff_ids = Staff.joins(user: [user_extension: [department: :school]]).where("schools.province in (?)", @current_admin.areas.pluck(:name)).pluck(:id)
54
+ @sale_reports = SaleReport.where("staff_id in (?)", staff_ids)
55
55
  else
56
56
  @sale_reports = SaleReport
57
57
  end
@@ -9,15 +9,15 @@ module EducodeSales
9
9
  @year = params[:year] ? params[:year] : Time.now.year
10
10
  @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
11
11
  year_time = "#{@year}-01-01 00:00:00"
12
- x = Common.find_by(clazz: '商机类型', name: 'X类')&.id
13
- o = Common.find_by(clazz: '商机类型', name: 'O类')&.id
12
+ x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
13
+ o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id
14
14
  @sale_trend = SaleTrend.find_or_create_by(year: @year)
15
15
  @business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).where("educode_sales_follow_ups.created_at >= ?", year_time).sum(:total_amount).round(2)
16
16
  stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
17
17
  @goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.created_at >= ? AND educode_sales_follow_ups.stage_id IN (?)", year_time, stage_ids).sum(:total_amount).round(2)
18
18
  s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
19
19
  @service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.created_at >= ? AND educode_sales_follow_ups.stage_id IN (?)", year_time, s_stage_ids).sum(:total_amount).round(2)
20
- @return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_money_plans.date_at >= ?", year_time).sum(:amount).round(2)
20
+ @return_amount = Business.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 >= ?", year_time).sum(:amount).round(2)
21
21
  a = Common.where(clazz: '商机类型', name: 'A类').pluck(:id)
22
22
  @a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).sum(:total_amount).round(2)
23
23
  b = Common.where(clazz: '商机类型', name: 'B类').pluck(:id)
@@ -14,7 +14,7 @@ module EducodeSales
14
14
  common = Common.find_by(clazz: 'staff_type', name: '销售')
15
15
  @a_clazz = Common.find_by(clazz: 'business_type', name: 'A类')
16
16
  @b_clazz = Common.find_by(clazz: 'business_type', name: 'B类')
17
- @x = Common.find_by(clazz: 'business_type', name: 'X类')
17
+ @x = Common.find_by(extras: EducodeSales::Common::XTYPE)
18
18
  @step_ids = Common.where(name: %w(已中标 已签单 已验收 回款中 服务中 已结束), clazz: 'business_step').pluck(:id)
19
19
 
20
20
  @staffs = Staff.where(job_type: common.id).page(params[:page]).per(params[:limit])
@@ -34,7 +34,7 @@ module EducodeSales
34
34
  def update
35
35
  follow_up = TeacherFollow.find(params[:id])
36
36
  follow_up.assign_attributes(follow_up_params)
37
- # follow_up.profit_amount = follow_up.actual_amount * (100-follow_up.divide_rate.to_i) * 0.01 if follow_up.actual_amount
37
+ # follow_up.profit_amount = follow_up.actual_amount * (100-follow_up.divide_amount.to_i) * 0.01 if follow_up.actual_amount
38
38
  if follow_up.save
39
39
  render_success
40
40
  else
@@ -280,7 +280,7 @@ module EducodeSales
280
280
  def course_list
281
281
  user = User.find_by(id: params[:user_id])
282
282
  if user
283
- @courses = Course.joins(:course_members).where(course_members: {user_id: user.id}).distinct("course_id").page(params[:page]).per(params[:limit])
283
+ @courses = Course.joins(:course_members).where(course_members: {user_id: user.id}).where("is_delete = 0 and role != 4 and excellent = 0 and is_hidden = 0").where("start_date is null or start_date <= '#{Date.today}'").distinct("course_id").page(params[:page]).per(params[:limit])
284
284
  else
285
285
  @courses = Course.none
286
286
  end
@@ -2,6 +2,8 @@ module EducodeSales
2
2
  class Common < ApplicationRecord
3
3
  acts_as_list scope: [:clazz]
4
4
 
5
+ XTYPE = "x_class"
6
+ OTYPE = 'o_class'
5
7
 
6
8
  validates :name, uniqueness: {scope: :clazz, message: '已存在'}
7
9
 
@@ -37,7 +37,7 @@ module EducodeSales
37
37
 
38
38
  def students_count
39
39
  if user_id.present?
40
- course_ids = CourseMember.where.not(role: "STUDENT").where(user_id: user_id).pluck(:course_id)
40
+ course_ids = Course.joins(:course_members).where(course_members: {user_id: user_id}).where("is_delete = 0 and role != 4 and excellent = 0 and is_hidden = 0").where("start_date is null or start_date <= '#{Date.today}'").distinct("course_id").pluck(:course_id)
41
41
  CourseMember.where(course_id: course_ids, role: "STUDENT").count
42
42
  else
43
43
  0
@@ -17,9 +17,9 @@
17
17
  <br>
18
18
  <div class="layui-inline">
19
19
  <label class="layui-form-label required">项目类型</label>
20
- <%if EducodeSales::FollowUp.where(business_id: @follow_up.business.id,clazz_id: EducodeSales::Common.find_by(name: "O类").id).count >= 2 %>
20
+ <%if EducodeSales::FollowUp.where(business_id: @follow_up.business.id,clazz_id: EducodeSales::Common.find_by(name: @o_name).id).count >= 2 %>
21
21
  <div class="layui-input-inline">
22
- <%= select_tag "clazz_id", options_for_select([['O类',EducodeSales::Common.find_by(name: "O类").id]]),:disabled => true, class: 'required' %>
22
+ <%= select_tag "clazz_id", options_for_select([[@o_name,EducodeSales::Common.find_by(name: @o_name).id]]),:disabled => true, class: 'required' %>
23
23
  </div>
24
24
  <%else %>
25
25
  <div class="layui-input-inline">
@@ -56,9 +56,9 @@
56
56
  </div>
57
57
  </div>
58
58
  <div class="layui-inline">
59
- <label class="layui-form-label">实额</label>
59
+ <label class="layui-form-label">合同额</label>
60
60
  <div class="layui-input-inline">
61
- <input name="actual_amount" type="number" class="layui-input" value="<%= @follow_up.actual_amount %>">
61
+ <input name="actual_amount" type="number" class="layui-input" placeholder="本单位的签单金额" value="<%= @follow_up.actual_amount %>">
62
62
  </div>
63
63
  </div>
64
64
  <br>
@@ -69,11 +69,10 @@
69
69
  </div>
70
70
  </div>
71
71
  <div class="layui-inline">
72
- <label class="layui-form-label">分成</label>
72
+ <label class="layui-form-label">渠道分成</label>
73
73
  <div class="layui-input-inline">
74
- <input name="divide_rate" class="layui-input" value="<%= @follow_up.divide_rate%>">
74
+ <input name="divide_amount" class="layui-input" value="<%= @follow_up.divide_amount%>">
75
75
  </div>
76
- <span style="margin-top: 10px; float:left;">%</span>
77
76
  </div>
78
77
  <div class="layui-form-item">
79
78
  <label class="layui-form-label">指定跟进人</label>
@@ -82,7 +81,7 @@
82
81
  </div>
83
82
  </div>
84
83
  <div class="layui-form-item layui-form-text">
85
- <label class="layui-form-label required">商机说明</label>
84
+ <label class="layui-form-label required">最新进展</label>
86
85
  <div class="layui-input-block">
87
86
  <textarea name="description" lay-verify="required" placeholder="此处可以填写:
88
87
  1、有无预算;
@@ -68,6 +68,8 @@
68
68
  <% if can? :create, EducodeSales::Business %>
69
69
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加商机</button>
70
70
  <% end %>
71
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right" lay-event="mine"> 我的商机</button>
72
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right" lay-event="all"> 全部商机</button>
71
73
  </div>
72
74
  </script>
73
75
  <script type="text/html" id="currentTableBar">
@@ -150,7 +152,7 @@
150
152
  // },
151
153
  {
152
154
  field: 'clazz',
153
- width: 60,
155
+ width: 120,
154
156
  title: '类型'
155
157
  },
156
158
  {
@@ -195,7 +197,12 @@
195
197
  {
196
198
  field: 'last_follow_person',
197
199
  width: 120,
198
- title: '跟进人'
200
+ title: '最新跟进人'
201
+ },
202
+ {
203
+ field: 'latest_time',
204
+ width: 200,
205
+ title: '最新跟进时间'
199
206
  },
200
207
  {
201
208
  title: '操作',
@@ -361,7 +368,35 @@
361
368
  $(window).on("resize", function () {
362
369
  layer.full(index);
363
370
  });
364
- } else if (obj.event === 'delete') { // 监听删除操作
371
+ } else if (obj.event === 'all') {
372
+ search = {"all":"1"}
373
+ table.reload('businesses_table', {
374
+ page: {
375
+ curr: 1
376
+ },
377
+ where: {q: search, sort: sort}
378
+ }, 'data');
379
+ form.val('search_form', {
380
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
381
+ place_id: '', date: '', area: ''
382
+ })
383
+ return false;
384
+ }
385
+ else if (obj.event === 'mine') {
386
+ search = {"mine":"1"}
387
+ table.reload('businesses_table', {
388
+ page: {
389
+ curr: 1
390
+ },
391
+ where: {q: search, sort: sort}
392
+ }, 'data');
393
+ form.val('search_form', {
394
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
395
+ place_id: '', date: '', area: ''
396
+ })
397
+ return false;
398
+ }
399
+ else if (obj.event === 'delete') {
365
400
  var checkStatus = table.checkStatus('currentTableId'),
366
401
  data = checkStatus.data;
367
402
  layer.alert(JSON.stringify(data));
@@ -20,6 +20,7 @@ json.data do
20
20
  json.assign_follow_ups d.last_follow_up.present? ? d.last_follow_up.assign_follow_ups.pluck(:staff_id) : []
21
21
  json.current_staff_id @current_admin.id
22
22
  json.staff_id d.staff_id
23
+ json.latest_time d.last_follow_up.present? ? d.last_follow_up.created_at.to_s : ''
23
24
  end
24
25
  end
25
26
  json.code 0
@@ -17,9 +17,9 @@
17
17
  <br>
18
18
  <div class="layui-inline">
19
19
  <label class="layui-form-label required">项目类型</label>
20
- <%if @last_follow_up&.clazz&.name == "O类" %>
20
+ <%if @last_follow_up&.clazz&.name == @o_name %>
21
21
  <div class="layui-input-inline">
22
- <%= select_tag "clazz_id", options_for_select([['O类',EducodeSales::Common.find_by(name: "O类").id]]),:disabled => true, class: 'required' %>
22
+ <%= select_tag "clazz_id", options_for_select([[@o_name,EducodeSales::Common.find_by(name: @o_name).id]]),:disabled => true, class: 'required' %>
23
23
  </div>
24
24
  <%else %>
25
25
  <div class="layui-input-inline">
@@ -59,9 +59,9 @@
59
59
  </div>
60
60
  </div>
61
61
  <div class="layui-inline">
62
- <label class="layui-form-label">实额(万)</label>
62
+ <label class="layui-form-label">合同额(万)</label>
63
63
  <div class="layui-input-inline">
64
- <input name="actual_amount" type="number" class="layui-input" autocomplete="off"
64
+ <input name="actual_amount" type="number" class="layui-input" autocomplete="off" placeholder="本单位的签单金额"
65
65
  value="<%= @last_follow_up&.actual_amount%>">
66
66
  </div>
67
67
  </div>
@@ -73,11 +73,10 @@
73
73
  </div>
74
74
  </div>
75
75
  <div class="layui-inline">
76
- <label class="layui-form-label">分成</label>
76
+ <label class="layui-form-label">渠道分成</label>
77
77
  <div class="layui-input-inline">
78
- <input name="divide_rate" class="layui-input" value="<%= @last_follow_up&.divide_rate%>">
78
+ <input name="divide_amount" class="layui-input" value="<%= @last_follow_up&.divide_amount%>">
79
79
  </div>
80
- <span style="margin-top: 10px; float:left;">%</span>
81
80
  </div>
82
81
  <div class="layui-form-item">
83
82
  <label class="layui-form-label">指定跟进人</label>
@@ -86,7 +85,7 @@
86
85
  </div>
87
86
  </div>
88
87
  <div class="layui-form-item layui-form-text">
89
- <label class="layui-form-label required">商机说明</label>
88
+ <label class="layui-form-label required">最新进展</label>
90
89
  <div class="layui-input-block">
91
90
  <textarea name="description" lay-verify="required" placeholder="此处可以填写:
92
91
  1、有无预算;
@@ -86,9 +86,14 @@
86
86
  title: '时间',
87
87
  sort: true
88
88
  },
89
+ {
90
+ field: 'staff',
91
+ width: 100,
92
+ title: '跟进人',
93
+ },
89
94
  {
90
95
  field: 'clazz',
91
- width: 60,
96
+ width: 120,
92
97
  title: '类型',
93
98
  },
94
99
  {
@@ -120,12 +125,12 @@
120
125
  {
121
126
  field: 'actual_amount',
122
127
  width: 100,
123
- title: '实额',
128
+ title: '合同额',
124
129
  },
125
130
  {
126
- field: 'divide_rate',
127
- width: 80,
128
- title: '分成',
131
+ field: 'divide_amount',
132
+ width: 100,
133
+ title: '渠道分成',
129
134
  },
130
135
  {
131
136
  field: 'money',
@@ -138,11 +143,6 @@
138
143
  title: '回款计划',
139
144
  templet: '#edit_plan'
140
145
  },
141
- {
142
- field: 'staff',
143
- width: 100,
144
- title: '跟进人',
145
- },
146
146
  {
147
147
  field: 'place',
148
148
  width: 200,
@@ -9,11 +9,11 @@ json.data do
9
9
  json.reception_at d.reception_at&.to_s(:date)
10
10
  json.total_amount d.total_amount
11
11
  json.actual_amount d.actual_amount
12
- json.divide_rate d.divide_rate ? "#{d.divide_rate}%" : ""
12
+ json.divide_amount d.divide_amount ? d.divide_amount : ""
13
13
  json.staff d.staff.user.real_name
14
14
  json.place d.place&.name
15
15
  json.money_plans_count d.money_plans_count
16
- json.money d.money_plans.where(clazz: 1).sum(:amount)
16
+ json.money d.money_plans.where(clazz: 1).sum(:amount).round(2)
17
17
  json.is_latest d.id == @latest&.id
18
18
  end
19
19
  end
@@ -47,7 +47,7 @@
47
47
  </div>
48
48
  </div>
49
49
  <div class="layui-inline">
50
- <label class="layui-form-label">实额:</label>
50
+ <label class="layui-form-label">合同额:</label>
51
51
  <div class="layui-input-inline">
52
52
  <%= @follow_up.actual_amount %>万
53
53
  </div>
@@ -60,9 +60,9 @@
60
60
  </div>
61
61
  </div>
62
62
  <div class="layui-inline">
63
- <label class="layui-form-label">分成:</label>
63
+ <label class="layui-form-label">渠道分成:</label>
64
64
  <div class="layui-input-inline">
65
- <%= @follow_up.divide_rate %>%
65
+ <%= @follow_up.divide_amount %>
66
66
  </div>
67
67
  </div>
68
68
  <div class="ayui-form-item">
@@ -72,7 +72,7 @@
72
72
  </div>
73
73
  </div>
74
74
  <div class="layui-form-item layui-form-text">
75
- <label class="layui-form-label">商机说明:</label>
75
+ <label class="layui-form-label">最新进展:</label>
76
76
  <div class="layui-input-block" style="padding-right: 20px;">
77
77
  <pre><%= @follow_up.description %></pre>
78
78
  </div>
@@ -83,5 +83,17 @@
83
83
  <pre><%= @follow_up.advise %></pre>
84
84
  </div>
85
85
  </div>
86
+ <div class="layui-form-item layui-form-text">
87
+ <label class="layui-form-label">时间:</label>
88
+ <div class="layui-input-block" style="padding-right: 20px;">
89
+ <pre><%= @follow_up.created_at.to_s %></pre>
90
+ </div>
91
+ </div>
92
+ <div class="layui-form-item layui-form-text">
93
+ <label class="layui-form-label">跟进人:</label>
94
+ <div class="layui-input-block" style="padding-right: 20px;">
95
+ <pre><%= @follow_up.staff.user.real_name %></pre>
96
+ </div>
97
+ </div>
86
98
  </div>
87
99
  </form>