finstlbillsDetails.vue 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button size="small" style="margin-right: 8px"
  11. :loading="saveLoading" :disabled="!form.id" @click="previewreportfun" >预 览
  12. </el-button>
  13. <el-button size="small" style="margin-right: 8px"
  14. :loading="saveLoading" :disabled="!form.id" @click="DesignreportDialog = true" >报表设计
  15. </el-button>
  16. <el-button size="small" type="success" plain style="margin-right: 8px" :disabled="!form.id" v-if="form.status == '0'"
  17. :loading="saveLoading" @click="settlementApprovefun">提交申请
  18. </el-button>
  19. <el-button size="small" type="warning" plain style="margin-right: 8px" :disabled="!form.id" v-if="form.status == '1'"
  20. :loading="saveLoading" @click="revokeSettlementApprovefun">撤销申请
  21. </el-button>
  22. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="form.isCleared == 1" v-if="editSave"
  23. :loading="saveLoading" @click="editHandle">编 辑
  24. </el-button>
  25. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="form.isCleared == 1" v-else
  26. :loading="saveLoading" @click="editCustomer">保 存
  27. </el-button>
  28. </div>
  29. </div>
  30. <div style="margin: 55px 5px 0px 5px;'">
  31. <el-card class="box-card">
  32. <el-form :model="form" ref="form" label-width="90px" :rules="rules" class="demo-ruleForm">
  33. <el-row>
  34. <el-row>
  35. <el-col :span="5">
  36. <el-form-item label="付费对象" prop="corpCnName">
  37. <search-query :datalist="corpData"
  38. :selectValue="form.corpCnName"
  39. :clearable="true"
  40. :disabled="editSave || tableData.length != 0"
  41. :filterable="true"
  42. :remote="true"
  43. :buttonIf="false"
  44. :forParameter="{ key:'id', label:'cnName', value:'cnName'}"
  45. @corpChange="corpChange($event,'corpCnName')"
  46. @remoteMethod="corpBcorpsListfun"
  47. @corpFocus="corpBcorpsListfun" >
  48. </search-query>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="10">
  52. <el-form-item label="开户帐号" prop="bankId">
  53. <search-query :datalist="bankData"
  54. :selectValue="form.bankId"
  55. :clearable="true"
  56. :disabled="editSave || !form.corpId"
  57. :filterable="true"
  58. :buttonIf="false"
  59. :forParameter="{ key:'id', label:'accountBankNo', value:'id'}"
  60. @corpChange="corpChange($event,'bankId')"
  61. @corpFocus="bcorpsbankListfun" >
  62. </search-query>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="9">
  66. <el-form-item label="付费事由" prop="remarks">
  67. <el-input style="width: 100%;" v-model="form.remarks"
  68. size="small" autocomplete="off"
  69. :disabled="editSave"
  70. clearable placeholder="请输入付费事由" >
  71. </el-input>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :span="5">
  75. <el-form-item label="预计收回" prop="estimatedTime">
  76. <el-date-picker
  77. v-model="form.estimatedTime"
  78. type="date"
  79. style="width: 100%;"
  80. size="small"
  81. :disabled="editSave"
  82. value-format="yyyy-MM-dd"
  83. placeholder="选择预计收回">
  84. </el-date-picker>
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="5">
  88. <el-form-item label="收款情况" prop="collectionSituation">
  89. <el-input style="width: 100%;" v-model="form.collectionSituation"
  90. size="small" autocomplete="off"
  91. :disabled="editSave"
  92. clearable placeholder="请输入CHK NO" >
  93. </el-input>
  94. </el-form-item>
  95. </el-col>
  96. <el-col :span="5">
  97. <el-form-item label="业务日期" prop="etd">
  98. <el-date-picker
  99. v-model="form.accountDate"
  100. type="datetimerange"
  101. range-separator="至"
  102. start-placeholder="开始日期"
  103. end-placeholder="结束日期"
  104. style="width: 100%;"
  105. size="small"
  106. :disabled="editSave"
  107. format="yyyy-MM-dd"
  108. value-format="yyyy-MM-dd"
  109. placeholder="选择业务日期">
  110. </el-date-picker>
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="5">
  114. <el-form-item label="收/付" prop="queryAmount">
  115. <search-query :datalist="dcData"
  116. :selectValue="form.dc"
  117. :filterable="true"
  118. :clearable="true"
  119. :remote="true"
  120. :buttonIf="false"
  121. :disabled="editSave"
  122. placeholder="请选择方向"
  123. @corpChange="corpChange($event,'dc')">
  124. </search-query>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="4">
  128. <el-form-item label="币别" prop="curCode">
  129. <search-query :datalist="curCodeData"
  130. :selectValue="form.curCode"
  131. :clearable="true"
  132. :disabled="editSave"
  133. :buttonIf="false"
  134. :filterable="true"
  135. :remote="true"
  136. :forParameter="{ key:'id', label:'code', value:'code'}"
  137. @corpChange="corpChange($event,'curCode')"
  138. @remoteMethod="getRateListfun"
  139. @corpFocus="getRateListfun" >
  140. </search-query>
  141. </el-form-item>
  142. </el-col>
  143. <el-col :span="5">
  144. <el-form-item label="JOB NO" prop="businessNo">
  145. <el-input style="width: 100%;" v-model="form.businessNo"
  146. size="small" autocomplete="off"
  147. :disabled="editSave"
  148. clearable placeholder="请输入JOB NO" >
  149. </el-input>
  150. </el-form-item>
  151. </el-col>
  152. <el-col :span="5">
  153. <el-form-item label="ACCT NO" prop="accountNo">
  154. <el-input style="width: 100%;" v-model="form.accountNo"
  155. size="small" autocomplete="off"
  156. :disabled="editSave"
  157. clearable placeholder="请输入ACCT NO" >
  158. </el-input>
  159. </el-form-item>
  160. </el-col>
  161. <el-col :span="5">
  162. <el-form-item label="MBL NO" prop="mblno">
  163. <el-input style="width: 100%;" v-model="form.mblno"
  164. size="small" autocomplete="off"
  165. :disabled="editSave"
  166. clearable placeholder="请输入MBL NO" >
  167. </el-input>
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="5">
  171. <el-form-item label="HBL NO" prop="hblno">
  172. <el-input style="width: 100%;" v-model="form.hblno"
  173. size="small" autocomplete="off"
  174. :disabled="editSave"
  175. clearable placeholder="请输入HBL NO" >
  176. </el-input>
  177. </el-form-item>
  178. </el-col>
  179. <el-col :span="4">
  180. <el-form-item label="对账单号" prop="checkNo">
  181. <el-input style="width: 100%;" v-model="form.checkNo"
  182. size="small" autocomplete="off"
  183. :disabled="editSave"
  184. clearable placeholder="请输入CHK NO" >
  185. </el-input>
  186. </el-form-item>
  187. </el-col>
  188. </el-row>
  189. <expand :showBtn="true" :showSpan="true">
  190. <el-row>
  191. <el-col :span="5">
  192. <el-form-item label="业务类型" prop="businessTypes" >
  193. <search-query :datalist="businessTypesData"
  194. :selectValue="form.businessTypes"
  195. :clearable="true"
  196. :disabled="editSave"
  197. :buttonIf="false"
  198. :multiple="true"
  199. @corpChange="corpChange($event,'businessTypes')">
  200. </search-query>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="5">
  204. <el-form-item label="船 名" prop="vesselCnName" >
  205. <el-input style="width: 100%;" v-model="form.vesselCnName"
  206. size="small" autocomplete="off"
  207. :disabled="editSave"
  208. clearable placeholder="请选择船名" ></el-input>
  209. </el-form-item>
  210. </el-col>
  211. <el-col :span="5">
  212. <el-form-item label="航 次" prop="voyageNo" >
  213. <el-input style="width: 100%;" v-model="form.voyageNo"
  214. size="small" autocomplete="off"
  215. :disabled="editSave"
  216. clearable placeholder="请选择航次" ></el-input>
  217. </el-form-item>
  218. </el-col>
  219. </el-row>
  220. </expand>
  221. <el-row>
  222. <el-col span="24">
  223. <div style="text-align: right">
  224. <el-button size="small" type="" style="margin-right: 8px"
  225. :loading="saveLoading" @click="ResetFilter">重置条件
  226. </el-button>
  227. <el-checkbox v-model="appendType" false-label="检索" true-label="追加">追加</el-checkbox>
  228. <el-button size="small" type="primary" style="margin-right: 8px"
  229. :loading="saveLoading" @click="finstlbillslistAccBillV1fun(appendType)" >检 索
  230. </el-button>
  231. </div>
  232. </el-col>
  233. </el-row>
  234. </el-row>
  235. </el-form>
  236. </el-card>
  237. <el-card style="margin-top: 10px">
  238. <div style="margin-bottom: 10px">
  239. <el-button size="small" type="info" style="margin-right: 8px" :disabled="editSave"
  240. :loading="saveLoading" @click="SelectedRows">确认选定行
  241. </el-button>
  242. <el-button size="small" type="danger" style="margin-right: 8px" :disabled="editSave"
  243. :loading="saveLoading" @click="batchDeletefun" >批量删除
  244. </el-button>
  245. </div>
  246. <finstlbillsitems :tableData="tableData"
  247. :editSave="editSave"
  248. :handleSelectionData="handleSelectionData"
  249. @handleSelectionChange="handleSelectionChange"
  250. @deletefun="finstlbillsitemsRemovefun">
  251. </finstlbillsitems>
  252. </el-card>
  253. </div>
  254. <el-card style="margin-top: 10px">
  255. <el-row>
  256. <el-col :span="3">
  257. <div class="bottomFlex" style="color: #6BBCD1">
  258. <span>应付:</span>
  259. <span class="weightnum">¥{{form.amountCr || 0}}</span>
  260. </div>
  261. </el-col>
  262. <el-col :span="3">
  263. <div class="bottomFlex" style="color: #6BBCD1">
  264. <span>应付:</span>
  265. <span class="weightnum">${{form.amountCrUsd || 0}}</span>
  266. </div>
  267. </el-col>
  268. <el-col :span="3">
  269. <div class="bottomFlex" style="color: #6BBCD1">
  270. <span>应付合计:</span>
  271. <span class="weightnum">¥{{form.amountCrLoc || 0}}</span>
  272. </div>
  273. </el-col>
  274. <el-col :span="3">
  275. <div class="bottomFlex" style="color: #81B337">
  276. <span>应收:</span>
  277. <span class="weightnum">¥{{form.amountDr || 0}}</span>
  278. </div>
  279. </el-col>
  280. <el-col :span="3">
  281. <div class="bottomFlex" style="color: #81B337">
  282. <span>应收:</span>
  283. <span class="weightnum">${{form.amountDrUsd || 0}}</span>
  284. </div>
  285. </el-col>
  286. <el-col :span="3">
  287. <div class="bottomFlex" style="color: #81B337">
  288. <span>应收合计:</span>
  289. <span class="weightnum">¥{{form.amountDrLoc || 0}}</span>
  290. </div>
  291. </el-col>
  292. </el-row>
  293. </el-card>
  294. <!--设计报表弹窗-->
  295. <el-dialog append-to-body title="设计报表" class="el-dialogDeep" :visible.sync="DesignreportDialog" width="70%"
  296. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  297. <reports :id="form.id" :disabled="editSave" businessValue="FFSQ"></reports>
  298. </el-dialog>
  299. <!--预览-->
  300. <el-dialog
  301. title="打印"
  302. :visible.sync="selectPrintingDialog"
  303. append-to-body
  304. width="70%"
  305. :close-on-click-modal="false"
  306. :destroy-on-close="true"
  307. :close-on-press-escape="false"
  308. v-dialog-drag>
  309. <div>
  310. <reportformsList ref="reportformsList" @reportRadio="reportRadio"></reportformsList>
  311. </div>
  312. <span slot="footer" class="dialog-footer">
  313. <el-button size="small" @click="selectPrintingDialog = false;">取 消</el-button>
  314. </span>
  315. </el-dialog>
  316. <!--报表组件-->
  317. <reportContainer ref="reportContainer"></reportContainer>
  318. </div>
  319. </template>
  320. <script>
  321. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  322. import {getRateList} from "@/api/iosBasicData/rateManagement";
  323. import {bcorpsbankList, getBcorpslistByType} from "@/api/iosBasicData/bcorps";
  324. import {
  325. finstlbillsConfirmSignFor,
  326. finstlbillsDetail, finstlbillsitemsRemove,
  327. finstlbillslistAccBillV1,
  328. finstlbillsRevokeSignFor,
  329. finstlbillsSubmit, revokeSettlementApprove, settlementApprove
  330. } from '@/api/iosBasicData/finstlbills'
  331. import expand from "@/components/basic-container/expand.vue";
  332. import finstlbillsitems from "@/views/iosBasicData/PaymentApplication/assembly/finstlbillsitems.vue";
  333. import reports from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reports.vue";
  334. import reportformsList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsList.vue";
  335. import {reportsGetReportData} from "@/api/iosBasicData/reports";
  336. import reportContainer from "@/views/iosBasicData/report-container/report-container.vue";
  337. export default {
  338. components: {reportContainer, reportformsList, reports, SearchQuery,expand,finstlbillsitems},
  339. props:{
  340. // 编辑还是保存
  341. editSave:{
  342. type:Boolean,
  343. default:true
  344. }
  345. },
  346. data(){
  347. return {
  348. DesignreportDialog:false, // 设计报表弹窗
  349. selectPrintingDialog:false, // 预览报表
  350. // 收/付数据
  351. dcData: [{
  352. label: '全部',
  353. value: null
  354. },{
  355. label: '收',
  356. value: 'D'
  357. }, {
  358. label: '付',
  359. value: 'C'
  360. }],
  361. appendType:'检索', // 是否追加
  362. tableData:[],
  363. pageLoading:false, // 全屏加载动画
  364. saveLoading:false, // 按钮动画
  365. // 绑定的数据
  366. form:{
  367. dc:'C'
  368. },
  369. handleSelectionData:[], // 表格选择的数据
  370. corpData:[], // 结算单位 数据
  371. bankData:[], // 查询银行数据
  372. curCodeData:[],// 币别
  373. srcforParameter:{},
  374. // 业务类型
  375. businessTypesData:[
  376. {
  377. label:'海运出口',
  378. value:'SE'
  379. },{
  380. label:'海运进口',
  381. value:'SI'
  382. }
  383. ],
  384. rules: {
  385. corpCnName: [
  386. {required: true, message: '请输入付费对象', trigger: 'blur'},
  387. ],
  388. bankId: [
  389. {required: true, message: '请输入开户银行', trigger: 'blur'},
  390. ],
  391. remarks: [
  392. {required: true, message: '请输入付费事由', trigger: 'blur'},
  393. ],
  394. estimatedTime: [
  395. {required: true, message: '请输入预计收回', trigger: 'blur'},
  396. ],
  397. collectionSituation: [
  398. {required: true, message: '请输入收款情况', trigger: 'blur'},
  399. ],
  400. },
  401. }
  402. },
  403. created() {
  404. },
  405. methods:{
  406. // 打印
  407. reportRadio(val){
  408. console.log(val,505)
  409. // 获取报表数据
  410. reportsGetReportData({
  411. billId:this.form.id,
  412. reportCode:val.classifyCode,
  413. groupCode:val.groupCode,
  414. }).then(res=>{
  415. this.handleReportPreview(val.url,res.data.data.data)
  416. })
  417. },
  418. // 报表预览
  419. previewreportfun(){
  420. this.saveLoading = true
  421. this.selectPrintingDialog = true
  422. this.saveLoading = false
  423. let page = {
  424. pageSize: 10,
  425. currentPage: 1,
  426. total: 0
  427. }
  428. this.$nextTick(()=>{
  429. this.$refs.reportformsList.onLoad(page,{
  430. businessType:'FFSQ',
  431. classifyCode:'付费申请',
  432. groupCode:'付费申请'
  433. })
  434. })
  435. },
  436. // 批量删除
  437. batchDeletefun(){
  438. if (this.handleSelectionData.length == 0) {
  439. return this.$message.warning('请选择要删除的数据')
  440. }
  441. this.$confirm("确定将选择数据删除?", {
  442. confirmButtonText: "确定",
  443. cancelButtonText: "取消",
  444. type: "warning"
  445. }).then(()=>{
  446. // 获取有id 的数据
  447. const itemsWithId = this.handleSelectionData.filter(item => item.hasOwnProperty('id'));
  448. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  449. // 把选中的删除掉
  450. this.handleSelectionData.forEach((item)=>{
  451. for (let index in this.tableData) {
  452. if (item.accBillNo == this.tableData[index].accBillNo) {
  453. this.tableData.splice(index,1)
  454. }
  455. }
  456. })
  457. // 有id 的处理
  458. if(itemsWithId.length != 0) {
  459. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  460. this.$message.success('操作成功')
  461. })
  462. }
  463. })
  464. },
  465. // 删除
  466. finstlbillsitemsRemovefun(id,index){
  467. this.$confirm("确定将选择数据删除?", {
  468. confirmButtonText: "确定",
  469. cancelButtonText: "取消",
  470. type: "warning"
  471. }).then(()=>{
  472. if (id) {
  473. finstlbillsitemsRemove(id).then(res=>{
  474. this.$message.success('操作成功')
  475. })
  476. }
  477. this.tableData.splice(index,1)
  478. })
  479. },
  480. // 下拉回调
  481. corpChange(value,name){
  482. // 结算单位
  483. if (name == 'corpCnName') {
  484. if (!value) {
  485. this.$set(this.form,'corpId','')
  486. this.$set(this.form,'corpCnName','')
  487. this.$set(this.form,'corpEnName','')
  488. this.$set(this.form,'corpArgreementNo','')
  489. }
  490. for(let item of this.corpData) {
  491. if (item.cnName == value) {
  492. this.$set(this.form,'corpId',item.id)
  493. this.$set(this.form,'corpCnName',item.cnName)
  494. this.$set(this.form,'corpEnName',item.enName)
  495. this.$set(this.form,'corpArgreementNo',item.enName)
  496. }
  497. }
  498. }
  499. else if (name == 'bankId') {
  500. if (!value) {
  501. this.$set(this.form,'bankId','')
  502. this.$set(this.form,'bankAccountName','')
  503. this.$set(this.form,'bankAccountBank','')
  504. this.$set(this.form,'bankAccountNo','')
  505. }
  506. for(let item of this.bankData) {
  507. if (item.id == value) {
  508. this.$set(this.form,'bankId',item.id)
  509. this.$set(this.form,'bankAccountName',item.accountName)
  510. this.$set(this.form,'bankAccountBank',item.accountBank)
  511. this.$set(this.form,'bankAccountNo',item.accountNo)
  512. }
  513. }
  514. }
  515. else {
  516. this.$set(this.form,name,value)
  517. }
  518. },
  519. // 编辑
  520. editHandle(){
  521. this.editSave = false
  522. },
  523. // 保存
  524. editCustomer(){
  525. this.$refs.form.validate((valid) => {
  526. if (!valid) return
  527. if (!this.form.id) {
  528. // 是否选择从表数据
  529. if (this.handleSelectionData.length == 0) {
  530. this.$message.warning('请选择结算数据');
  531. return;
  532. }
  533. }
  534. for (let item of this.handleSelectionData) {
  535. if (!item.currentStlCurCode) {
  536. this.$message.warning('请选择本次结算币种');
  537. return;
  538. }
  539. }
  540. this.saveLoading = true // 打开按钮动画
  541. if(this.form.estimatedTime) {
  542. this.form.estimatedTime = this.form.estimatedTime + ' 00:00:00'
  543. }
  544. this.saveLoading = true // 加载动画
  545. this.form.billNoFormat = 'FFSQ'
  546. this.form.businessTypeCode = 'FFSQ'
  547. this.form.businessType = 'FFSQ' // 结算单
  548. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  549. this.form.finStlBillsItemsList = this.handleSelectionData.map((item,index)=>{
  550. if (item.currentStlCurCode == 'CNY') {
  551. item.currentStlAmount = item.currentStlAmountRMB
  552. }else {
  553. item.currentStlAmount = item.currentStlAmountUSD
  554. }
  555. if (!this.form.id) {
  556. delete item.businessType
  557. delete item.billDate
  558. delete item.accountDc
  559. }
  560. return item
  561. })
  562. finstlbillsSubmit(this.form).then(res=>{
  563. this.saveLoading = false
  564. this.$message.success('操作成功');
  565. this.saveLoading = false // 关闭按钮动画
  566. this.finstlbillsDetailfun(res.data.data.id)
  567. })
  568. })
  569. },
  570. // 详情接口
  571. finstlbillsDetailfun(id){
  572. this.pageLoading = true
  573. finstlbillsDetail(id).then(res=>{
  574. this.form = res.data.data
  575. this.form.businessTypes = this.form.businessTypes.split(',') // 业务类型转换成数组显示
  576. this.tableData = this.form.finStlBillsItemsList.map(item=>{
  577. item.stlTtlAmountNet = Number(item.stlTtlAmount) - (Number(item.stlTtlAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  578. item.currentStlAmountNet = Number(item.unsettledAmount) - (Number(item.unsettledAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  579. if(item.curCode == 'CNY') {
  580. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  581. this.$set(item,'amountRMB',item.amount)
  582. this.$set(item,'amountNetRMB',item.amountNet)
  583. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  584. this.$set(item,'stlTtlAmountNetRMB',item.stlTtlAmountNet)
  585. this.$set(item,'currentStlAmountNetRMB',item.currentStlAmountNet)
  586. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  587. }else {
  588. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  589. this.$set(item,'amountUSD',item.amount)
  590. this.$set(item,'amountNetUSD',item.amountNet)
  591. this.$set(item,'stlTtlAmountNetUSD',item.stlTtlAmountNet)
  592. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  593. this.$set(item,'currentStlAmountNetUSD',item.currentStlAmountNet)
  594. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  595. }
  596. return item
  597. })
  598. this.pageLoading = false
  599. this.bcorpsbankListfun() // 查银行数据
  600. }).catch(err=>{
  601. this.pageLoading = false
  602. })
  603. },
  604. // 重置条件
  605. ResetFilter(){
  606. this.form = {}
  607. },
  608. // 检索接口
  609. finstlbillslistAccBillV1fun(type){
  610. // 对账单位
  611. if (!this.form.corpId) {
  612. this.$message.warning('请选择对账单位');
  613. return
  614. }
  615. // 业务类型
  616. // if (!this.form.businessTypes) {
  617. // this.$message.warning('请选择业务类型');
  618. // return
  619. // }
  620. delete this.form.id
  621. // let obj = JSON.parse(JSON.stringify(this.form))
  622. let obj = {}
  623. obj.type = '2'
  624. obj.corpCnName = this.form.corpId // 结算单位
  625. obj.curCode = this.form.curCode // 币别
  626. obj.dc = this.form.dc // 收付 D=收 C=付
  627. obj.accBillNo = this.form.accountNo // 账单编号 ACCT NO
  628. obj.billNo = this.form.businessNo // 单据编号 JOB NO
  629. obj.checkBillNo = this.form.checkNo // CHK NO
  630. obj.mblno = this.form.mblno // MB/L NO
  631. obj.hblno = this.form.hblno // HB/L NO
  632. obj.queryAmount = this.form.queryAmount // 查询金额
  633. obj.businessType = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  634. obj.vesselCnName = this.form.vesselCnName // 中文船名
  635. obj.receivableAdvance = this.form.receivableAdvance // 预收帐款
  636. obj.voyageNo = this.form.voyageNo // 航次
  637. obj.signforDateList = this.form.signforDateList // 签收日期
  638. obj.auditStatus = '0'
  639. // 财务期间
  640. if (this.form.accountDate) {
  641. obj.billDateList = this.form.accountDate
  642. }
  643. finstlbillslistAccBillV1(obj).then(res=>{
  644. let arr = res.data.data.map((item,index)=>{
  645. item.accBillId = item.id
  646. delete item.id
  647. // 账单编号
  648. item.accBillNo = item.billNo
  649. item.currentStlCurCode = item.curCode // 币别
  650. item.lineNo = Number(index) + 1
  651. item.pType = item.businessType
  652. item.billNo = item.businessBillDivideNo?item.businessBillDivideNo:item.businessBillNo
  653. item.accDate = item.billDate
  654. item.dc = item.accountDc // 收付
  655. if(item.curCode == 'CNY') {
  656. // 发票
  657. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  658. // 应结算金额
  659. this.$set(item,'amountRMB',item.amount)
  660. // 已结算金额
  661. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  662. // 本次金额
  663. this.$set(item,'currentStlAmountRMB',(Number(item.amount) - Number(item.stlTtlAmount) - Number(item.appliedAmount)).toFixed(2))
  664. }else {
  665. // 发票
  666. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  667. // 应结算金额
  668. this.$set(item,'amountUSD',item.amount)
  669. // 已结算金额
  670. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  671. // 本次金额
  672. this.$set(item,'currentStlAmountUSD',(Number(item.amount) - Number(item.stlTtlAmount) - Number(item.appliedAmount)).toFixed(2))
  673. }
  674. return item
  675. })
  676. if (type == '追加') {
  677. let a = [...this.tableData,...arr,]
  678. this.tableData = a.filter((obj, index) => {
  679. return a.findIndex((elem) => {
  680. return elem.accBillNo === obj.accBillNo
  681. }) === index;
  682. });
  683. }else {
  684. // 获取有id 的数据
  685. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  686. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  687. // 有id 的处理
  688. if(itemsWithId.length != 0) {
  689. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  690. this.$message.success('操作成功')
  691. })
  692. }
  693. this.tableData = arr
  694. }
  695. })
  696. },
  697. // 结算确认
  698. settlementApprovefun(){
  699. this.$confirm("确定进行对账操作?", {
  700. confirmButtonText: "确定",
  701. cancelButtonText: "取消",
  702. type: "warning"
  703. }).then(()=>{
  704. this.pageLoading = true
  705. this.form.businessTypes = this.form.businessTypes.join(',') // 业务类型
  706. settlementApprove(this.form).then(res=>{
  707. this.pageLoading = false
  708. this.$message.success('操作成功');
  709. this.finstlbillsDetailfun(res.data.data.id)
  710. }).catch(err=>{
  711. this.pageLoading = false
  712. })
  713. })
  714. },
  715. // 结算撤销
  716. revokeSettlementApprovefun(){
  717. this.$confirm("确定进行撤销对账操作?", {
  718. confirmButtonText: "确定",
  719. cancelButtonText: "取消",
  720. type: "warning"
  721. }).then(()=>{
  722. this.pageLoading = true
  723. this.form.businessTypes = this.form.businessTypes.join(',') // 业务类型
  724. revokeSettlementApprove(this.form).then(res=>{
  725. this.pageLoading = false
  726. this.$message.success('操作成功');
  727. this.finstlbillsDetailfun(res.data.data.id)
  728. })
  729. }).catch(err=>{
  730. this.pageLoading = false
  731. })
  732. },
  733. // 确认选定行
  734. SelectedRows(){
  735. this.editCustomer()
  736. },
  737. // 下面表格多选
  738. handleSelectionChange(arr){
  739. this.handleSelectionData = arr
  740. },
  741. //返回列表
  742. backToList() {
  743. this.$emit('goBack')
  744. },
  745. // 请求的接口
  746. // 获取币别数据
  747. getRateListfun(cnName){
  748. getRateList({current:1,size:10,cnName}).then(res=>{
  749. this.curCodeData = res.data.data.records
  750. })
  751. },
  752. // 获取结算单位数据
  753. corpBcorpsListfun(cnName){
  754. getBcorpslistByType(1,10,{cnName}).then(res=>{
  755. this.corpData = res.data.data.records
  756. })
  757. },
  758. // 获取银行数据
  759. bcorpsbankListfun(){
  760. bcorpsbankList(1,50,{pid:this.form.corpId}).then(res=>{
  761. this.bankData = res.data.data.records.map(item=>{
  762. item.accountBankNo = item.accountBank + ' - ' + item.accountNo
  763. return item
  764. })
  765. })
  766. },
  767. // 预览报表
  768. handleReportPreview(url,data){
  769. console.log(url,1670)
  770. console.log(data,1671)
  771. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  772. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  773. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  774. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
  775. // 工具栏
  776. var options = new Stimulsoft.Viewer.StiViewerOptions()
  777. options.height = '100%'
  778. options.appearance.scrollbarsMode = true // 滚动条模式
  779. options.toolbar.showDesignButton = false // 显示设计按钮
  780. options.toolbar.showAboutButton = false // 显示关于按钮
  781. options.toolbar.showResourcesButton = false // 显示资源按钮
  782. options.toolbar.showFullScreenButton = false // 显示全屏按钮
  783. options.toolbar.showOpenButton = false // 显示打开按钮
  784. options.appearance.showTooltips = false // 显示工具提示
  785. options.appearance.showDialogsHelp = false // 显示对话框帮助
  786. options.exports.showExportToDocument = false // 显示导出到文档
  787. options.toolbar.showParametersButton = true // 显示参数按钮
  788. options.appearance.bookmarksPrint = true // 书签打印
  789. // options.toolbar.showPrintButton = false // 打印按钮是否显示 下面直接自定义控制打印弹窗是否开启
  790. // printDestination 参数:用于指定报表打印的目标位置,可以是打印机、PDF 文件或者直接打印到浏览器等。
  791. // Stimulsoft.Viewer.StiPrintDestination.Direct:表示直接打印到打印机,即将报表内容直接发送至打印机进行打印。
  792. // 通过设置不同的 printDestination 参数,你可以控制报表打印的行为,例如是直接打印到打印机,还是生成 PDF 文件,或者直接在浏览器中预览打印内容等。
  793. options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
  794. // htmlRenderMode html渲染模式
  795. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  796. // 是创建一个 Stimulsoft 报表查看器的实例的代码
  797. let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
  798. // 报表
  799. console.log("创建一个报表实例");
  800. console.log()
  801. let report = new window.Stimulsoft.Report.StiReport();
  802. // 加载文件
  803. console.log("从url加载报表");
  804. // report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  805. report.load(url)
  806. data.pageOne = 'Page : 1 of 1'
  807. // 处理超长数据
  808. if (data.hshipperDetails) {
  809. var consignerIndex2 = data.hshipperDetails.indexOf( '\n' )
  810. for (let i = 0; i < 4; i++) {
  811. consignerIndex2 = data.hshipperDetails.indexOf( '\n', consignerIndex2 + 1 );
  812. }
  813. if (consignerIndex2 != -1) {
  814. var hshipperDetails = data.hshipperDetails.substring(consignerIndex2 + 2, data.hshipperDetails.length)
  815. data.hshipperDetails = data.hshipperDetails.substring(0, consignerIndex2) + ' *'
  816. data.commodityDescr += '\n*' + hshipperDetails
  817. }
  818. }
  819. if (data.hconsigneeDetails) {
  820. var consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n' )
  821. for (let i = 0; i < 3; i++) {
  822. consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n', consigneeIndex2 + 1 );
  823. }
  824. if (consigneeIndex2 != -1) {
  825. var hconsigneeDetails = data.hconsigneeDetails.substring(consigneeIndex2 + 2, data.hconsigneeDetails.length)
  826. data.hconsigneeDetails = data.hconsigneeDetails.substring(0, consigneeIndex2) + ' **'
  827. data.commodityDescr += '\n**' + hconsigneeDetails
  828. }
  829. }
  830. if (data.hnotifyDetails) {
  831. var notifierIndex2 = data.hnotifyDetails.indexOf( '\n' )
  832. for (let i = 0; i < 3; i++) {
  833. notifierIndex2 = data.hnotifyDetails.indexOf( '\n', notifierIndex2 + 1 );
  834. }
  835. if (notifierIndex2 != -1) {
  836. var hnotifyDetails = data.hnotifyDetails.substring(notifierIndex2 + 2, data.hnotifyDetails.length)
  837. data.hnotifyDetails = data.hnotifyDetails.substring(0, notifierIndex2) + ' ***'
  838. data.commodityDescr += '\n***' + hnotifyDetails
  839. }
  840. }
  841. // 处理箱号
  842. if (this.isPrintTheBoxNumber) {
  843. data.commodityDescr += '\n.\n.\n'
  844. }
  845. // PLACE & DATE OF ISSUE
  846. data.placeAndDateOfIssue = ''
  847. if (data.issueAt) {
  848. data.placeAndDateOfIssue += data.issueAt
  849. }
  850. if (data.issueDate) {
  851. let date = new Date(data.issueDate.replace(/-/g,'/'));
  852. let yyyy = date.getFullYear();
  853. let mmmm = date.toDateString().split(" ")[1]
  854. let dd = date.getDate()
  855. data.placeAndDateOfIssue += ', ' + dd + '-' + mmmm + '-' + yyyy
  856. }
  857. // Total number of containers or packages received by the Carriers
  858. if (data.preContainersList) {
  859. let boxMap = new Map();
  860. for (let boxQuantity of data.preContainersList) {
  861. if (boxMap.get(boxQuantity.cntrTypeCode)) {
  862. let v = boxMap.get(boxQuantity.cntrTypeCode)
  863. boxMap.set(boxQuantity.cntrTypeCode, v + boxQuantity.quantity)
  864. } else {
  865. boxMap.set(boxQuantity.cntrTypeCode, boxQuantity.quantity)
  866. }
  867. }
  868. let boxs = ''
  869. boxMap.forEach(function (value, key, map) {
  870. boxs += value + 'x' + key + ', '
  871. })
  872. boxs = boxs.substring(0, boxs.length - 2)
  873. data.boxQuantity = boxs + ' CONTAINER(S) ONLY'
  874. }
  875. // Number of original B/Ls
  876. if (data.numberOfObl) {
  877. data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
  878. }
  879. if (data.commodityDescr) {
  880. var descriptionIndex2 = data.commodityDescr.indexOf( '\n' )
  881. for (let i = 0; i < 19; i++) {
  882. descriptionIndex2 = data.commodityDescr.indexOf( '\n', descriptionIndex2 + 1 );
  883. }
  884. if (descriptionIndex2 != -1) {
  885. data.pageOne = 'Page : 1 of 2'
  886. data.pageTwo = 'Page : 2 of 2'
  887. var extraLongText = data.commodityDescr.substring(descriptionIndex2 + 2, data.commodityDescr.length)
  888. data.commodityDescr = data.commodityDescr.substring(0, descriptionIndex2)
  889. data.extraLongTips = '** TO BE CONTINUED ON ATTACHED LIST **'
  890. data.extraLongText = extraLongText
  891. }
  892. }
  893. // console.log(data.hshipperDetails, 'hshipperDetails2')
  894. // 创建一个 Stimulsoft 数据集(DataSet)的实例的代码
  895. var dataSet = new Stimulsoft.System.Data.DataSet(
  896. 'reportData'
  897. )
  898. dataSet.readJson(data) // 用于将 JSON 格式的数据加载到数据集中。data 是包含报表数据的 JSON 对象。
  899. // 这是一个方法调用,用于在报表中注册数据源。参数 'reportData' 是数据源的名称,
  900. // 第二个 'reportData' 是数据源的别名,dataSet 则是之前创建的数据集实例
  901. report.regData('reportData', 'reportData', dataSet)
  902. // 从模版和数据加载报表
  903. // loadReport(report, '', {})
  904. // 这是将报表对象指定给报表查看器的属性。viewer 是报表查看器的实例,而 report 是之前创建的报表对象。
  905. viewer.report = report;
  906. this.$refs.reportContainer.showContainer(
  907. ()=> {
  908. setTimeout(() => {
  909. viewer.renderHtml('reportContainer')
  910. this.createViewerButtons(viewer)
  911. }, 50)
  912. },
  913. ()=>{
  914. },
  915. )
  916. console.log("加载成功完成!");
  917. },
  918. createViewerButtons (viewer){
  919. viewer.jsObject.collections.images['myClose.png'] =
  920. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
  921. const closeBtn = viewer.jsObject.SmallButton(
  922. 'closeBtn',
  923. '关闭',
  924. 'myClose.png'
  925. )
  926. // 增加打印弹窗配置
  927. const printBtn = viewer.jsObject.SmallButton(
  928. 'printBtn',
  929. '打印报表',
  930. 'myClose.png'
  931. )
  932. // console.log(viewer.jsObject.print(),'1013')
  933. // 获取 关闭按钮的dom元素位置
  934. const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
  935. const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
  936. const userButtonCell = buttonsTable.rows[0].insertCell(0)
  937. // 获取打印按钮的位置
  938. const buttonsTablePrint = toolbarTable.rows[0].childNodes[0].lastChild // 打印按钮
  939. const userButtonPrint = buttonsTablePrint.rows[0].childNodes[0] // 打印按钮dom位置
  940. userButtonPrint.addEventListener("click", (event)=>{
  941. console.log("打印点击");
  942. // event.preventDefault()
  943. });
  944. userButtonPrint.addEventListener("mouseover", (event) => {
  945. console.log("移入打印按钮");
  946. console.log(event,1035)
  947. });
  948. userButtonCell.className = 'stiJsViewerClearAllStyles'
  949. userButtonCell.appendChild(closeBtn) // 添加关闭节点
  950. // userButtonPrint.prepend(printBtn) // 在 printBtn 节点里最前面增加一个子级节点
  951. let that=this
  952. // 关闭按钮的监听点击
  953. closeBtn.action = function() {
  954. console.log(that.$refs.ReportContainer,'1022')
  955. if (that.$refs.reportContainer)
  956. that.$refs.reportContainer.hideContainer()
  957. }
  958. // // // 打印按钮监听
  959. // printBtn.action = (e)=>{
  960. // console.log('打印')
  961. // window.print()
  962. // }
  963. },
  964. }
  965. }
  966. </script>
  967. <style scoped>
  968. ::v-deep.el-form-item {
  969. margin-bottom: 0;
  970. }
  971. .bottomFlex {
  972. display: flex;
  973. align-items: center;
  974. }
  975. .weightfont {
  976. font-size: 20px;
  977. font-weight: bold;
  978. }
  979. .weightnum {
  980. font-size: 18px;
  981. font-weight: 500;
  982. }
  983. /deep/.el-dialog .el-dialog__body {
  984. padding: 0px 20px;
  985. }
  986. </style>