financeOpen.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. <template>
  2. <div class="app-container zap-main">
  3. <el-form ref="form" :model="form" :rules="rules" label-width="auto">
  4. <el-row class="zap-form pt20">
  5. <content-title title="开立融信"></content-title>
  6. <el-row class="zap-margin-top">
  7. <el-col :span="8">
  8. <el-form-item label="开立方" prop="openName">
  9. <el-input v-model="form.openName" class="zap-form-input" disabled />
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="8">
  13. <el-form-item label="授信额度" prop="zfiSupplierQuotaId">
  14. <el-select
  15. v-model="form.zfiSupplierQuotaId"
  16. filterable
  17. clearable
  18. remote
  19. @change="change"
  20. class="zap-form-input">
  21. <el-option v-for="item in creditLineList" :key="item.value" :label="item.label+'/'+item.remaining" :value="item.value">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="8" style="height: 36px;line-height: 36px;margin-bottom: 22px;font-size: 14px;">
  27. <span>最小融资金额:</span>
  28. <span>{{zfpMinimumAmount}}</span>
  29. </el-col>
  30. <el-col :span="8">
  31. <el-form-item label="接收方" prop="receiveName">
  32. <el-input v-model="form.receiveName" disabled class="zap-form-input" />
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="8">
  36. <el-form-item label="签发有效期" prop="zfiEffectiveDate" class="zap-form-item__content">
  37. <el-date-picker
  38. class="zap-form-input"
  39. clearable
  40. v-model="form.zfiEffectiveDate"
  41. type="date"
  42. value-format="yyyy-MM-dd"
  43. placeholder="选择签发有效期"
  44. :picker-options="pickerOptions">
  45. </el-date-picker>
  46. <el-tooltip class="zap-form-tip" effect="light" content="签发有效期:即指定签发截止日期,对方企业在签发截止日内未处理该笔融信,本次融信操作将自动失效" placement="top">
  47. <img src="../../../assets/images/icon_tip.png" alt="">
  48. </el-tooltip>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="8">
  52. <el-form-item label="承诺还款日" prop="zfiExpireDate">
  53. <el-date-picker
  54. class="zap-form-input"
  55. clearable
  56. v-model="form.zfiExpireDate"
  57. type="date"
  58. value-format="yyyy-MM-dd"
  59. placeholder="选择承诺还款日"
  60. :picker-options="pickerOptions">
  61. </el-date-picker>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="8">
  65. <el-form-item label="签发金额" prop="zfiAmount">
  66. <el-input class="zap-form-input" v-model="form.zfiAmount" @input="getBigSmall" @input.native="changeRate($event,form.zfiAmount)" />
  67. </el-form-item>
  68. </el-col>
  69. <el-col :span="8">
  70. <el-form-item label="金额大写" prop="issuedAmount">
  71. {{issuedAmount}}
  72. </el-form-item>
  73. </el-col>
  74. </el-row>
  75. </el-row>
  76. <el-row class="zap-form mt20 pt20">
  77. <el-row>
  78. <content-title title="资产信息"></content-title>
  79. <zap-tip class="pt12"></zap-tip>
  80. </el-row>
  81. <el-row>
  82. <el-col :span="12">
  83. <el-button type="success" @click="openTicket">选择</el-button>
  84. <el-button type="primary" icon="el-icon-plus" @click="addPay">新增应付账款</el-button>
  85. <el-button @click="deleteTicekt">清空全部</el-button>
  86. </el-col>
  87. <el-col :span="12">
  88. <el-row type="flex" align="middle" justify="end">
  89. <content-total :amount="checkTotalAmt" :words="checkTotalBigAmt"></content-total>
  90. </el-row>
  91. </el-col>
  92. </el-row>
  93. <el-row>
  94. <el-table class="zap-table" :data="ticketList" style="width: 100%;" stripe>
  95. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  96. <el-table-column label="应收企业" align="center" prop="receiveName" />
  97. <el-table-column label="应付企业" align="center" prop="payName" />
  98. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" width="100" show-overflow-tooltip />
  99. <el-table-column label="金额" align="center" :formatter="moneyFormat" prop="zbiAmount" width="120" />
  100. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
  101. <template slot-scope="scope">
  102. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.$index, ticketList)">删除</el-button>
  103. <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.$index, ticketList)">详情</el-button>
  104. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.$index, ticketList)">修改</el-button>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. </el-row>
  109. </el-row>
  110. </el-form>
  111. <el-row type="flex" justify="center" align="middle" style="height: 96px;">
  112. <el-button type="primary" @click="submitForm">确 定</el-button>
  113. <el-button type="primary" plain @click="cancel">取 消</el-button>
  114. </el-row>
  115. <!-- 应付账款信息 -->
  116. <el-dialog :title="payTitle" :visible.sync="open" width="1120px" append-to-body destroy-on-close>
  117. <search-bar :hiddenSetting="true" @query="handleQuerys" @reset="resetQuerys">
  118. <el-form :model="queryParamsPay" ref="formQuery" :inline="true" label-width="68px" style="margin-bottom: -21px">
  119. <el-form-item label="账款名称" prop="zbiName">
  120. <el-input
  121. v-model="queryParamsPay.zbiName"
  122. placeholder="请输入账款名称"
  123. clearable
  124. size="small"
  125. maxlength="11"
  126. @keyup.enter.native="handleQuerys" />
  127. </el-form-item>
  128. <el-form-item label="应付企业" prop="payName" style="margin-left: 94px;">
  129. <el-input
  130. v-model="queryParamsPay.payName"
  131. placeholder="请输入应付企业"
  132. clearable
  133. size="small"
  134. maxlength="11"
  135. @keyup.enter.native="handleQuerys" />
  136. </el-form-item>
  137. </el-form>
  138. </search-bar>
  139. <el-table :data="payList" ref="tablePay" class="single-select-table" @selection-change="handleSelectionChange" :row-key="rowkey">
  140. <el-table-column type="selection" :reserve-selection="true" width="50" align="center" />
  141. <el-table-column label="序号" type="index" width="50" align="center">
  142. <template slot-scope="scope">
  143. <span>{{ (queryParamsPay.pageNum - 1) * queryParamsPay.pageSize + scope.$index + 1}}</span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  147. <el-table-column label="应收企业" align="center" prop="receiveName" />
  148. <el-table-column label="应付企业" align="center" prop="payName" />
  149. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
  150. <el-table-column label="金额" :formatter="moneyFormat" align="center" prop="zbiAmount" />
  151. </el-table>
  152. <pagination v-show="total > 0" :total="total" :page.sync="queryParamsPay.pageNum" :limit.sync="queryParamsPay.pageSize" @pagination="getAccountsCollection" />
  153. <span slot="footer">
  154. <el-button type="primary" @click="closeTicket">确认</el-button>
  155. <el-button @click="cancelTicket">取消</el-button>
  156. </span>
  157. </el-dialog>
  158. <!-- 新增往来账款 -->
  159. <el-dialog title="新增往来账款" :visible.sync="openAddBill" width="1120px" append-to-body>
  160. <add-bill :companyId="form.zfiCoreId" companyType="01" :payDate="payDate" @addClick="emitAddClick" v-if="openAddBill"></add-bill>
  161. </el-dialog>
  162. <!-- 附件详情 -->
  163. <el-dialog title="详情" :visible.sync="openDetailBill" width="1120px" append-to-body>
  164. <detail-bill :zbiId="this.zbiId" v-if="openDetailBill"></detail-bill>
  165. </el-dialog>
  166. <!-- 修改往来账款 -->
  167. <el-dialog title="修改往来账款" :visible.sync="openEditBill" width="1120px" append-to-body>
  168. <edit-bill :zbiId="this.zbiId" @editClick="emitEditClick" v-if="openEditBill"></edit-bill>
  169. </el-dialog>
  170. <!--预览-->
  171. <el-dialog :visible.sync="openFile" width="1000px" append-to-body>
  172. <img :src="wordUrl" v-if="show" width='450px' height='500px' />
  173. <iframe :src="wordUrl" width='800px' height='600px' frameborder='1' v-if="heid" />
  174. </el-dialog>
  175. </div>
  176. </template>
  177. <script>
  178. import {
  179. listSupplierCreditLine,
  180. getAccountsCollection,
  181. getSupplierAvailableBalance,
  182. addCredit,
  183. getFile
  184. } from "@/api/service/credit/credit";
  185. import {
  186. getRandom
  187. } from "@/api/common/getRandom";
  188. import {
  189. accAdd
  190. } from "@/utils/calculation";
  191. import {
  192. getToken
  193. } from "@/utils/auth";
  194. import {
  195. getBill
  196. } from "@/api/service/bill/bill";
  197. import AddBill from "@/views/service/bill/addBill";
  198. import EditBill from "@/views/service/bill/editBill";
  199. import DetailBill from "@/views/service/credit/billDetail";
  200. import {
  201. isOpenApproval
  202. } from "@/api/service/credit/approvalRelatedCredit";
  203. import {
  204. listCompanyHandler
  205. } from "@/api/common/companyHandler";
  206. import Cookies from 'js-cookie'
  207. import SearchBar from '@/components/SearchBar/index.vue'
  208. import ContentTotal from '@/components/ContentTotal/index.vue'
  209. export default {
  210. name: "financeOpen",
  211. components: {
  212. AddBill,
  213. EditBill,
  214. DetailBill,
  215. SearchBar,
  216. ContentTotal
  217. },
  218. data() {
  219. return {
  220. //往来账款id
  221. zbiId: '',
  222. // 总条数
  223. total: 0,
  224. // 查询参数
  225. queryParams: {
  226. pageNum: 1,
  227. pageSize: 10,
  228. },
  229. creditParams: {
  230. zfsqId: null
  231. },
  232. queryParamsPay: {
  233. pageNum: 1,
  234. pageSize: 10,
  235. payName: null,
  236. zbiName: null
  237. },
  238. // 表单参数
  239. form: {
  240. },
  241. // 表单校验
  242. rules: {
  243. //授信额度
  244. zfiSupplierQuotaId: [{
  245. required: true,
  246. message: "请选择授信额度",
  247. trigger: ["blur", "change"],
  248. }, ],
  249. //接收方
  250. zfiSupplierId: [{
  251. required: true,
  252. message: "请选择接收方",
  253. trigger: ["blur", "change"],
  254. }, ],
  255. //签发有效期
  256. zfiEffectiveDate: [{
  257. required: true,
  258. message: "请选择签发有效期",
  259. trigger: ["blur", "change"],
  260. }, ],
  261. //签发金额
  262. zfiAmount: [{
  263. required: true,
  264. message: "请输入签发金额",
  265. trigger: ["blur", "change"],
  266. },
  267. {
  268. pattern: /^(?:0|[1-9]\d{0,8})(?:\.\d{1,2})?$/,
  269. message: "请输入正确的签发金额",
  270. trigger: ["blur", "change"],
  271. },
  272. ],
  273. //承诺还款日
  274. zfiExpireDate: [{
  275. required: true,
  276. message: "请选择承诺还款日",
  277. trigger: ["blur", "change"],
  278. }, ],
  279. },
  280. // 是否显示弹出层
  281. open: false,
  282. openAddBill: false,
  283. openEditBill: false,
  284. openDetailBill: false,
  285. //授信
  286. creditLineList: [],
  287. //接收方
  288. supplierList: [],
  289. //应付账款
  290. payList: [],
  291. //应付账款表格数据
  292. ticketList: [],
  293. //应付标题
  294. payTitle: "",
  295. //可用额度
  296. availableAmt: "0.00",
  297. //有效期
  298. validityDate: "",
  299. //有效期类型
  300. zfpcrDateType: "",
  301. //合计选中的应付账款的金额
  302. checkTotalAmt: "0.00",
  303. //合计选中的应付账款的大写金额
  304. checkTotalBigAmt: "零元整",
  305. //签发金额大写
  306. issuedAmount: "零元整",
  307. //产品是否可拆分
  308. zfpSplit: "",
  309. //融资放款方式
  310. zfpcrLoanType: "",
  311. //产品编号
  312. zfpId: "",
  313. //利率
  314. zfpcrRate: '',
  315. //最小融资额度
  316. zfpMinimumAmount: "",
  317. //合同附件
  318. contractFileList: [],
  319. //发票附件
  320. invoiceFileList: [],
  321. //其他文件
  322. otherFileList: [],
  323. pickerOptions: {
  324. disabledDate(v) {
  325. return v.getTime() < new Date().getTime() - 86400000;
  326. }
  327. },
  328. openFile: false,
  329. wordUrl: "",
  330. show: false,
  331. heid: false,
  332. chooseTicket: [],
  333. payDate: null
  334. };
  335. },
  336. created() {
  337. //获取当前公司
  338. getRandom().then((response) => {
  339. if (response.data) {
  340. this.$set(this.form, "receiveName", response.data.companyName);
  341. }
  342. }),
  343. //获取授信额度
  344. listSupplierCreditLine(this.creditParams).then((response) => {
  345. this.creditLineList = response.data.map(item => {
  346. return {
  347. value: item.zfsqId,
  348. label: item.zfpName,
  349. zfpcrDateType: item.zfpcrDateType,
  350. zfpcrEndDate: item.zfpcrEndDate,
  351. zfpcrLoanType: item.zfpcrLoanType,
  352. zfpSplit: item.zfpSplit,
  353. zfpId: item.zfpId,
  354. zfpcrRate: item.zfpcrRate,
  355. remaining: item.remaining,
  356. zfpMinimumAmount: item.zfpMinimumAmount
  357. };
  358. });
  359. });
  360. //签发金额
  361. this.$set(this.form, "zfiAmount", "0.00");
  362. },
  363. methods: {
  364. //列表格式化金额
  365. moneyFormat(row, column, cellValue) {
  366. if (cellValue == null || cellValue == undefined || cellValue == "") {
  367. cellValue = "0.00";
  368. }
  369. cellValue += "";
  370. if (!cellValue.includes(".")) {
  371. cellValue += ".00";
  372. }
  373. return cellValue
  374. .replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  375. return $1 + ",";
  376. })
  377. .replace(/\.$/, "");
  378. },
  379. // 取消按钮
  380. cancel() {
  381. this.$store.dispatch("tagsView/delView", this.$route);
  382. this.$router.go(-1);
  383. },
  384. /* 多选框跨页 */
  385. rowkeyCustomer(row) {
  386. return row.cciId;
  387. },
  388. //表格变动触发事件
  389. handle() {
  390. },
  391. //应收账款查询列表
  392. getAccountsCollection() {
  393. return getAccountsCollection(this.queryParamsPay).then((response) => {
  394. this.payList = response.data.records;
  395. this.selectChecked();
  396. this.total = response.data.total;
  397. return Promise.resolve(response)
  398. });
  399. },
  400. resetQuerys() {
  401. this.resetForm("formQuery");
  402. this.handleQuerys();
  403. },
  404. handleQuerys() {
  405. this.queryParamsPay.pageNum = 1;
  406. this.getAccountsCollection();
  407. },
  408. //打开应付账款选择列表
  409. openTicket() {
  410. //清空搜索条件
  411. this.queryParamsPay.zbiName = "";
  412. this.queryParamsPay.payName = "";
  413. this.queryParamsPay.pageNum = 1;
  414. this.chooseTicket = eval("(" + JSON.stringify(this.ticketList) + ")");
  415. this.getAccountsCollection();
  416. this.open = true;
  417. this.payTitle = "应收账款";
  418. },
  419. //获取签发金额大写
  420. getBigSmall() {
  421. this.issuedAmount = this.smallToBig(this.form.zfiAmount);
  422. },
  423. selectChecked() {
  424. //清空选择
  425. // this.$refs.tablePay && this.$refs.tablePay.clearSelection();
  426. var changeSelectionTemp = eval("(" + JSON.stringify(this.chooseTicket) + ")")
  427. this.$nextTick(() => {
  428. this.$refs.tablePay.clearSelection();
  429. changeSelectionTemp.forEach((item) => {
  430. var f = true;
  431. for (var i = 0; i < this.payList.length; i++) {
  432. var row = this.payList[i];
  433. if (row.zbiId == item.zbiId) {
  434. this.$refs.tablePay && this.$refs.tablePay.toggleRowSelection(row, true);
  435. f = false;
  436. break;
  437. }
  438. };
  439. if (f) {
  440. this.$refs.tablePay && this.$refs.tablePay.toggleRowSelection(item, true);
  441. }
  442. });
  443. })
  444. //合计
  445. // this.getReTotal(this.ticketList);
  446. //附件
  447. // this.getFile(this.ticketList);
  448. },
  449. //获取附件信息
  450. getFile(datas) {
  451. var queryParamsFile = {};
  452. queryParamsFile.ticketList = datas;
  453. getFile(queryParamsFile).then((response) => {
  454. if (response.data) {
  455. //获取发票文件
  456. this.invoiceFileList = response.data.invoiceFileList;
  457. //获取合同文件
  458. this.contractFileList = response.data.contractFileList;
  459. //获取其他文件
  460. this.otherFileList = response.data.otherFileList;
  461. }
  462. });
  463. },
  464. /* 多选框跨页 */
  465. rowkey(row) {
  466. return row.zbiId;
  467. },
  468. // 多选框选中数据
  469. handleSelectionChange(val) {
  470. this.chooseTicket = val
  471. },
  472. // 确认选择
  473. closeTicket() {
  474. if (this.chooseTicket.length > 0) {
  475. var flag = true;
  476. //获取选中第一个的应付企业
  477. var payName = this.chooseTicket[0].payName;
  478. //获取选中第一个的预计还款日期
  479. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  480. for (var i = 0; i < this.chooseTicket.length; i++) {
  481. if (payName != this.chooseTicket[i].payName) {
  482. flag = false;
  483. this.$message({
  484. message: '请选择应付企业相同的应付账款',
  485. type: 'warning'
  486. });
  487. break;
  488. } else if (zbiPayDate != this.chooseTicket[i].zbiPayDate) {
  489. flag = false;
  490. this.$message({
  491. message: '请选择预计还款日期相同的应付账款',
  492. type: 'warning'
  493. });
  494. break;
  495. }
  496. }
  497. if (flag) {
  498. //合计
  499. this.getReTotal(this.chooseTicket);
  500. this.ticketList = this.chooseTicket;
  501. //更新附件信息
  502. this.getFile(this.ticketList);
  503. //开立方赋值
  504. this.$set(this.form, "openName", this.chooseTicket[0].payName);
  505. if (new Date(this.ticketList[0].zbiPayDate) >= new Date()) {
  506. // this.form.zfiExpireDate = this.ticketList[0].zbiPayDate
  507. //承诺还款日为空
  508. if (!this.form.zfiExpireDate) {
  509. this.$set(this.form, "zfiExpireDate", this.ticketList[0].zbiPayDate);
  510. }
  511. }
  512. this.open = false;
  513. }
  514. } else {
  515. this.$message({
  516. message: '请选择应收账款',
  517. type: 'warning'
  518. });
  519. }
  520. },
  521. //重新合计
  522. getReTotal(chooseTicket) {
  523. //合计
  524. this.checkTotalAmt = "0.00";
  525. for (var i = 0; i < chooseTicket.length; i++) {
  526. this.checkTotalAmt = accAdd(this.checkTotalAmt, chooseTicket[i].zbiAmount, 2);
  527. }
  528. //签发金额
  529. this.$set(this.form, "zfiAmount", this.checkTotalAmt);
  530. //签发金额大写
  531. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  532. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  533. this.checkTotalAmt = this.amtFormat(this.checkTotalAmt);
  534. },
  535. //取消选择按钮
  536. cancelTicket() {
  537. /* this.ticketList = [];
  538. if(this.$refs.tablePay){
  539. this.$refs.tablePay.clearSelection();
  540. } */
  541. this.open = false;
  542. },
  543. /** 清空选择信息 */
  544. deleteTicekt() {
  545. this.ticketList = [];
  546. this.checkTotalAmt = "0.00";
  547. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  548. //签发金额
  549. this.$set(this.form, "zfiAmount", "0.00");
  550. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  551. //开立方清空
  552. this.$set(this.form, "openName", "");
  553. if (this.$refs.tablePay) {
  554. this.$refs.tablePay.clearSelection();
  555. }
  556. //更新附件
  557. this.getFile(this.ticketList);
  558. },
  559. /* 删除按钮 */
  560. handleDelete(index, rows) {
  561. rows.splice(index, 1);
  562. if (this.$refs.tablePay) {
  563. this.$refs.tablePay.clearSelection();
  564. }
  565. this.selectChecked();
  566. },
  567. //详情按钮
  568. handleDetail(index, rows) {
  569. this.zbiId = rows[index].zbiId
  570. this.openDetailBill = true
  571. },
  572. /* 修改按钮 */
  573. handleUpdate(index, rows) {
  574. this.zbiId = rows[index].zbiId;
  575. this.openEditBill = true
  576. },
  577. onSelectAll() {
  578. if (this.$refs.tablePay) {
  579. this.$refs.tablePay.clearSelection();
  580. }
  581. },
  582. //选择授信触发
  583. change(val) {
  584. if (!val) {
  585. //可用额度
  586. this.availableAmt = "0.00";
  587. //有效期
  588. this.validityDate = "";
  589. //产品是否可拆分
  590. this.zfpSplit = "",
  591. //融资放款方式
  592. this.zfpcrLoanType = "";
  593. //产品
  594. this.zfpId = "";
  595. //利率
  596. this.zfpcrRate = "";
  597. //有效期类型
  598. this.zfpcrDateType = "";
  599. //最小融资金额
  600. this.zfpMinimumAmount = "";
  601. return;
  602. }
  603. let obj = {};
  604. obj = this.creditLineList.find(item => {
  605. return item.value === val;
  606. });
  607. //获取有效期的类型
  608. this.zfpcrDateType = obj.zfpcrDateType;
  609. //产品是否可拆分
  610. this.zfpSplit = obj.zfpSplit;
  611. //放款方式
  612. this.zfpcrLoanType = obj.zfpcrLoanType;
  613. //产品
  614. this.zfpId = obj.zfpId;
  615. //利率
  616. this.zfpcrRate = obj.zfpcrRate;
  617. //最小融资金额
  618. this.zfpMinimumAmount = obj.zfpMinimumAmount;
  619. //长期
  620. if ("0" == this.zfpcrDateType) {
  621. this.validityDate = "长期";
  622. } else {
  623. this.validityDate = obj.zfpcrEndDate;
  624. }
  625. var lineQueryParam = {};
  626. lineQueryParam.zfsqId = val;
  627. //获取可用额度
  628. getSupplierAvailableBalance(lineQueryParam).then((response) => {
  629. this.availableAmt = response.data.remaining;
  630. });
  631. },
  632. //格式化金额
  633. amtFormat(cellValue) {
  634. if (cellValue == null || cellValue == undefined || cellValue == '') {
  635. cellValue = '0.00'
  636. }
  637. cellValue += '';
  638. if (!cellValue.includes('.')) {
  639. cellValue += '.00';
  640. }
  641. console.log(cellValue);
  642. return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  643. return $1 + ',';
  644. }).replace(/\.$/, '');
  645. },
  646. /* // 将数字金额转换为大写金额 */
  647. smallToBig(money) {
  648. // 将数字金额转换为大写金额
  649. var cnNums = new Array(
  650. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); //汉字的数字
  651. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  652. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  653. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  654. var cnInteger = "整"; //整数金额时后面跟的字符
  655. var cnIntLast = "元"; //整数完以后的单位
  656. //最大处理的数字
  657. var maxNum = 999999999999999.9999;
  658. var integerNum; //金额整数部分
  659. var decimalNum; //金额小数部分
  660. //输出的中文金额字符串
  661. var chineseStr = "";
  662. var parts; //分离金额后用的数组,预定义
  663. if (money == "" || money == null || money == undefined) {
  664. return "零元零角零分";
  665. }
  666. money = parseFloat(money);
  667. if (money >= maxNum) {
  668. //超出最大处理数字
  669. return "超出最大处理数字";
  670. }
  671. if (money == 0) {
  672. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  673. return chineseStr;
  674. }
  675. //四舍五入保留两位小数,转换为字符串
  676. money = Math.round(money * 100).toString();
  677. integerNum = money.substr(0, money.length - 2);
  678. decimalNum = money.substr(money.length - 2);
  679. //获取整型部分转换
  680. if (parseInt(integerNum, 10) > 0) {
  681. var zeroCount = 0;
  682. var IntLen = integerNum.length;
  683. for (var i = 0; i < IntLen; i++) {
  684. var n = integerNum.substr(i, 1);
  685. var p = IntLen - i - 1;
  686. var q = p / 4;
  687. var m = p % 4;
  688. if (n == "0") {
  689. zeroCount++;
  690. } else {
  691. if (zeroCount > 0) {
  692. chineseStr += cnNums[0];
  693. }
  694. //归零
  695. zeroCount = 0;
  696. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  697. }
  698. if (m == 0 && zeroCount < 4) {
  699. chineseStr += cnIntUnits[q];
  700. }
  701. }
  702. chineseStr += cnIntLast;
  703. }
  704. //小数部分
  705. if (decimalNum != "") {
  706. var decLen = decimalNum.length;
  707. for (var i = 0; i < decLen; i++) {
  708. var n = decimalNum.substr(i, 1);
  709. if (n != "0") {
  710. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  711. }
  712. }
  713. }
  714. if (chineseStr == "") {
  715. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  716. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  717. chineseStr += cnInteger;
  718. }
  719. return chineseStr;
  720. },
  721. //文件下载
  722. handleDownload(row) {
  723. const pfiUrl = row.pfiUrl;
  724. if (pfiUrl != null && pfiUrl != '') {
  725. window.open(pfiUrl + "/" + getToken());
  726. } else {
  727. this.$message({
  728. message: '该附件不存在!',
  729. type: 'warning'
  730. });
  731. return;
  732. }
  733. },
  734. //新增
  735. submitForm() {
  736. debugger;
  737. if (this.ticketList.length < 1) {
  738. this.$message({
  739. message: '请选择应收账款',
  740. type: 'warning'
  741. });
  742. return;
  743. }
  744. //放款方式==指定供应商时收款账号必输
  745. /* if("1"== this.zfpcrLoanType){
  746. if(!this.form.zfiCollectionAccount){
  747. this.$message({
  748. message: '请输入收款账号',
  749. type: 'warning'
  750. });
  751. return;
  752. }
  753. } */
  754. if (parseFloat(this.form.zfiAmount) < parseFloat(this.zfpMinimumAmount)) {
  755. this.$message({
  756. message: '签发金额不可小于产品的最小融资金额',
  757. type: 'warning'
  758. });
  759. return;
  760. }
  761. if (parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.availableAmt))) {
  762. this.$message({
  763. message: '签发金额不可大于可用金额',
  764. type: 'warning'
  765. });
  766. return;
  767. }
  768. if (parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.checkTotalAmt))) {
  769. this.$message({
  770. message: '签发金额不可大于合计金额',
  771. type: 'warning'
  772. });
  773. return;
  774. }
  775. this.$refs["form"].validate(valid => {
  776. if (valid) {
  777. const loading = this.$loading({
  778. lock: true,
  779. text: 'Loading',
  780. background: 'rgba(0, 0, 0,0)'
  781. })
  782. //签发金额小于合计金额
  783. if ((parseFloat(this.form.zfiAmount)) < (parseFloat(this.moneyDelete(this.checkTotalAmt)))) {
  784. var _this = this;
  785. this.$confirm('签发金额小于应付金额合计,是否确认提交', "警告", {
  786. confirmButtonText: "确定",
  787. cancelButtonText: "取消",
  788. type: "warning"
  789. }).then(function () {
  790. //应收账款
  791. _this.form.ticketList = _this.ticketList;
  792. //产品是否可拆分
  793. _this.form.zfpSplit = _this.zfpSplit;
  794. //放款方式
  795. _this.form.zfpcrLoanType = _this.zfpcrLoanType;
  796. //融信类型
  797. _this.form.type = "2";
  798. //利率
  799. _this.form.zfiRate = _this.zfpcrRate;
  800. //产品
  801. _this.form.zfpId = _this.zfpId;
  802. //可用额度
  803. _this.form.availableAmt = _this.availableAmt;
  804. //最小融资金额
  805. _this.form.zfpMinimumAmount = _this.zfpMinimumAmount;
  806. //合计金额
  807. _this.form.checkTotalAmt = _this.moneyDelete(_this.checkTotalAmt);
  808. addCredit(_this.form).then(response => {
  809. //获取融信编号
  810. var zfiId = response.data.zfiId;
  811. loading.close();
  812. //查询当前用户是否为经办人
  813. listCompanyHandler().then((response) => {
  814. if (false == response.data) {
  815. //当前用户不是经办人,返回到列表页
  816. _this.msgSuccess("融信资料已提交企业内部审批");
  817. _this.$store.dispatch(
  818. "tagsView/delView",
  819. _this.$route
  820. );
  821. _this.$router.go(-1);
  822. } else {
  823. //当前用户是经办人,判断有无融信开立融信的内部审批
  824. //查询有无融信开立内部审批
  825. var confirmParam = {};
  826. confirmParam.menuId = "1000000001";
  827. isOpenApproval(confirmParam).then((response) => {
  828. var result = response.data.isOpen;
  829. //有融信开立内部审批
  830. if (true == result) {
  831. _this.msgSuccess("融信资料已提交企业内部审批");
  832. _this.$store.dispatch(
  833. "tagsView/delView",
  834. _this.$route
  835. );
  836. _this.$router.go(-1);
  837. } else {
  838. //无融信开立内部审批
  839. //查询有无平台审批
  840. var platParam = {};
  841. platParam.menuId = "1000000004";
  842. isOpenApproval(platParam).then((response) => {
  843. var platResult = response.data.isOpen;
  844. //开启平台审批
  845. if (platResult) {
  846. _this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  847. _this.$store.dispatch("tagsView/delView", _this.$route);
  848. _this.$router.go(-1);
  849. } else {
  850. //未开启平台审批
  851. //关闭当前页面
  852. _this.$store.dispatch(
  853. "tagsView/delView",
  854. _this.$route
  855. );
  856. //跳转盖章页面
  857. Cookies.set("/credit/creditSeal/" + zfiId + "/", _this.$route.fullPath)
  858. _this.$router.push({
  859. path: "/credit/creditSeal/" + zfiId + "/"
  860. });
  861. }
  862. });
  863. }
  864. });
  865. }
  866. });
  867. }).catch((response) => {
  868. loading.close();
  869. });
  870. }).catch((e) => {
  871. loading.close();
  872. });
  873. } else {
  874. //应收账款
  875. this.form.ticketList = this.ticketList;
  876. //产品是否可拆分
  877. this.form.zfpSplit = this.zfpSplit;
  878. //放款方式
  879. this.form.zfpcrLoanType = this.zfpcrLoanType;
  880. //融信类型
  881. this.form.type = "2";
  882. //利率
  883. this.form.zfiRate = this.zfpcrRate;
  884. //产品
  885. this.form.zfpId = this.zfpId;
  886. //可用额度
  887. this.form.availableAmt = this.availableAmt;
  888. //最小融资金额
  889. this.form.zfpMinimumAmount = this.zfpMinimumAmount;
  890. //合计金额
  891. this.form.checkTotalAmt = this.moneyDelete(this.checkTotalAmt);
  892. addCredit(this.form).then(response => {
  893. loading.close();
  894. //获取融信编号
  895. var zfiId = response.data.zfiId;
  896. //查询当前用户是否为经办人
  897. listCompanyHandler().then((response) => {
  898. if (false == response.data) {
  899. //当前用户不是经办人,返回到列表页
  900. this.msgSuccess("融信资料已提交企业内部审批");
  901. this.$store.dispatch(
  902. "tagsView/delView",
  903. this.$route
  904. );
  905. this.$router.go(-1);
  906. } else {
  907. //当前用户是经办人,判断有无融信开立融信的内部审批
  908. //查询有无融信开立内部审批
  909. var confirmParam = {};
  910. confirmParam.menuId = "1000000001";
  911. isOpenApproval(confirmParam).then((response) => {
  912. var result = response.data.isOpen;
  913. //有融信开立内部审批
  914. if (true == result) {
  915. this.msgSuccess("融信资料已提交企业内部审批");
  916. this.$store.dispatch(
  917. "tagsView/delView",
  918. this.$route
  919. );
  920. this.$router.go(-1);
  921. } else {
  922. //无融信开立内部审批
  923. //查询有无平台审批
  924. var platParam = {};
  925. platParam.menuId = "1000000004";
  926. isOpenApproval(platParam).then((response) => {
  927. var platResult = response.data.isOpen;
  928. //开启平台审批
  929. if (platResult) {
  930. this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  931. this.$store.dispatch("tagsView/delView", this.$route);
  932. this.$router.go(-1);
  933. } else {
  934. //未开启平台审批
  935. //关闭当前页面
  936. this.$store.dispatch(
  937. "tagsView/delView",
  938. this.$route
  939. );
  940. //跳转盖章页面
  941. Cookies.set("/credit/creditSeal/" + zfiId + "/", this.$route.fullPath)
  942. this.$router.push({
  943. path: "/credit/creditSeal/" + zfiId + "/"
  944. });
  945. }
  946. });
  947. }
  948. });
  949. }
  950. });
  951. }).catch((response) => {
  952. loading.close();
  953. });
  954. }
  955. }
  956. });
  957. },
  958. //金额去掉千分位
  959. moneyDelete(num) {
  960. if (num && num != undefined && num != null) {
  961. let _num = num;
  962. _num = _num.toString();
  963. _num = _num.replace(/,/gi, '');
  964. return _num;
  965. } else {
  966. return num;
  967. }
  968. },
  969. //预览
  970. handlePreview(row) {
  971. const pfiUrl = row.pfiUrl;
  972. const pfiFileName = row.pfiFileName;
  973. if (row.pfiUrl) {
  974. console.log(pfiFileName.substr(-3));
  975. if (pfiFileName.substr(-3) == "pdf") {
  976. this.wordUrl = pfiUrl + "/" + getToken();
  977. this.show = false;
  978. this.heid = true;
  979. } else if (
  980. pfiFileName.substr(-3) == "jpg" ||
  981. pfiFileName.substr(-3) == "png" ||
  982. pfiFileName.substr(-3) == "JPG" ||
  983. pfiFileName.substr(-3) == "PNG" ||
  984. pfiFileName.substr(-4) == "jpeg" ||
  985. pfiFileName.substr(-3) == "JPEG"
  986. ) {
  987. this.wordUrl =
  988. pfiUrl +
  989. "/" +
  990. getToken();
  991. this.show = true;
  992. this.heid = false;
  993. console.log("====>", this.wordUrl);
  994. } else if (
  995. pfiFileName.substr(-3) == "doc" ||
  996. pfiFileName.substr(-3) == "DOC" ||
  997. pfiFileName.substr(-4) == "docx" ||
  998. pfiFileName.substr(-3) == "DOCX"
  999. ) {
  1000. this.wordUrl =
  1001. "https://view.officeapps.live.com/op/view.aspx?src=" +
  1002. pfiUrl +
  1003. "/" +
  1004. getToken() +
  1005. "/" +
  1006. pfiFileName;
  1007. this.show = false;
  1008. this.heid = true;
  1009. console.log("====>", this.wordUrl);
  1010. } else {
  1011. this.$message({
  1012. message: "暂不支持该类型文件预览",
  1013. type: "warning",
  1014. });
  1015. return;
  1016. }
  1017. }
  1018. this.openFile = true;
  1019. },
  1020. changeRate(e, input) {
  1021. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  1022. this.input = e.target.value
  1023. this.form.zfiAmount = this.input
  1024. },
  1025. //新增应付
  1026. addPay() {
  1027. //获取选中第一个的预计还款日期
  1028. if (this.chooseTicket[0]) {
  1029. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  1030. this.payDate = zbiPayDate;
  1031. }
  1032. this.openAddBill = true
  1033. },
  1034. //新增账款回调
  1035. emitAddClick(val) {
  1036. var self = this
  1037. this.getAccountsCollection().then((response) => {
  1038. //新增付款返回id直接选中
  1039. if (val) {
  1040. self.payList.forEach(element => {
  1041. if (element.zbiId == val) {
  1042. // 将当前点击项选中
  1043. self.chooseTicket.push(element)
  1044. self.closeTicket()
  1045. }
  1046. });
  1047. }
  1048. })
  1049. self.openAddBill = false
  1050. },
  1051. //修改账款回调
  1052. emitEditClick(val) {
  1053. var self = this
  1054. getBill(val).then((response) => {
  1055. for (var i = 0; i < this.ticketList.length; i++) {
  1056. if (response.data.zbiId == this.ticketList[i].zbiId) {
  1057. this.$set(this.ticketList, i, response.data)
  1058. break;
  1059. }
  1060. }
  1061. for (var i = 0; i < this.ticketList.length; i++) {
  1062. if (response.data.zbiId == this.ticketList[i].zbiId) {
  1063. this.$set(this.chooseTicket, i, response.data)
  1064. break;
  1065. }
  1066. }
  1067. self.closeTicket();
  1068. })
  1069. self.openEditBill = false
  1070. },
  1071. }
  1072. };
  1073. </script>
  1074. <style lang="scss">
  1075. .uoloadfj .el-upload--picture-card {
  1076. width: 110px;
  1077. height: 110px;
  1078. line-height: 110px;
  1079. }
  1080. .fjUoloadSty .el-upload--picture-card {
  1081. display: none;
  1082. }
  1083. table th.star div::before {
  1084. content: '*';
  1085. color: red;
  1086. }
  1087. </style><style lang="scss" scoped>
  1088. .zap-available-credit {
  1089. height: 40px;
  1090. margin-bottom: 22px;
  1091. }
  1092. .zap-title {
  1093. padding: 20px 25px;
  1094. font-size: 16px;
  1095. color: #333333;
  1096. background-color: #ffffff;
  1097. }
  1098. .zap-form {
  1099. padding: 10px 25px 8px;
  1100. background-color: #ffffff;
  1101. box-sizing: border-box;
  1102. }
  1103. .zap-form--clear {
  1104. padding-left: 0;
  1105. padding-right: 0;
  1106. }
  1107. </style>