main.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. <template>
  2. <div>
  3. <containerTitle title="费用明细"></containerTitle>
  4. <basic-container>
  5. <avue-crud
  6. ref="feeCrud"
  7. :data="feeData"
  8. :option="feeOption"
  9. @saveColumn="saveColumn"
  10. @resetColumn="resetColumn"
  11. @selection-change="selectionChange"
  12. :summary-method="summaryMethod"
  13. :cell-style="cellStyle"
  14. >
  15. <template slot="menuLeft">
  16. <el-tabs v-model="activeName" @tab-click="tabHandle">
  17. <el-tab-pane
  18. label="应收"
  19. name="first"
  20. :key="'first'"
  21. v-if="tabShow == 1 || tabShow == 2"
  22. >
  23. </el-tab-pane>
  24. <el-tab-pane
  25. label="应付"
  26. name="second"
  27. :key="'second'"
  28. v-if="tabShow == 1 || tabShow == 3"
  29. >
  30. </el-tab-pane>
  31. </el-tabs>
  32. <el-button
  33. type="primary"
  34. icon="el-icon-plus"
  35. size="small"
  36. @click.stop="rowAdd"
  37. :loading="buttonLoading"
  38. :disabled="disabled"
  39. >录入明细</el-button
  40. >
  41. <el-button
  42. type="warning"
  43. size="small"
  44. @click.stop="billingDetails('收费')"
  45. :loading="buttonLoading"
  46. :disabled="
  47. (financeDisabled && disabled) || selectionList.length == 0
  48. "
  49. v-if="selectTab === 1"
  50. >生成账单</el-button
  51. >
  52. <el-button
  53. type="warning"
  54. size="small"
  55. @click.stop="billingDetails('申请')"
  56. :loading="buttonLoading"
  57. :disabled="
  58. (financeDisabled && disabled) || selectionList.length == 0
  59. "
  60. v-if="selectTab === 2"
  61. >申请付费</el-button
  62. >
  63. </template>
  64. <template slot="menu" slot-scope="{ row, index }">
  65. <el-button
  66. size="small"
  67. icon="el-icon-edit"
  68. type="text"
  69. @click="rowCell(row, index)"
  70. :disabled="disabled"
  71. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  72. >
  73. <el-button
  74. size="small"
  75. icon="el-icon-delete"
  76. type="text"
  77. @click="rowDel(row, index)"
  78. :disabled="disabled"
  79. >删 除</el-button
  80. >
  81. </template>
  82. <template slot="headerSerial">
  83. <el-button
  84. type="primary"
  85. icon="el-icon-plus"
  86. size="mini"
  87. @click.stop="addRow"
  88. :disabled="disabled"
  89. circle
  90. ></el-button>
  91. </template>
  92. <template slot="corpId" slot-scope="{ row, index }">
  93. <span v-if="row.$cellEdit && !inCropId" class="required_fields"
  94. >*</span
  95. >
  96. <crop-select
  97. ref="corp"
  98. style="width: 90% !important;display: inline-block"
  99. v-if="row.$cellEdit"
  100. v-model="row.corpId"
  101. :cropIndex="index"
  102. @getCorpData="getCorpData"
  103. corpType="KG"
  104. ></crop-select>
  105. <span v-else>{{ row.corpName }}</span>
  106. </template>
  107. <template slot="feeName" slot-scope="{ row }">
  108. <span v-if="row.$cellEdit" class="required_fields">*</span>
  109. <breakdown-select
  110. v-if="row.$cellEdit"
  111. v-model="row.itemId"
  112. @selectValue="value => selectValue(value, row)"
  113. :configuration="breakConfiguration"
  114. >
  115. </breakdown-select>
  116. <span v-else>{{ row.feeName }}</span>
  117. </template>
  118. <template slot="billNo" slot-scope="{ row }">
  119. <el-select
  120. v-if="row.$cellEdit"
  121. v-model="row.billNo"
  122. size="small"
  123. filterable
  124. allow-create
  125. default-first-option
  126. clearable
  127. >
  128. <el-option
  129. v-for="(item, index) in billNoList"
  130. :key="index"
  131. :label="item"
  132. :value="item"
  133. >
  134. </el-option>
  135. </el-select>
  136. <span v-else>{{ row.billNo }}</span>
  137. </template>
  138. <template slot="price" slot-scope="{ row }">
  139. <el-input-number
  140. v-if="row.$cellEdit"
  141. v-model="row.price"
  142. placeholder="请输入"
  143. size="small"
  144. :controls="false"
  145. :precision="2"
  146. @input="countChange(row)"
  147. style="width: 100%"
  148. ></el-input-number>
  149. <span v-else>{{ row.price | micrometerFormat }}</span>
  150. </template>
  151. <template slot="quantity" slot-scope="{ row }">
  152. <el-input-number
  153. v-if="row.$cellEdit"
  154. v-model="row.quantity"
  155. size="small"
  156. placeholder="请输入"
  157. :controls="false"
  158. :precision="0"
  159. @input="countChange(row)"
  160. style="width: 100%"
  161. ></el-input-number>
  162. <span v-else>{{ row.quantity | decimalFormat }}</span>
  163. </template>
  164. <template slot="amount" slot-scope="{ row }">
  165. <span>{{ row.amount | micrometerFormat }}</span>
  166. </template>
  167. <template slot="exchangeRate" slot-scope="{ row }">
  168. <el-input-number
  169. v-if="row.$cellEdit"
  170. v-model="row.exchangeRate"
  171. size="small"
  172. :controls="false"
  173. :precision="6"
  174. @change="rateChange(row)"
  175. style="width: 100%"
  176. placeholder="请输入"
  177. ></el-input-number>
  178. <span v-else>{{ row.exchangeRate }}</span>
  179. </template>
  180. <template slot="currency" slot-scope="{ row }">
  181. <el-select
  182. v-if="row.$cellEdit"
  183. v-model="row.currency"
  184. filterable
  185. allow-create
  186. default-first-option
  187. placeholder="请选择"
  188. size="small"
  189. @change="currencyChange(row)"
  190. >
  191. <el-option
  192. v-for="(item, index) in currencyList"
  193. :key="index"
  194. :label="item.dictValue"
  195. :value="item.dictValue"
  196. >
  197. </el-option>
  198. </el-select>
  199. <span v-else>{{ row.currency }}</span>
  200. </template>
  201. <template slot="unit" slot-scope="{ row }">
  202. <el-select
  203. v-if="row.$cellEdit"
  204. v-model="row.unit"
  205. filterable
  206. placeholder="请选择"
  207. size="small"
  208. >
  209. <el-option
  210. v-for="(item, index) in unitList"
  211. :key="index"
  212. :label="item.dictValue"
  213. :value="item.dictValue"
  214. >
  215. </el-option>
  216. </el-select>
  217. <span v-else>{{ row.unit }}</span>
  218. </template>
  219. </avue-crud>
  220. </basic-container>
  221. <el-dialog
  222. title="导入费用"
  223. append-to-body
  224. :visible.sync="feeDialog"
  225. top="5vh"
  226. width="60%"
  227. :close-on-click-modal="false"
  228. @closed="feeClose"
  229. class="el-dialogDeep"
  230. v-dialog-drag
  231. >
  232. <el-row style="height: 0;">
  233. <el-col :span="5">
  234. <div style="margin-top:45px">
  235. <el-scrollbar>
  236. <basic-container>
  237. <avue-tree
  238. :option="treeOption"
  239. :data="treeData"
  240. @node-click="nodeClick"
  241. />
  242. </basic-container>
  243. </el-scrollbar>
  244. </div>
  245. </el-col>
  246. <el-col :span="19">
  247. <avue-crud
  248. :option="option"
  249. :table-loading="loading"
  250. :data="data"
  251. ref="crud"
  252. @refresh-change="refreshChange"
  253. @selection-change="selectionChange"
  254. @current-change="currentChange"
  255. @size-change="sizeChange"
  256. :page.sync="page"
  257. @on-load="onLoad"
  258. :cell-style="cellStyle"
  259. >
  260. </avue-crud>
  261. </el-col>
  262. </el-row>
  263. <div class="dialogButton">
  264. <el-button @click="feeDialog = false">取 消</el-button>
  265. <el-button
  266. type="primary"
  267. @click="importData"
  268. :disabled="this.selectionList.length == 0"
  269. >
  270. 导入
  271. </el-button>
  272. </div>
  273. </el-dialog>
  274. <crop-dialog ref="cropDialog" @importCorp="importCorp"></crop-dialog>
  275. </div>
  276. </template>
  277. <script>
  278. import feeOption from "./config/feeInfo.json";
  279. import option from "./config/feeList.json";
  280. import { getDeptLazyTree, customerList } from "@/api/basicData/basicFeesDesc";
  281. import { delItem } from "@/api/feeInfo/fee-info";
  282. import { isPercentage, micrometerFormat, IntegerFormat } from "@/util/validate";
  283. import cropDialog from "@/components/crop-dialog/main";
  284. import _ from "lodash";
  285. import ApplyPayment from "../finance/applyPayment";
  286. import {
  287. applyLoan,
  288. paymentApply
  289. } from "@/api/financialManagement/paymentRequest";
  290. import { contrastList } from "@/util/contrastData";
  291. import { allCropList } from "@/api/basicData/customerInformation";
  292. import { getCustomerCode, getCustomerName } from "@/enums/management-type";
  293. import { getParities } from "@/api/basicData/customerInquiry";
  294. import { dateFormat } from "@/util/date";
  295. export default {
  296. name: "feeInfo",
  297. data() {
  298. return {
  299. option: option,
  300. feeOption: {},
  301. feeDialog: false,
  302. buttonLoading: false,
  303. treeOption: {
  304. nodeKey: "id",
  305. lazy: true,
  306. treeLoad: function(node, resolve) {
  307. const parentId = node.level === 0 ? 0 : node.data.id;
  308. getDeptLazyTree(parentId).then(res => {
  309. resolve(
  310. res.data.data.map(item => {
  311. return {
  312. ...item,
  313. leaf: !item.hasChildren
  314. };
  315. })
  316. );
  317. });
  318. },
  319. addBtn: false,
  320. menu: false,
  321. size: "small",
  322. props: {
  323. labelText: "标题",
  324. label: "title",
  325. value: "value",
  326. children: "children"
  327. }
  328. },
  329. page: {
  330. pageSize: 10,
  331. currentPage: 1,
  332. total: 0
  333. },
  334. treeDeptId: null,
  335. loading: false,
  336. receivableButton: "primary",
  337. copeWithButton: "",
  338. data: [],
  339. feeData: [],
  340. selectionList: [],
  341. reData: null,
  342. currencyList: [],
  343. unitList: [],
  344. breakConfiguration: {
  345. multipleChoices: false,
  346. multiple: false,
  347. disabled: false,
  348. searchShow: true,
  349. collapseTags: false,
  350. clearable: true,
  351. placeholder: "请点击右边按钮选择",
  352. dicData: []
  353. },
  354. allData: [],
  355. data_one: [],
  356. data_two: [],
  357. selectTab: 1,
  358. activeName: "first",
  359. enableName: "first",
  360. tab1: true,
  361. tab2: false,
  362. corpList: []
  363. };
  364. },
  365. props: {
  366. orderFeesList: {
  367. type: Array
  368. },
  369. disabled: {
  370. type: Boolean
  371. },
  372. feeUrl: {
  373. type: String
  374. },
  375. billUrl: {
  376. type: String
  377. },
  378. optionType: {
  379. type: String
  380. },
  381. itemType: {
  382. type: String
  383. },
  384. srcType: {
  385. type: Number,
  386. default: 2
  387. },
  388. corpId: {
  389. type: String
  390. },
  391. billNoList: {
  392. type: Array
  393. },
  394. financeDisabled: {
  395. type: Boolean,
  396. default: true
  397. },
  398. inCropId: {
  399. type: Boolean,
  400. default: false
  401. },
  402. // 1.显示全部 2.收费 3.付费
  403. tabShow: {
  404. type: Number,
  405. default: 1
  406. }
  407. },
  408. filters: {
  409. isPercentage(val) {
  410. return isPercentage(val);
  411. },
  412. micrometerFormat(val) {
  413. return micrometerFormat(val);
  414. },
  415. decimalFormat(num) {
  416. return num ? Number(num).toFixed(6) : "0.00";
  417. },
  418. IntegerFormat(num) {
  419. return IntegerFormat(num);
  420. }
  421. },
  422. async created() {
  423. // 判断tabShow的activeName默认的显示
  424. this.activeName =
  425. this.tabShow == 1 ? "first" : this.tabShow == 2 ? "first" : "second";
  426. this.feeOption = await this.getColumnData(
  427. this.getColumnName(33),
  428. feeOption
  429. );
  430. if (this.$store.getters.userInfo.tenant_id === "888390") {
  431. this.feeOption.column.forEach(item => {
  432. if (item.prop === "billNo") {
  433. item.hide = false;
  434. }
  435. });
  436. }
  437. this.getWorkDicts("currency").then(res => {
  438. this.currencyList = res.data.data;
  439. });
  440. this.getWorkDicts("unit").then(res => {
  441. this.unitList = res.data.data;
  442. });
  443. allCropList({
  444. corpType: getCustomerCode("KG")
  445. }).then(res => {
  446. this.corpList = res.data.data;
  447. });
  448. if (localStorage.getItem("roleName") == "贸易") {
  449. this.findObject(this.feeOption.column, "corpId").hide = true;
  450. this.findObject(this.feeOption.column, "corpId").showColumn = false;
  451. }
  452. },
  453. components: {
  454. cropDialog,
  455. ApplyPayment
  456. },
  457. watch: {
  458. disabled: function() {
  459. this.$refs.feeCrud.refreshTable();
  460. },
  461. orderFeesList(newVla, oldVal) {
  462. if (newVla !== oldVal) {
  463. this.allData = newVla;
  464. this.data_one = newVla.filter(item => item.feesType === 1); //应收
  465. this.data_two = newVla.filter(item => item.feesType === 2); //应付
  466. if (this.selectTab === 1) {
  467. this.feeData = this.data_one;
  468. } else {
  469. this.feeData = this.data_two;
  470. }
  471. }
  472. },
  473. activeName(newVla, oldVal) {
  474. if (newVla !== oldVal) {
  475. if (newVla === "first") {
  476. this.tab1 = true;
  477. this.tab2 = false;
  478. this.data_two = this.feeData;
  479. this.selectTab = 1;
  480. this.feeData = this.data_one;
  481. } else {
  482. this.tab1 = false;
  483. this.tab2 = true;
  484. this.data_one = this.feeData;
  485. this.selectTab = 2;
  486. this.feeData = this.data_two;
  487. }
  488. }
  489. }
  490. },
  491. methods: {
  492. //选择费用
  493. selectValue(value, row) {
  494. this.$set(row, "feeName", value.cname);
  495. this.$set(row, "ename", value.ename);
  496. this.currencyChange(row);
  497. },
  498. //选择应收应付
  499. // handleClick(tab){
  500. // if(tab.name === "first"){
  501. // this.tab1 = true;
  502. // this.tab2 = false;
  503. //
  504. // this.data_two = this.feeData
  505. //
  506. // this.selectTab = 1
  507. // this.feeData = this.data_one
  508. // }else{
  509. // this.tab1 = false;
  510. // this.tab2 = true;
  511. //
  512. // this.data_one = this.feeData
  513. //
  514. // this.selectTab = 2
  515. // this.feeData = this.data_two
  516. // }
  517. // },
  518. cellStyle() {
  519. return "padding:0;height:40px;";
  520. },
  521. importCorp(row) {
  522. this.feeData.push({
  523. itemId: null,
  524. corpId: row.id,
  525. corpName: row.name,
  526. ename: null,
  527. feeName: null,
  528. price: null,
  529. unit: null,
  530. quantity: null,
  531. amount: null,
  532. currency: "CNY",
  533. exchangeRate: 1,
  534. remarks: null,
  535. $cellEdit: true,
  536. feesType: this.selectTab
  537. });
  538. },
  539. //带出汇率
  540. currencyChange(row) {
  541. getParities({
  542. currency: row.currency,
  543. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00"
  544. }).then(res => {
  545. const data = res.data.data;
  546. row.exchangeRate = data.receivableParities;
  547. });
  548. },
  549. rowDel(row, index) {
  550. this.$confirm("确定删除数据?", {
  551. confirmButtonText: "确定",
  552. cancelButtonText: "取消",
  553. type: "warning"
  554. }).then(() => {
  555. //费用判断是否需要调用删除接口
  556. if (row.id) {
  557. delItem(row.id, this.feeUrl).then(res => {
  558. this.$message({
  559. type: "success",
  560. message: "删除成功!"
  561. });
  562. this.feeData.splice(index, 1);
  563. });
  564. } else {
  565. this.$message({
  566. type: "success",
  567. message: "删除成功!"
  568. });
  569. this.feeData.splice(index, 1);
  570. }
  571. });
  572. },
  573. getCorpData(row) {
  574. this.feeData[row.index].corpName = row.cname;
  575. },
  576. countChange(row) {
  577. if (row.price && row.quantity) {
  578. row.amount = _.multiply(row.quantity, row.price).toFixed(2);
  579. }
  580. },
  581. rateChange(row) {
  582. if (row.exchangeRate >= 100) {
  583. row.exchangeRate = 0;
  584. this.$message.error("汇率不能超过100%");
  585. }
  586. },
  587. currentChange(val) {
  588. this.page.currentPage = val;
  589. },
  590. sizeChange(val) {
  591. this.page.currentPage = 1;
  592. this.page.pageSize = val;
  593. },
  594. //刷新
  595. refreshChange() {
  596. this.page.currentPage = 1;
  597. this.onLoad(this.page);
  598. },
  599. //多选
  600. selectionChange(list) {
  601. this.selectionList = list;
  602. },
  603. rePick(row, index) {
  604. this.reData = {
  605. ...row,
  606. index: index
  607. };
  608. this.feeDialog = true;
  609. this.onLoad(this.page);
  610. },
  611. //费用编辑
  612. rowCell(row, index) {
  613. if (row.$cellEdit == true) {
  614. this.$set(row, "$cellEdit", false);
  615. } else {
  616. this.$set(row, "$cellEdit", true);
  617. }
  618. },
  619. //新增
  620. rowAdd() {
  621. if (this.inCropId) {
  622. const params = {
  623. feesType: this.selectTab
  624. };
  625. this.$refs.feeCrud.rowCellAdd(params);
  626. } else {
  627. if (!this.corpId) return this.$message.error("请选择往来单位");
  628. if (this.$store.getters.userInfo.tenant_id === "888390") {
  629. this.$emit("getBillNo");
  630. }
  631. let corpName = this.corpList.find(item => this.corpId == item.id).cname;
  632. const params = {
  633. feesType: this.selectTab,
  634. corpId: this.corpId,
  635. corpName: corpName
  636. };
  637. this.$refs.feeCrud.rowCellAdd(params);
  638. }
  639. },
  640. addRow() {
  641. this.rowAdd();
  642. },
  643. onLoad(page) {
  644. this.loading = true;
  645. let data = {
  646. size: page.pageSize,
  647. current: page.currentPage,
  648. parentId: 0,
  649. feesTypeId: this.treeDeptId
  650. };
  651. customerList(data).then(res => {
  652. const data = res.data.data;
  653. this.page.total = data.total;
  654. this.data = data.records;
  655. this.loading = false;
  656. if (this.page.total) {
  657. this.option.height = window.innerHeight - 350;
  658. }
  659. });
  660. },
  661. //导入页左费用类型查询
  662. nodeClick(data) {
  663. this.treeDeptId = data.id;
  664. this.page.currentPage = 1;
  665. this.onLoad(this.page);
  666. },
  667. feeClose() {
  668. this.selectionList = [];
  669. this.page = {
  670. pageSize: 10,
  671. currentPage: 1,
  672. total: 0
  673. };
  674. this.treeDeptId = null;
  675. this.loading = false;
  676. this.data = [];
  677. this.reData = null;
  678. },
  679. importData() {
  680. if (this.reData) {
  681. this.selectionList.length;
  682. if (this.selectionList.length != 1) {
  683. return this.$message.error("重新选择的时候只能选择一条数据");
  684. } else {
  685. this.selectionList.forEach(e => {
  686. this.feeData.forEach((item, index) => {
  687. if (index == this.reData.index) {
  688. item.itemId = e.id;
  689. item.corpId = this.reData.corpId;
  690. item.feeName = e.cname;
  691. item.price = this.reData.price;
  692. // item.unit = e.unitno;
  693. item.quantity = this.reData.quantity;
  694. item.amount = this.reData.amount;
  695. item.remarks = this.reData.remarks;
  696. item.$cellEdit = true;
  697. }
  698. });
  699. });
  700. }
  701. } else {
  702. this.selectionList.forEach(e => {
  703. this.feeData.push({
  704. itemId: e.id,
  705. corpId: null,
  706. feeName: e.cname,
  707. price: 0,
  708. // unit: e.unitno,
  709. quantity: 0,
  710. amount: 0,
  711. remarks: null,
  712. $cellEdit: true
  713. });
  714. });
  715. }
  716. this.feeDialog = false;
  717. },
  718. submitData() {
  719. let list = [];
  720. //保存时 将所出的tab页数据赋值到相应 data上
  721. if (this.selectTab === 1) {
  722. this.data_one = this.feeData;
  723. } else {
  724. this.data_two = this.feeData;
  725. }
  726. list.push(...this.data_one, ...this.data_two);
  727. return list;
  728. },
  729. billingDetails(type) {
  730. //查看是否改动过数据
  731. this.$emit("beforeFinance", this.submitData(), params => {
  732. if (params.valid) {
  733. for (let i = 0; i < this.selectionList.length; i++) {
  734. if (this.selectionList[i].corpId != this.selectionList[0].corpId) {
  735. return this.$message.error("批量操作结算单位必须一致");
  736. }
  737. if (this.selectionList[i].isCheck == 1) {
  738. return this.$message.error(
  739. "选中的数据已" + type + ",请勿重复操作!"
  740. );
  741. }
  742. }
  743. this.selectionList.map(item => {
  744. // item.url = this.billUrl
  745. item.srcOrderno = params.srcOrderno;
  746. item.srcParentId = params.parentId;
  747. item.corpsName = item.corpName;
  748. item.srcFeesId = item.id;
  749. item.costType = item.itemId;
  750. item.itemType = this.itemType;
  751. item.optionType = this.optionType;
  752. item.srcType = this.srcType; //费用明细申请
  753. item.tradeType = this.optionType;
  754. });
  755. let data = {
  756. billType: type,
  757. itemsList: this.selectionList
  758. };
  759. if (type === "申请") {
  760. this.$confirm("您确定申请付费吗?", "提示", {
  761. confirmButtonText: "确定",
  762. cancelButtonText: "取消",
  763. type: "warning"
  764. }).then(() => {
  765. this.buttonLoading = true;
  766. data.checkType = "ffsq";
  767. data.url = "/financialManagement/paymentRequest/index";
  768. data.pageStatus = "this.$store.getters.pqStatus";
  769. data.pageLabel = "付费申请";
  770. applyLoan(data)
  771. .then(res => {
  772. if (res.data.success) {
  773. this.$message.success("操作成功!");
  774. this.$emit("afterFinance");
  775. //跳转付费申请页面
  776. // if(this.$store.getters.pqStatus){
  777. // this.$alert("无法自动跳转,因为付费申请页面已存在!", "温馨提示", {
  778. // confirmButtonText: "确定",
  779. // type: 'warning',
  780. // callback: action => {
  781. // }
  782. // });
  783. // }else{
  784. // //关闭一下存在的列表页 跳转
  785. // this.$router.$avueRouter.closeTag('/financialManagement/paymentRequest/index');
  786. // this.$router.push({
  787. // path: "/financialManagement/paymentRequest/index",
  788. // query: {params: res.data.data.id},
  789. // });
  790. // }
  791. }
  792. })
  793. .finally(() => {
  794. this.buttonLoading = false;
  795. });
  796. });
  797. } else {
  798. this.$confirm("您确定生成账单吗?", "提示", {
  799. confirmButtonText: "确定",
  800. cancelButtonText: "取消",
  801. type: "warning"
  802. }).then(() => {
  803. this.buttonLoading = true;
  804. paymentApply(data)
  805. .then(res => {
  806. if (res.data.success) {
  807. this.$message.success("操作成功!");
  808. this.$emit("afterFinance");
  809. }
  810. })
  811. .finally(() => {
  812. this.buttonLoading = false;
  813. });
  814. });
  815. }
  816. }
  817. });
  818. },
  819. summaryMethod({ columns, data }) {
  820. const sums = [];
  821. if (columns.length > 0) {
  822. columns.forEach((item, index) => {
  823. sums[0] = "合计";
  824. if (item.property == "quantity" || item.property == "amount") {
  825. let qtySum = 0;
  826. let amountSum = 0;
  827. data.forEach(e => {
  828. qtySum = _.add(qtySum, Number(e.quantity));
  829. amountSum = _.add(amountSum, Number(e.amount));
  830. });
  831. //数量总计
  832. if (item.property == "quantity") {
  833. sums[index] = qtySum ? qtySum.toFixed(6) : "0.00";
  834. }
  835. //金额总计
  836. if (item.property == "amount") {
  837. sums[index] = micrometerFormat(amountSum);
  838. }
  839. }
  840. });
  841. }
  842. return sums;
  843. },
  844. async saveColumn() {
  845. const inSave = await this.saveColumnData(
  846. this.getColumnName(33),
  847. this.feeOption
  848. );
  849. if (inSave) {
  850. this.$message.success("保存成功");
  851. //关闭窗口
  852. this.$refs.feeCrud.$refs.dialogColumn.columnBox = false;
  853. }
  854. },
  855. async resetColumn() {
  856. const inSave = await this.delColumnData(
  857. this.getColumnName(33),
  858. feeOption
  859. );
  860. if (inSave) {
  861. this.$message.success("重置成功");
  862. this.feeOption = feeOption;
  863. //关闭窗口
  864. this.$refs.feeCrud.$refs.dialogColumn.columnBox = false;
  865. }
  866. },
  867. tabHandle(data) {
  868. // if (data.name == this.enableName) return
  869. // this.enableName = data.name
  870. }
  871. }
  872. };
  873. </script>
  874. <style lang="scss" scoped>
  875. .required_fields {
  876. color: #f56c6c;
  877. display: inline-block;
  878. width: 7%;
  879. }
  880. </style>