creditSeal.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <template>
  2. <div class="app-container">
  3. <el-form ref="form" :model="form" disabled :rules="rules" :inline="true" style="margin-top: 20px" label-width="auto" >
  4. <el-row>
  5. <el-col :span="8">
  6. <el-form-item label="融信编号" prop="zfiNumber">
  7. <el-input v-model="form.zfiNumber" style="width: 200px"/>
  8. </el-form-item>
  9. </el-col>
  10. <el-col :span="8">
  11. <el-form-item label="创建时间" prop="createTime">
  12. <el-date-picker disabled size="small" style="width: 200px" v-model="form.createTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss">
  13. </el-date-picker>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="8">
  17. <el-form-item label="创建人" prop="createName">
  18. <el-input v-model="form.createName" style="width: 200px"/>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="8">
  22. <el-form-item label="开立方" prop="openName">
  23. <el-input v-model="form.openName" style="width: 200px"/>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="8">
  27. <el-form-item label="接收方" prop="receiveName">
  28. <el-input v-model="form.receiveName" style="width: 200px"/>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="8">
  32. <el-form-item label="授信额度" prop="zfpName" >
  33. <el-input v-model="form.zfpName" style="width: 200px"/>
  34. </el-form-item>
  35. </el-col>
  36. </el-row>
  37. <el-row>
  38. <el-col :span="8">
  39. <el-form-item label="签发有效期" prop="zfiEffectiveDate">
  40. <el-date-picker disabled size="small" style="width: 200px" v-model="form.zfiEffectiveDate" type="date" value-format="yyyy-MM-dd">
  41. </el-date-picker>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="8">
  45. <el-form-item label="承诺还款日" prop="zfiExpireDate" >
  46. <el-date-picker disabled size="small" style="width: 200px" v-model="form.zfiExpireDate" type="date" value-format="yyyy-MM-dd">
  47. </el-date-picker>
  48. </el-form-item>
  49. </el-col>
  50. <!-- <el-col :span="8">
  51. <el-form-item label="收款账号" prop="zfiCollectionAccount" v-if="isShow">
  52. <el-input v-model="form.zfiCollectionAccount" style="width: 200px"/>
  53. </el-form-item>
  54. </el-col> -->
  55. </el-row>
  56. <el-divider content-position="left" >{{tableTitle}}</el-divider>
  57. <el-form-item style="margin-left: 100px">
  58. <el-form-item label="合计金额:">
  59. <span>{{checkTotalAmt}}</span>
  60. </el-form-item>
  61. <el-form-item label="金额大写:">
  62. <span>{{checkTotalBigAmt}}</span>
  63. </el-form-item>
  64. <el-table :data="payList" style="width: 1100px">
  65. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  66. <el-table-column label="应收企业" align="center" prop="receiveName"/>
  67. <el-table-column label="应付企业" align="center" prop="payName" />
  68. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
  69. <el-table-column label="金额" align="center" prop="zbiAmount" />
  70. </el-table>
  71. </el-form-item>
  72. <el-row>
  73. <el-col :span="8">
  74. <el-form-item label="签发金额" prop="zfiAmount">
  75. <el-input v-model="form.zfiAmount" style="width: 200px"/>
  76. </el-form-item>
  77. </el-col>
  78. </el-row>
  79. <el-row>
  80. <el-col :span="8">
  81. <el-form-item label="金额大写" prop="issuedAmount">
  82. {{issuedAmount}}
  83. </el-form-item>
  84. </el-col>
  85. </el-row>
  86. </el-form>
  87. <!-- 发票附件 -->
  88. <el-divider content-position="left">发票附件</el-divider>
  89. <el-table :data="invoiceFileList" style="width: 100%">
  90. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  91. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  92. <template slot-scope="scope">
  93. <el-button
  94. size="mini"
  95. type="text"
  96. icon="el-icon-view"
  97. @click="handleDetail(scope.row)"
  98. >下载</el-button>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <!-- 合同附件 -->
  103. <el-divider content-position="left">合同附件</el-divider>
  104. <el-table :data="contractFileList" style="width: 100%">
  105. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  106. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  107. <template slot-scope="scope">
  108. <el-button
  109. size="mini"
  110. type="text"
  111. icon="el-icon-view"
  112. @click="handleDetail(scope.row)"
  113. >下载</el-button>
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <!-- 其他附件 -->
  118. <el-divider content-position="left">其他附件</el-divider>
  119. <el-table :data="otherFileList" style="width: 100%">
  120. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  121. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  122. <template slot-scope="scope">
  123. <el-button
  124. size="mini"
  125. type="text"
  126. icon="el-icon-view"
  127. @click="handleDetail(scope.row)"
  128. >下载</el-button>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <div class="footer" style="float: right;
  133. margin-bottom:2px;">
  134. <el-button type="success" @click="getContractFile">预览文件</el-button>
  135. <el-button type="primary" @click="selectType">确定</el-button>
  136. <el-button @click="cancel">取消</el-button>
  137. </div>
  138. <el-dialog
  139. title="预览"
  140. :visible.sync="pdfShowDialog"
  141. width="30%">
  142. <pdf-show :pdfFileList="pdfFileList">
  143. </pdf-show>
  144. </el-dialog>
  145. <!--选择签署意愿类型-->
  146. <el-dialog :visible.sync="confirmIsShow" width="600px" append-to-body :before-close = "cancelUpdate" center>
  147. <el-form ref="updateForm" :disabled="false" :model="updateForm" v-if="confirmIsShow" label-width="150px" class="demo-form-inline" :inline="true">
  148. <el-radio-group v-model="updateForm.radio">
  149. <el-radio label="01">人脸</el-radio>
  150. <el-radio label="02">短信</el-radio>
  151. </el-radio-group>
  152. </el-form>
  153. <div slot="footer" class="dialog-footer">
  154. <el-button type="primary" @click="confirmSelect">确 定</el-button>
  155. <el-button @click="cancelUpdate">取 消</el-button>
  156. </div>
  157. </el-dialog>
  158. <!--短信-->
  159. <el-dialog :visible.sync="messageIsShow" width="600px" append-to-body :before-close = "cancelMessage" center>
  160. <el-form ref="messageForm" :disabled="false" :model="messageForm" v-if="messageIsShow" label-width="150px" class="demo-form-inline" :inline="true">
  161. <el-form-item label="验证码" prop="validCode">
  162. <el-input v-model="messageForm.validCode" style="width: 200px" maxlength="6"/>
  163. </el-form-item>
  164. <el-form-item>
  165. <el-button type="success" @click="send">发送验证码</el-button>
  166. </el-form-item>
  167. </el-form>
  168. <div slot="footer" class="dialog-footer">
  169. <el-button type="primary" @click="checkCode">确定</el-button>
  170. <el-button @click="cancelMessage">取 消</el-button>
  171. </div>
  172. </el-dialog>
  173. <!--人脸二维码-->
  174. <el-dialog :visible.sync="faceIsShow" width="500px" append-to-body :before-close = "cancelFace" center>
  175. <img :src="'data:image/jpeg;base64,' + this.fileUrl" style="overflow: auto; width: 100%; height: 100%;"/>
  176. </el-dialog>
  177. </div>
  178. </template>
  179. <script>
  180. import {getCreditDetail,getFile} from "@/api/service/credit/credit";
  181. import {accAdd} from "@/utils/calculation";
  182. import {getContractFile} from "@/api/service/credit/creditHandle";
  183. import {sendMessage,checkCode,faceAuth,checkFaceAuth,contractSigning} from "@/api/service/credit/message";
  184. import pdfShow from "./pdfShow";
  185. export default {
  186. name: "addCredit",
  187. components: {pdfShow},
  188. data() {
  189. return {
  190. // 总条数
  191. total: 0,
  192. // 表单参数
  193. form: {
  194. },
  195. // 表单校验
  196. rules: {
  197. },
  198. // 是否显示弹出层
  199. open: false,
  200. //应付账款
  201. payList:[],
  202. //签发金额大写
  203. issuedAmount:"零元整",
  204. //合计选中的应付账款的金额
  205. checkTotalAmt:"0.00",
  206. //合计选中的应付账款的大写金额
  207. checkTotalBigAmt:"零元整",
  208. //标题
  209. tableTitle:"",
  210. //控制收款账号是否显示
  211. isShow:false,
  212. //获取类型
  213. createType:'',
  214. //获取融信的类型
  215. zfiStatus:'',
  216. //融资方审批状态
  217. zfiSupplierStatus:'',
  218. //合同附件
  219. contractFileList:[],
  220. //发票附件
  221. invoiceFileList:[],
  222. //其他文件
  223. otherFileList:[],
  224. pdfShowDialog : false,
  225. pdfFileList : [],
  226. //展示选择意愿
  227. confirmIsShow:false,
  228. //意愿
  229. updateForm:{},
  230. //意愿类型
  231. zfpAuthType:'',
  232. //短信展示
  233. messageIsShow:false,
  234. //短信
  235. messageForm:{validCode:""},
  236. //人脸二维码
  237. fileUrl:"",
  238. //控制人脸二维码是否展示
  239. faceIsShow:false,
  240. //人脸验证结果
  241. faceResult:"",
  242. //人脸识别结果传参
  243. authForm:{}
  244. };
  245. },
  246. created() {
  247. const zfiId = this.$route.params && this.$route.params.zfiId;
  248. getCreditDetail(zfiId).then((response) => {
  249. if(response.data){
  250. //融信信息
  251. this.form = response.data.financeInf;
  252. //类型
  253. this.createType = response.data.financeInf.zfiCreateType;
  254. //融信状态
  255. this.zfiStatus = response.data.financeInf.zfiStatus;
  256. //融资方审批状态
  257. this.zfiSupplierStatus = response.data.financeInf.zfiSupplierStatus;
  258. //意愿类型
  259. this.zfpAuthType = response.data.zfpAuthType;
  260. //核心开立
  261. if(response.data.financeInf.zfiCreateType == '1'){
  262. this.tableTitle = "应付账款";
  263. }else{
  264. this.tableTitle = "应收账款";
  265. //融资开立
  266. if(response.data.financeInf.zfiCreateType == '2'){
  267. //收款账号
  268. //非电子
  269. if(response.data.proComRel.zfpcrLoanType != '0'){
  270. this.isShow = true;
  271. }
  272. }
  273. }
  274. //接收方
  275. this.form.receiveName = response.data.receiveName;
  276. //授信额度
  277. this.form.zfpName = response.data.zfpName;
  278. //开立方
  279. this.form.openName = response.data.openName;
  280. //创建人
  281. this.form.createName = response.data.createName;
  282. //签发金额大写
  283. this.issuedAmount = this.smallToBig(this.form.zfiAmount);
  284. }
  285. if(response.data.payList){
  286. this.payList = response.data.payList.records;
  287. this.getReTotal(this.payList);
  288. //附件
  289. this.getFile(this.payList);
  290. }
  291. })
  292. },
  293. methods: {
  294. // 取消按钮
  295. cancel() {
  296. this.$store.dispatch("tagsView/delView", this.$route);
  297. this.$router.go(-1);
  298. },
  299. /* 多选框跨页 */
  300. rowkeyCustomer(row) {
  301. return row.cciId;
  302. },
  303. //重新合计
  304. getReTotal(chooseTicket){
  305. //合计
  306. this.checkTotalAmt = "0.00";
  307. for(var i = 0; i < chooseTicket.length;i++){
  308. this.checkTotalAmt = accAdd(this.checkTotalAmt,chooseTicket[i].zbiAmount,2);
  309. }
  310. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  311. this.checkTotalAmt = this.amtFormat(this.checkTotalAmt);
  312. },
  313. //获取附件信息
  314. getFile(datas){
  315. var queryParamsFile = {};
  316. queryParamsFile.ticketList = datas;
  317. getFile(queryParamsFile).then((response) => {
  318. if(response.data){
  319. //获取发票文件
  320. this.invoiceFileList = response.data.invoiceFileList;
  321. //获取合同文件
  322. this.contractFileList = response.data.contractFileList;
  323. //获取其他文件
  324. this.otherFileList = response.data.otherFileList;
  325. }
  326. });
  327. },
  328. //格式化金额
  329. amtFormat(cellValue) {
  330. if(cellValue == null || cellValue== undefined || cellValue == ''){
  331. cellValue = '0.00'
  332. }
  333. cellValue += '';
  334.       if (!cellValue.includes('.')) {
  335. cellValue += '.00';
  336. }
  337.       return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  338.         return $1 + ',';
  339.       }).replace(/\.$/, '');
  340. },
  341. /* // 将数字金额转换为大写金额 */
  342. smallToBig(money) {
  343. // 将数字金额转换为大写金额
  344. var cnNums = new Array(
  345. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" ); //汉字的数字
  346. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  347. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  348. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  349. var cnInteger = "整"; //整数金额时后面跟的字符
  350. var cnIntLast = "元"; //整数完以后的单位
  351. //最大处理的数字
  352. var maxNum = 999999999999999.9999;
  353. var integerNum; //金额整数部分
  354. var decimalNum; //金额小数部分
  355. //输出的中文金额字符串
  356. var chineseStr = "";
  357. var parts; //分离金额后用的数组,预定义
  358. if (money == "" || money == null || money == undefined) {
  359. return "零元零角零分";
  360. }
  361. money = parseFloat(money);
  362. if (money >= maxNum) {
  363. //超出最大处理数字
  364. return "超出最大处理数字";
  365. }
  366. if (money == 0) {
  367. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  368. return chineseStr;
  369. }
  370. //四舍五入保留两位小数,转换为字符串
  371. money = Math.round(money * 100).toString();
  372. integerNum = money.substr(0, money.length - 2);
  373. decimalNum = money.substr(money.length - 2);
  374. //获取整型部分转换
  375. if (parseInt(integerNum, 10) > 0) {
  376. var zeroCount = 0;
  377. var IntLen = integerNum.length;
  378. for (var i = 0; i < IntLen; i++) {
  379. var n = integerNum.substr(i, 1);
  380. var p = IntLen - i - 1;
  381. var q = p / 4;
  382. var m = p % 4;
  383. if (n == "0") {
  384. zeroCount++;
  385. } else {
  386. if (zeroCount > 0) {
  387. chineseStr += cnNums[0];
  388. }
  389. //归零
  390. zeroCount = 0;
  391. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  392. }
  393. if (m == 0 && zeroCount < 4) {
  394. chineseStr += cnIntUnits[q];
  395. }
  396. }
  397. chineseStr += cnIntLast;
  398. }
  399. //小数部分
  400. if (decimalNum != "") {
  401. var decLen = decimalNum.length;
  402. for (var i = 0; i < decLen; i++) {
  403. var n = decimalNum.substr(i, 1);
  404. if (n != "0") {
  405. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  406. }
  407. }
  408. }
  409. if (chineseStr == "") {
  410. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  411. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  412. chineseStr += cnInteger;
  413. }
  414. return chineseStr;
  415. },
  416. //取消选择意愿
  417. cancelUpdate(){
  418. this.confirmIsShow = false;
  419. this.resetUpdate();
  420. },
  421. //关闭短信
  422. cancelMessage(){
  423. this.messageIsShow = false;
  424. this.resetMessage();
  425. },
  426. //关闭二维码
  427. cancelFace(){
  428. this.faceIsShow = false;
  429. },
  430. resetUpdate() {
  431. this.updateForm = {
  432. radio:""
  433. };
  434. //意愿类型还原为全部
  435. this.zfpAuthType ="00";
  436. this.resetForm("updateForm");
  437. },
  438. resetMessage() {
  439. this.messageForm = {
  440. validCode:""
  441. };
  442. this.resetForm("messageForm");
  443. },
  444. //获取合同文件
  445. getContractFile(){
  446. getContractFile(this.form).then((response) => {
  447. if(response.data.list){
  448. this.pdfFileList = response.data.list;
  449. }
  450. });
  451. //文件存在
  452. if(this.pdfFileList.length > 0 ){
  453. this.pdfShowDialog = true;
  454. }
  455. },
  456. //选择类型
  457. selectType(){
  458. //可以直接盖章的
  459. if( (this.zfiCreateType =='0' && this.zfiStatus =='01' && this.zfiSupplierStatus =='01')
  460. || (this.zfiCreateType =='1' && this.zfiStatus =='01' && this.zfiSupplierStatus =='01')){
  461. //直接盖章
  462. this.contractSigning();
  463. }else{
  464. //选择签署意愿
  465. if(this.zfpAuthType == "00"){
  466. this.confirmIsShow = true;
  467. }else{
  468. this.checking();
  469. }
  470. }
  471. },
  472. //确认选择
  473. confirmSelect(){
  474. if(!this.updateForm.radio){
  475. this.$message({
  476. message: '请选择签署意愿类型',
  477. type: 'warning'
  478. });
  479. return;
  480. }
  481. this.confirmIsShow = false;
  482. this.zfpAuthType = this.updateForm.radio;
  483. //调用人脸识别或者短信验证
  484. this.checking();
  485. },
  486. //去签署
  487. checking(){
  488. //人脸
  489. if(this.zfpAuthType == '01'){
  490. //调用人脸识别生成二维码
  491. faceAuth().then((response) => {
  492. if(response.data){
  493. //获取二维码
  494. this.fileUrl = response.data.fileUrl;
  495. //获取源流水号
  496. var originalTxSN = response.data.originalTxSN;
  497. this.faceIsShow = true;
  498. //每5秒查证人脸识别结果
  499. var timeInterval = window.setInterval(() => {
  500. setTimeout(() => {
  501. //源流水不为空并且结果为空
  502. if(originalTxSN && !this.faceResult){
  503. this.authForm.originalTxSN = originalTxSN;
  504. //调用查证方法
  505. checkFaceAuth(this.authForm).then((res) => {
  506. //认证结果
  507. this.faceResult = res.data.Verification;
  508. //成功
  509. if(this.faceResult == '20'){
  510. this.msgSuccess("验证成功");
  511. //关闭验证码
  512. this.faceIsShow = false;
  513. //关闭定时
  514. window.clearInterval(timeInterval);
  515. //调用盖章
  516. this.contractSigning();
  517. }else if(this.faceResult == '30'){
  518. this.$message({
  519. message: "验证失败",
  520. type: 'warning'
  521. });
  522. //关闭验证码
  523. this.faceIsShow = false;
  524. window.clearInterval(timeInterval);
  525. }
  526. });
  527. }
  528. }, 0)
  529. },10000)
  530. }
  531. });
  532. }else if(this.zfpAuthType == '02'){//短信
  533. this.messageIsShow = true;
  534. }
  535. },
  536. //发送短信验证码
  537. send(){
  538. //发送
  539. sendMessage().then((response) => {
  540. if(response.data){
  541. //手机号
  542. var newIphone = response.data.newIphone;
  543. //结果
  544. var result = response.data.result;
  545. //成功
  546. if("20" == result){
  547. this.$message({
  548. message: "已向经办人手机号为"+newIphone+"发送短信验证码,请注意查收",
  549. type: 'warning'
  550. });
  551. }else if("10" == result){//失败
  552. this.$message({
  553. message: "短信发送失败",
  554. type: 'warning'
  555. });
  556. }
  557. }
  558. });
  559. },
  560. //校验验证码是否正确
  561. checkCode(){
  562. if(!this.messageForm.validCode){
  563. this.$message({
  564. message: "请输入验证码",
  565. type: 'warning'
  566. });
  567. return;
  568. }
  569. //校验验证码
  570. checkCode(this.messageForm).then((response) => {
  571. if(response.data){
  572. //结果
  573. var verification = response.data.verification;
  574. //匹配
  575. if("20" == verification){
  576. //进行下一步-- 盖章
  577. this.contractSigning();
  578. }else if("30" == verification){//不匹配
  579. this.$message({
  580. message: "验证有误,请重新输入",
  581. type: 'warning'
  582. });
  583. }
  584. }
  585. });
  586. },
  587. //盖章
  588. contractSigning(){
  589. contractSigning(this.form).then((response) => {
  590. this.msgSuccess("盖章成功");
  591. if(this.zfpAuthType == '02'){
  592. //关闭短信验证
  593. this.messageIsShow = false;
  594. }else if(this.zfpAuthType == '01'){
  595. //关闭人脸二维码
  596. this.faceIsShow = false;
  597. }
  598. this.$store.dispatch(
  599. "tagsView/delView",
  600. this.$route
  601. );
  602. this.$router.go(-1);
  603. }).catch((response) => {
  604. });
  605. }
  606. }
  607. };
  608. </script>
  609. <style lang="scss">
  610. .uoloadfj .el-upload--picture-card{
  611. width:110px;
  612. height:110px;
  613. line-height:110px;
  614. }
  615. .fjUoloadSty .el-upload--picture-card{
  616. display:none;
  617. }
  618. table th.star div::before {
  619. content: '*';
  620. color: red;
  621. }
  622. </style>