kaihe-detail.vue 24 KB

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