kaihe-detail.vue 24 KB

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