procurementBill.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. @extends('layouts.app')
  2. @section('title')采购管理-财务-采购账单@endsection
  3. @section('content')
  4. @component('procurement.finance.menu')@endcomponent
  5. <div class="container-fluid" id="list">
  6. <div id="form_div" class="mt-1"></div>
  7. <div class="row mt-2">
  8. <span class="dropdown ml-3">
  9. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  10. :class="[checkData.length>0?'btn-dark text-light':'']"
  11. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  12. 导出Excel
  13. </button>
  14. <div class="dropdown-menu">
  15. <a class="dropdown-item" @click="procurementBillExport(false)" href="javascript:">导出勾选内容</a>
  16. <a class="dropdown-item" @click="procurementBillExport(true)" href="javascript:">导出所有页</a>
  17. </div>
  18. </span>
  19. </div>
  20. <label for="all" id="cloneCheckAll" class="d-none">
  21. <input id="all" type="checkbox" @click="checkAll($event)">全选
  22. </label>
  23. <table class="table table-sm table-bordered text-nowrap d-none" id="headerRoll"></table>
  24. <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2"
  25. id="headerParent">
  26. <tr id="header"></tr>
  27. <tr v-for="(procurement,i) in procurements">
  28. <td>
  29. <input class="checkItem" type="checkbox" :value="procurement.id" v-model="checkData">
  30. </td>
  31. <td class="">@{{ procurement.code }}</td>
  32. <td class="">@{{ procurement.created_at }}</td>
  33. <td class=""><span v-if="procurement.supplier_id">@{{ procurement.deadline }}</span></td>
  34. <td class=""></td>
  35. <td v-if="procurement.owner_material.owner">@{{ procurement.owner_material.owner.name }}</td>
  36. <td v-if="procurement.owner_material.owner.customer">@{{ procurement.owner_material.owner.customer.company_name }}</td>
  37. <td ><span v-if="procurement.supplier">@{{ procurement.supplier.name }}</span></td>
  38. <td class="tooltipTarget" style="max-width: 200px;overflow:hidden" v-if="procurement.owner_material.material">@{{ procurement.owner_material.material.code }}</td>
  39. <td class="text-muted" v-if="procurement.owner_material.material">@{{ procurement.owner_material.material.name }}</td>
  40. <td class="text-muted" v-if="procurement.owner_material">@{{ procurement.owner_material.size }}</td>
  41. <td class="text-muted" v-if="procurement.owner_material">@{{ procurement.owner_material.special }}</td>
  42. <td class="text-muted" v-if="procurement.owner_material">@{{ procurement.owner_material.specification }}</td>
  43. <td>@{{ procurement.quantity }}</td>{{--采购数量--}}
  44. <td>@{{ procurement.amount }}</td> {{--销售数量--}}
  45. <td></td>
  46. <td>@{{ procurement.cost_price }}</td> {{--采购单价--}}
  47. <td>@{{ procurement.unit_price }}</td> {{--销售单价--}}
  48. <td>@{{ procurement.amount*procurement.cost_price }}</td> {{--应收--}}
  49. <td>@{{ procurement.quantity*procurement.unit_price }}</td> {{--应付--}}
  50. <td><span>@{{ procurement_status[procurement.status] }}</span></td>
  51. <td>
  52. <span v-if="procurement.status<9">
  53. <span class="btn btn-sm btn-outline-danger">锁定</span>
  54. <span class="btn btn-sm btn-outline-success" @click="changeCostPrice(procurement.id,procurement.cost_price)">修改采购单价</span>
  55. </span>
  56. </td>
  57. </tr>
  58. </table>
  59. @can('采购管理-财务-采购账单')
  60. @include('procurement.finance._changeCostPrice')
  61. @endcan
  62. <div class="text-info h5 btn btn">{{$procurements->count()}}/@{{ sum }}</div>
  63. <div>{{$procurements->appends($paginateParams)->links()}}</div>
  64. </div>
  65. @endsection
  66. @section('lastScript')
  67. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  68. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  69. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  70. <script>
  71. let vue = new Vue({
  72. el: '#list',
  73. data: {
  74. procurements: {!! $procurements->toJson() !!}['data'],
  75. owners:[
  76. @foreach($owners as $owner)
  77. {name:'{{$owner->id}}',value:'{{$owner->name}}'},
  78. @endforeach
  79. ],
  80. materials: [
  81. @foreach($materials as $material)
  82. {name:'{{$material->id}}',value:'{{$material->name}}'},
  83. @endforeach
  84. ],
  85. suppliers:[
  86. @foreach($suppliers as $supplier)
  87. {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
  88. @endforeach
  89. ],
  90. checkData: [],
  91. sum:{!! $procurements->total() !!},
  92. procurement_status:{!! json_encode(\App\Procurement::status,JSON_UNESCAPED_UNICODE) !!},
  93. procurement_id:'',cost_price:'',
  94. },
  95. mounted: function () {
  96. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  97. $('#list').removeClass('d-none');
  98. let data = [
  99. [
  100. {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
  101. {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
  102. {
  103. name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的项目'],
  104. placeholder: ['项目', '定位或多选项目'], data: this.owners
  105. },
  106. {
  107. name: 'material_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
  108. placeholder: ['耗材', '定位或多选耗材'], data: this.materials
  109. },
  110. {
  111. name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
  112. placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
  113. },
  114. {name: 'company_name', type: 'input', tip: '采购公司:可在两侧增加百分号(%)进行模糊搜索', placeholder: '采购公司'},
  115. ],
  116. ];
  117. this.form = new query({
  118. el: "#form_div",
  119. condition: data,
  120. });
  121. this.form.init();
  122. let column = [
  123. {
  124. name: 'cloneCheckAll', customization: true, type: 'checkAll',column:'id',
  125. dom: $('#cloneCheckAll').removeClass('d-none'), neglect: true
  126. },
  127. {name: 'code', value: '采购编号', neglect: true},
  128. {name: 'code', value: '采购日期', neglect: true},
  129. {name: 'code', value: '接单日期', neglect: true},
  130. {name: 'code', value: '签收日期', neglect: true},
  131. {name: 'owner_id', value: '项目名称', class: ''},
  132. {name: 'company_name', value: '采购公司', class: ''},
  133. {name: 'supplier_name', value: '供应商',},
  134. {name: 'material_code', value: '耗材编号', class: 'text-muted'},
  135. {name: 'material_name', value: '耗材'},
  136. {name: 'size', value: '尺寸大小', class: 'text-muted'},
  137. {name: 'special', value: '特殊要求', class: 'text-muted'},
  138. {name: 'specification', value: '材质规格', class: 'text-muted'},
  139. {name: 'quantity', value: '采购数量', neglect: true},
  140. {name: '', value: '销售数量', neglect: true},
  141. {name: '', value: '收货数量', neglect: true},
  142. {name: '', value: '采购单价(元)', neglect: true},
  143. {name: 'unit_price', value: '销售单价(元)', neglect: true},
  144. {name: '', value: '应收金额(元)', neglect: true},
  145. {name: '', value: '应付金额(元)', neglect: true},
  146. {name: '', value: '状态', neglect: true},
  147. {name: '', value: '操作', neglect: true},
  148. ];
  149. let _this = this;
  150. setTimeout(function () {
  151. let header = new Header({
  152. el: "#header",
  153. column: column,
  154. data: _this.procurements,
  155. restorationColumn: 'id',
  156. fixedTop: ($('#form_div').height()) + 2,
  157. offset: 0.5,
  158. vue: vue
  159. });
  160. header.init();
  161. }, 0);
  162. },
  163. methods: {
  164. //全选事件
  165. checkAll(e) {
  166. if (e.target.checked) {
  167. this.procurements.forEach((el, i) => {
  168. if (this.checkData.indexOf(el.id) == '-1') {
  169. this.checkData.push(el.id);
  170. }
  171. });
  172. } else {
  173. this.checkData = [];
  174. }
  175. },
  176. changeCostPrice(id,cost_price){
  177. this.procurement_id=id;
  178. this.cost_price=cost_price;
  179. $("#change-costPrice").modal('show');
  180. },
  181. costPrice(){
  182. let _this=this;
  183. let url='{{url('procurement/finance/costPrice')}}';
  184. let param={id:_this.procurement_id,cost_price:_this.cost_price};
  185. window.axios.post(url,param).then(function (res) {
  186. if (res.data.success){
  187. _this.procurements.forEach(function (procurement) {
  188. if (procurement.id===res.data.data.id){
  189. procurement.cost_price=res.data.data.cost_price;
  190. $("#change-costPrice").modal('hide');
  191. }
  192. })
  193. }else {
  194. tempTip.setDuration(3000);
  195. tempTip.show(res.data.message);
  196. }
  197. }).catch(function (err) {
  198. window.tempTip.setDuration(3000);
  199. window.tempTip.show("网络错误:" + err);
  200. })
  201. },
  202. procurementBillExport(selectAll){
  203. let url = '{{url('procurement/finance/procurementBillExport')}}';
  204. let token='{{ csrf_token() }}';
  205. excelExport(selectAll,this.checkData,url,this.sum,token);
  206. },
  207. }
  208. });
  209. </script>
  210. @endsection