settlementDetails.vue 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411
  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" v-if="roleName.indexOf('admin') != -1"
  14. :loading="saveLoading" :disabled="!form.id" @click="DesignreportDialog = true" >报表设计
  15. </el-button>
  16. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="!form.id || form.isCleared != 1" v-if="!form.voucherNo"
  17. :loading="saveLoading" @click="generateVoucherfun">生成凭证
  18. </el-button>
  19. <span v-else style="font-size: 12px;margin-right: 8px;" >已生成凭证</span>
  20. <el-button size="small" type="warning" plain style="margin-right: 8px" :disabled="!form.id || editPower" v-if="form.isCleared == 1"
  21. :loading="saveLoading" @click="finstlbillsRevokeSettlementfun">撤销结算
  22. </el-button>
  23. <el-button size="small" type="success" plain style="margin-right: 8px" :disabled="!form.id || editPower" v-else
  24. :loading="saveLoading" @click="editCustomer('结算')">确认结算
  25. </el-button>
  26. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="form.isCleared == 1 || editPower" v-if="editSave"
  27. :loading="saveLoading" @click="editHandle">编 辑
  28. </el-button>
  29. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="form.isCleared == 1" v-else
  30. :loading="saveLoading" @click="editCustomer()">保 存
  31. </el-button>
  32. </div>
  33. </div>
  34. <div style="margin: 55px 5px 0px 5px;'">
  35. <el-card class="box-card">
  36. <el-form :model="form" ref="form" label-width="90px" :rules="rules" class="demo-ruleForm">
  37. <el-row>
  38. <el-row>
  39. <el-col :span="5">
  40. <el-form-item label="往来单位" prop="corpCnName">
  41. <search-query :datalist="corpData"
  42. :selectValue="form.corpCnName"
  43. :clearable="true"
  44. :disabled="editSave || tableData.length != 0 || tableData.length > 0"
  45. :filterable="true"
  46. :remote="true"
  47. :buttonIf="false"
  48. placeholder="请选择往来单位"
  49. :forParameter="{ key:'id', label:'cnName', value:'cnName'}"
  50. @corpChange="corpChange($event,'corpCnName')"
  51. @remoteMethod="corpBcorpsListfun"
  52. @corpFocus="corpBcorpsListfun" >
  53. </search-query>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="10">
  57. <el-form-item label="开户帐号" prop="bankId">
  58. <search-query :datalist="bankData"
  59. :selectValue="form.bankId"
  60. :clearable="true"
  61. :disabled="editSave || !form.corpId"
  62. :filterable="true"
  63. :buttonIf="false"
  64. :allowCreate="true"
  65. placeholder="请选择开户帐号"
  66. :forParameter="{ key:'id', label:'accountBankNo', value:'id'}"
  67. @corpChange="corpChange($event,'bankId')"
  68. @corpFocus="bcorpsbankListfun" >
  69. </search-query>
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="9">
  73. <el-form-item label="事由" prop="remarks">
  74. <el-input style="width: 100%;" v-model="form.remarks"
  75. size="small" autocomplete="off"
  76. :disabled="editSave"
  77. clearable placeholder="请输入事由" >
  78. </el-input>
  79. </el-form-item>
  80. </el-col>
  81. <el-col :span="4">
  82. <el-form-item label="业务开始" prop="businessDateStart">
  83. <el-date-picker v-model="form.businessDateStart" clearable
  84. style="width: 100%;"
  85. type="date" size="small"
  86. :disabled="editSave || tableData.length > 0"
  87. format="yyyy-MM-dd"
  88. value-format="yyyy-MM-dd"
  89. placeholder="选择业务开始日期">
  90. </el-date-picker>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="4">
  94. <el-form-item label="业务结束" prop="businessDateEnd">
  95. <el-date-picker v-model="form.businessDateEnd" clearable
  96. style="width: 100%;"
  97. type="date" size="small"
  98. :disabled="editSave || tableData.length > 0"
  99. format="yyyy-MM-dd"
  100. value-format="yyyy-MM-dd"
  101. placeholder="选择业务结束日期">
  102. </el-date-picker>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="3">
  106. <el-form-item label="收/付" prop="queryAmount">
  107. <search-query :datalist="dcData"
  108. :selectValue="form.dc"
  109. :filterable="true"
  110. :clearable="true"
  111. :remote="true"
  112. :buttonIf="false"
  113. :disabled="editSave || tableData.length > 0"
  114. placeholder="请选择收/付"
  115. @corpChange="corpChange($event,'dc')">
  116. </search-query>
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="3">
  120. <el-form-item label="币别" prop="curCode">
  121. <search-query :datalist="curCodeData"
  122. :selectValue="form.curCode"
  123. :clearable="true"
  124. :disabled="editSave || tableData.length > 0"
  125. :buttonIf="false"
  126. :filterable="true"
  127. :remote="true"
  128. placeholder="请选择币别"
  129. :forParameter="{ key:'id', label:'code', value:'code'}"
  130. @corpChange="corpChange($event,'curCode')"
  131. @remoteMethod="getRateListfun"
  132. @corpFocus="getRateListfun" >
  133. </search-query>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="5">
  137. <el-form-item label="业务编号" prop="businessNo">
  138. <el-input style="width: 100%;" v-model="form.businessNo"
  139. size="small" autocomplete="off"
  140. :disabled="editSave || tableData.length > 0"
  141. clearable placeholder="请输入业务编号" >
  142. </el-input>
  143. </el-form-item>
  144. </el-col>
  145. <el-col :span="5">
  146. <el-form-item label="ACCT NO" prop="accountNo">
  147. <el-input style="width: 100%;" v-model="form.accountNo"
  148. size="small" autocomplete="off"
  149. :disabled="editSave || tableData.length > 0"
  150. clearable placeholder="请输入ACCT NO" >
  151. </el-input>
  152. </el-form-item>
  153. </el-col>
  154. <el-col :span="5">
  155. <el-form-item label="MBL NO" prop="mblno">
  156. <el-input style="width: 100%;" v-model="form.mblno"
  157. size="small" autocomplete="off"
  158. :disabled="editSave || tableData.length > 0"
  159. clearable placeholder="请输入MBL NO" >
  160. </el-input>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="5">
  164. <el-form-item label="HBL NO" prop="hblno">
  165. <el-input style="width: 100%;" v-model="form.hblno"
  166. size="small" autocomplete="off"
  167. :disabled="editSave || tableData.length > 0"
  168. clearable placeholder="请输入HBL NO" >
  169. </el-input>
  170. </el-form-item>
  171. </el-col>
  172. <el-col :span="4">
  173. <el-form-item label="对账单号" prop="checkNo">
  174. <el-input style="width: 100%;" v-model="form.checkNo"
  175. size="small" autocomplete="off"
  176. :disabled="editSave || tableData.length > 0"
  177. clearable placeholder="请输入对账单号" >
  178. </el-input>
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="5">
  182. <el-form-item label="业务类型" prop="businessTypes" >
  183. <search-query :datalist="businessTypesData"
  184. :selectValue="form.businessTypes"
  185. :clearable="true"
  186. :disabled="editSave || tableData.length > 0"
  187. :buttonIf="false"
  188. :multiple="true"
  189. placeholder="请选择业务类型"
  190. @corpChange="corpChange($event,'businessTypes')">
  191. </search-query>
  192. </el-form-item>
  193. </el-col>
  194. <el-col :span="5">
  195. <el-form-item label="船 名" prop="vesselCnName" >
  196. <el-input style="width: 100%;" v-model="form.vesselCnName"
  197. size="small" autocomplete="off"
  198. :disabled="editSave || tableData.length > 0"
  199. clearable placeholder="请选择船名" ></el-input>
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. <expand :showBtn="true" :showSpan="true">
  204. <el-row>
  205. <el-col :span="5">
  206. <el-form-item label="航 次" prop="voyageNo" >
  207. <el-input style="width: 100%;" v-model="form.voyageNo"
  208. size="small" autocomplete="off"
  209. :disabled="editSave || tableData.length > 0"
  210. clearable placeholder="请输入航次" ></el-input>
  211. </el-form-item>
  212. </el-col>
  213. </el-row>
  214. </expand>
  215. <el-row>
  216. <el-col span="24">
  217. <div style="text-align: right">
  218. <!--<el-button size="small" type="" style="margin-right: 8px" :disabled="settlementdistar || editSave"-->
  219. <!-- :loading="saveLoading" @click="ResetFilter">重置条件-->
  220. <!--</el-button>-->
  221. <el-checkbox v-model="appendType" :disabled="settlementdistar || editSave" false-label="检索" true-label="追加">追加</el-checkbox>
  222. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="settlementdistar || editSave"
  223. :loading="saveLoading" @click="retrievalfun" >检 索
  224. </el-button>
  225. </div>
  226. </el-col>
  227. </el-row>
  228. </el-row>
  229. </el-form>
  230. </el-card>
  231. <el-card style="margin-top: 10px">
  232. <div style="margin-bottom: 10px">
  233. <el-button size="small" type="info" :disabled="editSave"
  234. :loading="saveLoading" @click="SelectedRows">确认选定行
  235. </el-button>
  236. <el-button size="small" type="danger" style="margin-left: 10px" :disabled="editSave"
  237. :loading="saveLoading" @click="batchDeletefun" >一键删除
  238. </el-button>
  239. <el-input style="width: 10%;margin-left: 10px;" v-model="invoiceAmountCNY"
  240. size="small" autocomplete="off" type="numbers"
  241. clearable placeholder="开票金额" >
  242. <span style="line-height: 32px;" slot="suffix" >CNY</span>
  243. </el-input>
  244. <el-input style="width: 10%;margin-left: 5px;" v-model="invoiceAmountUSD"
  245. size="small" autocomplete="off" type="numbers"
  246. clearable placeholder="开票金额" >
  247. <span style="line-height: 32px;" slot="suffix" >USD</span>
  248. </el-input>
  249. <el-button style="margin-left: 10px" :disabled="editSave" size="small" type="primary" @click="invoiceMatchingfun()" >匹配金额</el-button>
  250. </div>
  251. <finstlbillsitems ref="finstlbillsitems" :tableData="tableData"
  252. :editSave="editSave"
  253. :settlementdistar="settlementdistar"
  254. :handleSelectionData="handleSelectionData"
  255. @handleSelectionChange="handleSelectionChange"
  256. @deletefun="finstlbillsitemsRemovefun">
  257. </finstlbillsitems>
  258. </el-card>
  259. </div>
  260. <el-card style="margin-top: 10px">
  261. <el-row>
  262. <el-col :span="3">
  263. <div class="bottomFlex" style="color: #6BBCD1">
  264. <span>应付:</span>
  265. <span class="weightnum">¥{{form.amountCr || 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.amountCrUsd || 0}}</span>
  272. </div>
  273. </el-col>
  274. <el-col :span="3">
  275. <div class="bottomFlex" style="color: #6BBCD1">
  276. <span>应付合计:</span>
  277. <span class="weightnum">¥{{form.amountCrLoc || 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.amountDr || 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.amountDrUsd || 0}}</span>
  290. </div>
  291. </el-col>
  292. <el-col :span="3">
  293. <div class="bottomFlex" style="color: #81B337">
  294. <span>应收合计:</span>
  295. <span class="weightnum">¥{{form.amountDrLoc || 0}}</span>
  296. </div>
  297. </el-col>
  298. </el-row>
  299. </el-card>
  300. <!--选择数据弹窗-->
  301. <el-dialog
  302. title="选择数据"
  303. class="el-dialogDeep"
  304. :visible.sync="retrievePopupsType"
  305. append-to-body
  306. width="70%"
  307. :close-on-click-modal="false">
  308. <div>
  309. <avue-crud
  310. :option="retrievePopupsOption"
  311. :data="retrievePopupsData"
  312. ref="retrievePopupsRef"
  313. id="out-table">
  314. <template slot="menu" slot-scope="{ row }">
  315. <el-button
  316. type="text"
  317. size="small"
  318. @click.stop="retrievePopupsSelect(row)"
  319. >选择
  320. </el-button>
  321. </template>
  322. </avue-crud>
  323. </div>
  324. </el-dialog>
  325. <!--设计报表弹窗-->
  326. <el-dialog append-to-body title="设计报表" class="el-dialogDeep" :visible.sync="DesignreportDialog" width="70%"
  327. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  328. <reports :id="form.id" :assemblyForm="form" businessValue="JSZX"></reports>
  329. </el-dialog>
  330. <!--预览-->
  331. <el-dialog
  332. title="打印"
  333. :visible.sync="selectPrintingDialog"
  334. append-to-body
  335. width="70%"
  336. :close-on-click-modal="false"
  337. :destroy-on-close="true"
  338. :close-on-press-escape="false"
  339. v-dialog-drag>
  340. <div>
  341. <reportformsList ref="reportformsList" @reportRadio="reportRadio"></reportformsList>
  342. </div>
  343. <span slot="footer" class="dialog-footer">
  344. <el-button size="small" @click="selectPrintingDialog = false;">取 消</el-button>
  345. </span>
  346. </el-dialog>
  347. <!--报表组件-->
  348. <reportContainer ref="reportContainer"></reportContainer>
  349. </div>
  350. </template>
  351. <script>
  352. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  353. import {getRateList} from "@/api/iosBasicData/rateManagement";
  354. import {bcorpsbankList, getBcorpslistByType} from "@/api/iosBasicData/bcorps";
  355. import {
  356. finstlbillsDetail,
  357. finstlbillsitemsRemove,
  358. finstlbillslistAccBillV1,
  359. finstlbillsSubmit,
  360. finstlbillsConfirmSettlement,
  361. finstlbillsRevokeSettlement,
  362. finstlbillsGetByDetail,
  363. finstlbillslistAccBillByCorp, finstlbillsGenerateVoucher
  364. } from '@/api/iosBasicData/finstlbills'
  365. import expand from "@/components/basic-container/expand.vue";
  366. import finstlbillsitems from "@/views/iosBasicData/PaymentApplication/assembly/finstlbillsitems.vue";
  367. import reports from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reports.vue";
  368. import reportformsList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsList.vue";
  369. import {getList as getreportsList, reportsGetReportData} from "@/api/iosBasicData/reports";
  370. import reportContainer from "@/views/iosBasicData/report-container/report-container.vue";
  371. import { generateFinStlBills} from "@/api/iosBasicData/fininvoices";
  372. export default {
  373. components: {reportContainer, reportformsList, reports, SearchQuery,expand,finstlbillsitems},
  374. props:{
  375. // 编辑还是保存
  376. editSave:{
  377. type:Boolean,
  378. default:true
  379. },
  380. },
  381. data(){
  382. return {
  383. retrievePopupsType:false, // 弹窗开启关闭
  384. retrievePopupsData:[], // 选择弹窗数据
  385. retrievePopupsOption: {
  386. border: true,
  387. calcHeight: 30,
  388. tip: false,
  389. height: 'auto',
  390. index: true,
  391. addBtn: false,
  392. viewBtn: false,
  393. delBtn: false,
  394. editBtn: false,
  395. refreshBtn: false,
  396. columnBtn: false,
  397. menuWidth: '60',
  398. column: [
  399. {
  400. label: "客户中文名",
  401. prop: "cnName",
  402. overHidden: true,
  403. },
  404. {
  405. label: "客户英文文名",
  406. prop: "cnName",
  407. overHidden: true,
  408. },
  409. ]
  410. },
  411. invoiceAmountCNY:0, // 费用明细开票金额输入框CNY
  412. invoiceAmountUSD:0, // 费用明细开票金额输入框USD
  413. settlementdistar:false, // 结算挑进来的
  414. DesignreportDialog:false, // 设计报表弹窗
  415. selectPrintingDialog:false, // 预览报表
  416. // 收/付数据
  417. dcData: [{
  418. label: '全部',
  419. value: null
  420. },{
  421. label: '收',
  422. value: 'D'
  423. }, {
  424. label: '付',
  425. value: 'C'
  426. }],
  427. appendType:'检索', // 是否追加
  428. tableData:[],
  429. pageLoading:false, // 全屏加载动画
  430. saveLoading:false, // 按钮动画
  431. // 绑定的数据
  432. form:{
  433. dc:null
  434. },
  435. handleSelectionData:[], // 表格选择的数据
  436. corpData:[], // 结算单位 数据
  437. bankData:[], // 查询银行数据
  438. curCodeData:[],// 币别
  439. srcforParameter:{},
  440. // 业务类型
  441. businessTypesData:[
  442. {
  443. label:'海运出口',
  444. value:'SE'
  445. },{
  446. label:'海运进口',
  447. value:'SI'
  448. }
  449. ],
  450. rules: {
  451. corpCnName: [
  452. {required: true, message: '请输入付费对象', trigger: 'blur'},
  453. ],
  454. bankId: [
  455. {required: true, message: '请输入开户银行', trigger: 'blur'},
  456. ],
  457. remarks: [
  458. {required: true, message: '请输入付费事由', trigger: 'blur'},
  459. ],
  460. estimatedTime: [
  461. {required: true, message: '请输入预计收回', trigger: 'blur'},
  462. ],
  463. collectionSituation: [
  464. {required: true, message: '请输入收款情况', trigger: 'blur'},
  465. ],
  466. },
  467. roleName:[], // 当前的角色权限
  468. saberUserInfo:{}, // 当前登录人信息
  469. editPower:false, // 当前是否可以编辑
  470. }
  471. },
  472. created() {
  473. this.roleName = localStorage.getItem('roleName').split(',')
  474. // 获取当前登录人个人信息
  475. this.saberUserInfo = JSON.parse(localStorage.getItem('saber-userInfo')).content
  476. },
  477. methods:{
  478. // 打印
  479. reportRadio(val){
  480. // 获取报表数据
  481. reportsGetReportData({
  482. billId:this.form.id,
  483. reportCode:val.classifyCode,
  484. groupCode:val.groupCode,
  485. type:'JSZX'
  486. }).then(res=>{
  487. this.handleReportPreview(val.url,res.data.data.data)
  488. })
  489. },
  490. // 报表预览
  491. previewreportfun(){
  492. getreportsList(1,10,{
  493. businessType:'JSZX',
  494. // classifyCode:'结算中心',
  495. // groupCode:'付费结算'
  496. }).then(res=>{
  497. if (res.data.data.records.length == 1){
  498. this.reportRadio(res.data.data.records[0])
  499. }else {
  500. this.saveLoading = true
  501. this.selectPrintingDialog = true
  502. this.saveLoading = false
  503. let page = {
  504. pageSize: 10,
  505. currentPage: 1,
  506. total: 0
  507. }
  508. this.$nextTick(()=>{
  509. this.$refs.reportformsList.onLoad(page,{
  510. businessType:'JSZX',
  511. // classifyCode:'结算中心',
  512. // groupCode:'付费结算'
  513. })
  514. })
  515. }
  516. })
  517. },
  518. // 费用明细开票匹配
  519. invoiceMatchingfun(){
  520. if (this.invoiceAmountCNY != 0 || this.invoiceAmountUSD != 0) {
  521. let dataCNY = JSON.parse(JSON.stringify(this.invoiceAmountCNY))
  522. let dataUSD = JSON.parse(JSON.stringify(this.invoiceAmountUSD))
  523. for (let item of this.tableData) {
  524. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,false)
  525. if (this.invoiceAmountCNY != 0) {
  526. if (dataCNY < 0) {
  527. dataCNY = 0
  528. }
  529. if (dataCNY > 1500) {
  530. if (item.currentStlCurCode == 'CNY') {
  531. this.$set(item,'currentStlAmountRMB',1500)
  532. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  533. dataCNY -= 1500
  534. }
  535. }else {
  536. if (item.currentStlCurCode == 'CNY') {
  537. if (dataCNY != 0) {
  538. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  539. }
  540. this.$set(item,'currentStlAmountRMB',dataCNY)
  541. dataCNY -= 1500
  542. }
  543. }
  544. }
  545. if (this.invoiceAmountUSD != 0) {
  546. if (dataUSD < 0) {
  547. dataUSD = 0
  548. }
  549. if (dataUSD > 1500) {
  550. if (item.currentStlCurCode == 'USD') {
  551. this.$set(item,'currentStlAmountUSD',1500)
  552. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  553. dataUSD -= 1500
  554. }
  555. }else {
  556. if (item.currentStlCurCode == 'USD') {
  557. this.$set(item,'currentStlAmountUSD',dataUSD)
  558. if (dataUSD != 0) {
  559. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  560. }
  561. dataUSD -= 1500
  562. }
  563. }
  564. }
  565. }
  566. }
  567. },
  568. // 一键删除
  569. batchDeletefun(){
  570. if (this.handleSelectionData.length == 0) {
  571. return this.$message.warning('请选择要删除的数据')
  572. }
  573. this.$confirm("确定将选择数据删除?", {
  574. confirmButtonText: "确定",
  575. cancelButtonText: "取消",
  576. type: "warning"
  577. }).then(()=>{
  578. // 获取有id 的数据
  579. const itemsWithId = this.handleSelectionData.filter(item => item.hasOwnProperty('id'));
  580. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  581. // 把选中的删除掉
  582. this.handleSelectionData.forEach((item)=>{
  583. for (let index in this.tableData) {
  584. if (item.accBillNo == this.tableData[index].accBillNo) {
  585. this.tableData.splice(Number(index),1)
  586. }
  587. }
  588. })
  589. // 有id 的处理
  590. if(itemsWithId.length != 0) {
  591. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  592. this.$message.success('操作成功')
  593. })
  594. }
  595. })
  596. },
  597. // 删除
  598. finstlbillsitemsRemovefun(id,index){
  599. this.$confirm("确定将选择数据删除?", {
  600. confirmButtonText: "确定",
  601. cancelButtonText: "取消",
  602. type: "warning"
  603. }).then(()=>{
  604. if (id) {
  605. finstlbillsitemsRemove(id).then(res=>{
  606. this.$message.success('操作成功')
  607. })
  608. }
  609. this.tableData.splice(index,1)
  610. })
  611. },
  612. // 下拉回调
  613. corpChange(value,name){
  614. // 结算单位
  615. if (name == 'corpCnName') {
  616. // 开户银行
  617. this.$set(this.form,'bankId','')
  618. this.$set(this.form,'bankAccountName','')
  619. this.$set(this.form,'bankAccountBank','')
  620. this.$set(this.form,'bankAccountNo','')
  621. if (!value) {
  622. this.$set(this.form,'corpId','')
  623. this.$set(this.form,'corpCnName','')
  624. this.$set(this.form,'corpEnName','')
  625. this.$set(this.form,'corpArgreementNo','')
  626. }
  627. for(let item of this.corpData) {
  628. if (item.cnName == value) {
  629. this.$set(this.form,'corpId',item.id)
  630. this.$set(this.form,'corpCnName',item.cnName)
  631. this.$set(this.form,'corpEnName',item.enName)
  632. this.$set(this.form,'corpArgreementNo',item.enName)
  633. this.bcorpsbankListfun()
  634. }
  635. }
  636. }
  637. else if (name == 'bankId') {
  638. if (!value) {
  639. this.$set(this.form,'bankId','')
  640. this.$set(this.form,'bankAccountName','')
  641. this.$set(this.form,'bankAccountBank','')
  642. this.$set(this.form,'bankAccountNo','')
  643. }
  644. for(let item of this.bankData) {
  645. if (item.id == value) {
  646. this.$set(this.form,'bankId',item.id)
  647. this.$set(this.form,'bankAccountName',item.accountName)
  648. this.$set(this.form,'bankAccountBank',item.accountBank)
  649. this.$set(this.form,'bankAccountNo',item.accountNo)
  650. }
  651. }
  652. }
  653. else {
  654. this.$set(this.form,name,value)
  655. }
  656. },
  657. // 编辑
  658. editHandle(){
  659. this.editSave = false
  660. },
  661. // 保存
  662. editCustomer(type){
  663. this.$refs.form.validate((valid) => {
  664. if (!valid) return
  665. if (!this.form.id) {
  666. // 是否选择从表数据
  667. if (this.handleSelectionData.length == 0) {
  668. this.$message.warning('请选择结算数据');
  669. return;
  670. }
  671. }
  672. for (let item of this.handleSelectionData) {
  673. if (!item.currentStlCurCode) {
  674. this.$message.warning('请选择本次结算币种');
  675. return;
  676. }
  677. }
  678. this.saveLoading = true // 打开按钮动画
  679. if(this.form.estimatedTime) {
  680. this.form.estimatedTime = this.form.estimatedTime + ' 00:00:00'
  681. }
  682. this.saveLoading = true // 加载动画
  683. this.form.billNoFormat = 'STL'
  684. this.form.businessTypeCode = 'STL'
  685. this.form.businessType = 'STL' // 结算单
  686. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  687. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  688. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  689. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  690. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  691. this.form.settlementType = this.settlementType
  692. if (this.form.id) {
  693. this.form.finStlBillsItemsList = this.form.finStlBillsItemsList.map((item,index)=>{
  694. if (item.currentStlCurCode == 'CNY') {
  695. item.currentStlAmount = item.currentStlAmountRMB
  696. }else {
  697. item.currentStlAmount = item.currentStlAmountUSD
  698. }
  699. return item
  700. })
  701. }else {
  702. this.form.finStlBillsItemsList = this.handleSelectionData.map((item,index)=>{
  703. if (item.currentStlCurCode == 'CNY') {
  704. item.currentStlAmount = item.currentStlAmountRMB
  705. }else {
  706. item.currentStlAmount = item.currentStlAmountUSD
  707. }
  708. if (!this.form.id) {
  709. delete item.businessType
  710. delete item.billDate
  711. delete item.accountDc
  712. }
  713. return item
  714. })
  715. }
  716. // 判断是结算还是保存
  717. if (type == '结算') {
  718. this.$confirm("确定进行结算操作?", {
  719. confirmButtonText: "确定",
  720. cancelButtonText: "取消",
  721. type: "warning"
  722. }).then(()=>{
  723. finstlbillsSubmit(this.form).then(res=>{
  724. this.form = res.data.data
  725. this.finstlbillsConfirmSettlementfun()
  726. })
  727. }).catch(()=>{
  728. this.saveLoading = false // 关闭按钮动画
  729. })
  730. }else {
  731. finstlbillsSubmit(this.form).then(res=>{
  732. this.$message.success('操作成功');
  733. this.saveLoading = false // 关闭按钮动画
  734. this.finstlbillsDetailfun(res.data.data.id)
  735. })
  736. }
  737. })
  738. },
  739. // 详情接口
  740. finstlbillsDetailfun(id){
  741. this.pageLoading = true
  742. finstlbillsDetail(id).then(res=>{
  743. this.form = res.data.data
  744. if (this.roleName.indexOf('admin') == -1?this.roleName.indexOf('允许修改他人业务') == -1?this.saberUserInfo.user_id != this.form.createUser:false:false) {
  745. this.editPower = true
  746. }else {
  747. this.editPower = false
  748. }
  749. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.split(','):[] // 业务类型转换成数组显示
  750. this.tableData = this.form.finStlBillsItemsList.map(item=>{
  751. item.stlTtlAmountNet = Number(item.stlTtlAmount) - (Number(item.stlTtlAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  752. item.currentStlAmountNet = Number(item.unsettledAmount) - (Number(item.unsettledAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  753. if(item.curCode == 'CNY') {
  754. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  755. this.$set(item,'amountRMB',item.amount)
  756. this.$set(item,'amountNetRMB',item.amountNet)
  757. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  758. this.$set(item,'stlTtlAmountNetRMB',item.stlTtlAmountNet)
  759. this.$set(item,'currentStlAmountNetRMB',item.currentStlAmountNet)
  760. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  761. }else {
  762. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  763. this.$set(item,'amountUSD',item.amount)
  764. this.$set(item,'amountNetUSD',item.amountNet)
  765. this.$set(item,'stlTtlAmountNetUSD',item.stlTtlAmountNet)
  766. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  767. this.$set(item,'currentStlAmountNetUSD',item.currentStlAmountNet)
  768. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  769. }
  770. if (item.srcIdInvoices) {
  771. this.settlementdistar = true
  772. }
  773. return item
  774. })
  775. this.pageLoading = false
  776. this.bcorpsbankListfun() // 查银行数据
  777. }).catch(err=>{
  778. this.pageLoading = false
  779. })
  780. },
  781. // 结算按钮
  782. generateFinStlBillsfun(id,dc){
  783. this.pageLoading = true
  784. if (dc == 'C' || dc == 'D') {
  785. this.settlementType = dc
  786. }
  787. generateFinStlBills({
  788. billId:id,
  789. dc:dc
  790. }).then(res=>{
  791. this.form = res.data.data
  792. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.split(','):[] // 业务类型转换成数组显示
  793. this.tableData = this.form.finStlBillsItemsList.map(item=>{
  794. item.stlTtlAmountNet = Number(item.stlTtlAmount) - (Number(item.stlTtlAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  795. item.currentStlAmountNet = Number(item.unsettledAmount) - (Number(item.unsettledAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  796. if(item.curCode == 'CNY') {
  797. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  798. this.$set(item,'amountRMB',item.amount)
  799. this.$set(item,'amountNetRMB',item.amountNet)
  800. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  801. this.$set(item,'stlTtlAmountNetRMB',item.stlTtlAmountNet)
  802. this.$set(item,'currentStlAmountNetRMB',item.currentStlAmountNet)
  803. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  804. }else {
  805. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  806. this.$set(item,'amountUSD',item.amount)
  807. this.$set(item,'amountNetUSD',item.amountNet)
  808. this.$set(item,'stlTtlAmountNetUSD',item.stlTtlAmountNet)
  809. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  810. this.$set(item,'currentStlAmountNetUSD',item.currentStlAmountNet)
  811. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  812. }
  813. if (item.srcIdInvoices) {
  814. this.settlementdistar = true
  815. }
  816. return item
  817. })
  818. this.pageLoading = false
  819. this.bcorpsbankListfun() // 查银行数据
  820. }).catch(err=>{
  821. this.pageLoading = false
  822. })
  823. },
  824. // 重置条件
  825. ResetFilter(){
  826. this.form = {}
  827. },
  828. // 弹窗选择
  829. retrievePopupsSelect(row){
  830. // this.form = row
  831. this.$set(this.form,'corpId',row.id)
  832. this.$set(this.form,'corpCnName',row.cnName)
  833. this.$set(this.form,'corpEnName',row.enName)
  834. this.$set(this.form,'corpArgreementNo',row.enName)
  835. this.retrievePopupsType = false
  836. this.bcorpsbankListfun()
  837. this.finstlbillslistAccBillV1fun(this.appendType)
  838. },
  839. // 检索
  840. retrievalfun(){
  841. // 判断是否有对账单位
  842. if (!this.form.corpId && (this.form.businessNo || this.form.accountNo || this.form.hblno || this.form.mblno)) {
  843. console.log('新接口')
  844. this.finstlbillslistAccBillByCorpfun()
  845. }else {
  846. if (!this.form.corpId) {
  847. return this.$message.warning('请填写对账单位')
  848. }
  849. console.log('原来的接口')
  850. this.finstlbillslistAccBillV1fun(this.appendType)
  851. }
  852. },
  853. // 检索弹窗数据
  854. finstlbillslistAccBillByCorpfun(){
  855. let obj = {}
  856. obj.type = '2'
  857. obj.curCode = this.form.curCode // 币别
  858. obj.dc = this.form.dc // 收付 D=收 C=付
  859. obj.accBillNo = this.form.accountNo // 账单编号 ACCT NO
  860. obj.billNo = this.form.businessNo // 单据编号 JOB NO
  861. obj.mblno = this.form.mblno // MB/L NO
  862. obj.hblno = this.form.hblno // HB/L NO
  863. obj.queryAmount = this.form.queryAmount // 查询金额
  864. obj.businessType = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  865. obj.vesselCnName = this.form.vesselCnName // 中文船名
  866. obj.receivableAdvance = this.form.receivableAdvance // 预收帐款
  867. obj.voyageNo = this.form.voyageNo // 航次
  868. obj.signforDateList = this.form.signforDateList // 签收日期
  869. obj.auditStatus = '0'
  870. obj.businessDateStart = this.form.businessDateStart // 业务开始日期
  871. obj.businessDateEnd = this.form.businessDateEnd // 业务开始日期
  872. finstlbillslistAccBillByCorp(obj).then(res=>{
  873. this.retrievePopupsType = true
  874. this.retrievePopupsData = res.data.data
  875. })
  876. },
  877. // 检索接口
  878. finstlbillslistAccBillV1fun(type){
  879. // 对账单位
  880. if (!this.form.corpId) {
  881. this.$message.warning('请选择对账单位');
  882. return
  883. }
  884. let obj = {}
  885. obj.type = '2'
  886. obj.curCode = this.form.curCode // 币别
  887. obj.dc = this.form.dc // 收付 D=收 C=付
  888. obj.accBillNo = this.form.accountNo // 账单编号 ACCT NO
  889. obj.billNo = this.form.businessNo // 单据编号 JOB NO
  890. obj.mblno = this.form.mblno // MB/L NO
  891. obj.hblno = this.form.hblno // HB/L NO
  892. obj.queryAmount = this.form.queryAmount // 查询金额
  893. obj.businessType = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  894. obj.vesselCnName = this.form.vesselCnName // 中文船名
  895. obj.receivableAdvance = this.form.receivableAdvance // 预收帐款
  896. obj.voyageNo = this.form.voyageNo // 航次
  897. obj.signforDateList = this.form.signforDateList // 签收日期
  898. obj.auditStatus = '0'
  899. obj.businessDateStart = this.form.businessDateStart // 业务开始日期
  900. obj.businessDateEnd = this.form.businessDateEnd // 业务开始日期
  901. // 判断是否有对账单号
  902. if (this.form.checkNo) {
  903. obj.corpId = this.form.corpId // 结算单位
  904. obj.checkNo = this.form.checkNo // CHK NO 对账单号
  905. finstlbillsGetByDetail(obj).then(res=>{
  906. let arr = res.data.data.finStlBillsItemsList.map((item)=>{
  907. delete item.id
  908. if(item.curCode == 'CNY') {
  909. // 发票
  910. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  911. // 应结算金额
  912. this.$set(item,'amountRMB',item.amount)
  913. // 已结算金额
  914. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  915. if (item.dc == 'D') {
  916. // 本次金额
  917. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  918. }else {
  919. // 本次金额
  920. this.$set(item,'currentStlAmountRMB',item.appliedCurrentStlAmount)
  921. }
  922. }else {
  923. // 发票
  924. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  925. // 应结算金额
  926. this.$set(item,'amountUSD',item.amount)
  927. // 已结算金额
  928. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  929. // 本次金额
  930. if (item.dc == 'D') {
  931. // 本次金额
  932. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  933. }else {
  934. // 本次金额
  935. this.$set(item,'currentStlAmountUSD',item.appliedCurrentStlAmount)
  936. }
  937. }
  938. return item
  939. })
  940. if (type == '追加') {
  941. let a = [...this.tableData,...arr,]
  942. this.tableData = a.filter((obj, index) => {
  943. return a.findIndex((elem) => {
  944. return elem.accBillNo === obj.accBillNo
  945. }) === index;
  946. });
  947. }else {
  948. // 获取有id 的数据
  949. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  950. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  951. // 有id 的处理
  952. if(itemsWithId.length != 0) {
  953. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  954. this.$message.success('操作成功')
  955. })
  956. }
  957. if(arr.length == 0){
  958. this.$message.warning('当前检索暂无数据!')
  959. }
  960. this.tableData = arr
  961. }
  962. })
  963. }else {
  964. obj.corpCnName = this.form.corpId // 结算单位
  965. obj.checkBillNo = this.form.checkNo // CHK NO 对账单号
  966. finstlbillslistAccBillV1(obj).then(res=>{
  967. let arr = res.data.data.map((item,index)=>{
  968. item.accBillId = item.id
  969. delete item.id
  970. // 账单编号
  971. item.accBillNo = item.billNo
  972. item.currentStlCurCode = item.curCode // 币别
  973. item.currentStlExrate = item.exrate
  974. // isCleared
  975. item.lineNo = Number(index) + 1
  976. item.pType = item.businessType
  977. item.billNo = item.businessBillDivideNo?item.businessBillDivideNo:item.businessBillNo
  978. item.accDate = item.billDate
  979. item.dc = item.accountDc // 收付
  980. if(item.curCode == 'CNY') {
  981. // 发票
  982. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  983. // 应结算金额
  984. this.$set(item,'amountRMB',item.amount)
  985. // 已结算金额
  986. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  987. // 本次金额
  988. if (item.dc == 'D') {
  989. // 本次金额
  990. this.$set(item,'currentStlAmountRMB',item.appliedInvoiceCurrentStlAmount)
  991. }else {
  992. // 本次金额
  993. this.$set(item,'currentStlAmountRMB',item.appliedCurrentStlAmount)
  994. }
  995. }else {
  996. // 发票
  997. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  998. // 应结算金额
  999. this.$set(item,'amountUSD',item.amount)
  1000. // 已结算金额
  1001. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  1002. // 本次金额
  1003. if (item.dc == 'D') {
  1004. // 本次金额
  1005. this.$set(item,'currentStlAmountUSD',item.appliedInvoiceCurrentStlAmount)
  1006. }else {
  1007. // 本次金额
  1008. this.$set(item,'currentStlAmountUSD',item.appliedCurrentStlAmount)
  1009. }
  1010. }
  1011. return item
  1012. })
  1013. if (type == '追加') {
  1014. let a = [...this.tableData,...arr,]
  1015. this.tableData = a.filter((obj, index) => {
  1016. return a.findIndex((elem) => {
  1017. return elem.accBillNo === obj.accBillNo
  1018. }) === index;
  1019. });
  1020. }else {
  1021. // 获取有id 的数据
  1022. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  1023. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  1024. // 有id 的处理
  1025. if(itemsWithId.length != 0) {
  1026. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  1027. this.$message.success('操作成功')
  1028. })
  1029. }
  1030. if(arr.length == 0){
  1031. this.$message.warning('当前检索暂无数据!')
  1032. }
  1033. this.tableData = arr
  1034. }
  1035. })
  1036. }
  1037. },
  1038. // 结算确认
  1039. finstlbillsConfirmSettlementfun(){
  1040. this.pageLoading = true
  1041. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  1042. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1043. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1044. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  1045. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  1046. this.form.url = '/iosBasicData/ComputationCenter/index',
  1047. this.form.pageStatus = "this.$store.getters.SettlementCenterF"
  1048. this.form.pageLabel = "结算中心(F)"
  1049. finstlbillsConfirmSettlement(this.form).then(res=>{
  1050. this.pageLoading = false
  1051. this.saveLoading = false
  1052. this.$message.success('操作成功');
  1053. this.finstlbillsDetailfun(res.data.data.id)
  1054. }).catch(err=>{
  1055. this.pageLoading = false
  1056. this.saveLoading = false
  1057. })
  1058. },
  1059. // 生成凭证
  1060. generateVoucherfun(){
  1061. this.$confirm("确定要生成凭证?", {
  1062. confirmButtonText: "确定",
  1063. cancelButtonText: "取消",
  1064. type: "warning"
  1065. }).then(()=>{
  1066. this.pageLoading = true
  1067. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  1068. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1069. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1070. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  1071. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  1072. finstlbillsGenerateVoucher(this.form).then(res=>{
  1073. this.pageLoading = false
  1074. this.$message.success('操作成功');
  1075. this.finstlbillsDetailfun(this.form.id)
  1076. })
  1077. })
  1078. },
  1079. // 结算撤销
  1080. finstlbillsRevokeSettlementfun(){
  1081. this.$confirm("确定进行撤销对账操作?", {
  1082. confirmButtonText: "确定",
  1083. cancelButtonText: "取消",
  1084. type: "warning"
  1085. }).then(()=>{
  1086. this.pageLoading = true
  1087. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  1088. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1089. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1090. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  1091. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  1092. finstlbillsRevokeSettlement(this.form).then(res=>{
  1093. this.pageLoading = false
  1094. this.$message.success('操作成功');
  1095. this.finstlbillsDetailfun(res.data.data.id)
  1096. })
  1097. }).catch(err=>{
  1098. this.pageLoading = false
  1099. })
  1100. },
  1101. // 确认选定行
  1102. SelectedRows(){
  1103. this.editCustomer()
  1104. },
  1105. // 下面表格多选
  1106. handleSelectionChange(arr){
  1107. this.handleSelectionData = arr
  1108. },
  1109. //返回列表
  1110. backToList() {
  1111. this.$emit('goBack')
  1112. },
  1113. // 请求的接口
  1114. // 获取币别数据
  1115. getRateListfun(cnName){
  1116. getRateList({current:1,size:10,cnName}).then(res=>{
  1117. this.curCodeData = res.data.data.records
  1118. })
  1119. },
  1120. // 获取结算单位数据
  1121. corpBcorpsListfun(cnName){
  1122. getBcorpslistByType(1,10,{cnName}).then(res=>{
  1123. this.corpData = res.data.data.records
  1124. })
  1125. },
  1126. // 获取银行数据
  1127. bcorpsbankListfun(){
  1128. bcorpsbankList(1,50,{pid:this.form.corpId}).then(res=>{
  1129. this.bankData = res.data.data.records.map(item=>{
  1130. item.accountBankNo = item.accountBank + ' - ' + item.accountNo
  1131. return item
  1132. })
  1133. if (!this.form.bankId) {
  1134. this.$set(this.form,'bankId',res.data.data.records[0].id)
  1135. this.$set(this.form,'bankAccountName',res.data.data.records[0].accountName)
  1136. this.$set(this.form,'bankAccountBank',res.data.data.records[0].accountBank)
  1137. this.$set(this.form,'bankAccountNo',res.data.data.records[0].accountNo)
  1138. }
  1139. })
  1140. },
  1141. // 预览报表
  1142. handleReportPreview(url,data){
  1143. console.log(url,1670)
  1144. console.log(data,1671)
  1145. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  1146. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  1147. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  1148. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
  1149. // 工具栏
  1150. var options = new Stimulsoft.Viewer.StiViewerOptions()
  1151. options.height = '100%'
  1152. options.appearance.scrollbarsMode = true // 滚动条模式
  1153. options.toolbar.showDesignButton = false // 显示设计按钮
  1154. options.toolbar.showAboutButton = false // 显示关于按钮
  1155. options.toolbar.showResourcesButton = false // 显示资源按钮
  1156. options.toolbar.showFullScreenButton = false // 显示全屏按钮
  1157. options.toolbar.showOpenButton = false // 显示打开按钮
  1158. options.appearance.showTooltips = false // 显示工具提示
  1159. options.appearance.showDialogsHelp = false // 显示对话框帮助
  1160. options.exports.showExportToDocument = false // 显示导出到文档
  1161. options.toolbar.showParametersButton = true // 显示参数按钮
  1162. options.appearance.bookmarksPrint = true // 书签打印
  1163. // options.toolbar.showPrintButton = false // 打印按钮是否显示 下面直接自定义控制打印弹窗是否开启
  1164. // printDestination 参数:用于指定报表打印的目标位置,可以是打印机、PDF 文件或者直接打印到浏览器等。
  1165. // Stimulsoft.Viewer.StiPrintDestination.Direct:表示直接打印到打印机,即将报表内容直接发送至打印机进行打印。
  1166. // 通过设置不同的 printDestination 参数,你可以控制报表打印的行为,例如是直接打印到打印机,还是生成 PDF 文件,或者直接在浏览器中预览打印内容等。
  1167. options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
  1168. // htmlRenderMode html渲染模式
  1169. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  1170. // 是创建一个 Stimulsoft 报表查看器的实例的代码
  1171. let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
  1172. // 报表
  1173. console.log("创建一个报表实例");
  1174. console.log()
  1175. let report = new window.Stimulsoft.Report.StiReport();
  1176. // 加载文件
  1177. console.log("从url加载报表");
  1178. // report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  1179. report.load(url)
  1180. data.pageOne = 'Page : 1 of 1'
  1181. // 处理超长数据
  1182. if (data.hshipperDetails) {
  1183. var consignerIndex2 = data.hshipperDetails.indexOf( '\n' )
  1184. for (let i = 0; i < 4; i++) {
  1185. consignerIndex2 = data.hshipperDetails.indexOf( '\n', consignerIndex2 + 1 );
  1186. }
  1187. if (consignerIndex2 != -1) {
  1188. var hshipperDetails = data.hshipperDetails.substring(consignerIndex2 + 2, data.hshipperDetails.length)
  1189. data.hshipperDetails = data.hshipperDetails.substring(0, consignerIndex2) + ' *'
  1190. data.commodityDescr += '\n*' + hshipperDetails
  1191. }
  1192. }
  1193. if (data.hconsigneeDetails) {
  1194. var consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n' )
  1195. for (let i = 0; i < 3; i++) {
  1196. consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n', consigneeIndex2 + 1 );
  1197. }
  1198. if (consigneeIndex2 != -1) {
  1199. var hconsigneeDetails = data.hconsigneeDetails.substring(consigneeIndex2 + 2, data.hconsigneeDetails.length)
  1200. data.hconsigneeDetails = data.hconsigneeDetails.substring(0, consigneeIndex2) + ' **'
  1201. data.commodityDescr += '\n**' + hconsigneeDetails
  1202. }
  1203. }
  1204. if (data.hnotifyDetails) {
  1205. var notifierIndex2 = data.hnotifyDetails.indexOf( '\n' )
  1206. for (let i = 0; i < 3; i++) {
  1207. notifierIndex2 = data.hnotifyDetails.indexOf( '\n', notifierIndex2 + 1 );
  1208. }
  1209. if (notifierIndex2 != -1) {
  1210. var hnotifyDetails = data.hnotifyDetails.substring(notifierIndex2 + 2, data.hnotifyDetails.length)
  1211. data.hnotifyDetails = data.hnotifyDetails.substring(0, notifierIndex2) + ' ***'
  1212. data.commodityDescr += '\n***' + hnotifyDetails
  1213. }
  1214. }
  1215. // 处理箱号
  1216. if (this.isPrintTheBoxNumber) {
  1217. data.commodityDescr += '\n.\n.\n'
  1218. }
  1219. // PLACE & DATE OF ISSUE
  1220. data.placeAndDateOfIssue = ''
  1221. if (data.issueAt) {
  1222. data.placeAndDateOfIssue += data.issueAt
  1223. }
  1224. if (data.issueDate) {
  1225. let date = new Date(data.issueDate.replace(/-/g,'/'));
  1226. let yyyy = date.getFullYear();
  1227. let mmmm = date.toDateString().split(" ")[1]
  1228. let dd = date.getDate()
  1229. data.placeAndDateOfIssue += ', ' + dd + '-' + mmmm + '-' + yyyy
  1230. }
  1231. // Total number of containers or packages received by the Carriers
  1232. if (data.preContainersList) {
  1233. let boxMap = new Map();
  1234. for (let boxQuantity of data.preContainersList) {
  1235. if (boxMap.get(boxQuantity.cntrTypeCode)) {
  1236. let v = boxMap.get(boxQuantity.cntrTypeCode)
  1237. boxMap.set(boxQuantity.cntrTypeCode, v + boxQuantity.quantity)
  1238. } else {
  1239. boxMap.set(boxQuantity.cntrTypeCode, boxQuantity.quantity)
  1240. }
  1241. }
  1242. let boxs = ''
  1243. boxMap.forEach(function (value, key, map) {
  1244. boxs += value + 'x' + key + ', '
  1245. })
  1246. boxs = boxs.substring(0, boxs.length - 2)
  1247. data.boxQuantity = boxs + ' CONTAINER(S) ONLY'
  1248. }
  1249. // Number of original B/Ls
  1250. if (data.numberOfObl) {
  1251. data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
  1252. }
  1253. if (data.commodityDescr) {
  1254. var descriptionIndex2 = data.commodityDescr.indexOf( '\n' )
  1255. for (let i = 0; i < 19; i++) {
  1256. descriptionIndex2 = data.commodityDescr.indexOf( '\n', descriptionIndex2 + 1 );
  1257. }
  1258. if (descriptionIndex2 != -1) {
  1259. data.pageOne = 'Page : 1 of 2'
  1260. data.pageTwo = 'Page : 2 of 2'
  1261. var extraLongText = data.commodityDescr.substring(descriptionIndex2 + 2, data.commodityDescr.length)
  1262. data.commodityDescr = data.commodityDescr.substring(0, descriptionIndex2)
  1263. data.extraLongTips = '** TO BE CONTINUED ON ATTACHED LIST **'
  1264. data.extraLongText = extraLongText
  1265. }
  1266. }
  1267. // console.log(data.hshipperDetails, 'hshipperDetails2')
  1268. // 创建一个 Stimulsoft 数据集(DataSet)的实例的代码
  1269. var dataSet = new Stimulsoft.System.Data.DataSet(
  1270. 'reportData'
  1271. )
  1272. dataSet.readJson(data) // 用于将 JSON 格式的数据加载到数据集中。data 是包含报表数据的 JSON 对象。
  1273. // 这是一个方法调用,用于在报表中注册数据源。参数 'reportData' 是数据源的名称,
  1274. // 第二个 'reportData' 是数据源的别名,dataSet 则是之前创建的数据集实例
  1275. report.regData('reportData', 'reportData', dataSet)
  1276. // 从模版和数据加载报表
  1277. // loadReport(report, '', {})
  1278. // 这是将报表对象指定给报表查看器的属性。viewer 是报表查看器的实例,而 report 是之前创建的报表对象。
  1279. viewer.report = report;
  1280. this.$refs.reportContainer.showContainer(
  1281. ()=> {
  1282. setTimeout(() => {
  1283. viewer.renderHtml('reportContainer')
  1284. this.createViewerButtons(viewer)
  1285. }, 50)
  1286. },
  1287. ()=>{
  1288. },
  1289. )
  1290. console.log("加载成功完成!");
  1291. },
  1292. createViewerButtons (viewer){
  1293. viewer.jsObject.collections.images['myClose.png'] =
  1294. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
  1295. const closeBtn = viewer.jsObject.SmallButton(
  1296. 'closeBtn',
  1297. '关闭',
  1298. 'myClose.png'
  1299. )
  1300. // 增加打印弹窗配置
  1301. const printBtn = viewer.jsObject.SmallButton(
  1302. 'printBtn',
  1303. '打印报表',
  1304. 'myClose.png'
  1305. )
  1306. // console.log(viewer.jsObject.print(),'1013')
  1307. // 获取 关闭按钮的dom元素位置
  1308. const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
  1309. const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
  1310. const userButtonCell = buttonsTable.rows[0].insertCell(0)
  1311. // 获取打印按钮的位置
  1312. const buttonsTablePrint = toolbarTable.rows[0].childNodes[0].lastChild // 打印按钮
  1313. const userButtonPrint = buttonsTablePrint.rows[0].childNodes[0] // 打印按钮dom位置
  1314. userButtonPrint.addEventListener("click", (event)=>{
  1315. console.log("打印点击");
  1316. // event.preventDefault()
  1317. });
  1318. userButtonPrint.addEventListener("mouseover", (event) => {
  1319. console.log("移入打印按钮");
  1320. console.log(event,1035)
  1321. });
  1322. userButtonCell.className = 'stiJsViewerClearAllStyles'
  1323. userButtonCell.appendChild(closeBtn) // 添加关闭节点
  1324. // userButtonPrint.prepend(printBtn) // 在 printBtn 节点里最前面增加一个子级节点
  1325. let that=this
  1326. // 关闭按钮的监听点击
  1327. closeBtn.action = function() {
  1328. console.log(that.$refs.ReportContainer,'1022')
  1329. if (that.$refs.reportContainer)
  1330. that.$refs.reportContainer.hideContainer()
  1331. }
  1332. // // // 打印按钮监听
  1333. // printBtn.action = (e)=>{
  1334. // console.log('打印')
  1335. // window.print()
  1336. // }
  1337. },
  1338. }
  1339. }
  1340. </script>
  1341. <style scoped>
  1342. ::v-deep.el-form-item {
  1343. margin-bottom: 0;
  1344. }
  1345. .bottomFlex {
  1346. display: flex;
  1347. align-items: center;
  1348. }
  1349. .weightfont {
  1350. font-size: 20px;
  1351. font-weight: bold;
  1352. }
  1353. .weightnum {
  1354. font-size: 18px;
  1355. font-weight: 500;
  1356. }
  1357. /deep/.el-dialog .el-dialog__body {
  1358. padding: 0px 20px;
  1359. }
  1360. </style>