kaihe-detail.vue 24 KB

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