billConfirmation.blade.php 10 KB

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