creditApply.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. <template>
  2. <div class="app-container">
  3. <el-form ref="form" :model="form" :rules="rules" :inline="true" style="margin-top: 10px" label-width="auto" >
  4. <el-row>
  5. <el-divider content-position="left" >资产信息</el-divider>
  6. <el-form-item style="margin-left: 100px">
  7. <el-button size="mini" type="success" @click="addPay">新增应收账款</el-button>
  8. <el-button size="mini" type="primary" @click="openTicket">选择</el-button>
  9. <el-button size="mini" @click="deleteTicekt">清空全部</el-button>
  10. <el-form-item label="合计金额:">
  11. <span>{{checkTotalAmt}}</span>
  12. </el-form-item>
  13. <el-form-item label="金额大写:">
  14. <span>{{checkTotalBigAmt}}</span>
  15. </el-form-item>
  16. <el-table :data="ticketList" style="width: 1100px" border>
  17. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  18. <el-table-column label="应收企业" align="center" prop="receiveName"/>
  19. <el-table-column label="应付企业" align="center" prop="payName" />
  20. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
  21. <el-table-column label="金额" align="center" prop="zbiAmount" />
  22. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
  23. <template slot-scope="scope">
  24. <el-button
  25. size="mini"
  26. type="text"
  27. icon="el-icon-delete"
  28. @click="handleDelete(scope.$index, ticketList)"
  29. >删除</el-button>
  30. <el-button
  31. size="mini"
  32. type="text"
  33. icon="el-icon-view"
  34. @click="handleDetail(scope.$index, ticketList)"
  35. >详情</el-button>
  36. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.$index, ticketList)">修改</el-button>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. </el-form-item>
  41. <el-col :span="8">
  42. <el-form-item label="签发金额" prop="zfiAmount">
  43. <el-input v-model="form.zfiAmount" style="width: 200px" @input="getBigSmall"  @input.native="changeRate($event,form.zfiAmount)" />
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="8">
  47. <el-form-item label="开立方" prop="openName">
  48. <el-input v-model="form.openName" style="width: 200px" disabled />
  49. </el-form-item>
  50. </el-col>
  51. <!-- <el-col :span="8">
  52. <el-form-item label="授信额度" prop="zfiSupplierQuotaId">
  53. <el-select
  54. style="width: 200px"
  55. v-model="form.zfiSupplierQuotaId"
  56. filterable
  57. clearable
  58. remote
  59. @change="change"
  60. >
  61. <el-option
  62. v-for="item in creditLineList"
  63. :key="item.value"
  64. :label="item.label"
  65. :value="item.value">
  66. </el-option>
  67. </el-select>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :span="8">
  71. <span>可用额度:</span>
  72. <span>{{availableAmt}}</span>
  73. <br>
  74. <span>有效期:</span>
  75. <span>{{validityDate}}</span>
  76. </el-col> -->
  77. </el-row>
  78. <!-- <el-row>
  79. <el-col :span="8">
  80. <el-form-item label="接收方" prop="receiveName">
  81. <el-input v-model="form.receiveName" style="width: 200px" disabled />
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="8">
  85. <el-form-item label="签发有效期" prop="zfiEffectiveDate">
  86. <el-date-picker clearable size="small" style="width: 200px"
  87. v-model="form.zfiEffectiveDate"
  88. type="date"
  89. value-format="yyyy-MM-dd"
  90. placeholder="选择签发有效期">
  91. </el-date-picker>
  92. </el-form-item>
  93. </el-col>
  94. <el-col :span="8">
  95. <el-form-item label="承诺还款日" prop="zfiExpireDate">
  96. <el-date-picker clearable size="small" style="width: 200px"
  97. v-model="form.zfiExpireDate"
  98. type="date"
  99. value-format="yyyy-MM-dd"
  100. placeholder="选择承诺还款日">
  101. </el-date-picker>
  102. </el-form-item>
  103. </el-col>
  104. </el-row> -->
  105. <el-row>
  106. <!-- <el-col :span="8">
  107. <el-form-item label="收款账号" prop="zfiCollectionAccount" v-if="zfpcrLoanType != '0'">
  108. <el-input v-model="form.zfiCollectionAccount" style="width: 200px" />
  109. </el-form-item>
  110. </el-col> -->
  111. </el-row>
  112. <el-row>
  113. <el-col :span="8">
  114. <el-form-item label="金额大写" prop="issuedAmount">
  115. {{issuedAmount}}
  116. </el-form-item>
  117. </el-col>
  118. </el-row>
  119. </el-form>
  120. <div class="contain">
  121. <p >友情提醒:
  122. </p>
  123. <p>
  124. 1. 申请金额:须小于或等于选中资产的总额;
  125. </p>
  126. <p>
  127. 2. 选择账款:如需选择多笔账款同时提交,须满足预计还款日期一致;
  128. </p>
  129. <p>
  130. 3. 融信有效期:融信有效期非已核心企业最终确认还款时间为准,而非资产
  131. 中预计还款时间;
  132. </p>
  133. <p>
  134. 4. 请勿一笔账款,重复作为资产抵押;其中一笔融信抵押生效后,重复业务
  135. 将立即失效,因此引发的业务责任,将由申请发起人自行承担;
  136. </p>
  137. </div>
  138. <!-- 发票附件 -->
  139. <!-- <el-divider content-position="left">发票附件</el-divider>
  140. <el-table :data="invoiceFileList" style="width: 100%">
  141. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  142. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  143. <template slot-scope="scope">
  144. <el-button
  145. size="mini"
  146. type="text"
  147. icon="el-icon-view"
  148. @click="handleDownload(scope.row)"
  149. >下载</el-button>
  150. <el-button
  151. size="mini"
  152. type="text"
  153. icon="el-icon-view"
  154. @click="handlePreview(scope.row)"
  155. >预览</el-button>
  156. </template>
  157. </el-table-column>
  158. </el-table> -->
  159. <!-- 合同附件 -->
  160. <!-- <el-divider content-position="left">合同附件</el-divider>
  161. <el-table :data="contractFileList" style="width: 100%">
  162. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  163. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  164. <template slot-scope="scope">
  165. <el-button
  166. size="mini"
  167. type="text"
  168. icon="el-icon-view"
  169. @click="handleDownload(scope.row)"
  170. >下载</el-button>
  171. <el-button
  172. size="mini"
  173. type="text"
  174. icon="el-icon-view"
  175. @click="handlePreview(scope.row)"
  176. >预览</el-button>
  177. </template>
  178. </el-table-column>
  179. </el-table> -->
  180. <!-- 其他附件 -->
  181. <!-- <el-divider content-position="left">其他附件</el-divider>
  182. <el-table :data="otherFileList" style="width: 100%">
  183. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  184. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  185. <template slot-scope="scope">
  186. <el-button
  187. size="mini"
  188. type="text"
  189. icon="el-icon-view"
  190. @click="handleDownload(scope.row)"
  191. >下载</el-button>
  192. <el-button
  193. size="mini"
  194. type="text"
  195. icon="el-icon-view"
  196. @click="handlePreview(scope.row)"
  197. >预览</el-button>
  198. </template>
  199. </el-table-column>
  200. </el-table> -->
  201. <div class="footer" style="float: right;
  202. margin-bottom:2px;">
  203. <el-button type="primary" @click="submitForm">确 定</el-button>
  204. <el-button @click="cancel">取 消</el-button>
  205. </div>
  206. <!-- 应收账款信息 -->
  207. <el-dialog :title="payTitle" :visible.sync="open" width="1120px" append-to-body>
  208. <el-form :model="queryParamsPay" ref="formQuery" :inline="true" label-width="68px" style="margin-bottom: -21px">
  209. <el-form-item label="账款名称" prop="zbiName">
  210. <el-input
  211. v-model="queryParamsPay.zbiName"
  212. placeholder="请输入账款名称"
  213. clearable
  214. size="small"
  215. maxlength="11"
  216. @keyup.enter.native="handleQuerys"/>
  217. </el-form-item>
  218. <el-form-item label="应付企业" prop="payName">
  219. <el-input
  220. v-model="queryParamsPay.payName"
  221. placeholder="请输入应付企业"
  222. clearable
  223. size="small"
  224. maxlength="11"
  225. @keyup.enter.native="handleQuerys"/>
  226. </el-form-item>
  227. <el-form-item>
  228. <el-button
  229. type="cyan"
  230. icon="el-icon-search"
  231. size="mini"
  232. @click="handleQuerys"
  233. >搜索</el-button>
  234. <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys"
  235. >重置</el-button>
  236. </el-form-item>
  237. </el-form>
  238. <el-table :data="payList"
  239. ref="tablePay"
  240. class="single-select-table"
  241. @selection-change="handleSelectionChange"
  242. :row-key="rowkey">
  243. <el-table-column
  244. type="selection"
  245. :reserve-selection="true"
  246. width="50"
  247. align="center"/>
  248. <el-table-column label="序号" type="index" width="50" align="center">
  249. <template slot-scope="scope">
  250. <span>{{ (queryParamsPay.pageNum - 1) * queryParamsPay.pageSize + scope.$index + 1}}</span>
  251. </template>
  252. </el-table-column>
  253. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  254. <el-table-column label="应收企业" align="center" prop="receiveName"/>
  255. <el-table-column label="应付企业" align="center" prop="payName" />
  256. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
  257. <el-table-column label="金额" align="center" prop="zbiAmount" />
  258. </el-table>
  259. <pagination
  260. v-show="total > 0"
  261. :total="total"
  262. :page.sync="queryParamsPay.pageNum"
  263. :limit.sync="queryParamsPay.pageSize"
  264. @pagination="getAccountsCollection" />
  265. <span slot="footer" class="dialog-footer">
  266. <el-button size="mini" @click="cancelTicket">取消</el-button>
  267. <el-button size="mini" type="primary" @click="closeTicket">确认</el-button>
  268. </span>
  269. </el-dialog>
  270. <!-- 新增往来账款 -->
  271. <el-dialog title="新增往来账款" :visible.sync="openAddBill" width="1120px" append-to-body>
  272. <add-bill :companyId="form.zfiCoreId" companyType="01" @addClick="emitAddClick" v-if="openAddBill"></add-bill>
  273. </el-dialog>
  274. <!-- 附件详情 -->
  275. <el-dialog title="详情" :visible.sync="openDetailBill" width="1120px" append-to-body>
  276. <detail-bill :zbiId="this.zbiId" v-if="openDetailBill"></detail-bill>
  277. </el-dialog>
  278. <!-- 修改往来账款 -->
  279. <el-dialog title="修改往来账款" :visible.sync="openEditBill" width="1120px" append-to-body>
  280. <edit-bill :zbiId="this.zbiId" v-if="openEditBill"></edit-bill>
  281. </el-dialog>
  282. <!--预览-->
  283. <el-dialog :visible.sync="openFile" width="1000px" append-to-body>
  284. <img :src="wordUrl" v-if="show" width='450px' height='500px'/>
  285. <iframe :src="wordUrl" width='800px' height='600px' frameborder='1' v-if="heid"/>
  286. </el-dialog>
  287. </div>
  288. </template>
  289. <script>
  290. import {getAccountsCollection,addCredit,getFile} from "@/api/service/credit/credit";
  291. import {isOpenApproval} from "@/api/service/credit/approvalRelatedCredit";
  292. import {accAdd} from "@/utils/calculation";
  293. import {getToken} from "@/utils/auth";
  294. import AddBill from "@/views/service/bill/addBill";
  295. import DetailBill from "@/views/service/credit/billDetail";
  296. import EditBill from "@/views/service/bill/editBill";
  297. export default {
  298. name: "creditApply",
  299. components: {AddBill,DetailBill,EditBill},
  300. data() {
  301. return {
  302. //往来账款id
  303. zbiId: '',
  304. // 总条数
  305. total: 0,
  306. // 查询参数
  307. queryParams: {
  308. pageNum: 1,
  309. pageSize: 10,
  310. },
  311. creditParams: {
  312. zfsqId:null
  313. },
  314. queryParamsPay: {
  315. pageNum: 1,
  316. pageSize: 10,
  317. payName:null,
  318. zbiName:null
  319. },
  320. // 表单参数
  321. form: {
  322. },
  323. // 表单校验
  324. rules: {
  325. //签发金额
  326. zfiAmount: [
  327. {
  328. required: true,
  329. message: "请输入签发金额",
  330. trigger: ["blur", "change"],
  331. },
  332. {
  333. pattern: /^(?:0|[1-9]\d{0,8})(?:\.\d{1,2})?$/,
  334. message: "请输入正确的签发金额",
  335. trigger: ["blur", "change"],
  336. },
  337. ]
  338. },
  339. // 是否显示弹出层
  340. open: false,
  341. openAddBill: false,
  342. openDetailBill: false,
  343. openEditBill: false,
  344. //应付账款
  345. payList:[],
  346. //应付账款表格数据
  347. ticketList: [],
  348. //应付标题
  349. payTitle:"",
  350. //合计选中的应付账款的金额
  351. checkTotalAmt:"0.00",
  352. //合计选中的应付账款的大写金额
  353. checkTotalBigAmt:"零元整",
  354. //签发金额大写
  355. issuedAmount:"零元整",
  356. //合同附件
  357. contractFileList:[],
  358. //发票附件
  359. invoiceFileList:[],
  360. //其他文件
  361. otherFileList:[],
  362. openFile:false,
  363. wordUrl: "",
  364. show:false,
  365. heid:false,
  366. chooseTicket:[]
  367. };
  368. },
  369. created() {
  370. //签发金额
  371. this.$set(this.form, "zfiAmount","0.00");
  372. },
  373. methods: {
  374. // 取消按钮
  375. cancel() {
  376. this.$store.dispatch("tagsView/delView", this.$route);
  377. this.$router.go(-1);
  378. },
  379. //应收账款查询列表
  380. getAccountsCollection() {
  381. return getAccountsCollection(this.queryParamsPay).then((response) => {
  382. this.payList = response.data.records;
  383. this.selectChecked();
  384. this.total = response.data.total;
  385. return Promise.resolve(response)
  386. });
  387. },
  388. resetQuerys() {
  389. this.resetForm("formQuery");
  390. this.handleQuerys();
  391. },
  392. handleQuerys() {
  393. this.queryParamsPay.pageNum = 1;
  394. this.getAccountsCollection();
  395. },
  396. //打开应付账款选择列表
  397. openTicket() {
  398. //清空搜索条件
  399. this.queryParamsPay.zbiName = "";
  400. this.queryParamsPay.payName = "";
  401. this.queryParamsPay.pageNum = 1;
  402. this.getAccountsCollection();
  403. this.open = true;
  404. this.payTitle = "应收账款";
  405. },
  406. //获取附件信息
  407. getFile(datas){
  408. var queryParamsFile = {};
  409. queryParamsFile.ticketList = datas;
  410. getFile(queryParamsFile).then((response) => {
  411. if(response.data){
  412. //获取发票文件
  413. this.invoiceFileList = response.data.invoiceFileList;
  414. //获取合同文件
  415. this.contractFileList = response.data.contractFileList;
  416. //获取其他文件
  417. this.otherFileList = response.data.otherFileList;
  418. }
  419. });
  420. },
  421. //获取签发金额大写
  422. getBigSmall(){
  423. this.issuedAmount = this.smallToBig(this.form.zfiAmount);
  424. },
  425. selectChecked() {
  426. //清空选择
  427.             this.$refs.tablePay && this.$refs.tablePay.clearSelection();
  428. this.ticketList.forEach((item) => {
  429. this.payList.forEach(row => {
  430. if (row.zbiId == item.zbiId) {
  431. this.$nextTick(() => {
  432. this.$refs.tablePay && this.$refs.tablePay.toggleRowSelection(row, true);
  433. })
  434. }
  435. });
  436. });
  437. //合计
  438. this.getReTotal(this.ticketList);
  439. //附件
  440. this.getFile(this.ticketList);
  441. },
  442. /* 多选框跨页 */
  443. rowkey(row) {
  444. return row.zbiId;
  445. },
  446. // 多选框选中数据
  447. handleSelectionChange(val) {
  448. this.chooseTicket = val
  449. },
  450. //文件下载
  451. handleDownload(row){
  452. const pfiUrl = row.pfiUrl;
  453. if(pfiUrl != null && pfiUrl != ''){
  454. window.open(pfiUrl +"/"+ getToken());
  455. }else{
  456. this.$message({
  457. message: '该附件不存在!',
  458. type: 'warning'
  459. });
  460. return;
  461. }
  462. },
  463. // 确认选择
  464. closeTicket() {
  465. if(this.chooseTicket.length > 0){
  466. var flag = true;
  467. //获取选中第一个的应付企业
  468. var payName = this.chooseTicket[0].payName;
  469. //获取选中第一个的预计还款日期
  470. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  471. for(var i = 0 ;i < this.chooseTicket.length;i++){
  472. if(payName != this.chooseTicket[i].payName){
  473. flag = false;
  474. this.$message({
  475. message: '请选择应付企业相同的应付账款',
  476. type: 'warning'
  477. });
  478. break;
  479. }else if(zbiPayDate != this.chooseTicket[i].zbiPayDate){
  480. flag = false;
  481. this.$message({
  482. message: '请选择预计还款日期相同的应付账款',
  483. type: 'warning'
  484. });
  485. break;
  486. }
  487. }
  488. if(flag){
  489. //合计
  490. this.getReTotal(this.chooseTicket);
  491. this.ticketList = this.chooseTicket;
  492. //更新附件信息
  493. this.getFile(this.ticketList);
  494. this.open = false;
  495. //开立方赋值
  496. this.$set(this.form, "openName",this.chooseTicket[0].payName);
  497. }
  498. }else{
  499. this.$message({
  500. message: '请选择应收账款',
  501. type: 'warning'
  502. });
  503. }
  504. },
  505. //重新合计
  506. getReTotal(chooseTicket){
  507. //合计
  508. this.checkTotalAmt = "0.00";
  509. for(var i = 0; i < chooseTicket.length;i++){
  510. this.checkTotalAmt = accAdd(this.checkTotalAmt,chooseTicket[i].zbiAmount,2);
  511. }
  512. //签发金额
  513. this.$set(this.form, "zfiAmount",this.checkTotalAmt);
  514. //签发金额大写
  515. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  516. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  517. this.checkTotalAmt = this.amtFormat(this.checkTotalAmt);
  518. },
  519. //取消选择按钮
  520. cancelTicket(){
  521. /* this.ticketList = [];
  522. if(this.$refs.tablePay){
  523. this.$refs.tablePay.clearSelection();
  524. } */
  525. this.open = false;
  526. },
  527. /** 清空选择信息 */
  528. deleteTicekt() {
  529. this.ticketList = [];
  530. this.checkTotalAmt = "0.00";
  531. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  532. //签发金额
  533. this.$set(this.form, "zfiAmount","0.00");
  534. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  535. //开立方清空
  536. this.$set(this.form, "openName","");
  537. //附件
  538. this.getFile(this.ticketList);
  539. if(this.$refs.tablePay){
  540. this.$refs.tablePay.clearSelection();
  541. }
  542. },
  543. /* 删除按钮 */
  544. handleDelete(index, rows) {
  545. rows.splice(index, 1);
  546. if(this.$refs.tablePay){
  547. this.$refs.tablePay.clearSelection();
  548. }
  549. this.selectChecked();
  550. },
  551. //详情按钮
  552. handleDetail(index, rows){
  553. this.zbiId = rows[0].zbiId
  554. this.openDetailBill = true
  555. },
  556. /* 修改按钮 */
  557. handleUpdate(index, rows) {
  558. this.zbiId = rows[0].zbiId;
  559. this.openEditBill = true
  560. },
  561. onSelectAll() {
  562. if(this.$refs.tablePay){
  563. this.$refs.tablePay.clearSelection();
  564. }
  565. },
  566. //格式化金额
  567. amtFormat(cellValue) {
  568. if(cellValue == null || cellValue== undefined || cellValue == ''){
  569. cellValue = '0.00'
  570. }
  571. cellValue += '';
  572.       if (!cellValue.includes('.')) {
  573. cellValue += '.00';
  574. }
  575. console.log(cellValue);
  576.       return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  577.         return $1 + ',';
  578.       }).replace(/\.$/, '');
  579. },
  580. /* // 将数字金额转换为大写金额 */
  581. smallToBig(money) {
  582. // 将数字金额转换为大写金额
  583. var cnNums = new Array(
  584. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" ); //汉字的数字
  585. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  586. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  587. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  588. var cnInteger = "整"; //整数金额时后面跟的字符
  589. var cnIntLast = "元"; //整数完以后的单位
  590. //最大处理的数字
  591. var maxNum = 999999999999999.9999;
  592. var integerNum; //金额整数部分
  593. var decimalNum; //金额小数部分
  594. //输出的中文金额字符串
  595. var chineseStr = "";
  596. var parts; //分离金额后用的数组,预定义
  597. if (money == "" || money == null || money == undefined) {
  598. return "零元零角零分";
  599. }
  600. money = parseFloat(money);
  601. if (money >= maxNum) {
  602. //超出最大处理数字
  603. return "超出最大处理数字";
  604. }
  605. if (money == 0) {
  606. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  607. return chineseStr;
  608. }
  609. //四舍五入保留两位小数,转换为字符串
  610. money = Math.round(money * 100).toString();
  611. integerNum = money.substr(0, money.length - 2);
  612. decimalNum = money.substr(money.length - 2);
  613. //获取整型部分转换
  614. if (parseInt(integerNum, 10) > 0) {
  615. var zeroCount = 0;
  616. var IntLen = integerNum.length;
  617. for (var i = 0; i < IntLen; i++) {
  618. var n = integerNum.substr(i, 1);
  619. var p = IntLen - i - 1;
  620. var q = p / 4;
  621. var m = p % 4;
  622. if (n == "0") {
  623. zeroCount++;
  624. } else {
  625. if (zeroCount > 0) {
  626. chineseStr += cnNums[0];
  627. }
  628. //归零
  629. zeroCount = 0;
  630. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  631. }
  632. if (m == 0 && zeroCount < 4) {
  633. chineseStr += cnIntUnits[q];
  634. }
  635. }
  636. chineseStr += cnIntLast;
  637. }
  638. //小数部分
  639. if (decimalNum != "") {
  640. var decLen = decimalNum.length;
  641. for (var i = 0; i < decLen; i++) {
  642. var n = decimalNum.substr(i, 1);
  643. if (n != "0") {
  644. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  645. }
  646. }
  647. }
  648. if (chineseStr == "") {
  649. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  650. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  651. chineseStr += cnInteger;
  652. }
  653. return chineseStr;
  654. },
  655. //新增
  656. submitForm(){
  657. if(this.ticketList.length < 1){
  658. this.$message({
  659. message: '请选择应收账款',
  660. type: 'warning'
  661. });
  662. return;
  663. }
  664. if(parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.checkTotalAmt))){
  665. this.$message({
  666. message: '签发金额不可大于合计金额',
  667. type: 'warning'
  668. });
  669. return;
  670. }
  671. this.$refs["form"].validate(valid => {
  672. if (valid) {
  673. const loading = this.$loading({
  674. lock: true,
  675. text: 'Loading',
  676. background: 'rgba(0, 0, 0,0)'
  677. });
  678. //如果签发金额小于合计金额
  679. if((parseFloat(this.form.zfiAmount)) < (parseFloat(this.moneyDelete(this.checkTotalAmt)))){
  680. var _this = this;
  681. this.$confirm('签发金额小于应付金额合计,是否确认提交', "警告", {
  682. confirmButtonText: "确定",
  683. cancelButtonText: "取消",
  684. type: "warning"
  685. }).then(function() {
  686. //应收账款
  687. _this.form.ticketList = _this.ticketList;
  688. //融信类型
  689. _this.form.type = "0";
  690. //合计金额
  691. _this.form.checkTotalAmt = _this.moneyDelete(_this.checkTotalAmt);
  692. addCredit(_this.form).then(response => {
  693. loading.close();
  694. //判断是否开启内部审批
  695. var params = {};
  696. params.menuId = "1000000002";
  697. isOpenApproval(params).then((response) => {
  698. var result = response.data.isOpen;
  699. //开启内部审批
  700. if(result == true){
  701. _this.msgSuccess("申请融信资料已提交企业内部审批");
  702. _this.$store.dispatch("tagsView/delView", _this.$route);
  703. _this.$router.go(-1);
  704. }else{
  705. //没有开启内部审批
  706. //判断有没有开启平台审批
  707. var platParam = {};
  708. platParam.menuId = "1000000004";
  709. isOpenApproval(platParam).then((response) => {
  710. var platResult = response.data.isOpen;
  711. //开启平台审批
  712. if(platResult){
  713. _this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  714. _this.$store.dispatch("tagsView/delView", _this.$route);
  715. _this.$router.go(-1);
  716. }else{
  717. //未开启平台审批
  718. _this.msgSuccess("融信资料已提交,待:"+_this.form.openName+"确权;确权结果请留意待办事项与站内消息");
  719. _this.$store.dispatch("tagsView/delView",_this.$route);
  720. _this.$router.go(-1);
  721. }
  722. });
  723. }
  724. })
  725. }).catch((response)=>{
  726. loading.close();
  727. });
  728. }).catch((e) => {
  729. loading.close();
  730. });
  731. }else{
  732. //应收账款
  733. this.form.ticketList = this.ticketList;
  734. //融信类型
  735. this.form.type = "0";
  736. //合计金额
  737. this.form.checkTotalAmt = this.moneyDelete(this.checkTotalAmt);
  738. addCredit(this.form).then(response => {
  739. loading.close();
  740. //判断是否开启内部审批
  741. var params = {};
  742. params.menuId = "1000000002";
  743. isOpenApproval(params).then((response) => {
  744. var result = response.data.isOpen;
  745. //开启内部审批
  746. if(result == true){
  747. this.msgSuccess("申请融信资料已提交企业内部审批");
  748. this.$store.dispatch("tagsView/delView", this.$route);
  749. this.$router.go(-1);
  750. }else{
  751. //没有开启内部审批
  752. //判断有没有开启平台审批
  753. var platParam = {};
  754. platParam.menuId = "1000000004";
  755. isOpenApproval(platParam).then((response) => {
  756. var platResult = response.data.isOpen;
  757. //开启平台审批
  758. if(platResult){
  759. this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  760. this.$store.dispatch("tagsView/delView", this.$route);
  761. this.$router.go(-1);
  762. }else{
  763. //未开启平台审批
  764. this.msgSuccess("融信资料已提交,待:"+this.form.openName+"确权;确权结果请留意待办事项与站内消息");
  765. this.$store.dispatch("tagsView/delView", this.$route);
  766. this.$router.go(-1);
  767. }
  768. });
  769. }
  770. })
  771. }).catch((response)=>{
  772. loading.close();
  773. });
  774. }
  775. }
  776. });
  777. },
  778. //金额去掉千分位
  779. moneyDelete(num){
  780. if(num &&num != undefined && num != null){
  781. let _num = num;
  782. _num = _num.toString();
  783. _num = _num.replace(/,/gi,'');
  784. return _num;
  785. }else{
  786. return num;
  787. }
  788. },
  789. //预览
  790. handlePreview(row) {
  791. const pfiUrl = row.pfiUrl;
  792. const pfiFileName = row.pfiFileName;
  793. if (row.pfiUrl) {
  794. console.log(pfiFileName.substr(-3));
  795. if (pfiFileName.substr(-3) == "pdf") {
  796. this.wordUrl = pfiUrl + "/" + getToken();
  797. this.show=false;
  798. this.heid=true;
  799. } else if (
  800. pfiFileName.substr(-3) == "jpg" ||
  801. pfiFileName.substr(-3) == "png" ||
  802. pfiFileName.substr(-3) == "JPG" ||
  803. pfiFileName.substr(-3) == "PNG" ||
  804. pfiFileName.substr(-4) == "jpeg" ||
  805. pfiFileName.substr(-3) == "JPEG"
  806. ) {
  807. this.wordUrl =
  808. pfiUrl +
  809. "/" +
  810. getToken();
  811. this.show=true;
  812. this.heid=false;
  813. console.log("====>",this.wordUrl);
  814. } else if (
  815. pfiFileName.substr(-3) == "doc" ||
  816. pfiFileName.substr(-3) == "DOC"||
  817. pfiFileName.substr(-4) == "docx" ||
  818. pfiFileName.substr(-3) == "DOCX"
  819. ) {
  820. this.wordUrl =
  821. "https://view.officeapps.live.com/op/view.aspx?src=" +
  822. pfiUrl +
  823. "/" +
  824. getToken() +
  825. "/" +
  826. pfiFileName;
  827. this.show=false;
  828. this.heid=true;
  829. console.log("====>",this.wordUrl);
  830. } else {
  831. this.$message({
  832. message: "暂不支持该类型文件预览",
  833. type: "warning",
  834. });
  835. return;
  836. }
  837. }
  838. this.openFile = true;
  839. },
  840. changeRate(e,input){
  841.       e.target.value=(e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  842.       this.input=e.target.value
  843.       this.form.zfiAmount=this.input
  844.     },
  845. //新增应付
  846. addPay(){
  847. this.openAddBill = true
  848. },
  849. //新增账款回调
  850. emitAddClick(val){
  851. var self = this
  852. this.getAccountsCollection().then((response) => {
  853. //新增付款返回id直接选中
  854. if (val) {
  855. self.payList.forEach(element => {
  856. if(element.zbiId == val){
  857. // 将当前点击项选中
  858. self.chooseTicket.push(element)
  859. self.closeTicket()
  860. }
  861. });
  862. }
  863. })
  864. self.openAddBill = false
  865. }
  866. }
  867. };
  868. </script>
  869. <style lang="scss">
  870. .contain p{
  871. color:#696969;
  872. }
  873. .uoloadfj .el-upload--picture-card{
  874. width:110px;
  875. height:110px;
  876. line-height:110px;
  877. }
  878. .fjUoloadSty .el-upload--picture-card{
  879. display:none;
  880. }
  881. table th.star div::before {
  882. content: '*';
  883. color: red;
  884. }
  885. </style>