company_contact.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. @extends('jkq.module.layouts.company')
  2. @push('meta')
  3. @endpush
  4. @push('css')
  5. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/common.css') }}"/>
  6. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_user.css')}}"/>
  7. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_ajax_dialog.css')}}"/>
  8. @endpush
  9. @section('content')
  10. <div class="user_main">
  11. <div class="mleft">
  12. @include('jkq.module.section.company_left')
  13. </div>
  14. <div class="mright">
  15. <div class="user_pagetitle pms_user_pagetitle" style="position: relative;">
  16. <div class="pat_l">联系信息</div>
  17. <div class="clear"></div>
  18. <div class="btnbox" style="position: absolute;right:0px;top:0px">
  19. <div class="btn_yellow J_hoverbut btn_add J_contact_add" style="margin-right:0px;">
  20. 添加联系人
  21. </div>
  22. </div>
  23. </div>
  24. <div class="user_tab">
  25. <a href="{{ route('jkq.com.contact') }}" class="tabli select">联系信息</a>
  26. <div class="clear"></div>
  27. </div>
  28. <div class="pms_wrap J_allListBox">
  29. @if($contacts->isNotEmpty())
  30. <div class="pms_th">
  31. <div class="th1" style="width: 140px;">联系人</div>
  32. <div class="th1" style="width: 120px;padding-left: 10px;">联系电话</div>
  33. <div class="th1" style="width: 200px;">邮箱</div>
  34. <div class="th4" style="width: 160px;text-align: center">操作</div>
  35. <div class="clear"></div>
  36. </div>
  37. @foreach($contacts as $k=>$v)
  38. <div class="pms J_hoverbut contact" contact_id="{{$v->id}}">
  39. <div class="td1 substring nowrap link_blue" style="padding-right: 0px;width: 160px;">
  40. <input class="J_allList chk" type="checkbox" name="id[]" value="{{$v->id}}">
  41. {{$v->contact}}
  42. </div>
  43. <div class="td2 substring" style="width: 160px;">
  44. @if($v->telephone)
  45. {{$v->telephone}}
  46. @else
  47. {{dealContactPhone($v->landline_tel)}}
  48. @endif
  49. </div>
  50. <div class="td2 substring" style="width: 230px;">{{$v->email}}</div>
  51. <div class="td2 link_blue" style="width: 160px;text-align: center;">
  52. <a href="javascript:;" class="J_contact_check">查看</a>&nbsp;&nbsp;
  53. <a href="javascript:;" class="J_contact_edit">编辑</a>&nbsp;&nbsp;
  54. <a href="javascript:;" url="{{ route('jkq.com.contact.del') }}" class="delete">删除</a>
  55. </div>
  56. <div class="clear"></div>
  57. </div>
  58. @endforeach
  59. <div class="pms_btn">
  60. <div class="allSelWrap">
  61. <input name="" class="allSel J_allSelected" type="checkbox">
  62. </div>
  63. <div class="btn_lightgray J_hoverbut btn_inline btn_border J_delall">删除</div>
  64. <div class="clear"></div>
  65. </div>
  66. {{ $contacts->links('module.widgets.pagination') }}
  67. @else
  68. <div style="text-align: center;">暂无联系人信息</div>
  69. @endif
  70. </div>
  71. </div>
  72. <div class="clear"></div>
  73. </div>
  74. @endsection
  75. @section('script')
  76. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.dropdown.js') }}"></script>
  77. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.listitem.js')}}"></script>
  78. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.disappear.tooltip.js') }}"></script>
  79. <script type="text/javascript" src="{{ theme_asset('app/js/company/jquery.common.js') }}"></script>
  80. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.allselected.js') }}"></script>
  81. <script type="text/javascript" src="{{ theme_asset('app/js/regular.js') }}"></script>
  82. <script type="text/javascript" src="{{theme_asset('app/js/jquery.modal.dialog.js')}}"></script>
  83. <script type="text/javascript">
  84. function checkForm() {
  85. var contactValue = $.trim($('#contact').val());
  86. var telephoneValue = $.trim($('#telephone').val());
  87. var telfirstValue = $.trim($('#tel_first').val());
  88. var telnextValue = $.trim($('#tel_next').val());
  89. var tellastValue = $.trim($('#tel_last').val());
  90. var landlinetelValue = telfirstValue+'-'+telnextValue+'-'+tellastValue;
  91. var emailValue = $.trim($('#email').val());
  92. var addressValue = $.trim($('#address').val());
  93. if (contactValue == "") {
  94. disapperTooltip('remind','请输入联系人');
  95. return false;
  96. }
  97. if (contactValue != "" && contactValue.length > 10) {
  98. disapperTooltip('remind','联系人1-10个字');
  99. return false;
  100. }
  101. if(telnextValue=="" && telephoneValue=="") {
  102. disapperTooltip('remind','手机号码和固定电话至少填写一项');
  103. return false;
  104. } else {
  105. if (telephoneValue != "" && !regularMobile.test(telephoneValue)) {
  106. disapperTooltip('remind','手机号码格式不正确');
  107. return false;
  108. }
  109. }
  110. //电话号码填写的某个不为空
  111. /**
  112. * 分机号可以为空
  113. */
  114. if(telfirstValue!="" || telnextValue!="" || tellastValue!=""){
  115. if (!regularTelFirst.test(telfirstValue)) {
  116. disapperTooltip("remind", "请填写正确的区号");
  117. return false;
  118. }
  119. if (!regularTelNext.test(telnextValue)) {
  120. disapperTooltip("remind", "电话号码为6-11位数字");
  121. return false;
  122. }
  123. if ((!regularTelLast.test(tellastValue) || tellastValue.length > 4) && tellastValue!="") {
  124. disapperTooltip("remind", "分机号码为数字且不能超出4位");
  125. return false;
  126. }
  127. }
  128. if (emailValue != "" && !regularEmail.test(emailValue) || emailValue.split("@")[0].length > 20) {
  129. disapperTooltip('remind','邮箱格式不正确');
  130. return false;
  131. }
  132. if (addressValue == "") {
  133. disapperTooltip('remind','联系地址不能为空');
  134. return false;
  135. }
  136. if (addressValue != "" && addressValue.length > 30) {
  137. disapperTooltip('remind','联系地址不能大于30个字');
  138. return false;
  139. }
  140. return true;
  141. }
  142. //添加联系人
  143. $('.J_contact_add').click(function(){
  144. var qsDialog = $(this).dialog({
  145. title: '添加联系人',
  146. loading: true,
  147. btns: ['确定', '取消'],
  148. showFooter: false,
  149. yes: function() {
  150. qsDialog.setCloseDialog(false);
  151. var form_data = $('#contact_content').serialize();
  152. if (checkForm()) {
  153. $.post("{{ route('jkq.com.contact.add') }}",form_data,function(result){
  154. if(result.status == 1){
  155. disapperTooltip('success',result.msg);
  156. setTimeout(function(){
  157. window.location.reload();
  158. },2000);
  159. }else{
  160. disapperTooltip('remind',result.msg);
  161. }
  162. },'json');
  163. }
  164. }
  165. });
  166. $.getJSON("{{ route('jkq.com.contact.add') }}",function(result){
  167. if(result.status == 1){
  168. qsDialog.setContent(result.data);
  169. qsDialog.showFooter(true);
  170. }else{
  171. qsDialog.setContent('<div class="confirm">' + result.msg + '</div>');
  172. }
  173. });
  174. });
  175. //编辑联系人
  176. $('.J_contact_edit').click(function(){
  177. var f = $(this).closest('.contact');
  178. var id = f.attr('contact_id');
  179. var qsDialog = $(this).dialog({
  180. title: '编辑联系人',
  181. loading: true,
  182. btns: ['确定', '取消'],
  183. showFooter: false,
  184. yes: function() {
  185. qsDialog.setCloseDialog(false);
  186. if (checkForm()) {
  187. var form_data = $('#contact_content').serialize();
  188. $.post("{{ route('jkq.com.contact.edit') }}",form_data,function(result){
  189. if(result.status == 1){
  190. disapperTooltip('success',result.msg);
  191. setTimeout(function(){
  192. window.location.reload();
  193. },2000);
  194. }else{
  195. disapperTooltip('remind',result.msg);
  196. }
  197. },'json');
  198. }
  199. }
  200. });
  201. $.getJSON("{{ route('jkq.com.contact.edit') }}",{id:id},function(result){
  202. if(result.status == 1){
  203. qsDialog.setContent(result.data);
  204. qsDialog.showFooter(true);
  205. }else{
  206. qsDialog.setContent('<div class="confirm">' + result.msg + '</div>');
  207. }
  208. });
  209. });
  210. //查看联系人
  211. $('.J_contact_check').click(function(){
  212. var f = $(this).closest('.contact'),
  213. id = f.attr('contact_id');
  214. var qsDialog = $(this).dialog({
  215. title: '企业联系人详情',
  216. loading: true,
  217. footer: false
  218. });
  219. $.getJSON("{{ route('jkq.com.contact.show') }}",{id:id},function(result){
  220. if(result.status == 1){
  221. qsDialog.setContent(result.data);
  222. qsDialog.showFooter(true);
  223. }else{
  224. qsDialog.setContent(result.msg);
  225. }
  226. });
  227. });
  228. //删除联系人
  229. $(".delete").click(function () {
  230. var url = $(this).attr('url'),
  231. f = $(this).closest('.contact'),
  232. id = f.attr('contact_id');
  233. var qsDialog = $(this).dialog({
  234. title: '删除企业联系人',
  235. loading: true,
  236. border: false,
  237. yes: function () {
  238. $.post(url,{id:id,_token: "{{csrf_token()}}"},function(result){
  239. if(result.status == 1){
  240. f.remove();
  241. disapperTooltip('success',result.msg);
  242. setTimeout(function () {
  243. location.href="{{route('jkq.com.contact')}}"
  244. },1000)
  245. }else{
  246. disapperTooltip('remind',result.msg);
  247. }
  248. },'json');
  249. }
  250. });
  251. qsDialog.setContent('被删除后将无法恢复,您确定要删除选中的企业联系信息吗?');
  252. });
  253. $('.J_delall').click(function(){
  254. var listCheckedArray = $('.J_allListBox .J_allList:checked');
  255. if (listCheckedArray.length) {
  256. var idarr = new Array();
  257. $.each($("input[name='id[]']:checked") ,function(){
  258. idarr.push($(this).val());
  259. });
  260. var qsDialog = $(this).dialog({
  261. title: '删除企业联系人',
  262. loading: true,
  263. border: false,
  264. yes: function () {
  265. $.post("{{ route('jkq.com.contact.del') }}",{id:idarr,_token: "{{csrf_token()}}"},function(result){
  266. if(result.status == 1){
  267. listCheckedArray.closest('.contact').remove();
  268. $(".J_allListBox input[type='checkbox']").prop("checked",false);
  269. disapperTooltip('success',result.msg);
  270. setTimeout(function () {
  271. location.href="{{route('jkq.com.contact')}}"
  272. },1000)
  273. }else{
  274. disapperTooltip('remind',result.msg);
  275. }
  276. },'json');
  277. }
  278. });
  279. qsDialog.setContent('被删除后将无法恢复,您确定要删除选中的企业联系信息吗?');
  280. } else {
  281. disapperTooltip("remind", "请选择要删除的联系信息");
  282. }
  283. });
  284. </script>
  285. @endsection