educode_sales 0.7.1 → 0.7.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales/indexlogo.png +0 -0
  3. data/app/controllers/educode_sales/businesses_controller.rb +17 -2
  4. data/app/controllers/educode_sales/follow_ups_controller.rb +14 -2
  5. data/app/controllers/educode_sales/results_controller.rb +54 -0
  6. data/app/controllers/educode_sales/sale_trends_controller.rb +116 -116
  7. data/app/helpers/educode_sales/follow_up_helper.rb +7 -0
  8. data/app/models/educode_sales/money_plan.rb +3 -3
  9. data/app/models/educode_sales/result.rb +4 -0
  10. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +150 -114
  11. data/app/views/educode_sales/businesses/edit_plan.html.erb +4 -4
  12. data/app/views/educode_sales/businesses/export_records.json.jbuilder +1 -2
  13. data/app/views/educode_sales/businesses/get_export_data.json.jbuilder +2 -1
  14. data/app/views/educode_sales/businesses/index.html.erb +131 -109
  15. data/app/views/educode_sales/businesses/index.json.jbuilder +3 -2
  16. data/app/views/educode_sales/businesses/new_follow_record.html.erb +156 -119
  17. data/app/views/educode_sales/businesses/show_follow.html.erb +30 -24
  18. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  19. data/app/views/educode_sales/businesses/show_follow_record.html.erb +8 -1
  20. data/app/views/educode_sales/customers/show_follow.html.erb +1 -1
  21. data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -1
  22. data/app/views/educode_sales/follow_ups/money_plans.json.jbuilder +2 -4
  23. data/app/views/educode_sales/money_plans/index.html.erb +1 -1
  24. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +8 -3
  25. data/app/views/educode_sales/operation_plans/_monthly.html.erb +2 -2
  26. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +2 -2
  27. data/app/views/educode_sales/operation_plans/_weekly.html.erb +2 -2
  28. data/app/views/educode_sales/plans/_monthPlan.html.erb +8 -3
  29. data/app/views/educode_sales/plans/_monthly.html.erb +2 -2
  30. data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -2
  31. data/app/views/educode_sales/plans/_weekly.html.erb +2 -2
  32. data/app/views/educode_sales/results/edit.html.erb +111 -0
  33. data/app/views/educode_sales/results/index.html.erb +0 -0
  34. data/app/views/educode_sales/results/index.json.jbuilder +13 -0
  35. data/app/views/educode_sales/results/new.html.erb +58 -0
  36. data/app/views/educode_sales/results/show.json.jbuilder +9 -0
  37. data/app/views/educode_sales/sale_reports/audit.html.erb +2 -0
  38. data/app/views/educode_sales/sale_reports/edit.html.erb +2 -0
  39. data/app/views/educode_sales/sale_reports/show.html.erb +2 -0
  40. data/app/views/educode_sales/sales/index.html.erb +7 -7
  41. data/app/views/educode_sales/teachers/show_follow.html.erb +1 -1
  42. data/app/views/layouts/educode_sales/application.html.erb +9 -3
  43. data/config/routes.rb +7 -1
  44. data/db/migrate/20220314053856_add_service_start_time_to_follow_ups.rb +6 -0
  45. data/db/migrate/20220314074354_add_service_time_long_to_follow_ups.rb +5 -0
  46. data/lib/educode_sales/version.rb +1 -1
  47. metadata +17 -6
@@ -57,6 +57,12 @@
57
57
  <%= select_tag "area", options_for_select(EducodeSales::Common.where(clazz: 'area').pluck(:name, :id)), { include_blank: true } %>
58
58
  </div>
59
59
  </div>
60
+ <div class="layui-inline show_item" style="display:none;">
61
+ <label class="layui-form-label">所属年度</label>
62
+ <div class="layui-input-inline">
63
+ <%= select_tag "business_year", options_for_select((2015..Time.now.year).to_a.reverse, params[:business_year]), { include_blank: true } %>
64
+ </div>
65
+ </div>
60
66
  <div class="layui-inline show_item" style="display:none;">
61
67
  <label class="layui-form-label">创建时间</label>
62
68
  <div class="layui-input-inline">
@@ -89,7 +95,7 @@
89
95
  <div class="layui-btn-container">
90
96
  <span class="table-label">商机列表</span>
91
97
  <% if can?(:export_business, EducodeSales::Business) %>
92
- <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm data-count-edit export_more-btn pull-right" style="color: #0000FF;" data-name="export" data-id="export">导出<i class="layui-icon layui-icon-down layui-nav-more"></i></button>
98
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm data-count-edit export_more-btn pull-right" style="color: #0000FF;" data-name="export" data-id="export">导出<i class="layui-icon layui-icon-down layui-nav-more" style="font-size: 12px"></i></button>
93
99
  <% end %>
94
100
  <% if can? :create, EducodeSales::Business %>
95
101
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加商机</button>
@@ -142,35 +148,45 @@
142
148
  <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
143
149
  </script>
144
150
  <script type="text/html" id="school_name">
145
- <a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school }}</a>
151
+ <a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school
152
+ }}</a>
146
153
  </script>
147
154
 
148
155
 
149
156
  <script>
150
157
  layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate', 'dropdown'], function () {
151
- var $ = layui.jquery,
152
- form = layui.form,
153
- request = layui.request,
154
- miniPage = layui.miniPage,
155
- dropdown = layui.dropdown,
156
- laydate = layui.laydate;
157
-
158
- laydate.render({
159
- elem: '#date',
160
- range: true
161
- });
162
- laydate.render({
163
- elem: '#invitation_at',
164
- range: true
165
- });
158
+ var $ = layui.jquery,
159
+ form = layui.form,
160
+ request = layui.request,
161
+ miniPage = layui.miniPage,
162
+ dropdown = layui.dropdown,
163
+ laydate = layui.laydate;
164
+
165
+ laydate.render({
166
+ elem: '#date',
167
+ range: true
168
+ });
169
+ laydate.render({
170
+ elem: '#invitation_at',
171
+ range: true
172
+ });
166
173
 
167
- var is_show = <%=params[:name].present? || params[:clazz_id].present? || params[:place_id].present? || params[:school].present? %>
168
- if(is_show){
169
- $('.follows_li').removeClass('layui-this');
170
- $('.follows_div').removeClass('layui-show');
171
- $('.businesses_list_li').addClass('layui-this');
172
- $('.businesses_list_div').addClass('layui-show');
173
- }
174
+ // function hn() {
175
+ // $("#search_bt").trigger("click");
176
+ // }
177
+ //
178
+ // $(document).ready(function () {
179
+ // window.onload = hn;
180
+ // });
181
+
182
+ var is_show =
183
+ <%=params[:name].present? || params[:clazz_id].present? || params[:place_id].present? || params[:school].present? %>
184
+ if (is_show) {
185
+ $('.follows_li').removeClass('layui-this');
186
+ $('.follows_div').removeClass('layui-show');
187
+ $('.businesses_list_li').addClass('layui-this');
188
+ $('.businesses_list_div').addClass('layui-show');
189
+ }
174
190
 
175
191
  var business_type_list = xmSelect.render({
176
192
  el: '#business_type',
@@ -224,62 +240,68 @@
224
240
  })
225
241
  }
226
242
  })
227
- index_place_list.setValue(gon.place)
228
-
229
-
230
- table = layui.table;
231
- var business_table = table.render({
232
- elem: '#businesses_table',
233
- url: '/missions/businesses',
234
- where: {q: form.val('search_form')},
235
- defaultToolbar: ['filter'],
236
- toolbar: '#bussinessBar',
237
- title: '商机数据表',
238
- totalRow: true,//开启合并行
239
- cols: [
240
- [
241
- {
242
- field: 'id',
243
- width: 60,
244
- title:'序号',type: 'numbers',
245
- totalRowText: '合计',
246
- },
247
- {
248
- field: 'name',
249
- width: 170,
250
- title: '名称',
251
- templet:'<div><span title="{{d.name}}">{{d.name}}</span></div>'
252
- },
253
- {
254
- field: 'school',
255
- width: 150,
256
- title: '单位',
257
- templet:'#school_name'
258
- },
259
- {
260
- field: 'department',
261
- width: 150,
262
- title: '部门',
263
- templet:'<div><span title="{{d.department}}">{{d.department}}</span></div>'
264
- },
265
- {
266
- field: 'follow_ups_count',
267
- title: '跟进',
268
- width: 60,
269
- templet: '#show_follow',
270
- totalRow: true,
271
- },
272
- // {
273
- // field: 'teachers_count',
274
- // width: 100,
275
- // title: '关键人',
276
- // templet: '#show_keys'
277
- // },
278
- {
279
- field: 'clazz',
280
- width: 80,
281
- title: '类型',
282
- templet:'<div><span title="{{d.clazz}}">{{d.clazz}}</span></div>'
243
+ index_place_list.setValue(gon.place)
244
+
245
+
246
+ var data = form.val("search_form");
247
+ data.business_type = <%=params[:clazz_id] %>
248
+ console.log(data);
249
+
250
+ table = layui.table;
251
+ var business_table = table.render({
252
+ elem: '#businesses_table',
253
+ url: '/missions/businesses',
254
+ where: {q: data},
255
+ defaultToolbar: ['filter'],
256
+ toolbar: '#bussinessBar',
257
+ title: '商机数据表',
258
+ totalRow: true,//开启合并行
259
+ cols: [
260
+ [
261
+ {
262
+ field: 'id',
263
+ width: 60,
264
+ title: '序号', type: 'numbers',
265
+ totalRowText: '合计',
266
+ fixed: "left"
267
+ },
268
+ {
269
+ field: 'name',
270
+ width: 170,
271
+ title: '商机名称',
272
+ templet: '<div><span title="{{d.name}}">{{d.name}}</span></div>',
273
+ fixed: 'left'
274
+ },
275
+ {
276
+ field: 'school',
277
+ width: 150,
278
+ title: '单位',
279
+ templet: '#school_name'
280
+ },
281
+ {
282
+ field: 'department',
283
+ width: 150,
284
+ title: '部门',
285
+ templet: '<div><span title="{{d.department}}">{{d.department}}</span></div>'
286
+ },
287
+ {
288
+ field: 'follow_ups_count',
289
+ title: '跟进',
290
+ width: 60,
291
+ templet: '#show_follow',
292
+ totalRow: true,
293
+ },
294
+ // {
295
+ // field: 'teachers_count',
296
+ // width: 100,
297
+ // title: '关键人',
298
+ // templet: '#show_keys'
299
+ // },
300
+ {
301
+ field: 'clazz',
302
+ width: 80,
303
+ title: '类型',
304
+ templet: '<div><span title="{{d.clazz}}">{{d.clazz}}</span></div>'
283
305
  },
284
306
  {
285
307
  field: 'stage',
@@ -316,26 +338,32 @@
316
338
  },
317
339
  {
318
340
  field: 'signed_date',
319
- width: 105,
320
- title: '签单时间',
341
+ width: 105,
342
+ title: '签单时间',
321
343
  sort: true
322
344
  },
323
- {
324
- field: 'reception_at',
325
- width: 105,
326
- title: '验收时间',
327
- sort: true
328
- },
329
- {
330
- field: 'total_amount',
331
- width: 100,
332
- title: '总额',
333
- totalRow: true,
334
- sort: true
335
- },
336
- {
337
- field: 'actual_amount',
338
- width: 100,
345
+ {
346
+ field: 'reception_at',
347
+ width: 105,
348
+ title: '验收时间',
349
+ sort: true
350
+ },
351
+ {
352
+ field: 'service_end_time',
353
+ width: 200,
354
+ title: '服务期',
355
+ sort: true
356
+ },
357
+ {
358
+ field: 'total_amount',
359
+ width: 100,
360
+ title: '总额',
361
+ totalRow: true,
362
+ sort: true
363
+ },
364
+ {
365
+ field: 'actual_amount',
366
+ width: 100,
339
367
  title: '合同额',
340
368
  totalRow: true,
341
369
  sort: true
@@ -639,12 +667,6 @@
639
667
  });
640
668
  }
641
669
 
642
- function hn(){
643
- $("#search_bt").trigger("click");
644
- }
645
- $(document).ready(function(){
646
- window.onload=hn;
647
- });
648
670
 
649
671
 
650
672
  var sort = {}, search = {};
@@ -699,11 +721,11 @@
699
721
  return false;
700
722
  });
701
723
  form.on('submit(reset_business_search)', function (data) {
702
- var field = data.field;
703
- form.val('search_form', {
704
- name: '', department: '', staff_id: '', business_type: '', business_step: '',
705
- place_id: '', date: '', area: '', invitation_at: ''
706
- })
724
+ var field = data.field;
725
+ form.val('search_form', {
726
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
727
+ place_id: '', date: '', area: '', invitation_at: '', business_year: ''
728
+ })
707
729
  business_type_list.setValue([])
708
730
  business_step_list.setValue([])
709
731
  index_place_list.setValue([])
@@ -17,12 +17,13 @@ json.data do
17
17
  json.reception_at d.last_follow_up&.reception_at.to_s
18
18
  json.bidded_date d.last_follow_up&.bidded_date.to_s
19
19
  json.signed_date d.last_follow_up&.signed_date.to_s
20
+ json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
20
21
  json.year d.last_follow_up&.year.to_s
21
22
  json.total_amount d.last_follow_up&.total_amount
22
23
  json.actual_amount d.last_follow_up&.actual_amount
23
24
  json.return_money d.return_money
24
- json.wait_return_money d.wait_return_money.to_i.round(2)
25
- json.return_money_days d.last_follow_up&.reception_at.present? && d.last_follow_up.money_plans.where(clazz: '已完成').present? ? (d.last_follow_up.money_plans.where(clazz: '已完成').order(created_at: :asc).first.date_at.to_s(:date).to_date - d.last_follow_up&.reception_at).to_i : ''
25
+ json.wait_return_money d.wait_return_money.to_f.round(2)
26
+ json.return_money_days d.last_follow_up&.reception_at.present? && d.last_follow_up.money_plans.where(clazz: '实际回款').present? ? (d.last_follow_up.money_plans.where(clazz: '实际回款').order(created_at: :asc).first.date_at.to_s(:date).to_date - d.last_follow_up&.reception_at).to_i : ''
26
27
  json.place d.last_follow_up&.place&.name
27
28
  json.last_follow_person d.last_follow_up.present? ? d.last_follow_up.staff.user.real_name : EducodeSales::Staff.find(d.staff_id).user.real_name
28
29
  json.source d.source
@@ -19,11 +19,11 @@
19
19
  <label class="layui-form-label required">项目类型</label>
20
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_name,EducodeSales::Common.find_by(name: @o_name).id]]),:disabled => true, class: 'required' %>
22
+ <%= select_tag "clazz_id", options_for_select([[@o_name, EducodeSales::Common.find_by(name: @o_name).id]]), { 'lay-filter': 'clazz_id', class: 'required', :disabled => true } %>
23
23
  </div>
24
24
  <%else %>
25
25
  <div class="layui-input-inline">
26
- <%= select_tag "clazz_id", options_for_select(@clazz, @last_follow_up&.clazz_id), class: 'required' %>
26
+ <%= select_tag "clazz_id", options_for_select(@clazz, @last_follow_up&.clazz_id), { 'lay-filter': 'clazz_id', class: 'required', } %>
27
27
  </div>
28
28
  <%end %>
29
29
  </div>
@@ -64,23 +64,31 @@
64
64
  <div class="layui-input-inline">
65
65
  <input type="text" class="layui-input" name="reception_at" autocomplete="off" id="reception_at_add"
66
66
  value="<%= @last_follow_up&.reception_at%>"
67
- placeholder="请选择日期">
67
+ placeholder="请选择日期">
68
68
  </div>
69
69
  </div>
70
70
  <br>
71
+ <div class="layui-inline service_show layui-hide">
72
+ <label class="layui-form-label required">服务期</label>
73
+ <div class="layui-input-inline">
74
+ <input type="text" class="layui-input required" id="service_time" name="service_time" placeholder=" - " autocomplete="off">
75
+ </div>
76
+ </div>
77
+ <br class="service_show layui-hide">
71
78
  <div class="layui-inline">
72
79
  <label class="layui-form-label">总额(万)</label>
73
80
  <div class="layui-input-inline">
74
81
  <input name="total_amount" type="number" class="layui-input" autocomplete="off"
75
- value="<%= @last_follow_up&.total_amount%>">
82
+ value="<%= @last_follow_up&.total_amount %>">
76
83
  </div>
77
- 客户采购支出的费用。总额的生命历程:1.在最初阶段,是商机的预算总额;2.在挂网阶段,是项目的挂网预算总额;3.在中标阶段,是项目的中标总额。 </div>
84
+ 客户采购支出的费用。总额的生命历程:1.在最初阶段,是商机的预算总额;2.在挂网阶段,是项目的挂网预算总额;3.在中标阶段,是项目的中标总额。
85
+ </div>
78
86
  <br>
79
87
  <div class="layui-inline">
80
88
  <label class="layui-form-label">合同额(万)</label>
81
89
  <div class="layui-input-inline">
82
90
  <input name="actual_amount" type="number" class="layui-input" autocomplete="off" placeholder="本单位的签单金额"
83
- value="<%= @last_follow_up&.actual_amount%>">
91
+ value="<%= @last_follow_up&.actual_amount %>">
84
92
  </div>
85
93
  客户签给头歌的费用。合同额的生命历程:1.在中标之前,合同额都是0;2.在中标之后,实际与头歌签合同的金额。
86
94
  </div>
@@ -150,132 +158,161 @@
150
158
  </div>
151
159
 
152
160
  <script>
153
- layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'laydate', 'xmSelect'], function () {
154
- var form = layui.form,
155
- layer = layui.layer,
156
- table = layui.table,
157
- laytpl = layui.laytpl,
158
- request = layui.request,
159
- laydate = layui.laydate,
160
- xmSelect = layui.xmSelect,
161
- $ = layui.$;
161
+ layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'laydate', 'xmSelect'], function () {
162
+ var form = layui.form,
163
+ layer = layui.layer,
164
+ table = layui.table,
165
+ laytpl = layui.laytpl,
166
+ request = layui.request,
167
+ laydate = layui.laydate,
168
+ xmSelect = layui.xmSelect,
169
+ $ = layui.$;
162
170
 
163
- laydate.render({
164
- elem: '#year',
165
- type: 'year'
166
- })
167
- laydate.render({
168
- elem: '#invitation_at_add'
169
- })
171
+ flag =
172
+ <%=@last_follow_up&.clazz&.name == @o_name %>
173
+ if (flag) {
174
+ $(".service_show").removeClass('layui-hide')
175
+ }
170
176
 
171
- laydate.render({
172
- elem: '#reception_at_add'
173
- });
174
- var sales_list = xmSelect.render({
175
- el: '#assign_follow',
176
- remoteSearch: true,
177
- clickClose: true,
178
- delay: 1000,
179
- paging: true,
180
- pageRemote: true,
181
- filterable: true,
182
- remoteMethod: function (val, cb, show, pageIndex) {
183
- $.ajax( '/missions/sales_staff', {
184
- method: 'get',
185
- data: {
186
- q: val,
187
- page: pageIndex
188
- },
189
- dataType: 'json',
190
- success: function (res) {
191
- var data = res.data;
192
- if (res.code == 0) {
193
- cb(res.data, res.count);
194
- } else {
195
- layer.msg(res.msg, {time: 2000, icon: 2, shade: 0.01});
196
- }
177
+ form.on('select(clazz_id)', function (data) {
178
+ console.log(data.value)
179
+ const value = data.value;
180
+ if (value == <%= EducodeSales::Common.where(extras: EducodeSales::Common::OTYPE).first&.id %>) {
181
+ $(".service_show").removeClass('layui-hide')
182
+ } else {
183
+ console.log(data.value)
184
+ $(".service_show").addClass('layui-hide')
185
+ }
186
+ })
187
+
188
+ laydate.render({
189
+ elem: '#service_time',
190
+ range: true
191
+ });
192
+
193
+ laydate.render({
194
+ elem: '#year',
195
+ type: 'year'
196
+ })
197
+ laydate.render({
198
+ elem: '#invitation_at_add'
199
+ })
197
200
 
201
+ laydate.render({
202
+ elem: '#reception_at_add'
203
+ });
204
+ var sales_list = xmSelect.render({
205
+ el: '#assign_follow',
206
+ remoteSearch: true,
207
+ clickClose: true,
208
+ delay: 1000,
209
+ paging: true,
210
+ pageRemote: true,
211
+ filterable: true,
212
+ remoteMethod: function (val, cb, show, pageIndex) {
213
+ $.ajax('/missions/sales_staff', {
214
+ method: 'get',
215
+ data: {
216
+ q: val,
217
+ page: pageIndex
218
+ },
219
+ dataType: 'json',
220
+ success: function (res) {
221
+ var data = res.data;
222
+ if (res.code == 0) {
223
+ cb(res.data, res.count);
224
+ } else {
225
+ layer.msg(res.msg, {time: 2000, icon: 2, shade: 0.01});
226
+ }
227
+
228
+ }
229
+ })
198
230
  }
199
- })
200
- }
201
- })
202
- var place_list = xmSelect.render({
203
- el: '#place',
204
- remoteSearch: true,
205
- model: {
206
- icon: 'hidden',
207
- label: {
208
- type: 'text',
209
- text: {
210
- //左边拼接的字符
211
- left: '',
212
- //右边拼接的字符
213
- right: '',
214
- //中间的分隔符
215
- separator: ', ',
216
- },
217
- }
218
- },
219
- clickClose: true,
220
- delay: 1000,
221
- paging: true,
222
- radio: true,
223
- pageRemote: true,
224
- filterable: true,
225
- remoteMethod: function (val, cb, show, pageIndex) {
226
- $.ajax( '/missions/sales_place', {
227
- method: 'get',
228
- data: {
229
- q: val,
230
- page: pageIndex
231
- },
232
- dataType: 'json',
233
- success: function (res) {
234
- var data = res.data;
235
- if (res.code == 0) {
236
- cb(res.data, res.count);
237
- } else {
238
- layer.msg(res.msg, {time: 2000, icon: 2, shade: 0.01});
231
+ })
232
+ var place_list = xmSelect.render({
233
+ el: '#place',
234
+ remoteSearch: true,
235
+ model: {
236
+ icon: 'hidden',
237
+ label: {
238
+ type: 'text',
239
+ text: {
240
+ //左边拼接的字符
241
+ left: '',
242
+ //右边拼接的字符
243
+ right: '',
244
+ //中间的分隔符
245
+ separator: ', ',
246
+ },
239
247
  }
248
+ },
249
+ clickClose: true,
250
+ delay: 1000,
251
+ paging: true,
252
+ radio: true,
253
+ pageRemote: true,
254
+ filterable: true,
255
+ remoteMethod: function (val, cb, show, pageIndex) {
256
+ $.ajax('/missions/sales_place', {
257
+ method: 'get',
258
+ data: {
259
+ q: val,
260
+ page: pageIndex
261
+ },
262
+ dataType: 'json',
263
+ success: function (res) {
264
+ var data = res.data;
265
+ if (res.code == 0) {
266
+ cb(res.data, res.count);
267
+ } else {
268
+ layer.msg(res.msg, {time: 2000, icon: 2, shade: 0.01});
269
+ }
240
270
 
271
+ }
272
+ })
241
273
  }
242
- })
243
- }
244
- })
274
+ })
245
275
 
246
- sales_list.setValue(gon.sales);
247
- place_list.setValue(gon.place);
248
- form.render();
276
+ sales_list.setValue(gon.sales);
277
+ place_list.setValue(gon.place);
278
+ form.render();
249
279
 
250
- form.on('submit(add_follow_up)', function (data) {
251
- $(".submit-btn").addClass("layui-hide");
252
- var assign_follow = [];
253
- sales_list.getValue().forEach(function(d) {
254
- assign_follow.push(d.value);
255
- })
256
- data.field.assign_follow_up = assign_follow;
257
- data.field.business_id = "<%= @business.id %>";
258
- data.field.place_id = place_list.getValue('valueStr');
259
- request.authPost("missions/follow_ups", data.field, function (res) {
260
- if (res.success == false) {
261
- layer.alert(res.msg)
262
- } else {
263
- layer.close(parent.sale_plan_index);
264
- parent.layer.close(parent.layer.getFrameIndex(window.name))
265
- parent.table.reload('sale_plan_follow_table')
266
- parent.table.reload('businesses_table')
267
- parent.table.reload('teachers_table')
268
- }
269
- })
280
+ form.on('submit(add_follow_up)', function (data) {
281
+ if (data.field.clazz_id == <%= EducodeSales::Common.where(extras: EducodeSales::Common::OTYPE).first&.id %>) {
282
+ if (data.field.service_time.length == 0) {
283
+ layer.msg('请选择服务期', {time: 2000, icon: 2, shade: 0.01});
284
+ return false;
285
+ }
286
+ }
287
+ $(".submit-btn").addClass("layui-hide");
288
+ var assign_follow = [];
289
+ sales_list.getValue().forEach(function (d) {
290
+ assign_follow.push(d.value);
291
+ })
292
+ data.field.assign_follow_up = assign_follow;
293
+ data.field.business_id = "<%= @business.id %>";
294
+ data.field.place_id = place_list.getValue('valueStr');
295
+ request.authPost("missions/follow_ups", data.field, function (res) {
296
+ if (res.success == false) {
297
+ layer.alert(res.msg)
298
+ } else {
299
+ layer.close(parent.sale_plan_index);
300
+ parent.layer.close(parent.layer.getFrameIndex(window.name))
301
+ parent.table.reload('sale_plan_follow_table')
302
+ parent.table.reload('businesses_table')
303
+ parent.table.reload('teachers_table')
304
+ }
305
+ })
270
306
 
271
307
 
272
- return false;
273
- });
308
+ return false;
309
+ });
274
310
 
275
- });
311
+ });
276
312
  </script>
277
313
  <style>
278
- .new_place_select xm-select > .xm-body{
279
- width: 300px; !important;
314
+ .new_place_select xm-select > .xm-body {
315
+ width: 300px;
316
+ !important;
280
317
  }
281
318
  </style>