addFinanceRecord.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <div class="app-container">
  3. <!-- 添加或修改融资记录对话框 -->
  4. <el-form ref="form" :label-position="labelPosition" :model="form" :rules="rules" label-width="80px">
  5. <el-divider content-position="left">融资信息</el-divider>
  6. <el-row>
  7. <el-col :span="8">
  8. <el-form-item label="融信编号:" prop="zfrFinanceId">
  9. <el-select v-model="form.zfrFinanceId" style="width : 284px" clearable @clear="clearBoth">
  10. <el-option
  11. v-for="(item,index) in financeInfList"
  12. :key="index"
  13. :label="item.zfiNumber"
  14. :value="item.zfiId"
  15. @click.native="amount(item)"
  16. ></el-option>
  17. </el-select>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="8">
  21. <el-form-item label="融资金额:" prop="zfrAmount">
  22. <el-input v-model="form.zfrAmount" placeholder="请输入融资金额" style="width: 284px;" readonly>
  23. <template slot="append">万元</template>
  24. </el-input>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="8">
  28. <el-form-item label="融资账户:" prop="zfrCollectionAccount" v-if="this.form.zfpcrLoanType != '0'">
  29. <el-input v-model="form.zfrCollectionAccount" placeholder="请输入融资账户" style="width: 284px;" maxlength="25"/>
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. <el-row>
  34. <el-col :span="8">
  35. <el-form-item label="承诺还款日" prop="zfrRepaymentDate" v-if="false">
  36. <el-input v-model="form.zfrRepaymentDate" placeholder="请输入承诺还款日" style="width: 284px;"/>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="8">
  40. <el-form-item label="融资利率" prop="zfrRate" v-if="false">
  41. <el-input v-model="form.zfrRate" placeholder="请输入融资利率" style="width: 284px;"/>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="8">
  45. <el-form-item label="融资放款方式" prop="zfpcrLoanType" label-width="90px" v-if="false">
  46. <el-input v-model="form.zfpcrLoanType" placeholder="请输入融资账户" style="width: 284px;"/>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. <el-row>
  51. <el-col :span="8">
  52. <el-form-item label="融资产品" prop="zfiProductId" v-if="false">
  53. <el-input v-model="form.zfiProductId" placeholder="请输入融资产品" style="width: 284px;"/>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="8">
  57. <el-form-item label="平台服务费收取费率" prop="zfpcrChargeRate" v-if="false">
  58. <el-input v-model="form.zfpcrChargeRate" placeholder="请输入平台服务费收取费率" style="width: 284px;"/>
  59. </el-form-item>
  60. </el-col>
  61. </el-row>
  62. </el-form>
  63. <el-divider content-position="left">应收账款</el-divider>
  64. <span style="float: right; margin-right: 125px;">金额大写:{{ smallToBig(allAmount()) }}</span>
  65. <span style="float: right; margin-right: 125px;">消费金额:{{ allAmount() }} 元</span>
  66. <el-table :data="billInfList" >
  67. <el-table-column label="序号" type="index" width="50" align="center">
  68. <template slot-scope="scope">
  69. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="编号" align="center" prop="zbiNumber" />
  73. <el-table-column label="账款名称" align="center" prop="zbiName" />
  74. <el-table-column label="应收企业" align="center" prop="payee" />
  75. <el-table-column label="应付企业" align="center" prop="payer" />
  76. <el-table-column label="还款时间" align="center" prop="zbiPayDate" />
  77. <el-table-column label="金额(万元)" align="center" prop="zbiAmount" />
  78. </el-table>
  79. <!-- 发票附件 -->
  80. <el-divider content-position="left">发票附件</el-divider>
  81. <el-table :data="invoiceFileList" border style="width: 100%">
  82. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  83. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  84. <template slot-scope="scope">
  85. <el-button
  86. size="mini"
  87. type="text"
  88. icon="el-icon-view"
  89. @click="handleDetail(scope.row)"
  90. >下载</el-button>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <!-- 合同附件 -->
  95. <el-divider content-position="left">合同附件</el-divider>
  96. <el-table :data="contractFileList" border style="width: 100%">
  97. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  98. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  99. <template slot-scope="scope">
  100. <el-button
  101. size="mini"
  102. type="text"
  103. icon="el-icon-view"
  104. @click="handleDetail(scope.row)"
  105. >下载</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <!-- 其他附件 -->
  110. <el-divider content-position="left">其他附件</el-divider>
  111. <el-table :data="otherFileList" border style="width: 100%">
  112. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  113. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  114. <template slot-scope="scope">
  115. <el-button
  116. size="mini"
  117. type="text"
  118. icon="el-icon-view"
  119. @click="handleDetail(scope.row)"
  120. >下载</el-button>
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <div slot="footer" class="dialog-footer">
  125. <el-button type="primary" @click="submitForm">确 定</el-button>
  126. <!-- <el-button @click="cancel">取 消</el-button> -->
  127. </div>
  128. </div>
  129. </template>
  130. <script>
  131. import {addRecord,listBillInf} from "@/api/service/financeRecord/record";
  132. import { listFinanceInf } from "@/api/common/financeInf";
  133. import { getFile } from "@/api/service/credit/credit";
  134. export default {
  135. name: "financeRecord",
  136. components: {
  137. },
  138. data() {
  139. return {
  140. labelPosition: 'top',
  141. // 遮罩层
  142. loading: true,
  143. // 选中数组
  144. ids: [],
  145. // 非单个禁用
  146. single: true,
  147. // 非多个禁用
  148. multiple: true,
  149. // 显示搜索条件
  150. showSearch: true,
  151. // 总条数
  152. total: 0,
  153. // 全部融资记录表格数据
  154. recordList: [],
  155. //融信编号数据
  156. financeInfList: [],
  157. //应收账款
  158. billInfList: [],
  159. //合同附件
  160. contractFileList:[],
  161. //发票附件
  162. invoiceFileList:[],
  163. //其他文件
  164. otherFileList:[],
  165. // 弹出层标题
  166. title: "",
  167. // 是否显示弹出层
  168. open: false,
  169. // 查询参数
  170. queryParams: {
  171. pageNum: 1,
  172. pageSize: 10,
  173. zfrFinanceId: null,
  174. zfrNumber: null,
  175. zfrAmount: null,
  176. zfrRate: null,
  177. zfrHandler: null,
  178. zfrRepaymentDate: null,
  179. zfrApplyDate: null,
  180. zfrLoanDate: null,
  181. zfrApplyAmount: null,
  182. zfrApplyType: null,
  183. zfrStatus: null,
  184. zfrApproveStt: null,
  185. zfpcrLoanType: null,
  186. zfiProductId: null
  187. },
  188. // 表单参数
  189. form: {},
  190. // 表单校验
  191. rules: {
  192. zfrFinanceId: [
  193. { required: true, message: "融信编号不能为空", trigger: "blur" }
  194. ],
  195. zfrAmount: [
  196. { required: true, message: "融资金额不能为空", trigger: "blur" }
  197. ],
  198. }
  199. };
  200. },
  201. created() {
  202. this.getFinanceInf();
  203. },
  204. methods: {
  205. /** 查询融信编号 */
  206. getFinanceInf(){
  207. this.loading = true;
  208. listFinanceInf().then(response => {
  209. this.financeInfList = response.data;
  210. this.loading = false;
  211. });
  212. },
  213. // 取消按钮
  214. cancel() {
  215. this.open = false;
  216. this.reset();
  217. },
  218. // 表单重置
  219. reset() {
  220. this.form = {
  221. zfrId: null,
  222. zfrFinanceId: null,
  223. zfrNumber: null,
  224. zfrAmount: null,
  225. zfrRate: null,
  226. zfrHandler: null,
  227. zfrRepaymentDate: null,
  228. zfrApplyDate: null,
  229. zfrLoanDate: null,
  230. zfrApplyAmount: null,
  231. zfrApplyType: null,
  232. zfrStatus: "00",
  233. zfrApproveStt: null,
  234. zfrProfitSpare1: null,
  235. zfrProfitSpare2: null,
  236. zfrProfitSpare3: null,
  237. zfrProfitSpare4: null,
  238. zfrProfitSpare5: null,
  239. zfrProfitSpare6: null,
  240. zfrProfitSpare7: null,
  241. zfrProfitSpare8: null,
  242. zfrProfitSpare9: null,
  243. createBy: null,
  244. createTime: null,
  245. updateBy: null,
  246. updateTime: null
  247. };
  248. this.resetForm("form");
  249. },
  250. /** 全部搜索按钮操作 */
  251. handleQuery() {
  252. this.queryParams.pageNum = 1;
  253. this.getList();
  254. },
  255. /** 全部重置按钮操作 */
  256. resetQuery() {
  257. this.resetForm("queryForm");
  258. this.handleQuery();
  259. },
  260. //全部 多选框选中数据
  261. handleSelectionChange(selection) {
  262. this.ids = selection.map(item => item.zfrId)
  263. this.single = selection.length!==1
  264. this.multiple = !selection.length
  265. },
  266. /* 融信编号赋值融资金额 */
  267. amount(item) {
  268. this.$set(this.form, "zfrAmount", item.zfiAmount);
  269. this.$set(this.form, "zfrRepaymentDate", item.zfiExpireDate);
  270. this.$set(this.form, "zfrRate", item.zfpcrRate);
  271. this.$set(this.form, "zfpcrLoanType", item.zfpcrLoanType);
  272. this.$set(this.form, "zfiProductId", item.zfiProductId);
  273. this.$set(this.form, "zfpcrChargeRate", item.zfpcrChargeRate);
  274. if(item.zfiId){
  275. this.loading = true;
  276. listBillInf(item.zfiId).then(response => {
  277. this.billInfList = response.data;
  278. this.loading = false;
  279. }).then(() =>{
  280. var queryParamsFile = {};
  281. queryParamsFile.ticketList = this.billInfList;
  282. getFile(queryParamsFile).then((response) => {
  283. if(response.data){
  284. //获取发票文件
  285. this.invoiceFileList = response.data.invoiceFileList;
  286. //获取合同文件
  287. this.contractFileList = response.data.contractFileList;
  288. //获取其他文件
  289. this.otherFileList = response.data.otherFileList;
  290. }
  291. });
  292. })
  293. }
  294. },
  295. /** 提交按钮 */
  296. submitForm() {
  297. this.$refs["form"].validate(valid => {
  298. if (valid) {
  299. const loading = this.$loading({
  300. lock: true,
  301. text: "Loading",
  302. spinner: "el-icon-loading",
  303. background: "rgba(0, 0, 0, 0.7)",
  304. });
  305. addRecord(this.form).then(response => {
  306. this.msgSuccess("新增成功");
  307. loading.close();
  308. this.$store.dispatch("tagsView/delView", this.$route);
  309. this.$router.go(-1);
  310. }).catch((response) => {
  311. loading.close();
  312. });
  313. }
  314. });
  315. },
  316. /* 清空 */
  317. clearBoth() {
  318. this.form.zfrAmount = '';
  319. this.form,zfrRepaymentDate = '';
  320. this.form.zfrRate = '';
  321. this.form.zfpcrLoanType = '';
  322. this.billInfList = [];
  323. this.contractFileList = [];
  324. this.invoiceFileList = [];
  325. this.otherFileList = [];
  326. },
  327. //应收账款合计
  328. allAmount() {
  329. var strarr = [0.00];
  330. for (let i in this.billInfList) {
  331. strarr.push((this.billInfList[i]["zbiAmount"] * '10000'));
  332. }
  333. return Math.floor(eval(strarr.join("+")) * 100) / 100; //结果
  334. },
  335. /* // 将数字金额转换为大写金额 */
  336. smallToBig(money) {
  337. // 将数字金额转换为大写金额
  338. var cnNums = new Array(
  339. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" ); //汉字的数字
  340. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  341. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  342. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  343. var cnInteger = "整"; //整数金额时后面跟的字符
  344. var cnIntLast = "元"; //整数完以后的单位
  345. //最大处理的数字
  346. var maxNum = 999999999999999.9999;
  347. var integerNum; //金额整数部分
  348. var decimalNum; //金额小数部分
  349. //输出的中文金额字符串
  350. var chineseStr = "";
  351. var parts; //分离金额后用的数组,预定义
  352. if (money == "" || money == null || money == undefined) {
  353. return "零元零角零分";
  354. }
  355. money = parseFloat(money);
  356. if (money >= maxNum) {
  357. //超出最大处理数字
  358. return "超出最大处理数字";
  359. }
  360. if (money == 0) {
  361. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  362. return chineseStr;
  363. }
  364. //四舍五入保留两位小数,转换为字符串
  365. money = Math.round(money * 100).toString();
  366. integerNum = money.substr(0, money.length - 2);
  367. decimalNum = money.substr(money.length - 2);
  368. //获取整型部分转换
  369. if (parseInt(integerNum, 10) > 0) {
  370. var zeroCount = 0;
  371. var IntLen = integerNum.length;
  372. for (var i = 0; i < IntLen; i++) {
  373. var n = integerNum.substr(i, 1);
  374. var p = IntLen - i - 1;
  375. var q = p / 4;
  376. var m = p % 4;
  377. if (n == "0") {
  378. zeroCount++;
  379. } else {
  380. if (zeroCount > 0) {
  381. chineseStr += cnNums[0];
  382. }
  383. //归零
  384. zeroCount = 0;
  385. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  386. }
  387. if (m == 0 && zeroCount < 4) {
  388. chineseStr += cnIntUnits[q];
  389. }
  390. }
  391. chineseStr += cnIntLast;
  392. }
  393. //小数部分
  394. if (decimalNum != "") {
  395. var decLen = decimalNum.length;
  396. for (var i = 0; i < decLen; i++) {
  397. var n = decimalNum.substr(i, 1);
  398. if (n != "0") {
  399. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  400. }
  401. }
  402. }
  403. if (chineseStr == "") {
  404. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  405. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  406. chineseStr += cnInteger;
  407. }
  408. return chineseStr;
  409. },
  410. /** 导出按钮操作 */
  411. handleExport() {
  412. this.download('sc-service/record/export', {
  413. ...this.queryParams
  414. }, `sc-service_record.xlsx`)
  415. }
  416. }
  417. };
  418. </script>