kaihe-detail.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  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.invoiceNo"
  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 == 'goodName'">
  351. {{ scope.row.goodName }}
  352. </span>
  353. <span v-if="item.label == 'fFeeUnitName'">
  354. {{ scope.row.fFeeUnitName }}
  355. </span>
  356. <span v-if="item.label == 'fQty'">
  357. {{ scope.row.fQty }}
  358. </span>
  359. <span v-if="item.label == 'fUnitPrice'">
  360. {{ scope.row.fUnitPrice }}
  361. </span>
  362. <span v-if="item.label == 'fAmtdr'">
  363. {{ scope.row.fAmtdr }}
  364. </span>
  365. <span v-if="item.label == 'fAmt'">
  366. <el-input
  367. v-model="scope.row.fAmt"
  368. size="small"
  369. placeholder="请输入"
  370. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  371. @change="fAmtChange(scope.row)"
  372. ></el-input>
  373. </span>
  374. <span v-if="item.label == 'fvslName'">
  375. {{ scope.row.fvslName }}
  376. </span>
  377. <span v-if="item.label == 'fvoyName'">
  378. {{ scope.row.fvoyName }}
  379. </span>
  380. <span v-if="item.label == 'fCntrCount'">
  381. {{ scope.row.fCntrCount }}
  382. </span>
  383. <span v-if="item.label == 'cntrName'">
  384. {{ scope.row.cntrName }}
  385. </span>
  386. <span v-if="item.label == 'fLoadPortName'">
  387. {{ scope.row.fLoadPortName }}
  388. </span>
  389. <span v-if="item.label == 'fDestPortName'">
  390. {{ scope.row.fDestPortName }}
  391. </span>
  392. <span v-if="item.label == 'fBillStatusName'">
  393. {{ scope.row.fBillStatusName }}
  394. </span>
  395. <span v-if="item.label == 'createBy'">
  396. {{ scope.row.createBy }}
  397. </span>
  398. <span v-if="item.label == 'createTime'">
  399. {{ scope.row.createTime }}
  400. </span>
  401. <span v-if="item.label == 'fRemarks'">
  402. <el-input
  403. v-model="scope.row.fRemarks"
  404. size="small"
  405. placeholder="请输入"
  406. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  407. ></el-input>
  408. </span>
  409. </template>
  410. </el-table-column>
  411. <el-table-column
  412. label="操作"
  413. align="center"
  414. class-name="small-padding fixed-width"
  415. min-width="180"
  416. fixed="right"
  417. >
  418. <template slot-scope="scope">
  419. <el-button
  420. size="mini"
  421. type="text"
  422. icon="el-icon-delete"
  423. @click="rowDel(scope.row, scope.$index, tableData)"
  424. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  425. >
  426. 删除
  427. </el-button>
  428. </template>
  429. </el-table-column>
  430. </el-table>
  431. <approval-comments
  432. v-if="addOrUpdateVisib"
  433. ref="ApprovalComments"
  434. @refreshDataList="returnData"
  435. />
  436. <add-or-update ref="addOrUpdate" @imporData="imporData" />
  437. <view-approval ref="viewApproval" />
  438. <column-setting
  439. ref="columnSetting"
  440. @reset="reset"
  441. @getRowdata="getRowdata"
  442. tableName="凯和收费详情页"
  443. />
  444. </div>
  445. </template>
  446. <script>
  447. import Cookies from "js-cookie";
  448. import { tableOption2 } from "./js/index";
  449. import {
  450. selectTVesself,
  451. selectTVoyagef,
  452. selectPortName,
  453. save,
  454. listCorps,
  455. confirm,
  456. RevocationApproval,
  457. getdetail,
  458. infoRemove,
  459. revoke,
  460. getExcelInfo,
  461. } from "@/api/finance/kaihe/charge";
  462. import ApprovalComments from "@/views/startApproval";
  463. import addOrUpdate from "./add-or-update.vue";
  464. import viewApproval from "@/views/viewApproval";
  465. import columnSetting from "@/components/ColumnSetting/index";
  466. import _ from "lodash";
  467. export default {
  468. data() {
  469. return {
  470. form: {
  471. fDc: "D",
  472. fSystemType: Cookies.get("sysType"),
  473. },
  474. options: [],
  475. tableData: [],
  476. tableOption: tableOption2,
  477. TVesselfs: [],
  478. TVoyagefs: [],
  479. portNames: [],
  480. corpList: [],
  481. wRtions: [],
  482. approve: false,
  483. addOrUpdateVisib: false,
  484. readOnly: null,
  485. };
  486. },
  487. components: {
  488. ApprovalComments,
  489. addOrUpdate,
  490. viewApproval,
  491. columnSetting,
  492. },
  493. props: {
  494. showDetail: {
  495. type: Boolean,
  496. },
  497. },
  498. created() {},
  499. methods: {
  500. /** 导出按钮操作 */
  501. handleExport() {
  502. let _this = this;
  503. this.$confirm("是否确认导出明细数据?", "警告", {
  504. confirmButtonText: "确定",
  505. cancelButtonText: "取消",
  506. type: "warning",
  507. })
  508. .then(function () {
  509. return getExcelInfo(_this.form.fId);
  510. })
  511. .then((response) => {
  512. this.download(response.msg);
  513. });
  514. },
  515. getRowdata(list) {
  516. this.tableOption = list;
  517. },
  518. reset() {
  519. this.tableOption = this.$options.data().tableOption;
  520. },
  521. colSetting() {
  522. this.$refs.columnSetting.init(this.tableOption);
  523. },
  524. init() {
  525. selectTVesself().then((res) => {
  526. this.TVesselfs = res.rows;
  527. });
  528. selectTVoyagef().then((res) => {
  529. this.TVoyagefs = res.rows;
  530. });
  531. selectPortName().then((res) => {
  532. this.portNames = res.rows;
  533. });
  534. this.getDicts("whether_reconciliation").then((response) => {
  535. if (response.data) {
  536. this.wRtions = response.data;
  537. }
  538. });
  539. listCorps().then((res) => {
  540. this.corpList = res;
  541. });
  542. setTimeout((e) => {
  543. this.$refs.columnSetting.getRow(this.tableOption);
  544. }, 100);
  545. },
  546. fAmtChange(row) {
  547. if (Number(row.fAmt) > Number(row.fAmtdr)) {
  548. row.fAmt = row.fAmtdr;
  549. this.$message.error("实收金额不能超过应收金额");
  550. }
  551. if (Number(row.fAmt) <= 0) {
  552. row.fAmt = row.fAmtdr;
  553. this.$message.error("请正确输入金额");
  554. }
  555. },
  556. rowDel(row, index, rows) {
  557. console.log();
  558. if (row.fId) {
  559. infoRemove(row.fId).then((res) => {
  560. if (res.code == 200) {
  561. rows.splice(index, 1);
  562. this.$message.success("删除成功");
  563. }
  564. });
  565. } else {
  566. rows.splice(index, 1);
  567. this.$message.success("删除成功");
  568. }
  569. },
  570. getSummaries(param) {
  571. const { columns, data } = param;
  572. const sums = [];
  573. if (data.length > 0) {
  574. columns.forEach((column, index) => {
  575. if (index == 0) {
  576. sums[index] = "合计";
  577. }
  578. if (column.label == "应收金额" || column.label == "实收金额") {
  579. const values = data.map((item) => Number(item[column.property]));
  580. if (!values.every((value) => isNaN(value))) {
  581. sums[index] = values.reduce((prev, curr) => {
  582. const value = Number(curr);
  583. if (!isNaN(value)) {
  584. return prev + curr;
  585. } else {
  586. return prev;
  587. }
  588. }, 0);
  589. // sums[index] += "元";
  590. } else {
  591. sums[index] = "0";
  592. // sums[index] = "0元";
  593. }
  594. }
  595. });
  596. }
  597. return sums;
  598. },
  599. info(row, status) {
  600. this.init();
  601. this.readOnly = status;
  602. const id = row.fId ? row.fId : row;
  603. getdetail(id).then((res) => {
  604. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  605. const date = [];
  606. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  607. res.data.tFee.date = date;
  608. }
  609. this.form = res.data.tFee;
  610. this.tableData = res.data.tFeeDo;
  611. });
  612. },
  613. copyData(id) {
  614. this.init();
  615. getdetail(id).then((res) => {
  616. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  617. const date = [];
  618. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  619. res.data.tFee.date = date;
  620. }
  621. delete res.data.tFee.fId;
  622. delete res.data.tFee.fBillstatus;
  623. delete res.data.tFee.fBillno;
  624. delete res.data.tFee.srcBillNo;
  625. delete res.data.tFee.createBy;
  626. delete res.data.tFee.createTime;
  627. delete res.data.tFee.updateBy;
  628. delete res.data.tFee.updateTime;
  629. delete res.data.tFee.fRemarks;
  630. this.form = res.data.tFee;
  631. });
  632. },
  633. returnData() {
  634. this.addOrUpdateVisib = false;
  635. this.homepaGe();
  636. },
  637. homepaGe() {
  638. let view = {
  639. fullPath: "/finance/contrast",
  640. hash: "",
  641. matched: Array(2),
  642. meta: Object,
  643. name: "Contrast",
  644. params: Object,
  645. path: "/finance/contrast",
  646. query: Object,
  647. title: "收费",
  648. };
  649. this.$router.push({ path: "/index" });
  650. this.$store
  651. .dispatch("tagsView/delView", view)
  652. .then(({ visitedViews }) => {
  653. if (this.isActive(view)) {
  654. this.toLastView(visitedViews, view);
  655. }
  656. });
  657. Global.$emit("removeCache", "closeSelectedTag", view);
  658. },
  659. // 审批按钮
  660. goApproval(status) {
  661. this.addOrUpdateVisib = true;
  662. this.$nextTick(() => {
  663. this.$refs.ApprovalComments.init(this.form.fId, status, 440);
  664. });
  665. },
  666. // 撤销审批
  667. backApproval(status) {
  668. let data = {
  669. id: this.form.fId,
  670. actId: 440,
  671. billId: this.form.fId,
  672. fidStatus: status,
  673. };
  674. RevocationApproval(data).then((response) => {
  675. if (response.code === 200) {
  676. this.msgSuccess("撤销审批成功");
  677. this.open = false;
  678. }
  679. });
  680. },
  681. returnData() {
  682. this.$emit("goBack", false);
  683. },
  684. // 查看审批流
  685. addOrUpdateHandle(status) {
  686. this.addOrUpdateVisible = true;
  687. this.addOrUpdateVisib = false;
  688. let id = null;
  689. if (this.form.fId) {
  690. id = this.form.fId;
  691. } else {
  692. id = this.form.id;
  693. }
  694. this.$nextTick(() => {
  695. this.$refs.viewApproval.init(id, 440, status);
  696. });
  697. },
  698. // 撤销收费
  699. backrRconciliation() {
  700. this.form.fBillstatus = "1";
  701. let formDate = new window.FormData();
  702. formDate.append("tFee", JSON.stringify(this.form));
  703. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  704. revoke(formDate).then((response) => {
  705. this.msgSuccess("撤回成功");
  706. this.$emit("goBack", false);
  707. });
  708. },
  709. Search() {
  710. const data = {
  711. fReconciliation: this.form.fReconciliation,
  712. fDc: this.form.fDc,
  713. fSystemType: 3,
  714. fCorpid: this.form.fCorpid,
  715. fVslid: this.form.fVslid,
  716. fVoyid: this.form.fVoyid,
  717. fDestportid: this.form.fDestportid,
  718. fLoadportid: this.form.fLoadportid,
  719. fStatementNo: this.form.fStatementNo,
  720. fFromDate: this.form.date ? this.form.date[0] : null,
  721. fToDate: this.form.date ? this.form.date[1] : null,
  722. };
  723. this.$refs["form"].validate((valid) => {
  724. if (valid) {
  725. this.$refs.addOrUpdate.init(data, this.tableData);
  726. } else {
  727. this.$message.error("请选择客户名称");
  728. return false;
  729. }
  730. });
  731. },
  732. imporData(rows) {
  733. this.tableData = this.tableData.concat(rows);
  734. },
  735. lumpSum() {
  736. let fAmtdr = 0;
  737. let fAmtcr = 0;
  738. this.tableData.map((e) => {
  739. fAmtdr = _.add(fAmtdr, Number(e.fAmtdr));
  740. fAmtcr = _.add(fAmtcr, Number(e.fAmt));
  741. });
  742. this.form.fAmtdr = fAmtdr;
  743. this.form.fAmtcr = fAmtcr;
  744. },
  745. submit() {
  746. if (this.form.fCorpid == null) {
  747. return this.$message.error("客户名称不能为空");
  748. }
  749. this.corpList.forEach((e) => {
  750. if (this.form.fCorpid == e.fId) {
  751. this.form.fCtrlcorpid = e.fName;
  752. }
  753. });
  754. if (this.tableData.length == 0) {
  755. return this.$message.error("明细表不能为空");
  756. }
  757. if (this.form.date) {
  758. this.form.fFromDate = this.form.date[0];
  759. this.form.fToDate = this.form.date[1];
  760. }
  761. this.lumpSum();
  762. if (this.form.fId == null) {
  763. return this.$message.error("数据未保存,不能进行确认收费");
  764. }
  765. let formDate = new window.FormData();
  766. formDate.append("tFee", JSON.stringify(this.form));
  767. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  768. formDate.append("billsType", JSON.stringify("KHDZ"));
  769. confirm(formDate).then((res) => {
  770. if (res.code == 200) {
  771. this.$emit("goBack", false);
  772. this.$message.success("收费成功");
  773. }
  774. });
  775. },
  776. save(type) {
  777. if (this.form.fCorpid == null) {
  778. return this.$message.error("客户名称不能为空");
  779. }
  780. this.corpList.forEach((e) => {
  781. if (this.form.fCorpid == e.fId) {
  782. this.form.fCtrlcorpid = e.fName;
  783. }
  784. });
  785. // if (this.tableData.length == 0) {
  786. // return this.$message.error("明细表不能为空");
  787. // }
  788. if (this.form.date) {
  789. this.form.fFromDate = this.form.date[0];
  790. this.form.fToDate = this.form.date[1];
  791. }
  792. this.lumpSum();
  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. save(formDate).then((res) => {
  798. if (res.code == 200) {
  799. if (!type) {
  800. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  801. const date = [];
  802. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  803. res.data.tFee.date = date;
  804. }
  805. this.form = res.data.tFee;
  806. this.tableData = res.data.tFeeDo;
  807. }
  808. this.$emit("refFresh");
  809. this.$message.success("保存成功");
  810. }
  811. });
  812. },
  813. cancel() {
  814. if (this.readOnly != 0) {
  815. this.$confirm("返回列表,是否保存?", "提示", {
  816. confirmButtonText: "保存",
  817. cancelButtonText: "取消",
  818. type: "warning",
  819. })
  820. .then(() => {
  821. this.save("back");
  822. Object.assign(this.$data, this.$options.data());
  823. this.$emit("goBack", false);
  824. })
  825. .catch(() => {
  826. Object.assign(this.$data, this.$options.data());
  827. this.$emit("goDetail", false);
  828. });
  829. } else {
  830. Object.assign(this.$data, this.$options.data());
  831. this.$emit("goBack", false);
  832. }
  833. },
  834. },
  835. watch: {
  836. info: function (obj) {
  837. console.log(obj);
  838. },
  839. },
  840. };
  841. </script>
  842. <style lang="scss" scoped>
  843. .head-but {
  844. display: flex;
  845. justify-content: space-between;
  846. margin-bottom: 8px;
  847. }
  848. .tabSetting {
  849. display: flex;
  850. justify-content: flex-end;
  851. }
  852. </style>