kaihe-detail.vue 25 KB

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