addInformation.vue 35 KB

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