settlementDetails.vue 72 KB

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