educode_sales 0.9.19 → 0.9.21
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 +38 -9
- data/app/controllers/educode_sales/follow_ups_controller.rb +2 -2
- data/app/controllers/educode_sales/sale_trends_controller.rb +30 -5
- data/app/views/educode_sales/businesses/daily_paper.html.erb +6 -6
- data/app/views/educode_sales/businesses/edit_follow_record.html.erb +19 -3
- data/app/views/educode_sales/businesses/get_export_data.json.jbuilder +5 -1
- data/app/views/educode_sales/businesses/index.html.erb +31 -48
- data/app/views/educode_sales/businesses/index.json.jbuilder +5 -3
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +19 -3
- data/app/views/educode_sales/businesses/show_follow.html.erb +3 -3
- data/app/views/educode_sales/businesses/show_follow_record.html.erb +8 -2
- data/app/views/educode_sales/sale_trends/_business_area.html.erb +8 -2
- data/app/views/educode_sales/sale_trends/_sales_analysis.html.erb +10 -2
- data/db/migrate/20221107122147_change_divide_rate_follow_ups.rb +15 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a49e1fe26099afa0e25a1542fe775e0433f635c3573e4f05c6ea6f3668446d5
|
4
|
+
data.tar.gz: 9a461d3ec11c8edf2e6a2a0ff5af5935e97e49f7604203cdaf1bdcc3f5e22ad8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 535bb72b0065d1fab5ebc6e7aef7d439f8ebdc6511ad9b15fbaf464404c043d937ccb6155e171f935d5e08b5431514e1aeb2f068e96736704616a5b0c06f9ca6
|
7
|
+
data.tar.gz: 8b31c2724ce9fe79f94cd1f8a0ce91045b0833ec2524476037827587fbc708c7507886c46b76511885c425906de6c84cc1219c1b965d68d3413a01a59db32912
|
@@ -230,7 +230,7 @@ module EducodeSales
|
|
230
230
|
@businesses = @businesses.where("number like :data", data: "%#{params[:q][:number].strip}%")
|
231
231
|
end
|
232
232
|
|
233
|
-
if params[:q][:clazz].present?
|
233
|
+
if params[:q].present? && params[:q][:clazz].present?
|
234
234
|
# 我的关注
|
235
235
|
if params[:q][:clazz] == 'followes'
|
236
236
|
my_ids = BusinessRelationShip.where(user_id:@current_admin.user_id).pluck(:business_id)
|
@@ -256,6 +256,7 @@ module EducodeSales
|
|
256
256
|
@businesses = @businesses.select("
|
257
257
|
educode_sales_businesses.*,
|
258
258
|
last_follow.invitation_at,
|
259
|
+
last_follow.budget_amount,
|
259
260
|
last_follow.service_time_long,
|
260
261
|
last_follow.service_end_time,
|
261
262
|
last_follow.service_start_time,
|
@@ -265,11 +266,21 @@ module EducodeSales
|
|
265
266
|
last_follow.year,
|
266
267
|
last_follow.created_at as latest_time,
|
267
268
|
last_follow.actual_amount,
|
269
|
+
last_follow.divide_rate,
|
270
|
+
last_follow.divide_amount,
|
271
|
+
(last_follow.total_amount - last_follow.actual_amount) as divide_money,
|
268
272
|
(last_follow.actual_amount - educode_sales_businesses.return_money) as wait_return_money,
|
269
|
-
last_follow.total_amount
|
273
|
+
last_follow.total_amount,
|
274
|
+
total_follow_ups.follow_ups_count
|
270
275
|
").joins("
|
271
276
|
LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id AND last_follow.deleted_at IS NULL
|
272
|
-
|
277
|
+
LEFT JOIN (
|
278
|
+
SELECT COUNT(*) AS follow_ups_count, educode_sales_follow_ups.business_id
|
279
|
+
FROM educode_sales_follow_ups
|
280
|
+
WHERE educode_sales_follow_ups.deleted_at IS NULL
|
281
|
+
GROUP BY educode_sales_follow_ups.business_id
|
282
|
+
) AS total_follow_ups ON educode_sales_businesses.id = total_follow_ups.business_id
|
283
|
+
").includes(:users, last_follow_up: [:clazz, :assign_follow_ups]).page(params[:page]).per(params[:limit])
|
273
284
|
|
274
285
|
end
|
275
286
|
|
@@ -282,12 +293,12 @@ module EducodeSales
|
|
282
293
|
business = EducodeSales::FollowUp.joins("
|
283
294
|
JOIN educode_sales_businesses ON educode_sales_businesses.id = educode_sales_follow_ups.business_id
|
284
295
|
JOIN educode_sales_follow_ups AS last_up ON last_up.id = educode_sales_businesses.last_follow_up_id
|
285
|
-
").where("educode_sales_businesses.staff_id = ? AND educode_sales_follow_ups.staff_id = ? AND last_up.clazz_id IN (?)", @current_admin.id, @current_admin.id, ab)
|
296
|
+
").where("educode_sales_businesses.staff_id = ? AND educode_sales_follow_ups.staff_id = ? AND last_up.clazz_id IN (?) AND last_up.staff_id = #{@current_admin.id}", @current_admin.id, @current_admin.id, ab)
|
286
297
|
|
287
298
|
|
288
|
-
@month = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_month).
|
289
|
-
@quarter = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_quarter).
|
290
|
-
@year = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_year).
|
299
|
+
@month = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_month).count("DISTINCT(educode_sales_follow_ups.business_id)")
|
300
|
+
@quarter = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_quarter).count("DISTINCT(educode_sales_follow_ups.business_id)")
|
301
|
+
@year = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_year).count("DISTINCT(educode_sales_follow_ups.business_id)")
|
291
302
|
|
292
303
|
render layout: false
|
293
304
|
end
|
@@ -571,6 +582,11 @@ module EducodeSales
|
|
571
582
|
ids1 = FollowUp.where(id: ids).pluck(:business_id)
|
572
583
|
@businesses =@businesses.where("educode_sales_businesses.id in (?) or educode_sales_businesses.staff_id = ?", ids1, @current_admin.id)
|
573
584
|
end
|
585
|
+
if params[:is_follow].present?
|
586
|
+
# 关注
|
587
|
+
my_ids = BusinessRelationShip.where(user_id:@current_admin.user_id).pluck(:business_id)
|
588
|
+
@businesses = @businesses.where(id: my_ids)
|
589
|
+
end
|
574
590
|
|
575
591
|
@businesses = @businesses
|
576
592
|
if params[:name].present? && params[:name] != "(销售态势-" + @year + "-已中标商机)" && params[:name] != "(销售态势-" + @year + "-已签单商机)" && params[:name] != "(销售态势-" + @year + "-已回款商机)" && params[:name] != "(销售态势-" + @year + "-现有商机)"&& params[:name] != "(销售态势-" + @year + "-应收款商机)"
|
@@ -649,6 +665,7 @@ module EducodeSales
|
|
649
665
|
@businesses = @businesses.select("
|
650
666
|
educode_sales_businesses.*,
|
651
667
|
last_follow.invitation_at,
|
668
|
+
last_follow.budget_amount,
|
652
669
|
last_follow.reception_at,
|
653
670
|
last_follow.service_time_long,
|
654
671
|
last_follow.service_end_time,
|
@@ -657,10 +674,21 @@ module EducodeSales
|
|
657
674
|
last_follow.signed_date,
|
658
675
|
last_follow.created_at as latest_time,
|
659
676
|
last_follow.actual_amount,
|
677
|
+
last_follow.divide_rate,
|
678
|
+
last_follow.divide_amount,
|
679
|
+
(last_follow.total_amount - last_follow.actual_amount) as divide_money,
|
660
680
|
(last_follow.actual_amount - educode_sales_businesses.return_money) as wait_return_money,
|
661
|
-
last_follow.total_amount
|
681
|
+
last_follow.total_amount,
|
682
|
+
total_follow_ups.follow_ups_count
|
683
|
+
").joins("
|
662
684
|
LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id AND last_follow.deleted_at IS NULL
|
663
|
-
|
685
|
+
LEFT JOIN (
|
686
|
+
SELECT COUNT(*) AS follow_ups_count, educode_sales_follow_ups.business_id
|
687
|
+
FROM educode_sales_follow_ups
|
688
|
+
WHERE educode_sales_follow_ups.deleted_at IS NULL
|
689
|
+
GROUP BY educode_sales_follow_ups.business_id
|
690
|
+
) AS total_follow_ups ON educode_sales_businesses.id = total_follow_ups.business_id
|
691
|
+
").includes(last_follow_up: [:clazz, :assign_follow_ups])
|
664
692
|
end
|
665
693
|
end
|
666
694
|
end
|
@@ -690,6 +718,7 @@ module EducodeSales
|
|
690
718
|
@businesses=Business.where(id:p)
|
691
719
|
@businesses=@businesses.select("
|
692
720
|
educode_sales_businesses.*,
|
721
|
+
last_follow.budget_amount,
|
693
722
|
last_follow.invitation_at,
|
694
723
|
last_follow.reception_at,
|
695
724
|
last_follow.service_time_long,
|
@@ -196,7 +196,7 @@ module EducodeSales
|
|
196
196
|
if params[:name].blank?
|
197
197
|
return render_failure '请从平台里选择教师'
|
198
198
|
end
|
199
|
-
|
199
|
+
|
200
200
|
names = params[:name].split("-")
|
201
201
|
if names[0] == 't'
|
202
202
|
# 从教师列表里选择的用户
|
@@ -255,7 +255,7 @@ module EducodeSales
|
|
255
255
|
end
|
256
256
|
|
257
257
|
def follow_up_params
|
258
|
-
params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_amount, :description, :advise, :place_id, :bidded_date, :signed_date, :year, :o_business_deployment)
|
258
|
+
params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_amount, :divide_rate, :budget_amount, :description, :advise, :place_id, :bidded_date, :signed_date, :year, :o_business_deployment)
|
259
259
|
end
|
260
260
|
|
261
261
|
def teacher_params
|
@@ -217,9 +217,10 @@ module EducodeSales
|
|
217
217
|
def business_area
|
218
218
|
respond_to do |format|
|
219
219
|
format.html do
|
220
|
-
|
221
220
|
end
|
222
221
|
format.js do
|
222
|
+
@business_types = EducodeSales::Common.where(clazz: 'business_type').where.not(extras: "x_class").map { |d| {name: d.name, value: d.id } }
|
223
|
+
@select_business_type = params[:business_type].present? ? params[:business_type].split(",") : []
|
223
224
|
x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
|
224
225
|
o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id
|
225
226
|
provinces = EducodeSales::Common.where(clazz: 'area').pluck(:name)
|
@@ -228,11 +229,23 @@ module EducodeSales
|
|
228
229
|
if params[:business_type].blank?
|
229
230
|
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).sum(:total_amount).round(2)
|
230
231
|
else
|
231
|
-
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id
|
232
|
+
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id in (?)", params[:business_type].split(",")).sum(:total_amount).round(2)
|
232
233
|
end
|
233
234
|
}
|
234
235
|
if params[:sort_by].present?
|
235
|
-
|
236
|
+
data_hash = []
|
237
|
+
data.each_with_index do |d, i|
|
238
|
+
data_hash << {id: i, num: d}
|
239
|
+
end
|
240
|
+
|
241
|
+
data_hash.sort! { |a, b| params[:sort_by] == 'asc' ? a[:num] <=> b[:num] : b[:num] <=> a[:num] }
|
242
|
+
data = []
|
243
|
+
provinces_sort = []
|
244
|
+
data_hash.each_with_index do |d|
|
245
|
+
data << d[:num]
|
246
|
+
provinces_sort << provinces[d[:id]]
|
247
|
+
end
|
248
|
+
provinces = provinces_sort
|
236
249
|
end
|
237
250
|
@business_data = {
|
238
251
|
labels: provinces,
|
@@ -251,11 +264,23 @@ module EducodeSales
|
|
251
264
|
if params[:business_type].blank?
|
252
265
|
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).count
|
253
266
|
else
|
254
|
-
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id
|
267
|
+
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id in (?)", params[:business_type].split(",")).count
|
255
268
|
end
|
256
269
|
}
|
257
270
|
if params[:sort_by].present?
|
258
|
-
|
271
|
+
data_hash = []
|
272
|
+
data.each_Wit_index do |d, i|
|
273
|
+
data_hash << {id: i, num: d}
|
274
|
+
end
|
275
|
+
|
276
|
+
data_hash.sort! { |a, b| params[:sort_by] == 'asc' ? a[:num] <=> b[:num] : b[:num] <=> a[:num] }
|
277
|
+
data = []
|
278
|
+
provinces_sort = []
|
279
|
+
data_hash.each_with_index do |d|
|
280
|
+
data << d[:num]
|
281
|
+
provinces_sort << provinces[d[:id]]
|
282
|
+
end
|
283
|
+
provinces = provinces_sort
|
259
284
|
end
|
260
285
|
@business_data = {
|
261
286
|
labels: provinces,
|
@@ -5,17 +5,17 @@
|
|
5
5
|
|
6
6
|
<p>一、AB类商机开拓情况</p>
|
7
7
|
<p style="margin-bottom: 30px;">
|
8
|
-
本月-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @month
|
9
|
-
本季-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @quarter
|
10
|
-
本年-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @year
|
8
|
+
本月-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @month %>, </span>
|
9
|
+
本季-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @quarter %>, </span>
|
10
|
+
本年-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @year %></span>
|
11
11
|
</p>
|
12
12
|
<p style="margin-bottom: 30px;">二、本月已组织会议</p>
|
13
13
|
<p>三、客户跟进情况</p>
|
14
14
|
<% text = "\n" %>
|
15
15
|
<% text += "一、AB类商机开拓情况\n" %>
|
16
|
-
<% text += "本月-#{@month
|
17
|
-
<% text += "本季-#{@quarter
|
18
|
-
<% text += "本年-#{@year
|
16
|
+
<% text += "本月-#{@month }, "%>
|
17
|
+
<% text += "本季-#{@quarter }, "%>
|
18
|
+
<% text += "本年-#{@year }\n\n"%>
|
19
19
|
<% text += "二、本月已组织会议 \n\n"%>
|
20
20
|
<% text += "三、客户跟进情况 \n"%>
|
21
21
|
<% @followups.each_with_index do |d, i| %>
|
@@ -78,11 +78,11 @@
|
|
78
78
|
</div>
|
79
79
|
<br class="service_show layui-hide">
|
80
80
|
<div class="layui-inline">
|
81
|
-
<label class="layui-form-label"
|
81
|
+
<label class="layui-form-label">中标额(万)</label>
|
82
82
|
<div class="layui-input-inline">
|
83
83
|
<input name="total_amount" type="number" class="layui-input" value="<%= @follow_up.total_amount %>">
|
84
84
|
</div>
|
85
|
-
|
85
|
+
客户采购支出的费用。中标额的生命历程:1.在最初阶段,是商机的预算总额;2.在挂网阶段,是项目的挂网预算总额;3.在中标阶段,是项目的中标总额。
|
86
86
|
</div>
|
87
87
|
<br>
|
88
88
|
<div class="layui-inline">
|
@@ -105,7 +105,23 @@
|
|
105
105
|
<div class="layui-input-inline">
|
106
106
|
<input name="divide_amount" class="layui-input" value="<%= @follow_up.divide_amount%>">
|
107
107
|
</div>
|
108
|
-
|
108
|
+
中标额里,渠道拿到的部分。
|
109
|
+
</div>
|
110
|
+
<br>
|
111
|
+
<div class="layui-inline">
|
112
|
+
<label class="layui-form-label">预算金额(万)</label>
|
113
|
+
<div class="layui-input-inline">
|
114
|
+
<input name="budget_amount" class="layui-input" value="<%= @last_follow_up&.budget_amount.to_f.round(2) %>">
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="layui-form-item">
|
118
|
+
<div class="layui-inline">
|
119
|
+
<label class="layui-form-label">分成比例</label>
|
120
|
+
<div class="layui-input-inline">
|
121
|
+
<input name="divide_rate" class="layui-input" value="<%= @follow_up&.divide_rate.to_f.round(2) %>">
|
122
|
+
</div>
|
123
|
+
% 渠道拿到的分成比例。
|
124
|
+
</div>
|
109
125
|
</div>
|
110
126
|
<div class="layui-form-item">
|
111
127
|
<div class="layui-inline">
|
@@ -6,7 +6,7 @@ json.data do
|
|
6
6
|
json.department d.department.name
|
7
7
|
json.school d.department.school.name
|
8
8
|
json.school_id d.department.school.id
|
9
|
-
follow_ups_count = d
|
9
|
+
follow_ups_count = d['follow_ups_count'] || 0
|
10
10
|
json.follow_ups_count follow_ups_count
|
11
11
|
json.follow_up_id d.last_follow_up_id
|
12
12
|
json.clazz d.last_follow_up&.clazz&.name || ""
|
@@ -23,6 +23,10 @@ json.data do
|
|
23
23
|
break
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
json.divide_rate d.divide_rate
|
28
|
+
json.divide_money d.divide_amount
|
29
|
+
json.budget_money d.budget_amount
|
26
30
|
json.area d.department.school.province
|
27
31
|
school_property = d.department.school.school_property
|
28
32
|
property = []
|
@@ -413,7 +413,7 @@
|
|
413
413
|
{
|
414
414
|
field: 'total_amount',
|
415
415
|
width: 100,
|
416
|
-
title: '
|
416
|
+
title: '中标额',
|
417
417
|
totalRow: true,
|
418
418
|
sort: true,
|
419
419
|
hide: gon.filter.total_amount
|
@@ -449,10 +449,24 @@
|
|
449
449
|
hide: gon.filter.return_money_days
|
450
450
|
},
|
451
451
|
{
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
452
|
+
field: 'divide_rate',
|
453
|
+
width: 160,
|
454
|
+
title: '渠道分成比例',
|
455
|
+
sort: true,
|
456
|
+
hide: gon.filter.divide_rate
|
457
|
+
},
|
458
|
+
{
|
459
|
+
field: 'divide_money',
|
460
|
+
width: 160,
|
461
|
+
title: '渠道分成金额',
|
462
|
+
sort: true,
|
463
|
+
hide: gon.filter.divide_money
|
464
|
+
},
|
465
|
+
{
|
466
|
+
field: 'place',
|
467
|
+
width: 160,
|
468
|
+
title: '渠道',
|
469
|
+
hide: gon.filter.place
|
456
470
|
},
|
457
471
|
{
|
458
472
|
field: 'sale_way',
|
@@ -602,10 +616,10 @@
|
|
602
616
|
id = elem.data('id');
|
603
617
|
switch (data.event) {
|
604
618
|
case 'export_csv':
|
605
|
-
|
619
|
+
export_bussiness('csv')
|
606
620
|
break;
|
607
621
|
case 'export_excel':
|
608
|
-
|
622
|
+
export_bussiness('xls')
|
609
623
|
break;
|
610
624
|
case 'export_records':
|
611
625
|
export_records();
|
@@ -614,8 +628,7 @@
|
|
614
628
|
}
|
615
629
|
});
|
616
630
|
}
|
617
|
-
|
618
|
-
function export_csv() {
|
631
|
+
function export_bussiness(type) {
|
619
632
|
var data = form.val("search_form");
|
620
633
|
var business_type = [];
|
621
634
|
business_type_list.getValue().forEach(function(d) {
|
@@ -629,7 +642,6 @@
|
|
629
642
|
data.business_type = business_type.toString();
|
630
643
|
data.business_step = business_step.toString();
|
631
644
|
layer.load(0, {});
|
632
|
-
console.log(data);
|
633
645
|
request.authPost("/missions/businesses/get_export_data", {
|
634
646
|
name: data.name,
|
635
647
|
area: data.area,
|
@@ -640,53 +652,21 @@
|
|
640
652
|
invitation_at: data.invitation_at,
|
641
653
|
place_id: data.place_id,
|
642
654
|
select: data.select,
|
643
|
-
staff_id: data.staff_id
|
655
|
+
staff_id: data.staff_id,
|
656
|
+
mine: search['clazz'] == 'me' ? true : '',
|
657
|
+
is_follow: search['clazz'] == 'followes' ? true : '',
|
644
658
|
}, function (res) {
|
645
659
|
console.log(res.data);
|
646
660
|
data = res.data
|
647
|
-
table.exportFile(business_table.config.id,data,
|
661
|
+
table.exportFile(business_table.config.id,data, type);
|
648
662
|
layer.closeAll('loading');
|
649
|
-
request.get('/missions/businesses/add_export_records?type=
|
663
|
+
request.get('/missions/businesses/add_export_records?type=' + type, {}, function (res) {
|
650
664
|
})
|
651
665
|
})
|
652
666
|
|
653
667
|
}
|
654
|
-
function export_excel() {
|
655
|
-
var data = form.val("search_form");
|
656
|
-
var business_type = [];
|
657
|
-
business_type_list.getValue().forEach(function(d) {
|
658
|
-
business_type.push(d.value);
|
659
|
-
})
|
660
|
-
var business_step = [];
|
661
|
-
business_step_list.getValue().forEach(function(d) {
|
662
|
-
business_step.push(d.value);
|
663
|
-
})
|
664
|
-
data.place_id = index_place_list.getValue('valueStr');
|
665
|
-
data.business_type = business_type.toString();
|
666
|
-
data.business_step = business_step.toString();
|
667
|
-
layer.load(0, {});
|
668
|
-
console.log(data);
|
669
|
-
request.authPost("/missions/businesses/get_export_data", {
|
670
|
-
name: data.name,
|
671
|
-
area: data.area,
|
672
|
-
business_step: data.business_step,
|
673
|
-
business_type: data.business_type,
|
674
|
-
date: data.date,
|
675
|
-
department: data.department,
|
676
|
-
invitation_at: data.invitation_at,
|
677
|
-
place_id: data.place_id,
|
678
|
-
select: data.select,
|
679
|
-
staff_id: data.staff_id
|
680
|
-
}, function (res) {
|
681
|
-
console.log(res.data);
|
682
|
-
data = res.data
|
683
|
-
table.exportFile(business_table.config.id,data, 'xls');
|
684
|
-
layer.closeAll('loading');
|
685
|
-
request.get('/missions/businesses/add_export_records?type=xls', {}, function (res) {
|
686
|
-
})
|
687
|
-
})
|
688
668
|
|
689
|
-
|
669
|
+
|
690
670
|
function export_records() {
|
691
671
|
var content = miniPage.getHrefContent('/missions/businesses/export_records')
|
692
672
|
var openWH = miniPage.getOpenWidthHeight();
|
@@ -842,6 +822,9 @@
|
|
842
822
|
|
843
823
|
|
844
824
|
var sort = {}, search = {};
|
825
|
+
<% if params[:name].present? %>
|
826
|
+
search.name = "<%= params[:name] %>";
|
827
|
+
<% end %>
|
845
828
|
table.on('sort(businesses_table)', function (obj) {
|
846
829
|
sort.field = obj.field;
|
847
830
|
sort.order = obj.type;
|
@@ -8,7 +8,7 @@ json.data do
|
|
8
8
|
json.department d.department.name
|
9
9
|
json.school d.department.school.name
|
10
10
|
json.school_id d.department.school.id
|
11
|
-
follow_ups_count = d
|
11
|
+
follow_ups_count = d['follow_ups_count'] || 0
|
12
12
|
json.follow_ups_count follow_ups_count
|
13
13
|
follow_count += follow_ups_count
|
14
14
|
json.follow_up_id d.last_follow_up_id
|
@@ -26,7 +26,9 @@ json.data do
|
|
26
26
|
break
|
27
27
|
end
|
28
28
|
end
|
29
|
-
json.
|
29
|
+
json.divide_rate d.divide_rate
|
30
|
+
json.divide_money d.divide_amount
|
31
|
+
json.budget_money d.budget_amount #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
|
30
32
|
json.area d.department.school.province
|
31
33
|
school_property = d.department.school.school_property
|
32
34
|
property = []
|
@@ -53,7 +55,7 @@ json.data do
|
|
53
55
|
json.staff_id d.staff_id
|
54
56
|
json.latest_time d.last_follow_up.present? ? d.last_follow_up.created_at.to_s : ''
|
55
57
|
json.self_flag (d.staff_id == @current_admin.id) || (d.last_follow_up_id.in? follow_up_ids)
|
56
|
-
json.followed d.users.where(user_id:@current_admin.user.id).first ? 1 : 0
|
58
|
+
json.followed d.users.pluck(:user_id).include?(@current_admin.user.id) ? 1 : 0 # d.users.where(user_id:@current_admin.user.id).first ? 1 : 0
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
@@ -84,12 +84,12 @@
|
|
84
84
|
|
85
85
|
<br class="service_show layui-hide">
|
86
86
|
<div class="layui-inline">
|
87
|
-
<label class="layui-form-label"
|
87
|
+
<label class="layui-form-label">中标额(万)</label>
|
88
88
|
<div class="layui-input-inline">
|
89
89
|
<input name="total_amount" type="number" class="layui-input" autocomplete="off"
|
90
90
|
value="<%= @last_follow_up&.total_amount.to_f.round(2) %>">
|
91
91
|
</div>
|
92
|
-
|
92
|
+
客户采购支出的费用。中标额的生命历程:1.在最初阶段,是商机的预算总额;2.在挂网阶段,是项目的挂网预算总额;3.在中标阶段,是项目的中标总额。
|
93
93
|
</div>
|
94
94
|
<br>
|
95
95
|
<div class="layui-inline">
|
@@ -113,7 +113,23 @@
|
|
113
113
|
<div class="layui-input-inline">
|
114
114
|
<input name="divide_amount" class="layui-input" value="<%= @last_follow_up&.divide_amount.to_f.round(2) %>">
|
115
115
|
</div>
|
116
|
-
|
116
|
+
中标额里,渠道拿到的部分。
|
117
|
+
</div>
|
118
|
+
<br>
|
119
|
+
<div class="layui-inline">
|
120
|
+
<label class="layui-form-label">预算金额(万)</label>
|
121
|
+
<div class="layui-input-inline">
|
122
|
+
<input name="budget_amount" class="layui-input" value="<%= @last_follow_up&.budget_amount.to_f.round(2) %>">
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
<div class="layui-form-item">
|
126
|
+
<div class="layui-inline">
|
127
|
+
<label class="layui-form-label">分成比例</label>
|
128
|
+
<div class="layui-input-inline">
|
129
|
+
<input name="divide_rate" class="layui-input" value="<%= @last_follow_up&.divide_rate.to_f.round(2) %>">
|
130
|
+
</div>
|
131
|
+
% 渠道拿到的分成比例。
|
132
|
+
</div>
|
117
133
|
</div>
|
118
134
|
<div class="layui-form-item">
|
119
135
|
<div class="layui-inline">
|
@@ -186,7 +186,7 @@
|
|
186
186
|
{
|
187
187
|
field: 'total_amount',
|
188
188
|
width: 100,
|
189
|
-
title: '
|
189
|
+
title: '中标额',
|
190
190
|
},
|
191
191
|
{
|
192
192
|
field: 'actual_amount',
|
@@ -519,7 +519,7 @@
|
|
519
519
|
obj.del();
|
520
520
|
layer.close(index);
|
521
521
|
})
|
522
|
-
|
522
|
+
|
523
523
|
});
|
524
524
|
} else if (obj.event === 'show') {
|
525
525
|
content = miniPage.getHrefContent('/missions/plans/show_week?id=' + data.id);
|
@@ -559,7 +559,7 @@
|
|
559
559
|
layer.full(sindex);
|
560
560
|
});
|
561
561
|
return false;
|
562
|
-
}
|
562
|
+
}
|
563
563
|
// else if (obj.event === 'show_follow') {
|
564
564
|
// content = miniPage.getHrefContent('/educode_sales/businesses/show_follow');
|
565
565
|
// openWH = miniPage.getOpenWidthHeight();
|
@@ -81,7 +81,7 @@
|
|
81
81
|
<br>
|
82
82
|
|
83
83
|
<div class="layui-inline">
|
84
|
-
<label class="layui-form-label"
|
84
|
+
<label class="layui-form-label">中标额:</label>
|
85
85
|
<div class="layui-input-inline">
|
86
86
|
<%= @follow_up.total_amount.to_f.round(2) %>万
|
87
87
|
</div>
|
@@ -99,11 +99,17 @@
|
|
99
99
|
<%= @follow_up.place&.name %>
|
100
100
|
</div>
|
101
101
|
</div>
|
102
|
-
<div class="layui-inline">
|
102
|
+
<!-- <div class="layui-inline">
|
103
103
|
<label class="layui-form-label">渠道分成:</label>
|
104
104
|
<div class="layui-input-inline">
|
105
105
|
<%= @follow_up.divide_amount.to_f.round(2) %>万
|
106
106
|
</div>
|
107
|
+
</div> -->
|
108
|
+
<div class="layui-inline">
|
109
|
+
<label class="layui-form-label">分成比例:</label>
|
110
|
+
<div class="layui-input-inline">
|
111
|
+
<%= @follow_up.divide_rate.to_f.round(2) %>%
|
112
|
+
</div>
|
107
113
|
</div>
|
108
114
|
<div class="layui-form-item">
|
109
115
|
<div class="layui-inline">
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<div class="layui-inline m-t-10">
|
13
13
|
<label class="layui-form-label">商机类型</label>
|
14
14
|
<div class="layui-input-inline">
|
15
|
-
|
15
|
+
<div id="business_type"></div>
|
16
16
|
</div>
|
17
17
|
</div>
|
18
18
|
<div class="layui-inline m-t-10">
|
@@ -64,7 +64,13 @@
|
|
64
64
|
}
|
65
65
|
}
|
66
66
|
};
|
67
|
-
|
67
|
+
var business_type_select = xmSelect.render({
|
68
|
+
el: '#business_type',
|
69
|
+
name: 'business_type',
|
70
|
+
data: <%= raw @business_types.to_json %>
|
71
|
+
})
|
72
|
+
business_type_select.setValue(<%= raw @select_business_type.to_json %>);
|
73
|
+
|
68
74
|
|
69
75
|
var ctx = document.getElementById('myChart3');
|
70
76
|
var myChart3 = new Chart(ctx, {
|
@@ -29,8 +29,8 @@
|
|
29
29
|
</div>
|
30
30
|
</form>
|
31
31
|
</div>
|
32
|
-
<canvas id="myChart2" width="960" height="
|
33
|
-
<canvas id="myChart2_1" width="960" height="
|
32
|
+
<canvas id="myChart2" width="960" height="350"></canvas>
|
33
|
+
<canvas id="myChart2_1" width="960" height="350" style="margin-top: 30px;"></canvas>
|
34
34
|
</div>
|
35
35
|
</div>
|
36
36
|
<script>
|
@@ -43,6 +43,14 @@
|
|
43
43
|
tooltips: {
|
44
44
|
enabled: false
|
45
45
|
},
|
46
|
+
layout: {
|
47
|
+
padding: {
|
48
|
+
left: 50,
|
49
|
+
right: 50,
|
50
|
+
top: 0,
|
51
|
+
bottom: 0
|
52
|
+
}
|
53
|
+
},
|
46
54
|
hover: {
|
47
55
|
animationDuration: 0
|
48
56
|
},
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ChangeDivideRateFollowUps < ActiveRecord::Migration[5.2]
|
2
|
+
def self.up
|
3
|
+
change_table :educode_sales_follow_ups do |t|
|
4
|
+
t.change :divide_rate, :float
|
5
|
+
end
|
6
|
+
add_column :educode_sales_follow_ups, :budget_amount, :float, comment: '预算金额'
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
change_table :educode_sales_follow_ups do |t|
|
11
|
+
t.change :divide_rate, :integer
|
12
|
+
end
|
13
|
+
remove_column :educode_sales_follow_ups, :budget_amount
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: educode_sales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -479,6 +479,7 @@ files:
|
|
479
479
|
- db/migrate/20220921131116_add_change_clazz_to_follow_up.rb
|
480
480
|
- db/migrate/20220923084102_create_table_to_busines_number_recoreds.rb
|
481
481
|
- db/migrate/20221025094655_delete_business_number.rb
|
482
|
+
- db/migrate/20221107122147_change_divide_rate_follow_ups.rb
|
482
483
|
- lib/educode_sales.rb
|
483
484
|
- lib/educode_sales/engine.rb
|
484
485
|
- lib/educode_sales/version.rb
|