main.vue 24 KB

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