main.vue 26 KB

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