billConfirmation.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. @extends('layouts.app')
  2. @section('title')账单确认-项目管理@endsection
  3. @section('content')
  4. @component('finance.menu')@endcomponent
  5. <div class="container-fluid d-none" id="container">
  6. <div id="form_div"></div>
  7. <div class="mt-1">
  8. <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  9. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  10. 导出Excel
  11. </button>
  12. <div class="dropdown-menu">
  13. <a class="dropdown-item" @click="billExport(false)" href="javascript:">导出勾选内容</a>
  14. <a class="dropdown-item" @click="billExport(true)" href="javascript:">导出所有页</a>
  15. </div>
  16. @include("finance._resetBillConfirmation")
  17. @can("结算管理-账单确认-重置账单确认")<button data-toggle="modal" data-target="#resetBillConfirmation" class="btn btn-sm btn-outline-primary">重置账单确认</button>@endcan
  18. </div>
  19. <div>
  20. <table class="table table-sm text-nowrap table-striped table-hover td-min-width-80" id="table">
  21. <tr v-for="(bill,i) in bills">
  22. <td>
  23. <label><input type="checkbox" :value="bill.id"></label>
  24. </td>
  25. <td><span>@{{ i+1 }}</span></td>
  26. <td><span>@{{ bill.ownerGroupName }}</span></td>
  27. <td><span>@{{ bill.customerName }}</span></td>
  28. <td><span>@{{ bill.ownerName }}</span></td>
  29. <td><span>@{{ bill.countingMonth }}</span></td>
  30. <td><span>@{{ bill.updatedAt }}</span></td>
  31. <td class="font-weight-bold"><span>@{{ bill.initialFee }}</span></td>
  32. <td>
  33. <label><input :id="'confirmFee-'+bill.id" @click="thisIndex=i" :readonly="thisIndex==i ? false : true" type="number" min="0" class="form-control form-control-sm" :value="bill.confirmFee"></label>
  34. <div v-if="thisIndex==i">
  35. <button class="btn btn-sm btn-success" @click="updateConfirmFee(bill)">确定</button>
  36. <button class="btn btn-sm btn-danger" @click="thisIndex='-1'">取消</button>
  37. </div>
  38. </td>
  39. <td><span>@{{ bill.difference }}</span></td>
  40. <td>
  41. <button class="btn btn-sm btn-outline-success" v-if="bill.confirmed == '否'" @click="billConfirm(bill)">确认</button>
  42. <label v-else class="text-success">已确认</label>
  43. </td>
  44. </tr>
  45. </table>
  46. </div>
  47. </div>
  48. @stop
  49. @section("lastScript")
  50. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  51. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  52. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  53. <script>
  54. let vue = new Vue({
  55. el:"#container",
  56. data:{
  57. bills : [
  58. @foreach($bills as $bill)
  59. { id : "{{$bill->id}}",
  60. ownerGroupName : "{{$bill->owner ? ($bill->owner->userOwnerGroup ? $bill->owner->userOwnerGroup->name : '') : ''}}",
  61. customerName : "{{$bill->owner ? ($bill->owner->customer ? $bill->owner->customer->name : '') : ''}}",
  62. ownerName : "{{$bill->owner ? $bill->owner->name : ''}}",
  63. countingMonth : "{{$bill->counting_month}}",
  64. updatedAt : "{{$bill->updated_at}}",
  65. initialFee : "{{$bill->initial_fee}}",
  66. confirmFee : "{{$bill->confirm_fee}}",
  67. difference : "{{$bill->difference}}",
  68. confirmed : "{{$bill->confirmed}}",
  69. },
  70. @endforeach
  71. ],
  72. owners : [
  73. @foreach($owners as $owner)
  74. {name:"{{$owner->id}}",value:"{{$owner->name}}"},
  75. @endforeach
  76. ],
  77. ownerGroups : [
  78. @foreach($ownerGroups as $ownerGroup)
  79. {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
  80. @endforeach
  81. ],
  82. customers : [
  83. @foreach($customers as $customer)
  84. {name:"{{$customer->id}}",value:"{{$customer->name}}"},
  85. @endforeach
  86. ],
  87. thisIndex:"-1",
  88. sum : Number("{{ $bills->total() }}"),
  89. reset:{
  90. owner:[],
  91. }
  92. },
  93. mounted(){
  94. $('#container').removeClass('d-none');
  95. let data=[
  96. [
  97. {name:'owner_group_id',type:'select',tip:'项目小组',placeholder: '项目小组',data:this.ownerGroups},
  98. {name:'counting_month_start',type:'dateMonth',tip:'起始结算月'},
  99. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
  100. placeholder:['项目','定位或多选项目'],data:this.owners},
  101. ],[
  102. {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
  103. {name:'counting_month_end',type:'dateMonth',tip:'结束结算月'},
  104. ],
  105. ];
  106. this.form = new query({
  107. el:"#form_div",
  108. condition:data,
  109. });
  110. this.form.init();
  111. let column = [
  112. {name:'index',value: '序号', neglect: true},
  113. {name:'ownerGroupName',value: '项目小组'},
  114. {name:'customerName',value: '客户'},
  115. {name:'ownerName',value: '子项目'},
  116. {name:'countingMonth',value: '结算月'},
  117. {name:'updatedAt',value: '录入日期'},
  118. {name:'initialFee',value: '原始账单金额', neglect: true},
  119. {name:'confirmFee',value: '确认账单金额', neglect: true},
  120. {name:'difference',value: '差额', neglect: true},
  121. {name:'operating',value: '操作', neglect: true},
  122. ];
  123. new Header({
  124. el: "table",
  125. name: "billConfirmation",
  126. column: column,
  127. data: this.reports,
  128. fixedTop:($('#form_div').height())+2,
  129. }).init();
  130. },
  131. methods:{
  132. billExport(isAll){
  133. let url = '{{url('finance/billConfirmation/export')}}';
  134. let token='{{ csrf_token() }}';
  135. excelExport(isAll,checkData,url,this.sum,token);
  136. },
  137. updateConfirmFee(bill){
  138. let confirm_fee = $('#confirmFee-'+bill.id).val();
  139. if (confirm_fee === bill.fee){
  140. window.tempTip.setDuration(2000);
  141. window.tempTip.show("无更新");
  142. return;
  143. }
  144. window.tempTip.confirm("确定要更新账单确认金额为“"+confirm_fee+"”吗?",()=>{
  145. window.axios.post("{{url('finance/updateBillReport')}}",{id:bill.id,confirm_fee:confirm_fee})
  146. .then(res=>{
  147. if (res.data.success){
  148. bill.confirmFee = confirm_fee;
  149. bill.difference = Number(confirm_fee) - Number(bill.initialFee);
  150. bill.updatedAt = res.data.data;
  151. this.thisIndex = '-1';
  152. window.tempTip.setDuration(2000);
  153. window.tempTip.showSuccess("修改成功");
  154. return;
  155. }
  156. window.tempTip.setDuration(3000);
  157. window.tempTip.show(res.data.data);
  158. }).catch(err=>{
  159. window.tempTip.setDuration(3000);
  160. window.tempTip.show("网络错误:"+err);
  161. })
  162. });
  163. },
  164. billConfirm(bill){
  165. window.tempTip.confirm("确定要完结该账单吗?",()=>{
  166. window.axios.post("{{url('finance/billConfirm')}}",{id:bill.id})
  167. .then(res=>{
  168. if (res.data.success){
  169. bill.confirmed = "是";
  170. window.tempTip.setDuration(2000);
  171. window.tempTip.showSuccess("完结成功!");
  172. return;
  173. }
  174. window.tempTip.setDuration(3000);
  175. window.tempTip.show(res.data.data);
  176. }).catch(err=>{
  177. window.tempTip.setDuration(3000);
  178. window.tempTip.show("网络错误:"+err);
  179. })
  180. });
  181. },
  182. resetBillConfirmation(){
  183. window.tempTip.setDuration(3000);
  184. window.tempTip.setIndex(1099);
  185. if (!this.reset.month){
  186. window.tempTip.show("未选择结算月");
  187. return;
  188. }
  189. window.tempTip.setDuration(999999);
  190. window.tempTip.waitingTip("加载中......");
  191. window.tempTip.postBasicRequest("{{url('customer/project/resetBillConfirmation')}}",this.reset,res=>{
  192. window.tempTip.setDuration(2000);
  193. window.tempTip.cancelWaitingTip();
  194. return "重置成功";
  195. },true)
  196. },
  197. },
  198. });
  199. </script>
  200. @stop