save.blade.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. @extends('admin/layout')
  2. @section('header')
  3. <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. <body class="gray-bg">
  7. <div class="wrapper wrapper-content animated fadeInRight">
  8. <div class="row">
  9. <div class="col-sm-12">
  10. <div class="ibox float-e-margins">
  11. <div class="ibox-content">
  12. <form class="form-horizontal" id="form">
  13. {{--<div class="form-group">--}}
  14. {{--<label class="col-sm-2 control-label" for="agent_type">代理商类型:</label>--}}
  15. {{--<div class="col-sm-4">--}}
  16. {{--<select class="form-control" id="agent_type" name="agent_type">--}}
  17. {{--<option value="">请选择代理商</option>--}}
  18. {{--@foreach(\App\Http\Models\AgentSeller::AGENT_TYPE as $inx=>$val)--}}
  19. {{--<option value="{{$inx}}"--}}
  20. {{--@if($data->agent_type??null==$inx) selected @endif>{{$val}}</option>--}}
  21. {{--@endforeach--}}
  22. {{--</select>--}}
  23. {{--</div>--}}
  24. {{--</div>--}}
  25. <div class="form-group">
  26. <label class="col-sm-2 control-label" for="title"><span class="red">* </span>名称:</label>
  27. <div class="col-sm-8">
  28. <input type="text" class="form-control" id="title" name="title"
  29. value="{{$data->title ?? ''}}">
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label class="col-sm-2 control-label" for="site_id"><span class="red">* </span>关联站点:</label>
  34. <div class="col-sm-8 ">
  35. <select data-placeholder="选择关联站点..." style="width:350px;"
  36. class="chosen-select" id="site_id" name="site_id">
  37. <option value="">请选择关联站点</option>
  38. @foreach ($sites as $item)
  39. <option value="{{$item->id}}"
  40. @if($item->id==($data->site_id??null)) selected @endif>{{$item->cn_title}}</option>
  41. @endforeach
  42. </select>
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. <label class="col-sm-2 control-label" for="amount"><span class="red">* </span>金额:</label>
  47. <div class="col-sm-8">
  48. <input type="text" class="form-control" id="amount" name="amount"
  49. value="{{$data->amount??''}}">
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. <label class="col-sm-2 control-label"><span class="red">* </span>合同文件:</label>
  54. <div class="col-sm-8">
  55. <button type="button" class="btn btn-primary" onclick="units.triggerFile(this)">
  56. 文件上传
  57. </button>
  58. <input type="file" value="" style="display: none" onchange="units.fileUpload(this)">
  59. <a href="{{$data->contract_file['url']??''}}"
  60. id="contract_file" download="{{$data->contract_file['origin']??''}}">{{$data->contract_file['origin']??''}}</a>
  61. {{--<input type="hidden" id="contract_file" name="contract_file" value="{{$data->contract_file??''}}" onchange="units.fileUpload(this)">--}}
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <label class="col-sm-2 control-label" for="remark">备注:</label>
  66. <div class="col-sm-8">
  67. <input type="text" class="form-control" id="remark" name="remark"
  68. value="{{$data->remark??''}}">
  69. </div>
  70. </div>
  71. {{--<div class="form-group">--}}
  72. {{--<label class="col-sm-2 control-label" for="sign_at">签约时间:</label>--}}
  73. {{--<div class="col-sm-8">--}}
  74. {{--<input type="text" class="form-control" id="sign_at" name="sign_at"--}}
  75. {{--value="{{$data->sign_at??''}}">--}}
  76. {{--</div>--}}
  77. {{--</div>--}}
  78. <div class="hr-line-dashed"></div>
  79. <div class="form-group">
  80. <div class="col-sm-4 col-sm-offset-2">
  81. <button class="btn btn-primary" type="button"
  82. onclick="units.save({{$data->id??0}})">
  83. 保存
  84. </button>
  85. <button class="btn btn-white closeLayer" type="button" id="cancel">取消</button>
  86. </div>
  87. </div>
  88. </form>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </body>
  95. @endsection
  96. @section('footer')
  97. <script src="{{asset('js/plugins/chosen/chosen.jquery.js')}}"></script>
  98. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  99. <script>
  100. // laydate.render({
  101. // elem: '#sign_at', //指定元素
  102. // type: 'datetime'
  103. // });
  104. var config = {".chosen-select": {}};
  105. for (var selector in config) $(selector).chosen(config[selector]);
  106. var units = {
  107. save: function (id) {
  108. var data = tips.getFormValues('#form');
  109. var contract_file = $("#contract_file");
  110. data.contract_file = {origin: contract_file.text(), url: contract_file.data('val')};
  111. var ajaxConfig = {
  112. url: '/admin/lading-bills/' + id,
  113. type: 'put',
  114. data: data,
  115. success: function (result) {
  116. layer.msg(result.message, {icon: 6, time: 1000}, function () {
  117. window.parent.tips.tableRefresh('#table');
  118. tips.closeParentLayer();
  119. });
  120. }
  121. };
  122. tips.ajax(ajaxConfig);
  123. },
  124. triggerFile: function (_this) { //文件上传
  125. $(_this).next().trigger('click');
  126. },
  127. fileUpload: function (_this) {
  128. var config = {
  129. url: '/admin/tool/upload'
  130. };
  131. config.success = function (result) {
  132. console.log(result);
  133. layer.msg(result.message, {icon: 6, time: 1500});
  134. $("#contract_file").attr('href', result.data.file_url)
  135. .text(result.data.original_name).attr('download',result.data.original_name);
  136. };
  137. tips.fileUpload(_this, config);
  138. }
  139. };
  140. </script>
  141. @endsection