educode_sales 0.9.57 → 0.9.58

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.
@@ -0,0 +1,71 @@
1
+ follow_up_ids = EducodeSales::AssignFollowUp.where(staff_id: @current_admin.id).pluck(:follow_up_id)
2
+ follow_count = 0
3
+ json.data do
4
+ json.array! @businesses do |d|
5
+ json.id d.id
6
+ json.number d.number
7
+ json.name d.name
8
+ json.department d.department&.name
9
+ json.school d.department&.school&.name
10
+ json.school_id d.department&.school_id
11
+ follow_ups_count = d['follow_ups_counts'] || 0
12
+ json.follow_ups_count follow_ups_count
13
+ follow_count += follow_ups_count
14
+ json.follow_up_id d.last_follow_up_id
15
+ json.clazz d.clazz&.name || ""
16
+ json.clazz_changed d.last_follow_up&.clazz_changed || false
17
+ json.stage d.last_follow_up&.stage&.name
18
+ json.invitation_at d.last_follow_up&.invitation_at.to_s
19
+ json.reception_at d.last_follow_up&.reception_at.to_s
20
+ json.bidded_date d.last_follow_up&.bidded_date.to_s
21
+ json.signed_date d.last_follow_up&.signed_date.to_s
22
+ json.o_business_deployment EducodeSales::FollowUp::BUSINESS_DEPLOYMENT[1..-1].to_h.invert[d.last_follow_up&.o_business_deployment]
23
+ json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
24
+ json.created_at d.created_at.to_s
25
+ json.no_followup_days (d['latest_time'] ? DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d['latest_time'].strftime("%Y-%m-%d")) : DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d.created_at.strftime("%Y-%m-%d"))).to_i
26
+
27
+ json.staff_manages d.last_follow_up&.assign_follow_ups.present? ? (d.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.staff&.user&.real_name
28
+ json.divide_rate d.divide_rate
29
+ json.divide_money d.divide_amount.to_f.round(2)
30
+ json.budget_amount d.budget_amount.to_f.round(2) #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
31
+ json.area d.department&.school&.province
32
+ # school_property = d.department.school.school_property
33
+ # property = []
34
+
35
+ # if school_property.present?
36
+ # property << '本科地方院校' if school_property.regular_college || school_property.project_985 || school_property.project_211
37
+ # property << '高职' if school_property.junior_college || school_property.secondary_school
38
+ # property << '本科军校' if school_property.military_school
39
+ # property << '企业' if school_property.enterprise
40
+ # end
41
+ if d.department&.school
42
+ json.property d.department.school.school_tags.where(for_missions: true).pluck(:name).join("、")
43
+ else
44
+ json.property ''
45
+ end
46
+ # json.property d.school.school_property.school_tags.where(for_missions: true).pluck(:name).join("、")#property.join("、")
47
+ json.sale_way d.last_follow_up&.place&.name.present? ? '渠道' : '直销'
48
+ json.year d.last_follow_up&.year.to_s
49
+ json.total_amount d.last_follow_up&.total_amount.to_f.round(2)
50
+ json.actual_amount d.last_follow_up&.actual_amount.to_f.round(2)
51
+ json.return_money d.return_money
52
+ json.wait_return_money d.wait_return_money.to_f.round(2)
53
+ 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 : ''
54
+ json.place d.last_follow_up&.place&.name
55
+ json.last_follow_person d.last_follow_up.present? ? d.last_follow_up.staff&.user&.real_name : d.staff&.user&.real_name
56
+ json.source d.source
57
+ json.assign_follow_ups d.last_follow_up.present? ? d.last_follow_up.assign_follow_ups.pluck(:staff_id) : []
58
+ json.current_staff_id @current_admin.id
59
+ json.staff_id d.staff_id
60
+ json.latest_time d.last_follow_up.present? ? d.last_follow_up.created_at.to_s : ''
61
+ json.self_flag (d.staff_id == @current_admin.id) || (d.last_follow_up_id.in? follow_up_ids)
62
+ 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
63
+ end
64
+ end
65
+
66
+ json.totalRow do
67
+ json.follow_ups_count follow_count.to_i.to_s
68
+ end
69
+ json.code 0
70
+ json.count @businesses.total_count
71
+ json.msg 'succcess'
@@ -2,9 +2,6 @@
2
2
  <ul class="layui-tab-title">
3
3
  <li class="layui-this follows_li">跟进动态</li>
4
4
  <li class="businesses_list_li" >商机列表</li>
5
- <% if can?(:contract_business, EducodeSales::Business) %>
6
- <li class="businesses_contract_li" >合同管理</li>
7
- <% end %>
8
5
  </ul>
9
6
  <div class="layui-tab-content">
10
7
  <div class="layui-tab-item follows_div layui-show">
@@ -139,11 +136,6 @@
139
136
  </div>
140
137
  </div>
141
138
  </div>
142
- <% if can?(:contract_business, EducodeSales::Business) %>
143
- <div class="layui-tab-item businesses_contract_div">
144
- <%=render 'contract' %>
145
- </div>
146
- <% end %>
147
139
  </div>
148
140
  </div>
149
141
  <script type="text/html" id="bussinessBar">
@@ -166,11 +158,18 @@
166
158
  <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right area-btn" lay-event="area">区域管理商机</button>
167
159
  <% end %>
168
160
  <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right all-btn" lay-event="all"> 全部商机</button>
169
- <% if can?(:delete_list, EducodeSales::Business) %>
170
- <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right delete-btn" lay-event="delete_list">删除的商机</button>
161
+ <% if can?(:audit_business, EducodeSales::Business) %>
162
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right delete-btn" lay-event="delete_list">审核商机</button>
171
163
  <% end %>
172
164
  </div>
173
165
  </script>
166
+ <script type="text/html" id="delete_bar">
167
+ {{# if (d.state_id == 1) { }}
168
+ <a class="layui-btn layui-btn-warm layui-btn-xs data-count-edit" lay-event="auth_delete">审核删除</a>
169
+ {{# } else { }}
170
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="auth_down">审核降级</a>
171
+ {{# }}}
172
+ </script>
174
173
  <script type="text/html" id="currentTableBar">
175
174
  <%unless !can?(:add_follow, EducodeSales::Business) && can?(:self_add_follow, EducodeSales::Business) %>
176
175
  <% if can? :add_follow, EducodeSales::Business %>
@@ -206,9 +205,9 @@
206
205
  <% end %>
207
206
  <% if @more %>
208
207
  {{# if(d.followed==0){}}
209
- <a class="layui-btn-xs data-count-edit more-btn more-btn1" data-name={{d.name}} data-id={{d.id}}>更多<i class="layui-icon layui-icon-down layui-nav-more"></i></a>
208
+ <a class="layui-btn-xs data-count-edit more-btn more-btn1" data-name={{d.name}} data-id={{d.id}} data-clazz="{{d.extras_clazz}}">更多<i class="layui-icon layui-icon-down layui-nav-more"></i></a>
210
209
  {{# }else{}}
211
- <a class="layui-btn-xs data-count-edit more-btn more-btn2" data-name={{d.name}} data-id={{d.id}}>更多<i class="layui-icon layui-icon-down layui-nav-more"></i></a>
210
+ <a class="layui-btn-xs data-count-edit more-btn more-btn2" data-name={{d.name}} data-id={{d.id}} data-clazz="{{d.extras_clazz}}">更多<i class="layui-icon layui-icon-down layui-nav-more"></i></a>
212
211
  {{# }}}
213
212
  <% end %>
214
213
  </script>
@@ -612,6 +611,21 @@
612
611
  ]
613
612
  ]
614
613
 
614
+ var delete_business_cols = [cols_table[0].slice(0, -1).concat(
615
+ {
616
+ field: 'delete_reason',
617
+ width: 125,
618
+ title: '删除原因',
619
+ hide: gon.filter.delete_reason
620
+ },
621
+ ).concat({
622
+ title: '操作',
623
+ minWidth: 220,
624
+ toolbar: '#delete_bar',
625
+ align: "center",
626
+ fixed: 'right'
627
+ })]
628
+
615
629
  var business_table = table.render({
616
630
  elem: '#businesses_table',
617
631
  url: '/missions/businesses',
@@ -673,7 +687,7 @@
673
687
  time_line(id, elem.data('name'));
674
688
  break;
675
689
  case 'delete':
676
- deleteBusiness(id, elem.data('name'));
690
+ deleteBusiness(id, elem.data('name'), elem.data('clazz'));
677
691
  break;
678
692
  case 'following':
679
693
  following(id);
@@ -705,7 +719,7 @@
705
719
  time_line(id, elem.data('name'));
706
720
  break;
707
721
  case 'delete':
708
- deleteBusiness(id, elem.data('name'));
722
+ deleteBusiness(id, elem.data('name'), elem.data('clazz'));
709
723
  break;
710
724
  case 'following':
711
725
  following(id);
@@ -715,7 +729,7 @@
715
729
  });
716
730
  }
717
731
 
718
- export_drowpdwonRender = function() {
732
+ export_drowpdwonRender = function() {
719
733
  dropdown.render({
720
734
  elem: '.export_more-btn',
721
735
  data: export_dropmenu,
@@ -838,7 +852,7 @@
838
852
  data: {business_id:id},
839
853
  success: function (da) {
840
854
  layer.msg(da.msg,{icon: da.code==200? 1:2})
841
- table.reload("businesses_table")
855
+ table.reload("businesses_table", {cols: cols_table,})
842
856
  },
843
857
  error:function (da){
844
858
  alert('请求错误')
@@ -926,13 +940,27 @@
926
940
  });
927
941
  }
928
942
 
929
- function deleteBusiness(id, name) {
943
+ function deleteBusiness(id, name, clazz) {
944
+ if (['a_class', 'b_class'].includes(clazz)) {
945
+ layer.prompt({
946
+ formType: 2,
947
+ value: '',
948
+ title: '删除A、B类商机请输入删除'+ name + " 原因",
949
+ }, function(value, index, elem){
950
+ request.delete('missions/businesses/' + id, {content: value}, function (res) {
951
+ layer.close(index);
952
+ table.reload("businesses_table",{url: '/missions/businesses', cols: cols_table,})
953
+ })
954
+ });
955
+ } else {
930
956
  layer.confirm('确定删除' + name, function (index) {
931
- request.delete('missions/businesses/' + id, {}, function (res) {
932
- layer.close(index);
933
- table.reload("businesses_table",{url: '/missions/businesses'})
934
- })
935
- });
957
+ request.delete('missions/businesses/' + id, {}, function (res) {
958
+ layer.close(index);
959
+ table.reload("businesses_table",{url: '/missions/businesses', cols: cols_table,})
960
+ })
961
+ });
962
+ }
963
+
936
964
  }
937
965
 
938
966
 
@@ -944,14 +972,15 @@
944
972
  sort.field = obj.field;
945
973
  sort.order = obj.type;
946
974
  table.reload('businesses_table', {
947
- url: '/missions/businesses',
975
+ url: '/missions/businesses',
976
+ cols: cols_table,
948
977
  initSort: obj,
949
978
  where: {
950
979
  sort: sort,
951
980
  q: search
952
- }
953
- });
954
- })
981
+ }
982
+ });
983
+ })
955
984
 
956
985
  // 监听搜索操作
957
986
  form.on('submit(search_bussiness)', function (data) {
@@ -975,21 +1004,14 @@
975
1004
  }
976
1005
  search = data.field
977
1006
  table.reload('businesses_table', {
978
- url: '/missions/businesses',
979
- page: {
1007
+ url: '/missions/businesses',
1008
+ cols: search['clazz'] == 'delete_list' ? delete_business_cols : cols_table,
1009
+ page: {
980
1010
  curr: 1
981
- },
982
- where: {q: search, sort: sort}
983
- }, 'data');
984
- // table.reload('teachers_table', {
985
- // page: {
986
- // curr: 1
987
- // },
988
- // where: {q: search, sort: sort}
989
- // }, 'data');
990
- // form.val('search_follows', {
991
- // name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area
992
- // })
1011
+ },
1012
+ where: {q: search, sort: sort}
1013
+ }, 'data');
1014
+
993
1015
  if (search['clazz'] == 'me') {
994
1016
  $(".my-btn").addClass("selected-btn");
995
1017
  } else if (search['clazz'] == 'followes') {
@@ -1060,28 +1082,27 @@
1060
1082
  var content = miniPage.getHrefContent('/missions/businesses/new');
1061
1083
  var openWH = miniPage.getOpenWidthHeight();
1062
1084
  index = layer.open({
1063
- title: '添加商机',
1064
- type: 1,
1065
- shade: 0.2,
1066
- maxmin: true,
1067
- shadeClose: true,
1068
- area: [openWH[0] + 'px', openWH[1] + 'px'],
1069
- offset: [openWH[2] + 'px', openWH[3] + 'px'],
1070
- content: content,
1085
+ title: '添加商机',
1086
+ type: 1,
1087
+ shade: 0.2,
1088
+ maxmin: true,
1089
+ shadeClose: true,
1090
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
1091
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
1092
+ content: content,
1071
1093
  });
1072
1094
  $(window).on("resize", function () {
1073
- layer.full(index);
1095
+ layer.full(index);
1074
1096
  });
1075
1097
  } else if (obj.event === 'all') {
1076
1098
  search = {"all":"1"}
1077
1099
  table.reload('businesses_table', {
1078
- url: '/missions/businesses',
1079
- page: {
1080
- curr: 1
1081
- },
1082
- where: {q: search, sort: sort},
1083
- done: function(res, curr, count){
1084
- }
1100
+ url: '/missions/businesses',
1101
+ cols: cols_table,
1102
+ page: {
1103
+ curr: 1
1104
+ },
1105
+ where: {q: search, sort: sort}
1085
1106
  }, 'data');
1086
1107
  form.val('search_form', {
1087
1108
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
@@ -1093,13 +1114,14 @@
1093
1114
  search = {"all":"1", clazz: 'followes'}
1094
1115
  business_type_list.setValue([])
1095
1116
  table.reload('businesses_table', {
1096
- url: '/missions/businesses',
1097
- page: {
1098
- curr: 1
1099
- },
1100
- where: {q: search, sort: sort},
1101
- done: function(res, curr, count){
1102
- }
1117
+ url: '/missions/businesses',
1118
+ cols: cols_table,
1119
+ page: {
1120
+ curr: 1
1121
+ },
1122
+ where: {q: search, sort: sort},
1123
+ done: function(res, curr, count){
1124
+ }
1103
1125
  }, 'data');
1104
1126
  form.val('search_form', {
1105
1127
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
@@ -1113,16 +1135,15 @@
1113
1135
  business_type_list.setValue([])
1114
1136
  table.reload('businesses_table', {
1115
1137
  url: '/missions/businesses',
1138
+ cols: cols_table,
1116
1139
  page: {
1117
- curr: 1
1140
+ curr: 1
1118
1141
  },
1119
- where: {q: search, sort: sort},
1120
- done: function(res, curr, count){
1121
- }
1142
+ where: {q: search, sort: sort}
1122
1143
  }, 'data');
1123
1144
  form.val('search_form', {
1124
- name: '', department: '', staff_id: '', business_type: '', business_step: '',
1125
- place_id: '', date: '', area: ''
1145
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
1146
+ place_id: '', date: '', area: ''
1126
1147
  })
1127
1148
  $(".my-btn").addClass("selected-btn");
1128
1149
  return false;
@@ -1133,15 +1154,13 @@
1133
1154
  table.reload('businesses_table', {
1134
1155
  url: '/missions/businesses',
1135
1156
  page: {
1136
- curr: 1
1157
+ curr: 1
1137
1158
  },
1138
- where: {q: search, sort: sort},
1139
- done: function(res, curr, count){
1140
- }
1159
+ where: {q: search, sort: sort}
1141
1160
  }, 'data');
1142
1161
  form.val('search_form', {
1143
- name: '', department: '', staff_id: '', business_type: '', business_step: '',
1144
- place_id: '', date: '', area: ''
1162
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
1163
+ place_id: '', date: '', area: ''
1145
1164
  })
1146
1165
  $(".s-btn").addClass("selected-btn");
1147
1166
  return false;
@@ -1150,47 +1169,44 @@
1150
1169
  search = {"clazz": "area"}
1151
1170
  business_type_list.setValue([])
1152
1171
  table.reload('businesses_table', {
1153
- url: '/missions/businesses',
1154
- page: {
1155
- curr: 1
1156
- },
1157
- where: {q: search, sort: sort},
1158
- done: function(res, curr, count){
1159
- }
1172
+ url: '/missions/businesses',
1173
+ cols: cols_table,
1174
+ page: {
1175
+ curr: 1
1176
+ },
1177
+ where: {q: search, sort: sort}
1160
1178
  }, 'data');
1161
1179
  form.val('search_form', {
1162
- name: '', department: '', staff_id: '', business_type: '', business_step: '',
1163
- place_id: '', date: '', area: ''
1180
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
1181
+ place_id: '', date: '', area: ''
1164
1182
  })
1165
1183
  $(".area-btn").addClass("selected-btn");
1166
1184
  return false;
1167
1185
  }
1168
1186
  else if (obj.event === 'delete_list') {
1169
- $(".layui-table-col-special").hide();
1170
1187
  search = {"clazz": "delete_list"}
1171
1188
  business_type_list.setValue([])
1172
1189
  table.reload('businesses_table', {
1173
- url: '/missions/businesses',
1174
- page: {
1175
- curr: 1
1176
- },
1177
- where: {q: search, sort: sort}
1178
- ,done: function(res, curr, count){
1179
- $(".layui-table-col-special").hide();
1180
- }
1190
+ url: '/missions/businesses',
1191
+ cols: delete_business_cols,
1192
+ page: {
1193
+ curr: 1
1194
+ },
1195
+ where: {q: search, sort: sort}
1181
1196
  }, 'data');
1197
+
1182
1198
  form.val('search_form', {
1183
- name: '', department: '', staff_id: '', business_type: '', business_step: '',
1184
- place_id: '', date: '', area: ''
1199
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
1200
+ place_id: '', date: '', area: ''
1185
1201
  })
1186
1202
  $(".delete-btn").addClass("selected-btn");
1187
-
1203
+
1188
1204
  return false;
1189
- }
1205
+ }
1190
1206
  else if (obj.event === 'delete') {
1191
- var checkStatus = table.checkStatus('currentTableId'),
1192
- data = checkStatus.data;
1193
- layer.alert(JSON.stringify(data));
1207
+ var checkStatus = table.checkStatus('currentTableId'),
1208
+ data = checkStatus.data;
1209
+ layer.alert(JSON.stringify(data));
1194
1210
  }
1195
1211
  });
1196
1212
 
@@ -1238,7 +1254,7 @@
1238
1254
  layer.confirm('确定删除' + data.name, function (index) {
1239
1255
  request.delete('missions/businesses/' + data.id, {}, function (res) {
1240
1256
  layer.close(index);
1241
- table.reload("businesses_table",{url: '/missions/businesses',})
1257
+ table.reload("businesses_table",{url: '/missions/businesses', cols: cols_table})
1242
1258
  })
1243
1259
  });
1244
1260
  }else if (obj.event === 'add_follow') { // 监听添加操作
@@ -1255,7 +1271,7 @@
1255
1271
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
1256
1272
  content: content,
1257
1273
  success: function (layero, index) {
1258
- form.render('select');
1274
+ form.render('select');
1259
1275
  }
1260
1276
  });
1261
1277
  $(window).on("resize", function () {
@@ -1319,27 +1335,52 @@
1319
1335
  });
1320
1336
  } else if (obj.event === 'show_follow') {
1321
1337
  time_line(obj.data.id, obj.data.name);
1322
- // self_flag = data.self_flag
1323
- // business_id = obj.data.id
1324
- // business_name = data.name
1325
- // content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + id);
1326
- // openWH = miniPage.getOpenWidthHeight();
1327
- // index = layer.open({
1328
- // title: '商机列表/' + data.name + '的跟进记录',
1329
- // type: 1,
1330
- // shade: 0.2,
1331
- // maxmin: true,
1332
- // shadeClose: true,
1333
- // area: [openWH[0] + 'px', openWH[1] + 'px'],
1334
- // offset: [openWH[2] + 'px', openWH[3] + 'px'],
1335
- // content: content
1336
- // });
1337
- // $(window).on("resize", function () {
1338
- // layer.full(index);
1339
- // });
1340
1338
  } else if (obj.event == 'show_business') {
1341
1339
  time_line(obj.data.id, obj.data.name)
1340
+ } else if (obj.event == 'auth_delete') {
1341
+ layer.open({
1342
+ content: '审核删除商机' + obj.data.name
1343
+ ,btn: ['通过', '拒绝', '关闭']
1344
+ ,yes: function(index, layero){
1345
+ request.authPut('missions/businesses/' + obj.data.id + "/audit", {clazz: 'destroy', op: 'pass'}, function (res) {
1346
+ layer.close(index);
1347
+ table.reload("businesses_table",{url: '/missions/businesses', cols: delete_business_cols})
1348
+ })
1349
+ }
1350
+ ,btn2: function(index, layero){
1351
+ request.authPut('missions/businesses/' + obj.data.id + "/audit", {clazz: 'destroy', op: 'reject'}, function (res) {
1352
+ layer.close(index);
1353
+ table.reload("businesses_table",{url: '/missions/businesses', cols: delete_business_cols})
1354
+ })
1355
+ }
1356
+ ,btn3: function(index, layero){
1357
+ }
1358
+ ,cancel: function(){
1359
+ }
1360
+ });
1361
+ } else if (obj.event == 'auth_down') {
1362
+ layer.open({
1363
+ content: '审核降级商机' + obj.data.name
1364
+ ,btn: ['通过', '拒绝', '关闭']
1365
+ ,yes: function(index, layero){
1366
+ request.authPut('missions/businesses/' + obj.data.id + "/audit", {clazz: 'down', op: 'pass'}, function (res) {
1367
+ layer.close(index);
1368
+ table.reload("businesses_table",{url: '/missions/businesses', cols: delete_business_cols})
1369
+ })
1370
+ }
1371
+ ,btn2: function(index, layero){
1372
+ request.authPut('missions/businesses/' + obj.data.id + "/audit", {clazz: 'down', op: 'reject'}, function (res) {
1373
+ layer.close(index);
1374
+ table.reload("businesses_table",{url: '/missions/businesses', cols: delete_business_cols})
1375
+ })
1376
+ }
1377
+ ,btn3: function(index, layero){
1378
+ }
1379
+ ,cancel: function(){
1380
+ }
1381
+ });
1342
1382
  }
1383
+ drowpdwonRender()
1343
1384
  });
1344
1385
  });
1345
1386
  </script>
@@ -13,6 +13,7 @@ json.data do
13
13
  follow_count += follow_ups_count
14
14
  json.follow_up_id d.last_follow_up_id
15
15
  json.clazz d.clazz&.name || ""
16
+ json.extras_clazz d.clazz&.extras
16
17
  json.clazz_changed d.last_follow_up&.clazz_changed || false
17
18
  json.stage d.last_follow_up&.stage&.name
18
19
  json.invitation_at d.last_follow_up&.invitation_at.to_s
@@ -43,6 +44,8 @@ json.data do
43
44
  else
44
45
  json.property ''
45
46
  end
47
+ json.delete_reason d.delete_reason
48
+ json.state_id d.state_id
46
49
  # json.property d.school.school_property.school_tags.where(for_missions: true).pluck(:name).join("、")#property.join("、")
47
50
  json.sale_way d.last_follow_up&.place&.name.present? ? '渠道' : '直销'
48
51
  json.year d.last_follow_up&.year.to_s
@@ -43,6 +43,20 @@
43
43
  field: 'name',
44
44
  title: '名称'
45
45
  },
46
+ {
47
+ field: 'follow_up_content',
48
+ width: 180,
49
+ title: '跟进信息'
50
+ },
51
+ {
52
+ field: 'staff_manages',
53
+ width: 150,
54
+ title: '销售经理'
55
+ },
56
+ {
57
+ field: 'clazz',
58
+ title: '商机类型'
59
+ },
46
60
  {
47
61
  field: 'school',
48
62
  title: '单位'
@@ -71,6 +85,10 @@
71
85
  sort: true,
72
86
 
73
87
  },
88
+ {
89
+ field: 'delete_reason',
90
+ title: '删除原因'
91
+ },
74
92
  {
75
93
  title: '操作',
76
94
  width: 120,
@@ -3,6 +3,10 @@ json.data do
3
3
  business = EducodeSales::Business.unscoped.find(d.source_id)
4
4
  json.id d.id
5
5
  json.name business.name
6
+ json.clazz business.clazz&.name
7
+ json.staff_manages business.last_follow_up_id.present? && EducodeSales::FollowUp.unscoped.find(business.last_follow_up_id).assign_follow_ups.present? ? (EducodeSales::FollowUp.unscoped.find(business.last_follow_up_id).assign_follow_ups.map{ |s| s.staff.user.real_name}.join("、")) : business.staff&.user&.real_name
8
+ json.follow_up_content business.last_follow_up_id.present? ? EducodeSales::FollowUp.unscoped.find_by(id: business.last_follow_up_id)&.description : ""
9
+ json.delete_reason business.delete_reason
6
10
  json.school business.department.school.name
7
11
  json.department business.department.name
8
12
  json.last_follow_person business.last_follow_up_id.present? ? EducodeSales::FollowUp.unscoped.find(business.last_follow_up_id).staff.user.real_name : EducodeSales::Staff.find(business.staff_id).user.real_name
@@ -37,6 +37,12 @@
37
37
  <input type="text" name="description" class="layui-input">
38
38
  </div>
39
39
  </div>
40
+ <div class="layui-inline">
41
+ <label class="layui-form-label">态度</label>
42
+ <div class="layui-input-inline">
43
+ <%= select_tag "attitude_id",options_for_select(EducodeSales::Common.where(clazz: "teacher_attitude").pluck(:name, :id)), {include_blank: true }%>
44
+ </div>
45
+ </div>
40
46
 
41
47
  <div class="layui-inline">
42
48
  <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_follows_search">重置
@@ -154,7 +160,7 @@
154
160
  title: '团队建议',
155
161
  templet:'<div><span title="{{d.advise}}">{{d.advise}}</span></div>'
156
162
  },
157
-
163
+
158
164
  {
159
165
  title: '操作',
160
166
  width: 80,
@@ -191,7 +197,7 @@
191
197
  },
192
198
  where: {q: search, sort: sort}
193
199
  }, 'data');
194
-
200
+
195
201
  return false;
196
202
  });
197
203
 
@@ -62,6 +62,12 @@
62
62
  <%= select_tag "assist", options_for_select(@staffs, params[:assist]), { 'lay-filter': 'assist', include_blank: true } %>
63
63
  </div>
64
64
  </div>
65
+ <div class="layui-inline show_item" style="display:none;">
66
+ <label class="layui-form-label">电话</label>
67
+ <div class="layui-input-inline">
68
+ <input type="text" class="layui-input" id="mobile" placeholder="请输入电话" autocomplete="off" name="mobile">
69
+ </div>
70
+ </div>
65
71
 
66
72
  <div class="layui-inline">
67
73
  <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
@@ -63,6 +63,10 @@
63
63
  <dd><a href="/missions/businesses" class="<%= current?('layui-this', businesses_path) %>"><i style="padding-right: 35px"></i><%= image_tag "educode_sales/4.商机管理.png",size:"15"%><i style="font-size: 25px; padding-right: 15px"></i>商机管理</a>
64
64
  </dd>
65
65
  <% end %>
66
+ <% if can? :contract_business, EducodeSales::Business %>
67
+ <dd><a href="/missions/businesses/contract" class="<%= current?('layui-this', contract_businesses_path) %>"><i style="padding-right: 35px"></i><%= image_tag "educode_sales/4.商机管理.png",size:"15"%><i style="font-size: 25px; padding-right: 15px"></i>合同管理</a>
68
+ </dd>
69
+ <% end %>
66
70
  <% if can? :read, EducodeSales::MoneyPlan %>
67
71
  <dd><a href="/missions/money_plans" class="<%= current?('layui-this', money_plans_path) %>"><i style="padding-right: 35px"></i><%= image_tag "educode_sales/money_plans.png",size:"15"%><i style="font-size: 25px; padding-right: 15px"></i>回款计划</a>
68
72
  </dd>