finstlbillsDetails.vue 53 KB

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