kaihe-detail.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. <template>
  2. <div v-if="showDetail">
  3. <div style="display: flex; justify-content: space-between">
  4. <div style="display: flex; align-items: center">
  5. <el-breadcrumb separator="/">
  6. <el-breadcrumb-item
  7. ><span style="font-weight: 700">付费</span></el-breadcrumb-item
  8. >
  9. <el-breadcrumb-item
  10. ><span style="font-weight: 700"
  11. >付费详情页</span
  12. ></el-breadcrumb-item
  13. >
  14. </el-breadcrumb>
  15. <el-button
  16. style="margin-left: 10px"
  17. size="mini"
  18. icon="el-icon-arrow-left"
  19. @click="cancel"
  20. >返回列表
  21. </el-button>
  22. </div>
  23. <!-- <div v-if="showApproval == 0">
  24. 审核
  25. </div> -->
  26. </div>
  27. <br />
  28. <el-form ref="form" :model="form" label-width="80px">
  29. <el-row>
  30. <el-col :span="6">
  31. <el-form-item label="客户名称" prop="fCorpid">
  32. <el-select
  33. v-model="form.fCorpid"
  34. size="small"
  35. placeholder="请选择"
  36. clearable
  37. :disabled="
  38. form.fBillstatus >= 4 || readOnly == 0 || form.fId != null
  39. "
  40. style="width: 100%"
  41. filterable
  42. >
  43. <el-option
  44. v-for="item in corpList"
  45. :key="item.fId"
  46. :label="item.fName"
  47. :value="item.fId"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="6">
  53. <el-form-item label="开船日期">
  54. <el-date-picker
  55. v-model="form.date"
  56. type="daterange"
  57. size="small"
  58. placeholder="请选择日期"
  59. format="yyyy-MM-dd"
  60. value-format="yyyy-MM-dd"
  61. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  62. style="width: 100%"
  63. />
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="6">
  67. <el-form-item label="船名">
  68. <el-select
  69. v-model="form.fVslid"
  70. size="small"
  71. placeholder="请选择"
  72. clearable
  73. @change="fvslChange"
  74. @clear="fvslClear"
  75. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  76. style="width: 100%"
  77. >
  78. <el-option
  79. v-for="item in TVesselfs"
  80. :key="item.fId"
  81. :label="item.fName"
  82. :value="item.fId"
  83. />
  84. </el-select>
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="6">
  88. <el-form-item label="航次">
  89. <el-select
  90. v-model="form.fVoyid"
  91. size="small"
  92. placeholder="请选择"
  93. clearable
  94. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  95. style="width: 100%"
  96. >
  97. <el-option
  98. v-for="item in TVoyagefs"
  99. :key="item.fId"
  100. :label="item.fNo"
  101. :value="item.fId"
  102. />
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="6">
  107. <el-form-item label="提单号">
  108. <el-input
  109. v-model="form.tMblno"
  110. size="small"
  111. placeholder="请输入"
  112. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  113. />
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="6">
  117. <el-form-item label="起运港">
  118. <el-select
  119. v-model="form.fLoadportid"
  120. size="small"
  121. placeholder="请选择"
  122. clearable
  123. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  124. style="width: 100%"
  125. >
  126. <el-option
  127. v-for="item in portNames"
  128. :key="item.fId"
  129. :label="item.fName"
  130. :value="item.fId"
  131. />
  132. </el-select>
  133. </el-form-item>
  134. </el-col>
  135. <el-col :span="6">
  136. <el-form-item label="目的港">
  137. <el-select
  138. v-model="form.fDestportid"
  139. size="small"
  140. placeholder="请选择"
  141. clearable
  142. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  143. style="width: 100%"
  144. >
  145. <el-option
  146. v-for="item in portNames"
  147. :key="item.fId"
  148. :label="item.fName"
  149. :value="item.fId"
  150. />
  151. </el-select>
  152. </el-form-item>
  153. </el-col>
  154. <el-col :span="6">
  155. <el-form-item label="对账单号">
  156. <el-input
  157. v-model="form.fStatementNo"
  158. size="small"
  159. placeholder="请输入"
  160. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  161. ></el-input>
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="6">
  165. <el-form-item label="付款银行">
  166. <el-input
  167. v-model="form.bank"
  168. size="small"
  169. placeholder="请输入"
  170. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  171. ></el-input>
  172. </el-form-item>
  173. </el-col>
  174. <el-col :span="6">
  175. <el-form-item label="付款账号">
  176. <el-input
  177. v-model="form.fBankNumber"
  178. size="small"
  179. placeholder="请输入"
  180. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  181. ></el-input>
  182. </el-form-item>
  183. </el-col>
  184. <el-col :span="6">
  185. <el-form-item label="水单号">
  186. <el-input
  187. v-model="form.waterBillNo"
  188. size="small"
  189. placeholder="请输入"
  190. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  191. ></el-input>
  192. </el-form-item>
  193. </el-col>
  194. <el-col :span="6">
  195. <el-form-item label="系统编号">
  196. <el-input
  197. v-model="form.srcBillNo"
  198. size="small"
  199. placeholder="请输入"
  200. disabled
  201. ></el-input>
  202. </el-form-item>
  203. </el-col>
  204. <el-col :span="6">
  205. <el-form-item label="应收应付" prop="fDc">
  206. <el-select
  207. v-model="form.fDc"
  208. size="small"
  209. clearable
  210. disabled
  211. style="width: 100%"
  212. >
  213. <el-option label="应收" value="D" />
  214. <el-option label="应付" value="C" />
  215. </el-select>
  216. </el-form-item>
  217. </el-col>
  218. <el-col :span="6">
  219. <el-form-item label="制单人">
  220. <el-input
  221. v-model="form.createBy"
  222. size="small"
  223. placeholder="请输入"
  224. disabled
  225. ></el-input>
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="6">
  229. <el-form-item label="制单日期">
  230. <el-date-picker
  231. v-model="form.createTime"
  232. size="small"
  233. placeholder="请选择"
  234. format="yyyy-MM-dd"
  235. value-format="yyyy-MM-dd 00:00:00"
  236. disabled
  237. style="width: 100%"
  238. />
  239. </el-form-item>
  240. </el-col>
  241. </el-row>
  242. <el-row>
  243. <el-col :span="6">
  244. <el-form-item label="备注">
  245. <el-input
  246. type="textarea"
  247. v-model="form.fRemarks"
  248. size="small"
  249. placeholder="请输入"
  250. ></el-input>
  251. </el-form-item>
  252. </el-col>
  253. </el-row>
  254. </el-form>
  255. <div class="head-but">
  256. <div>
  257. <el-button
  258. type="primary"
  259. size="mini"
  260. @click="submit"
  261. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  262. :loading="subLoading"
  263. >
  264. 确认付费
  265. </el-button>
  266. <el-button
  267. type="success"
  268. size="mini"
  269. @click="backrRconciliation"
  270. v-if="form.fBillstatus === '6'"
  271. :loading="subLoading"
  272. v-hasPermi="['finance:payment:revoke']"
  273. >撤销付费</el-button
  274. >
  275. <el-button
  276. type="danger"
  277. size="mini"
  278. v-if="form.fBillstatus == 4"
  279. @click="backApproval('f_billstatus')"
  280. >撤销审批</el-button
  281. >
  282. <el-button
  283. v-if="readOnly == 3"
  284. size="mini"
  285. @click="goApproval('f_billstatus')"
  286. >审批</el-button
  287. >
  288. <el-button
  289. type="primary"
  290. size="mini"
  291. v-if="form.fBillstatus >= '3'"
  292. @click="addOrUpdateHandle('f_billstatus')"
  293. >查看审批流</el-button
  294. >
  295. <el-button
  296. type="success"
  297. size="mini"
  298. @click="save"
  299. :loading="subLoading"
  300. >
  301. 保存
  302. </el-button>
  303. <el-button
  304. type="warning"
  305. size="mini"
  306. :disabled="!form.fId"
  307. @click="handleExport"
  308. >
  309. 导出
  310. </el-button>
  311. <el-button
  312. type="cyan"
  313. icon="el-icon-search"
  314. size="mini"
  315. @click="Search"
  316. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  317. >
  318. 检索
  319. </el-button>
  320. </div>
  321. <div class="tabSetting">
  322. <div style="margin: 0 12px">
  323. <el-button
  324. icon="el-icon-setting"
  325. size="mini"
  326. circle
  327. @click="colSetting"
  328. ></el-button>
  329. </div>
  330. </div>
  331. </div>
  332. <el-table
  333. :data="tableData"
  334. style="width: 100%"
  335. show-summary
  336. :summary-method="getSummaries"
  337. >
  338. <el-table-column label="序号" type="index" width="50" />
  339. <el-table-column
  340. v-for="(item, index) in tableOption"
  341. :key="index"
  342. :label="item.name"
  343. :width="item.width"
  344. :prop="item.label"
  345. align="center"
  346. :fixed="item.fixed"
  347. sortable
  348. :show-overflow-tooltip="true"
  349. >
  350. <template slot-scope="scope">
  351. <span v-if="item.label == 'srcBillNo'">
  352. {{ scope.row.srcBillNo }}
  353. </span>
  354. <span v-if="item.label == 'fName'">
  355. {{ scope.row.fName }}
  356. </span>
  357. <span v-if="item.label == 'fFeeName'">
  358. {{ scope.row.fFeeName }}
  359. </span>
  360. <span v-if="item.label == 'goodName'">
  361. {{ scope.row.goodName }}
  362. </span>
  363. <span v-if="item.label == 'fFeeUnitName'">
  364. {{ scope.row.fFeeUnitName }}
  365. </span>
  366. <span v-if="item.label == 'fQty'">
  367. {{ scope.row.fQty }}
  368. </span>
  369. <span v-if="item.label == 'fUnitPrice'">
  370. {{ scope.row.fUnitPrice }}
  371. </span>
  372. <span v-if="item.label == 'fAmtdr'">
  373. {{ scope.row.fAmtdr }}
  374. </span>
  375. <span v-if="item.label == 'fAmt'">
  376. <el-input
  377. v-model="scope.row.fAmt"
  378. size="small"
  379. placeholder="请输入"
  380. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  381. @change="fAmtChange(scope.row)"
  382. ></el-input>
  383. </span>
  384. <span v-if="item.label == 'fvslName'">
  385. {{ scope.row.fvslName }}
  386. </span>
  387. <span v-if="item.label == 'fvoyName'">
  388. {{ scope.row.fvoyName }}
  389. </span>
  390. <span v-if="item.label == 'fCntrCount'">
  391. {{ scope.row.fCntrCount }}
  392. </span>
  393. <span v-if="item.label == 'cntrName'">
  394. {{ scope.row.cntrName }}
  395. </span>
  396. <span v-if="item.label == 'fLoadPortName'">
  397. {{ scope.row.fLoadPortName }}
  398. </span>
  399. <span v-if="item.label == 'fDestPortName'">
  400. {{ scope.row.fDestPortName }}
  401. </span>
  402. <span v-if="item.label == 'fBillStatusName'">
  403. {{ scope.row.fBillStatusName }}
  404. </span>
  405. <span v-if="item.label == 'createBy'">
  406. {{ scope.row.createBy }}
  407. </span>
  408. <span v-if="item.label == 'createTime'">
  409. {{ scope.row.createTime }}
  410. </span>
  411. <span v-if="item.label == 'fRemarks'">
  412. <el-input
  413. v-model="scope.row.fRemarks"
  414. size="small"
  415. placeholder="请输入"
  416. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  417. ></el-input>
  418. </span>
  419. </template>
  420. </el-table-column>
  421. <el-table-column
  422. label="操作"
  423. align="center"
  424. class-name="small-padding fixed-width"
  425. min-width="180"
  426. fixed="right"
  427. >
  428. <template slot-scope="scope">
  429. <el-button
  430. size="mini"
  431. type="text"
  432. icon="el-icon-delete"
  433. @click="rowDel(scope.row, scope.$index, tableData)"
  434. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  435. >
  436. 删除
  437. </el-button>
  438. </template>
  439. </el-table-column>
  440. </el-table>
  441. <approval-comments
  442. v-if="addOrUpdateVisib"
  443. ref="ApprovalComments"
  444. @refreshDataList="returnData"
  445. />
  446. <add-or-update ref="addOrUpdate" @imporData="imporData" />
  447. <view-approval ref="viewApproval" />
  448. <column-setting
  449. ref="columnSetting"
  450. @reset="reset"
  451. @getRowdata="getRowdata"
  452. tableName="凯和付费详情页"
  453. />
  454. </div>
  455. </template>
  456. <script>
  457. import Cookies from "js-cookie";
  458. import { tableOption2 } from "./js/index";
  459. import {
  460. selectTVesself,
  461. selectTVoyagef,
  462. selectPortName,
  463. save,
  464. listCorps,
  465. confirm,
  466. RevocationApproval,
  467. getdetail,
  468. infoRemove,
  469. revoke,
  470. getExcelInfo,
  471. } from "@/api/finance/kaihe/payment";
  472. import ApprovalComments from "@/views/startApproval";
  473. import addOrUpdate from "./add-or-update.vue";
  474. import viewApproval from "@/views/viewApproval";
  475. import columnSetting from "@/components/ColumnSetting/index";
  476. import _ from "lodash";
  477. export default {
  478. data() {
  479. return {
  480. form: {
  481. fDc: "C",
  482. fSystemType: Cookies.get("sysType"),
  483. fVoyid: null,
  484. },
  485. options: [],
  486. tableData: [],
  487. tableOption: tableOption2,
  488. TVesselfs: [],
  489. TVoyagefs: [],
  490. portNames: [],
  491. corpList: [],
  492. wRtions: [],
  493. approve: false,
  494. addOrUpdateVisib: false,
  495. readOnly: null,
  496. subLoading: false,
  497. };
  498. },
  499. components: {
  500. ApprovalComments,
  501. addOrUpdate,
  502. viewApproval,
  503. columnSetting,
  504. },
  505. props: {
  506. showDetail: {
  507. type: Boolean,
  508. },
  509. },
  510. created() {},
  511. methods: {
  512. fvslChange(id) {
  513. selectTVoyagef({ fPid: id }).then((res) => {
  514. this.TVoyagefs = res.rows;
  515. });
  516. this.form.fVoyid = null;
  517. },
  518. fvslClear() {
  519. selectTVoyagef().then((res) => {
  520. this.TVoyagefs = res.rows;
  521. });
  522. this.form.fVoyid = null;
  523. },
  524. /** 导出按钮操作 */
  525. handleExport() {
  526. if (this.form.fCorpid == null) {
  527. return this.$message.error("客户名称不能为空");
  528. }
  529. let _this = this;
  530. this.$confirm("是否确认导出明细数据?", "警告", {
  531. confirmButtonText: "确定",
  532. cancelButtonText: "取消",
  533. type: "warning",
  534. })
  535. .then(function () {
  536. return getExcelInfo(_this.form.fId);
  537. })
  538. .then((response) => {
  539. this.download(response.msg);
  540. });
  541. },
  542. getRowdata(list) {
  543. this.tableOption = list;
  544. },
  545. reset() {
  546. this.tableOption = this.$options.data().tableOption;
  547. },
  548. colSetting() {
  549. this.$refs.columnSetting.init(this.tableOption);
  550. },
  551. init() {
  552. selectTVesself().then((res) => {
  553. this.TVesselfs = res.rows;
  554. });
  555. selectTVoyagef().then((res) => {
  556. this.TVoyagefs = res.rows;
  557. });
  558. selectPortName().then((res) => {
  559. this.portNames = res.rows;
  560. });
  561. this.getDicts("whether_reconciliation").then((response) => {
  562. if (response.data) {
  563. this.wRtions = response.data;
  564. }
  565. });
  566. listCorps().then((res) => {
  567. this.corpList = res;
  568. });
  569. setTimeout((e) => {
  570. this.$refs.columnSetting.getRow(this.tableOption);
  571. }, 100);
  572. },
  573. fAmtChange(row) {
  574. if (Number(row.fAmt) > Number(row.fAmtdr)) {
  575. row.fAmt = row.fAmtdr;
  576. this.$message.error("实收金额不能超过应收金额");
  577. }
  578. if (Number(row.fAmt) <= 0) {
  579. row.fAmt = row.fAmtdr;
  580. this.$message.error("请正确输入金额");
  581. }
  582. },
  583. rowDel(row, index, rows) {
  584. console.log();
  585. if (row.fId) {
  586. infoRemove(row.fId).then((res) => {
  587. if (res.code == 200) {
  588. rows.splice(index, 1);
  589. this.$message.success("删除成功");
  590. }
  591. });
  592. } else {
  593. rows.splice(index, 1);
  594. this.$message.success("删除成功");
  595. }
  596. },
  597. getSummaries(param) {
  598. const { columns, data } = param;
  599. const sums = [];
  600. if (data.length > 0) {
  601. columns.forEach((column, index) => {
  602. if (index == 0) {
  603. sums[index] = "合计";
  604. }
  605. if (column.label == "应付金额" || column.label == "实付金额") {
  606. const values = data.map((item) => Number(item[column.property]));
  607. if (!values.every((value) => isNaN(value))) {
  608. sums[index] = values.reduce((prev, curr) => {
  609. const value = Number(curr);
  610. if (!isNaN(value)) {
  611. return prev + curr;
  612. } else {
  613. return prev;
  614. }
  615. }, 0);
  616. // sums[index] += "元";
  617. } else {
  618. sums[index] = "0";
  619. // sums[index] = "0元";
  620. }
  621. }
  622. });
  623. }
  624. return sums;
  625. },
  626. info(row, status) {
  627. this.init();
  628. this.readOnly = status;
  629. const id = row.fId ? row.fId : row;
  630. getdetail(id).then((res) => {
  631. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  632. const date = [];
  633. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  634. res.data.tFee.date = date;
  635. }
  636. this.form = res.data.tFee;
  637. this.tableData = res.data.tFeeDo;
  638. });
  639. },
  640. copyData(id) {
  641. this.init();
  642. getdetail(id).then((res) => {
  643. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  644. const date = [];
  645. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  646. res.data.tFee.date = date;
  647. }
  648. delete res.data.tFee.fId;
  649. delete res.data.tFee.fBillstatus;
  650. delete res.data.tFee.fBillno;
  651. delete res.data.tFee.srcBillNo;
  652. delete res.data.tFee.createBy;
  653. delete res.data.tFee.createTime;
  654. delete res.data.tFee.updateBy;
  655. delete res.data.tFee.updateTime;
  656. delete res.data.tFee.fRemarks;
  657. this.form = res.data.tFee;
  658. });
  659. },
  660. returnData() {
  661. this.addOrUpdateVisib = false;
  662. this.homepaGe();
  663. },
  664. homepaGe() {
  665. let view = {
  666. fullPath: "/finance/contrast",
  667. hash: "",
  668. matched: Array(2),
  669. meta: Object,
  670. name: "Contrast",
  671. params: Object,
  672. path: "/finance/contrast",
  673. query: Object,
  674. title: "付费",
  675. };
  676. this.$router.push({ path: "/index" });
  677. this.$store
  678. .dispatch("tagsView/delView", view)
  679. .then(({ visitedViews }) => {
  680. if (this.isActive(view)) {
  681. this.toLastView(visitedViews, view);
  682. }
  683. });
  684. Global.$emit("removeCache", "closeSelectedTag", view);
  685. },
  686. // 审批按钮
  687. goApproval(status) {
  688. this.addOrUpdateVisib = true;
  689. this.$nextTick(() => {
  690. this.$refs.ApprovalComments.init(this.form.fId, status, 450);
  691. });
  692. },
  693. // 撤销审批
  694. backApproval(status) {
  695. let data = {
  696. id: this.form.fId,
  697. actId: 450,
  698. billId: this.form.fId,
  699. fidStatus: status,
  700. };
  701. RevocationApproval(data).then((response) => {
  702. if (response.code === 200) {
  703. this.msgSuccess("撤销审批成功");
  704. this.open = false;
  705. }
  706. });
  707. },
  708. returnData() {
  709. this.$emit("goBack", false);
  710. },
  711. // 查看审批流
  712. addOrUpdateHandle(status) {
  713. this.addOrUpdateVisible = true;
  714. this.addOrUpdateVisib = false;
  715. let id = null;
  716. if (this.form.fId) {
  717. id = this.form.fId;
  718. } else {
  719. id = this.form.id;
  720. }
  721. this.$nextTick(() => {
  722. this.$refs.viewApproval.init(id, 450, status);
  723. });
  724. },
  725. // 撤销付费
  726. backrRconciliation() {
  727. this.form.fBillstatus = "1";
  728. this.subLoading = true;
  729. let formDate = new window.FormData();
  730. formDate.append("tFee", JSON.stringify(this.form));
  731. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  732. revoke(formDate)
  733. .then((response) => {
  734. this.msgSuccess("撤回成功");
  735. Object.assign(this.$data, this.$options.data());
  736. this.$emit("goBack", false);
  737. })
  738. .finally(() => {
  739. this.subLoading = false;
  740. });
  741. },
  742. Search() {
  743. const data = {
  744. fReconciliation: this.form.fReconciliation,
  745. fDc: this.form.fDc,
  746. fSystemType: 3,
  747. fCorpid: this.form.fCorpid,
  748. fVslid: this.form.fVslid,
  749. fVoyid: this.form.fVoyid,
  750. fDestportid: this.form.fDestportid,
  751. fLoadportid: this.form.fLoadportid,
  752. fStatementNo: this.form.fStatementNo,
  753. fMblno: this.form.tMblno,
  754. fFromDate: this.form.date ? this.form.date[0] : null,
  755. fToDate: this.form.date ? this.form.date[1] : null,
  756. };
  757. this.$refs.addOrUpdate.init(data, this.tableData);
  758. },
  759. imporData(rows) {
  760. this.tableData = this.tableData.concat(rows);
  761. },
  762. lumpSum() {
  763. let fAmtdr = 0;
  764. let fAmtcr = 0;
  765. this.tableData.map((e) => {
  766. fAmtdr = _.add(fAmtdr, Number(e.fAmtdr));
  767. fAmtcr = _.add(fAmtcr, Number(e.fAmt));
  768. });
  769. this.form.fAmtdr = fAmtdr;
  770. this.form.fAmtcr = fAmtcr;
  771. },
  772. submit() {
  773. if (this.form.fCorpid == null) {
  774. return this.$message.error("客户名称不能为空");
  775. }
  776. this.corpList.forEach((e) => {
  777. if (this.form.fCorpid == e.fId) {
  778. this.form.fCtrlcorpid = e.fName;
  779. }
  780. });
  781. if (this.tableData.length == 0) {
  782. return this.$message.error("明细表不能为空");
  783. }
  784. if (this.form.date) {
  785. this.form.fFromDate = this.form.date[0];
  786. this.form.fToDate = this.form.date[1];
  787. }
  788. this.lumpSum();
  789. if (this.form.fId == null) {
  790. return this.$message.error("数据未保存,不能进行确认付费");
  791. }
  792. this.subLoading = true;
  793. let formDate = new window.FormData();
  794. formDate.append("tFee", JSON.stringify(this.form));
  795. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  796. formDate.append("billsType", JSON.stringify("KHDZ"));
  797. confirm(formDate)
  798. .then((res) => {
  799. if (res.code == 200) {
  800. this.$message.success("付费成功");
  801. Object.assign(this.$data, this.$options.data());
  802. this.$emit("goBack", false);
  803. }
  804. })
  805. .finally(() => {
  806. this.subLoading = false;
  807. });
  808. },
  809. save(type) {
  810. if (this.form.fCorpid == null) {
  811. return this.$message.error("客户名称不能为空");
  812. }
  813. this.corpList.forEach((e) => {
  814. if (this.form.fCorpid == e.fId) {
  815. this.form.fCtrlcorpid = e.fName;
  816. }
  817. });
  818. // if (this.tableData.length == 0) {
  819. // return this.$message.error("明细表不能为空");
  820. // }
  821. if (this.form.date) {
  822. this.form.fFromDate = this.form.date[0];
  823. this.form.fToDate = this.form.date[1];
  824. }
  825. this.lumpSum();
  826. this.subLoading = true;
  827. let formDate = new window.FormData();
  828. formDate.append("tFee", JSON.stringify(this.form));
  829. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  830. formDate.append("billsType", JSON.stringify("KHDZ"));
  831. save(formDate)
  832. .then((res) => {
  833. if (res.code == 200) {
  834. if (!type) {
  835. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  836. const date = [];
  837. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  838. res.data.tFee.date = date;
  839. }
  840. }
  841. this.form = res.data.tFee;
  842. this.tableData = res.data.tFeeDo;
  843. this.$emit("refFresh");
  844. this.$message.success("保存成功");
  845. }
  846. })
  847. .finally(() => {
  848. this.subLoading = false;
  849. });
  850. },
  851. cancel() {
  852. if (this.readOnly != 0) {
  853. this.$confirm("返回列表,是否保存?", "提示", {
  854. confirmButtonText: "保存",
  855. cancelButtonText: "取消",
  856. type: "warning",
  857. })
  858. .then(() => {
  859. this.save("back");
  860. Object.assign(this.$data, this.$options.data());
  861. this.$emit("goBack", false);
  862. })
  863. .catch(() => {
  864. Object.assign(this.$data, this.$options.data());
  865. this.$emit("goDetail", false);
  866. });
  867. } else {
  868. Object.assign(this.$data, this.$options.data());
  869. this.$emit("goBack", false);
  870. }
  871. },
  872. },
  873. watch: {
  874. info: function (obj) {
  875. console.log(obj);
  876. },
  877. },
  878. };
  879. </script>
  880. <style lang="scss" scoped>
  881. .head-but {
  882. display: flex;
  883. justify-content: space-between;
  884. margin-bottom: 8px;
  885. }
  886. .tabSetting {
  887. display: flex;
  888. justify-content: flex-end;
  889. }
  890. </style>