educode_sales 1.0.1 → 1.0.3
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.
- checksums.yaml +4 -4
- data/app/controllers/educode_sales/businesses_controller.rb +3 -0
- data/app/controllers/educode_sales/contracts_controller.rb +19 -2
- data/app/controllers/educode_sales/follow_ups_controller.rb +13 -12
- data/app/controllers/educode_sales/home_controller.rb +14 -0
- data/app/controllers/educode_sales/key_person_controller.rb +1 -1
- data/app/controllers/educode_sales/money_plan_records_controller.rb +103 -0
- data/app/controllers/educode_sales/money_plans_controller.rb +32 -28
- data/app/controllers/educode_sales/sales_details_controller.rb +1 -1
- data/app/controllers/educode_sales/teachers_controller.rb +7 -2
- data/app/models/educode_sales/business.rb +3 -0
- data/app/models/educode_sales/key_person.rb +1 -1
- data/app/models/educode_sales/money_plan.rb +27 -0
- data/app/models/educode_sales/money_plan_claim.rb +7 -0
- data/app/models/educode_sales/money_plan_record.rb +7 -0
- data/app/views/educode_sales/businesses/edit_plan.html.erb +1 -1
- data/app/views/educode_sales/businesses/key_person.json.jbuilder +1 -1
- data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -1
- data/app/views/educode_sales/follow_ups/teachers.json.jbuilder +1 -1
- data/app/views/educode_sales/home/search_contracts.json.jbuilder +9 -0
- data/app/views/educode_sales/home/search_money_plans.json.jbuilder +9 -0
- data/app/views/educode_sales/money_plan_records/_index.html.erb +231 -0
- data/app/views/educode_sales/money_plan_records/add.html.erb +101 -0
- data/app/views/educode_sales/money_plan_records/confirm_plan.html.erb +167 -0
- data/app/views/educode_sales/money_plan_records/index.js.erb +1 -0
- data/app/views/educode_sales/money_plan_records/index.json.jbuilder +26 -0
- data/app/views/educode_sales/money_plans/{index.html.erb → _index.html.erb} +119 -65
- data/app/views/educode_sales/money_plans/add.html.erb +147 -0
- data/app/views/educode_sales/money_plans/index.json.jbuilder +41 -8
- data/app/views/educode_sales/money_plans/list.html.erb +55 -0
- data/app/views/educode_sales/sales_details/edit.html.erb +6 -0
- data/app/views/educode_sales/teachers/add_keys.html.erb +2 -2
- data/app/views/layouts/educode_sales/application.html.erb +1 -1
- data/config/routes.rb +16 -1
- data/db/migrate/20230527150102_add_category_to_educode_sales_money_plans.rb +7 -0
- data/db/migrate/20230528115654_create_educode_sales_money_plan_records.rb +13 -0
- data/db/migrate/20230529022020_create_educode_sales_money_plan_claims.rb +12 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea14dcf8c116d91d0a273c02cd36f2d064cc48fe93cfd6024de598db56b0b21b
|
4
|
+
data.tar.gz: 0f796a9a5a15726bf97ccd161b0144d8be7d5b6d10b11f3763047ad4253dbb67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddefae214a2fb34bd44c7d9e7a0166ec5fa353b604643d617cba26687c3e806d0617d96b0ae892e366561005e7e133ea8649618eebe44c14f2521804829dc9b7
|
7
|
+
data.tar.gz: 835634d2f2f94ed809a372f299da738d9e45f67ddf9461e5fa5e76a7d0eb0fda73a491f838ffeedb5c1a771ec21c813591cb5d6262d11761728c6daf5599aded
|
@@ -484,6 +484,9 @@ module EducodeSales
|
|
484
484
|
params[:sourcable_id] = ""
|
485
485
|
end
|
486
486
|
end
|
487
|
+
if ['会议活动', '渠道代理', '客户'].include?(params[:source_way] ) && params[:sourcable_id].blank?
|
488
|
+
params[:sourcable_type] = ""
|
489
|
+
end
|
487
490
|
if params[:sourcable_type].blank?
|
488
491
|
params[:sourcable_id] = ""
|
489
492
|
end
|
@@ -352,9 +352,8 @@ module EducodeSales
|
|
352
352
|
d.select! { |d| d.delete_if{|f| f == ''}.present? }
|
353
353
|
end
|
354
354
|
|
355
|
-
|
356
|
-
|
357
355
|
follow_up = last_follow_up.dup
|
356
|
+
|
358
357
|
follow_up.assign_attributes(follow_up_params)
|
359
358
|
follow_up.description = params[:content]
|
360
359
|
if params[:service_time].present?
|
@@ -365,7 +364,25 @@ module EducodeSales
|
|
365
364
|
end
|
366
365
|
follow_up.staff = @current_admin
|
367
366
|
|
367
|
+
last_follow_up.assign_follow_ups.each do |d|
|
368
|
+
follow_up.assign_follow_ups.build(staff_id: d.staff_id)
|
369
|
+
end
|
370
|
+
|
368
371
|
if follow_up.save!
|
372
|
+
if last_follow_up.present?
|
373
|
+
last_follow_up.key_person.each do |d|
|
374
|
+
key_person = d.dup
|
375
|
+
key_person.follow_up_id = follow_up.id
|
376
|
+
key_person.save
|
377
|
+
end
|
378
|
+
last_follow_up.money_plans.each do |d|
|
379
|
+
money = d.dup
|
380
|
+
money.staff = @current_admin
|
381
|
+
money.follow_up_id = follow_up.id
|
382
|
+
money.save
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
369
386
|
contract_lists = EducodeSales::ContractDateList.clazzs.invert
|
370
387
|
data.each_with_index do |s, i|
|
371
388
|
if s.present?
|
@@ -234,22 +234,23 @@ module EducodeSales
|
|
234
234
|
# 从教师列表里选择的用户
|
235
235
|
teacher = Teacher.find(names[1])
|
236
236
|
key_peprson = KeyPerson.new(teacher_params)
|
237
|
+
key_peprson.name = teacher.name
|
237
238
|
key_peprson.teacher = teacher
|
238
|
-
|
239
|
+
elsif names[0] == 'u'
|
239
240
|
# 从头歌平台选择的用户
|
240
241
|
user = User.find(names[1])
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
)
|
242
|
+
key_peprson = KeyPerson.new(teacher_params)
|
243
|
+
teacher = EducodeSales::Teacher.find_or_initialize_by(name: user.real_name, department_id: user.department_id, user_id: user.id)
|
244
|
+
|
245
|
+
teacher.staff = @current_admin
|
246
|
+
teacher.professional_title = params[:professional_title]
|
247
|
+
teacher.job = params[:job]
|
248
|
+
teacher.is_key = true
|
249
249
|
teacher.save
|
250
|
+
key_peprson.name = teacher.name
|
251
|
+
key_peprson.teacher_id = teacher.id
|
252
|
+
else
|
250
253
|
key_peprson = KeyPerson.new(teacher_params)
|
251
|
-
teacher_id = EducodeSales::Teacher.find_by(name: user.real_name, department_id: user.department_id).id
|
252
|
-
key_peprson.teacher_id = teacher_id
|
253
254
|
end
|
254
255
|
|
255
256
|
follow_up.key_person << key_peprson
|
@@ -318,7 +319,7 @@ module EducodeSales
|
|
318
319
|
end
|
319
320
|
|
320
321
|
def teacher_params
|
321
|
-
params.permit(:professional_title, :job, :attitude_id, :sex, :birth_date, :remark, :tel)
|
322
|
+
params.permit(:professional_title, :job, :attitude_id, :sex, :birth_date, :remark, :tel, :name)
|
322
323
|
end
|
323
324
|
end
|
324
325
|
end
|
@@ -77,6 +77,13 @@ module EducodeSales
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
def search_contracts
|
81
|
+
@data = Business
|
82
|
+
if params[:q].present?
|
83
|
+
@data = @data.where("name like :q ", q: "%#{params[:q]}%").limit(20)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
80
87
|
def staff_departments
|
81
88
|
@departments = Department.where(school_id: params[:school_id])
|
82
89
|
if params[:q].present?
|
@@ -111,5 +118,12 @@ module EducodeSales
|
|
111
118
|
end
|
112
119
|
end
|
113
120
|
|
121
|
+
def search_money_plans
|
122
|
+
@data = MoneyPlan.joins(business: :school)
|
123
|
+
if params[:q].present?
|
124
|
+
@data = @data.where("educode_sales_businesses.name like :q OR educode_sales_businesses.number like :q OR schools.name like :q ", q: "%#{params[:q]}%").limit(20)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
114
128
|
end
|
115
129
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require_dependency "educode_sales/application_controller"
|
2
|
+
|
3
|
+
module EducodeSales
|
4
|
+
class MoneyPlanRecordsController < ApplicationController
|
5
|
+
|
6
|
+
def index
|
7
|
+
respond_to do |format|
|
8
|
+
format.html do
|
9
|
+
end
|
10
|
+
format.js do
|
11
|
+
end
|
12
|
+
format.json do
|
13
|
+
@money_plan_records = MoneyPlanRecord.left_joins(:money_plan_claims).group("educode_sales_money_plan_records.id").select("educode_sales_money_plan_records.*, COUNT(educode_sales_money_plan_claims.id) AS claim_num")
|
14
|
+
if @current_admin.is_admin?
|
15
|
+
else
|
16
|
+
level = @current_admin.role.role_areas.find_by(clazz: '回款管理').level
|
17
|
+
case level
|
18
|
+
when '自己'
|
19
|
+
@money_plan_records = @money_plan_records.where(staff_id: @current_admin.id)
|
20
|
+
when '区域'
|
21
|
+
school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
|
22
|
+
b_ids = Business.where(school_id: school_ids).pluck(:id)
|
23
|
+
@money_plan_records = @money_plan_records.joins(:business).where("educode_sales_businesses.id in (?) OR educode_sales_money_plans.staff_id = ?", b_ids, @current_admin.id)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if params[:q].present? && params[:q][:payer_name].present?
|
28
|
+
@money_plan_records = @money_plan_records.where("payer_name like ?", "%#{params[:q][:payer_name]}%")
|
29
|
+
end
|
30
|
+
|
31
|
+
if params[:q].present? && params[:q][:date_at].present?
|
32
|
+
date = params[:q][:date_at].split(" - ")
|
33
|
+
@money_plan_records = @money_plan_records.where("date_at BETWEEN ? AND ?", date[0], date[1])
|
34
|
+
end
|
35
|
+
if params[:q].present? && params[:q][:state].present?
|
36
|
+
if params[:q][:state] == '已认领'
|
37
|
+
@money_plan_records = @money_plan_records.having("claim_num > 0")
|
38
|
+
elsif params[:q][:state] == '待认领'
|
39
|
+
@money_plan_records = @money_plan_records.having("claim_num = 0 AND business_id IS NOT NULL")
|
40
|
+
elsif params[:q][:state] == '无对应合同'
|
41
|
+
@money_plan_records = @money_plan_records.having("claim_num = 0 AND business_id IS NULL")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
if params[:q].present? && params[:q][:amount].present?
|
46
|
+
@money_plan_records = @money_plan_records.where(amount: params[:q][:amount])
|
47
|
+
end
|
48
|
+
|
49
|
+
if params[:sort].present? && params[:sort][:field]
|
50
|
+
@money_plan_records = @money_plan_records.order("#{params[:sort][:field]} #{params[:sort][:order]}")
|
51
|
+
else
|
52
|
+
@money_plan_records = @money_plan_records.order(created_at: :desc)
|
53
|
+
end
|
54
|
+
@money_plan_records = @money_plan_records.page(params[:page]).per(params[:limit])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def add
|
60
|
+
render layout: false
|
61
|
+
end
|
62
|
+
|
63
|
+
def confirm_plan
|
64
|
+
@money_plan_record = MoneyPlanRecord.find(params[:id])
|
65
|
+
gon.money_plan_records = []
|
66
|
+
gon.money_plan_ids = []
|
67
|
+
gon.money_plan_claim_amount = []
|
68
|
+
@money_plan_claim = nil
|
69
|
+
@money_plan_claims = @money_plan_record.money_plan_claims.each_with_index do |d, i|
|
70
|
+
if i == 0
|
71
|
+
@money_plan_claim = d
|
72
|
+
end
|
73
|
+
gon.money_plan_records << [{value: d.money_plan_id.to_s, name: "#{d.money_plan.business&.number}/#{d.money_plan.business&.name}/#{d.money_plan.business&.school&.name}/ #{d.money_plan.business.last_follow_up&.actual_amount}万 / #{d.money_plan.date_at.to_s(:date)}"}]
|
74
|
+
gon.money_plan_ids << d.money_plan_id.to_s
|
75
|
+
gon.money_plan_claim_amount << [d.amount]
|
76
|
+
end
|
77
|
+
render layout: false
|
78
|
+
end
|
79
|
+
|
80
|
+
def create
|
81
|
+
business_id = Business.find_by(id: params[:business_id])&.id
|
82
|
+
record = MoneyPlanRecord.new(amount: params[:amount], payer_name: params[:payer_name], date_at: params[:date_at], staff_id: @current_admin.id, business_id: business_id)
|
83
|
+
if record.save
|
84
|
+
render_success
|
85
|
+
else
|
86
|
+
render_failure record
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def confirm
|
91
|
+
money_plan_record = MoneyPlanRecord.find(params[:id])
|
92
|
+
money_plan_record.money_plan_claims.where.not(money_plan_id: params[:money_plan_ids]).delete_all
|
93
|
+
(params[:num].to_i + 1).times do |i|
|
94
|
+
claim = money_plan_record.money_plan_claims.find_or_initialize_by(money_plan_id: params[:money_plan_ids][i])
|
95
|
+
claim.amount = params["amount[#{i}]"]
|
96
|
+
claim.staff = @current_admin
|
97
|
+
claim.save
|
98
|
+
end
|
99
|
+
|
100
|
+
render_success
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -4,51 +4,30 @@ module EducodeSales
|
|
4
4
|
class MoneyPlansController < ApplicationController
|
5
5
|
|
6
6
|
def index
|
7
|
-
follow_up_ids = Business.pluck(:last_follow_up_id)
|
8
7
|
authorize! :read, MoneyPlan
|
9
8
|
respond_to do |format|
|
10
9
|
format.html do
|
11
|
-
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
12
|
-
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
|
13
10
|
end
|
14
11
|
format.json do
|
15
|
-
|
12
|
+
@money_plans = MoneyPlan.joins(:business).left_joins(:money_plan_claims).group("educode_sales_money_plans.id").select("educode_sales_money_plans.*, COUNT(educode_sales_money_plan_claims.id) AS claim_num")
|
16
13
|
if @current_admin.is_admin?
|
17
|
-
@money_plans = MoneyPlan.joins(:follow_up).where("educode_sales_follow_ups.clazz_id != ?", x_id).where(follow_up_id: follow_up_ids)
|
18
14
|
else
|
19
15
|
level = @current_admin.role.role_areas.find_by(clazz: '回款管理').level
|
20
16
|
case level
|
21
17
|
when '自己'
|
22
|
-
@money_plans =
|
18
|
+
@money_plans = @money_plans.where(staff_id: @current_admin.id)
|
23
19
|
when '区域'
|
24
|
-
a_ids = MoneyPlan.where(follow_up_id: follow_up_ids).where(staff_id: @current_admin.id).pluck(:follow_up_id)
|
25
20
|
school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
|
26
|
-
b_ids = Business.where(school_id: school_ids).pluck(:
|
27
|
-
|
28
|
-
@money_plans = MoneyPlan.joins(:follow_up).where("educode_sales_follow_ups.clazz_id != ?", x_id).where(follow_up_id: ids)
|
29
|
-
else
|
30
|
-
@money_plans = MoneyPlan.joins(:follow_up).where("educode_sales_follow_ups.clazz_id != ?", x_id).where(follow_up_id: follow_up_ids)
|
21
|
+
b_ids = Business.where(school_id: school_ids).pluck(:id)
|
22
|
+
@money_plans = @money_plans.where("educode_sales_businesses.id in (?) OR educode_sales_money_plans.staff_id = ?", b_ids, @current_admin.id)
|
31
23
|
end
|
32
24
|
end
|
33
25
|
|
34
26
|
if params[:q].present? && params[:q][:business].present?
|
35
|
-
|
36
|
-
@money_plans = @money_plans.where(follow_up_id: follow_up_ids)
|
27
|
+
@money_plans = @money_plans.where("educode_sales_businesses.name like ?", "%#{params[:q][:business]}%")
|
37
28
|
end
|
38
29
|
if params[:q].present? && params[:q][:school].present?
|
39
|
-
|
40
|
-
follow_up_ids = Business.where(school_id: school_ids).pluck(:last_follow_up_id)
|
41
|
-
@money_plans = @money_plans.where(follow_up_id: follow_up_ids)
|
42
|
-
end
|
43
|
-
if params[:q].present? && params[:q][:staff_id].present?
|
44
|
-
@money_plans = @money_plans.where(staff_id: params[:q][:staff_id])
|
45
|
-
end
|
46
|
-
if params[:q].present? && params[:q][:clazz].present?
|
47
|
-
@money_plans = @money_plans.where(clazz: params[:q][:clazz])
|
48
|
-
end
|
49
|
-
if params[:q].present? && params[:q][:date].present?
|
50
|
-
date = params[:q][:date].split(" - ")
|
51
|
-
@money_plans = @money_plans.where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at < ?", date[0], date[1] + '23:59:59')
|
30
|
+
@money_plans = @money_plans.joins(business: :school).where("schools.name like ?", "%#{params[:q][:school]}%")
|
52
31
|
end
|
53
32
|
|
54
33
|
if params[:sort].present? && params[:sort][:field]
|
@@ -56,10 +35,35 @@ module EducodeSales
|
|
56
35
|
else
|
57
36
|
@money_plans = @money_plans.order(date_at: :desc)
|
58
37
|
end
|
59
|
-
@total_amount = @money_plans.sum(:amount)
|
60
38
|
@money_plans = @money_plans.page(params[:page]).per(params[:limit])
|
61
39
|
end
|
62
40
|
end
|
63
41
|
end
|
42
|
+
|
43
|
+
def list
|
44
|
+
follow_up_ids = Business.pluck(:last_follow_up_id)
|
45
|
+
authorize! :read, MoneyPlan
|
46
|
+
respond_to do |format|
|
47
|
+
format.html do
|
48
|
+
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
49
|
+
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def add
|
56
|
+
render layout: false
|
57
|
+
end
|
58
|
+
|
59
|
+
def create
|
60
|
+
business = Business.find(params[:business_id])
|
61
|
+
data = []
|
62
|
+
(params[:num].to_i+1).times do |i|
|
63
|
+
business.money_plans.create(category: params["category[#{i}]"], amount: params["amount[#{i}]"], payment_clause: params["payment_clause[#{i}]"], date_at: params["date_at[#{i}]"], follow_up_id: business.last_follow_up_id, staff_id: @current_admin.id )
|
64
|
+
end
|
65
|
+
render_success
|
66
|
+
end
|
67
|
+
|
64
68
|
end
|
65
69
|
end
|
@@ -157,7 +157,7 @@ module EducodeSales
|
|
157
157
|
private
|
158
158
|
|
159
159
|
def sales_detail_params
|
160
|
-
params.permit(:amount, :price, :total_price, :custom_clazz, :delivery_date, :product_catalog_id)
|
160
|
+
params.permit(:amount, :price, :total_price, :custom_clazz, :delivery_date, :product_catalog_id, :proprietorship)
|
161
161
|
end
|
162
162
|
|
163
163
|
end
|
@@ -9,8 +9,13 @@ module EducodeSales
|
|
9
9
|
last_follow = follow_up.business.follow_ups.where.not(id: follow_up.id).order("id desc").first
|
10
10
|
if last_follow.present? && last_follow.key_people_count > 0
|
11
11
|
@person = last_follow.key_person.last
|
12
|
-
|
13
|
-
|
12
|
+
if @person&.teacher.present?
|
13
|
+
gon.teacher = "t-#{@person.teacher_id}"
|
14
|
+
gon.teachers = { value: "t-#{@person.teacher_id}", name: @person.name }
|
15
|
+
else
|
16
|
+
gon.teacher = ""
|
17
|
+
gon.teachers = {}
|
18
|
+
end
|
14
19
|
end
|
15
20
|
end
|
16
21
|
@attitudes = Common.where(clazz: 'key_attitude').order("position").pluck(:name, :id)
|
@@ -18,6 +18,9 @@ module EducodeSales
|
|
18
18
|
has_many :business_levels, dependent: :destroy
|
19
19
|
has_many :business_watches, dependent: :destroy
|
20
20
|
has_many :business_histories, dependent: :destroy
|
21
|
+
has_many :money_plans
|
22
|
+
|
23
|
+
belongs_to :school
|
21
24
|
|
22
25
|
belongs_to :sourcable, :polymorphic => true, optional: true
|
23
26
|
|
@@ -1,15 +1,42 @@
|
|
1
1
|
module EducodeSales
|
2
2
|
class MoneyPlan < ApplicationRecord
|
3
3
|
belongs_to :staff
|
4
|
+
belongs_to :business
|
4
5
|
belongs_to :follow_up, counter_cache: true
|
5
6
|
|
7
|
+
has_many :money_plan_claims
|
8
|
+
|
6
9
|
# todo 1 :实际回款 0:计划回款
|
7
10
|
enum clazz: ['计划回款', '实际回款']
|
11
|
+
enum category: ['预收款', '交付款', '验收款', '质保金']
|
8
12
|
|
9
13
|
after_save :update_return_money
|
10
14
|
after_destroy :update_return_money
|
11
15
|
|
12
16
|
|
17
|
+
def return_period
|
18
|
+
if self.date_at && self.business&.last_follow_up&.signed_date
|
19
|
+
signed_date = self.business&.last_follow_up&.signed_date
|
20
|
+
month = (self.date_at.year - signed_date.year) * 12 + self.date_at.month - signed_date.month - (self.date_at.day >= signed_date.day ? 0 : 1)
|
21
|
+
if month <= 3
|
22
|
+
'3个月内'
|
23
|
+
elsif month <= 6
|
24
|
+
'4-6个月内'
|
25
|
+
elsif month <= 9
|
26
|
+
'7-9个月'
|
27
|
+
elsif month <= 12
|
28
|
+
'10-12个月'
|
29
|
+
elsif month <= 24
|
30
|
+
'1-2年'
|
31
|
+
elsif month <= 36
|
32
|
+
'2-3年'
|
33
|
+
end
|
34
|
+
else
|
35
|
+
''
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
13
40
|
private
|
14
41
|
|
15
42
|
def update_return_money
|
@@ -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" id="show_plan_box">
|
3
|
+
<div class="layui-form layuimini-form" lay-filter="teacher_form" id="show_plan_box" style="display:none;">
|
4
4
|
<fieldset class="table-search-fieldset">
|
5
5
|
<legend>添加回款计划</legend>
|
6
6
|
<div class="layui-form-item">
|
@@ -15,7 +15,7 @@ json.data do
|
|
15
15
|
json.staff_manages d.business.last_follow_up&.assign_follow_ups.present? ? (d.business.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.business.staff&.user&.real_name
|
16
16
|
# teacher_ids = d.key_person.pluck(:teacher_id)
|
17
17
|
json.tel d.key_person.pluck(:tel).select { |d| d.present? }.join("、")
|
18
|
-
json.key_people d.key_person.map { |d| d.
|
18
|
+
json.key_people d.key_person.map { |d| d.name }.join("、")# key_people(teacher_ids)
|
19
19
|
|
20
20
|
end
|
21
21
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
json.data do
|
2
|
+
json.array! @data do |d|
|
3
|
+
json.value d.id
|
4
|
+
json.name "#{d.number} / #{d.department&.school&.name.to_s}#{d.department&.name.to_s} / #{d.name} / #{d.last_follow_up&.actual_amount}万"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
json.count @data.size
|
8
|
+
json.code 0
|
9
|
+
json.msg "success"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
json.data do
|
2
|
+
json.array! @data do |d|
|
3
|
+
json.value d.id
|
4
|
+
json.name "#{d.business.number} / #{d.business.department&.school&.name.to_s}#{d.business.department&.name.to_s} / #{d.business.name} / #{d.business.last_follow_up&.actual_amount}万 / #{d.date_at.to_s(:date)}"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
json.count @data.size
|
8
|
+
json.code 0
|
9
|
+
json.msg "success"
|