addCreditLine.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <div class="app-container">
  3. <el-form ref="form" :label-position="labelPosition" :model="form" :rules="rules" label-width="106px">
  4. <el-divider content-position="left">授信信息</el-divider>
  5. <el-row>
  6. <el-col :span="8">
  7. <el-form-item label="资金方:" prop="zfpcrFundSide">
  8. <el-select v-model="form.zfpcrFundSide" style="width : 284px" clearable @change ="change">
  9. <el-option
  10. v-for="(item,index) in zfCompanyList"
  11. :key="index"
  12. :label="item.scyName"
  13. :value="item.scyId"
  14. ></el-option>
  15. </el-select>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="8">
  19. <el-form-item label="融资产品:" prop="zfpcrProductId">
  20. <el-select v-model="form.zfpcrProductId" style="width : 284px" clearable>
  21. <el-option
  22. v-for="(item,index) in financeProductList"
  23. :key="index"
  24. :label="item.zfpName"
  25. :value="item.zfpId"
  26. ></el-option>
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="8">
  31. <el-form-item label="授信企业名称:" prop="zfpcrCompanyId">
  32. <el-select v-model="form.zfpcrCompanyId" style="width : 284px" clearable>
  33. <el-option
  34. v-for="(item,index) in hxCompanyList"
  35. :key="index"
  36. :label="item.scyName"
  37. :value="item.scyId"
  38. ></el-option>
  39. </el-select>
  40. </el-form-item>
  41. </el-col>
  42. </el-row>
  43. <el-row>
  44. <el-col :span="8">
  45. <el-form-item label="授信额度:" prop="zfpcrAmount">
  46. <!-- <el-tooltip class="item" effect="light" :content= "zfpcrAmountFormat" placement="top-start"> -->
  47. <el-input v-model="form.zfpcrAmount" placeholder="请输入授信额度" style="width:284px">
  48. <template slot="append">元</template>
  49. </el-input>
  50. <!-- </el-tooltip> -->
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="8">
  54. <el-form-item label="利率:" prop="zfpcrRate">
  55. <el-input v-model="form.zfpcrRate" placeholder="请输入利率" style="width:284px">
  56. <template slot="append">%起</template>
  57. </el-input>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="8">
  61. <el-form-item label="有效期:" prop="zfpcrDateType">
  62. <el-radio-group v-model="form.zfpcrDateType" size="medium">
  63. <el-radio-button v-for="(dict,index) in dateTypeOptions" :key="index" :label="dict.dictValue" border>{{dict.dictLabel}}</el-radio-button>
  64. </el-radio-group>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. <el-row>
  69. <el-col :span="8">
  70. <el-form-item label="有效期范围:" prop="dateTime" v-if="this.form.zfpcrDateType == '1'">
  71. <el-date-picker
  72. v-model="form.dateTime"
  73. clearable
  74. style="width: 284px"
  75. unlink-panels
  76. value-format="yyyy-MM-dd"
  77. type="daterange"
  78. range-separator="-"
  79. start-placeholder="开始日期"
  80. end-placeholder="结束日期">
  81. </el-date-picker>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="8">
  85. <el-form-item label="融资网点:" prop="zfpcrAddress">
  86. <el-input v-model="form.zfpcrAddress" placeholder="请输入融资网点" style="width:284px"/>
  87. </el-form-item>
  88. </el-col>
  89. <el-col :span="8">
  90. <el-form-item label="是否收取手续费:" prop="zfpcrCharge" label-width="113px">
  91. <el-radio-group v-model="form.zfpcrCharge" size="medium" >
  92. <el-radio-button v-for="(dict,index) in chargeOptions" :key="index" :label="dict.dictValue" border>{{dict.dictLabel}}</el-radio-button>
  93. </el-radio-group>
  94. </el-form-item>
  95. </el-col>
  96. </el-row>
  97. <el-row>
  98. <el-col :span="8">
  99. <el-form-item label="平台服务费收取费率:" prop="zfpcrChargeRate" label-width="139px" v-if="this.form.zfpcrCharge == '1'">
  100. <el-input v-model="form.zfpcrChargeRate" placeholder="请输入平台服务费收取费率" style="width:284px">
  101. <template slot="append">%</template>
  102. </el-input>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="8">
  106. <el-form-item label="核心企业还款账户账号:" prop="zfpcrAccount" label-width="142px">
  107. <el-autocomplete
  108. style="width:286px"
  109. class="inline-input"
  110. v-model="form.zfpcrAccount"
  111. :fetch-suggestions="querySearch"
  112. placeholder="核心企业还款账户账号"
  113. ></el-autocomplete>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="8">
  117. <el-form-item label="融资放款方式:" prop="zfpcrLoanType">
  118. <el-select v-model="form.zfpcrLoanType" placeholder="请选择状态" clearable style="width : 284px" clearable>
  119. <el-option
  120. v-for="dict in loanTypeOptions"
  121. :key="dict.dictValue"
  122. :label="dict.dictLabel"
  123. :value="dict.dictValue"
  124. />
  125. </el-select>
  126. </el-form-item>
  127. </el-col>
  128. </el-row>
  129. <el-row>
  130. <el-col :span="8">
  131. <el-form-item label="记账簿托管方式:" prop="zfpcrBookkeepingType" label-width="113px">
  132. <el-select v-model="form.zfpcrBookkeepingType" placeholder="请选择状态" clearable style="width : 284px" clearable>
  133. <el-option
  134. v-for="dict in bookkeepingTypeOptions"
  135. :key="dict.dictValue"
  136. :label="dict.dictLabel"
  137. :value="dict.dictValue"
  138. />
  139. </el-select>
  140. </el-form-item>
  141. </el-col>
  142. </el-row>
  143. <el-divider content-position="left">关联合同</el-divider>
  144. <el-form-item prop="zfqcrContractId" style="margin-left: 100px" >
  145. <el-button size="mini" type="primary" @click="openTicket">选择合同</el-button>
  146. <el-button size="mini" @click="deleteTicekt">清空全部</el-button>
  147. <el-table :data="ticketList" style="width: 1100px">
  148. <el-table-column label="序号" type="index" width="50" align="center">
  149. <template slot-scope="scope">
  150. <span>{{ (queryParamsContract.pageNum - 1) * queryParamsContract.pageSize + scope.$index + 1}}</span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="合同模板名称" align="center" prop="zfcName" />
  154. <el-table-column label="签署主体" align="center" prop="zfcSubject" :formatter="subjectFormat" />
  155. <el-table-column label="合同id" align="center" prop="zfcId" v-if="false" />
  156. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
  157. <template slot-scope="scope">
  158. <el-button
  159. size="mini"
  160. type="text"
  161. icon="el-icon-delete"
  162. @click="handleDelete(scope.$index, ticketList)"
  163. >删除</el-button>
  164. </template>
  165. </el-table-column>
  166. </el-table>
  167. </el-form-item>
  168. </el-form>
  169. <!-- 合同信息 -->
  170. <el-dialog :title="title" :visible.sync="open" width="1120px" append-to-body>
  171. <el-form :model="queryParamsContract" ref="formQuery" :inline="true" label-width="68px" style="margin-bottom: -21px">
  172. <el-form-item label="合同模板名称" prop="zfcName" label-width="90px">
  173. <el-input
  174. v-model="queryParamsContract.zfcName"
  175. placeholder="请输入合同模板名称"
  176. clearable
  177. size="small"
  178. maxlength="11"
  179. @keyup.enter.native="handleQuerys"/>
  180. </el-form-item>
  181. <el-form-item>
  182. <el-button
  183. type="cyan"
  184. icon="el-icon-search"
  185. size="mini"
  186. @click="handleQuerys"
  187. >搜索</el-button>
  188. <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys"
  189. >重置</el-button>
  190. </el-form-item>
  191. </el-form>
  192. <el-table :data="contractList"
  193. ref="tableContract"
  194. class="single-select-table"
  195. @selection-change="handleSelectionChange"
  196. :row-key="rowkey">
  197. <el-table-column
  198. type="selection"
  199. :reserve-selection="true"
  200. width="50"
  201. align="center"/>
  202. <el-table-column label="序号" type="index" width="50" align="center">
  203. <template slot-scope="scope">
  204. <span>{{ (queryParamsContract.pageNum - 1) * queryParamsContract.pageSize + scope.$index + 1}}</span>
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="资金方" align="center" prop="scyName" :show-overflow-tooltip="true" />
  208. <el-table-column label="合同模板名称" align="center" prop="zfcName" :show-overflow-tooltip="true" />
  209. <el-table-column label="合同模板状态" align="center" prop="zfcStatus" :formatter="statusFormat" :show-overflow-tooltip="true"/>
  210. <el-table-column label="签署节点" align="center" prop="zfcNode" :formatter="nodeFormat" :show-overflow-tooltip="true" />
  211. <el-table-column label="签署方" align="center" prop="zfcSubject" :formatter="subjectFormat" :show-overflow-tooltip="true"/>
  212. <el-table-column label="创建人" align="center" prop="nickName" :show-overflow-tooltip="true"/>
  213. <el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
  214. </el-table>
  215. <pagination
  216. v-show="total > 0"
  217. :total="total"
  218. :page.sync="queryParamsContract.pageNum"
  219. :limit.sync="queryParamsContract.pageSize"
  220. @pagination="getContractList" />
  221. <span slot="footer" class="dialog-footer">
  222. <el-button size="mini" @click="cancelTicket">取消</el-button>
  223. <el-button size="mini" type="primary" @click="closeTicket">确认</el-button>
  224. </span>
  225. </el-dialog>
  226. <div slot="footer" class="dialog-footer">
  227. <el-button type="primary" @click="submitForm">确 定</el-button>
  228. <!-- <el-button @click="cancel">取 消</el-button> -->
  229. </div>
  230. </div>
  231. </template>
  232. <script>
  233. import { listCreditLine, getCreditLine, delCreditLine, addCreditLine, updateCreditLine} from "@/api/service/creditLine/creditLine";
  234. import { listFinanceProduct } from "@/api/common/financeProduct";
  235. import { listCompany } from "@/api/common/company";
  236. import { listCompanyAcc } from "@/api/common/companyAcc";
  237. import { listContract } from "@/api/common/contract";
  238. export default {
  239. name: "addCreditLine",
  240. components: {},
  241. data() {
  242. return {
  243. //金额展示
  244. zfpcrAmountFormat: '',
  245. //还款账户搜所
  246. restaurants: [],
  247. labelPosition: 'top',
  248. // 遮罩层
  249. loading: true,
  250. // 选中数组
  251. ids: [],
  252. // 非单个禁用
  253. single: true,
  254. // 非多个禁用
  255. multiple: true,
  256. // 显示搜索条件
  257. showSearch: true,
  258. // 总条数
  259. total: 0,
  260. // 企业授信额度表格数据
  261. creditLineList: [],
  262. //资金方数据
  263. zfCompanyList: [],
  264. //融资产品数据
  265. financeProductList: [],
  266. //核心企业数据
  267. hxCompanyList: [],
  268. //核心企业还款账户数据:
  269. accList: [],
  270. //合同表格数据
  271. ticketList: [],
  272. //合同列表数据
  273. contractList: [],
  274. //有效期数据字典
  275. dateTypeOptions: [],
  276. //是否收取手续费数据字典
  277. chargeOptions: [],
  278. //融资放款方式数据字典
  279. loanTypeOptions: [],
  280. //记账簿托管方式数据字典
  281. bookkeepingTypeOptions: [],
  282. //合同状态数据字典
  283. statusOptions: [],
  284. //签署节点数据字典
  285. nodeOptions: [],
  286. //签署主体数据字典
  287. subjectOptions:[],
  288. // 弹出层标题
  289. title: "",
  290. // 是否显示弹出层
  291. open: false,
  292. // 查询参数
  293. queryParams: {
  294. pageNum: 1,
  295. pageSize: 10,
  296. zfpcrProductId: null,
  297. zfpcrCompanyId: null,
  298. zfpcrType: null,
  299. zfpcrAmount: null,
  300. zfpcrRate: null,
  301. zfpcrDivisionAmount: null,
  302. zfpcrDateType: null,
  303. zfpcrStartDate: null,
  304. zfpcrEndDate: null,
  305. zfpcrAddress: null,
  306. zfpcrCharge: null,
  307. zfpcrChargeRate: null,
  308. zfpcrAccount: null,
  309. zfpcrLoanType: null,
  310. zfpcrBookkeepingType: null,
  311. zfpcrStatus: null,
  312. zfpcrProfitSpare1: null,
  313. zfpcrProfitSpare2: null,
  314. zfpcrProfitSpare3: null,
  315. zfpcrProfitSpare4: null,
  316. zfpcrProfitSpare5: null,
  317. zfpcrProfitSpare6: null,
  318. zfpcrProfitSpare7: null,
  319. zfpcrProfitSpare8: null,
  320. zfpcrProfitSpare9: null,
  321. },
  322. queryParamsContract: {
  323. pageNum: 1,
  324. pageSize: 10,
  325. zfcId: null,
  326. zfcName: null,
  327. zfcNumber: null,
  328. zfcManagementId: null
  329. },
  330. // 表单参数
  331. form: {
  332. zfpcrDateType: '0',
  333. zfpcrCharge: '1'
  334. },
  335. // 表单校验
  336. rules: {
  337. zfpcrFundSide: [
  338. { required: true, message: "资金方不能为空", trigger: ["blur", "change"] }
  339. ],
  340. zfpcrProductId: [
  341. { required: true, message: "融资产品不能为空", trigger: ["blur", "change"] }
  342. ],
  343. zfpcrCompanyId: [
  344. { required: true, message: "授信企业名称不能为空", trigger: ["blur", "change"] }
  345. ],
  346. zfpcrAmount: [
  347. { required: true, message: "授信额度不能为空", trigger: ["blur", "change"] },
  348. {
  349. pattern: /^[0-9][0-9]{0,7}$|^[1-9][0-9]{0,7}[.]\d{1,2}$/,
  350. message: "请输入正确的额度",
  351. trigger: "change",
  352. },
  353. ],
  354. zfpcrRate: [
  355. { required: true, message: "利率不能为空", trigger: ["blur", "change"] },
  356. {
  357. pattern: /^([0-9]{1,2}$)|(^[0-9]{1,2}\.[0-9]{1,2}$)|100$/,
  358. message: "请输入正确的利率",
  359. trigger: "change",
  360. },
  361. ],
  362. dateTime: [
  363. { required: true, message: "有效期范围不能为空", trigger: ["blur", "change"] }
  364. ],
  365. zfpcrChargeRate: [
  366. { required: true, message: "平台服务费收取费率不能为空", trigger: ["blur", "change"] },
  367. {
  368. pattern: /^([0-9]{1,2}$)|(^[0-9]{1,2}\.[0-9]{1,2}$)|100$/,
  369. message: "请输入正确的平台服务费收取费率",
  370. trigger: "change",
  371. },
  372. ],
  373. zfpcrAccount: [
  374. { required: true, message: "核心企业还款账户账号", trigger: ["blur", "change"] }
  375. ],
  376. zfpcrLoanType: [
  377. { required: true, message: "融资放款方式不能为空", trigger: ["blur", "change"] }
  378. ],
  379. zfpcrBookkeepingType: [
  380. { required: true, message: "记账簿托管方式不能为空", trigger: ["blur", "change"] }
  381. ],
  382. }
  383. };
  384. },
  385. created() {
  386. this.getZfCompany();
  387. this.getFinanceProduct();
  388. this.getHxCompany();
  389. this.getCompanyAcc();
  390. this.getDicts("zc_zfpcr_date_type").then(response => {
  391. this.dateTypeOptions = response.data;
  392. });
  393. this.getDicts("zc_zfpcr_charge").then(response => {
  394. this.chargeOptions = response.data;
  395. });
  396. this.getDicts("zc_zfpcr_loan_type").then(response => {
  397. this.loanTypeOptions = response.data;
  398. });
  399. this.getDicts("zc_zfpcr_bookkeeping_type").then(response => {
  400. this.bookkeepingTypeOptions = response.data;
  401. });
  402. this.getDicts("zc_zfc_status").then((response) => {
  403. this.statusOptions = response.data;
  404. });
  405. this.getDicts("zc_zfc_node").then((response) => {
  406. this.nodeOptions = response.data;
  407. });
  408. this.getDicts("zc_zfc_subject").then((response) => {
  409. this.subjectOptions = response.data;
  410. });
  411. },
  412. methods: {
  413. /* 资方公司 */
  414. getZfCompany(){
  415. //公司类型
  416. const scyType = '03'
  417. listCompany(scyType).then((response) =>{
  418. this.zfCompanyList = response.data
  419. })
  420. },
  421. /* 融资产品 */
  422. getFinanceProduct(){
  423. listFinanceProduct().then((response) =>{
  424. this.financeProductList = response.data
  425. })
  426. },
  427. /* 授信企业 */
  428. getHxCompany(){
  429. //公司类型
  430. const scyType = '01'
  431. listCompany(scyType).then((response) =>{
  432. this.hxCompanyList = response.data
  433. })
  434. },
  435. /* 核心企业还款账户账号 */
  436. getCompanyAcc(){
  437. listCompanyAcc().then((response) =>{
  438. this.accList = response.data
  439. this.restaurants = response.data;
  440. })
  441. },
  442. /* 账户模糊搜所 */
  443. querySearch(queryString, cb) {
  444. var restaurants = this.restaurants;
  445. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  446. // 调用 callback 返回建议列表的数据
  447. cb(results);
  448. },
  449. createFilter(queryString) {
  450. return (restaurant) => {
  451. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  452. };
  453. },
  454. /* ----------------合同相关---------------------------- */
  455. //合同列表
  456. getContractList() {
  457. this.queryParamsContract.zfcManagementId = this.form.zfpcrFundSide
  458. listContract(this.queryParamsContract).then((response) => {
  459. this.contractList = response.data.records;
  460. this.selectChecked();
  461. this.total = response.data.total;
  462. });
  463. },
  464. //打开合同选择列表
  465. openTicket() {
  466. this.getContractList()
  467. this.open = true
  468. this.title = "合同信息"
  469. },
  470. selectChecked() {
  471. this.ticketList.forEach((item) => {
  472. this.contractList.forEach(row => {
  473. if (row.zfcId == item.zfcId) {
  474. this.$nextTick(() => {
  475. this.$refs.tableContract && this.$refs.tableContract.toggleRowSelection(row, true);
  476. })
  477. }
  478. });
  479. });
  480. },
  481. /* 多选框跨页 */
  482. rowkey(row) {
  483. return row.zfcId;
  484. },
  485. // 多选框选中数据
  486. handleSelectionChange(val) {
  487. this.chooseTicket = val
  488. },
  489. // 确认选择
  490. closeTicket() {
  491. if(this.chooseTicket.length > 0){
  492. this.ticketList = this.chooseTicket
  493. this.$set(this.form, "zfcName", this.ticketList[0].zfcName);
  494. this.$set(this.form, "zfcSubject", this.ticketList[0].zfcSubject);
  495. this.$set(this.form, "zfcId", this.ticketList[0].zfcId);
  496. this.open = false
  497. }else{
  498. this.$message({
  499. message: '请选择合同',
  500. type: 'warning'
  501. });
  502. }
  503. },
  504. //取消选择合同按钮
  505. cancelTicket(){
  506. this.ticketList = [];
  507. if(this.$refs.tableContract){
  508. this.$refs.tableContract.clearSelection();
  509. }
  510. this.open = false;
  511. },
  512. /** 清空选择发票信息 */
  513. deleteTicekt() {
  514. this.ticketList = []
  515. if(this.$refs.tableContract){
  516. this.$refs.tableContract.clearSelection();
  517. }
  518. },
  519. /* 删除按钮 */
  520. handleDelete(index, rows) {
  521. rows.splice(index, 1);
  522. if(this.$refs.tableContract){
  523. this.$refs.tableContract.clearSelection();
  524. }
  525. this.selectChecked();
  526. },
  527. onSelectAll() {
  528. if(this.$refs.tableContract){
  529. this.$refs.tableContract.clearSelection();
  530. }
  531. },
  532. handleQuerys() {
  533. this.queryParamsContract.pageNum = 1;
  534. this.getContractList();
  535. },
  536. resetQuerys() {
  537. this.resetForm("formQuery");
  538. this.handleQuerys();
  539. },
  540. /* 清空 */
  541. change() {
  542. this.ticketList = [];
  543. this.$refs.tableContract.clearSelection()
  544. },
  545. /* -------------------------------------------------------------------------------- */
  546. /** 提交按钮 */
  547. submitForm() {
  548. if(this.ticketList == undefined || this.ticketList.length == 0){
  549. this.$message({
  550. message: '请选择合同',
  551. type: 'warning'
  552. });
  553. return;
  554. }
  555. this.$refs["form"].validate(valid => {
  556. this.form.ticketList = this.ticketList;
  557. if (valid) {
  558. const loading = this.$loading({
  559. lock: true,
  560. text: "Loading",
  561. spinner: "el-icon-loading",
  562. background: "rgba(0, 0, 0, 0.7)",
  563. });
  564. addCreditLine(this.form).then(response => {
  565. this.msgSuccess("新增成功");
  566. loading.close();
  567. this.$store.dispatch("tagsView/delView", this.$route);
  568. this.$router.go(-1);
  569. }).catch((response) => {
  570. loading.close();
  571. });
  572. }
  573. });
  574. },
  575. //合同模板状态字典反显
  576. statusFormat(row, column) {
  577. return this.selectDictLabel(this.statusOptions, row.zfcStatus);
  578. },
  579. //签署节点字典反显
  580. nodeFormat(row, column) {
  581. return this.selectDictLabel(this.nodeOptions, row.zfcNode);
  582. },
  583. //签署主体字典反显
  584. subjectFormat(row, column) {
  585. return this.selectDictLabel(this.subjectOptions, row.zfcSubject);
  586. },
  587. /* 金额展示 */
  588. handleInput(str) {
  589. this.zfpcrAmountFormat = amtformat(str,2, ".", ",");
  590. },
  591. /* // 将数字金额转换为大写金额 */
  592. smallToBig(money) {
  593. // 将数字金额转换为大写金额
  594. var cnNums = new Array(
  595. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" ); //汉字的数字
  596. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  597. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  598. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  599. var cnInteger = "整"; //整数金额时后面跟的字符
  600. var cnIntLast = "元"; //整数完以后的单位
  601. //最大处理的数字
  602. var maxNum = 999999999999999.9999;
  603. var integerNum; //金额整数部分
  604. var decimalNum; //金额小数部分
  605. //输出的中文金额字符串
  606. var chineseStr = "";
  607. var parts; //分离金额后用的数组,预定义
  608. if (money == "" || money == null || money == undefined) {
  609. return "零元零角零分";
  610. }
  611. money = parseFloat(money);
  612. if (money >= maxNum) {
  613. //超出最大处理数字
  614. return "超出最大处理数字";
  615. }
  616. if (money == 0) {
  617. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  618. return chineseStr;
  619. }
  620. //四舍五入保留两位小数,转换为字符串
  621. money = Math.round(money * 100).toString();
  622. integerNum = money.substr(0, money.length - 2);
  623. decimalNum = money.substr(money.length - 2);
  624. //获取整型部分转换
  625. if (parseInt(integerNum, 10) > 0) {
  626. var zeroCount = 0;
  627. var IntLen = integerNum.length;
  628. for (var i = 0; i < IntLen; i++) {
  629. var n = integerNum.substr(i, 1);
  630. var p = IntLen - i - 1;
  631. var q = p / 4;
  632. var m = p % 4;
  633. if (n == "0") {
  634. zeroCount++;
  635. } else {
  636. if (zeroCount > 0) {
  637. chineseStr += cnNums[0];
  638. }
  639. //归零
  640. zeroCount = 0;
  641. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  642. }
  643. if (m == 0 && zeroCount < 4) {
  644. chineseStr += cnIntUnits[q];
  645. }
  646. }
  647. chineseStr += cnIntLast;
  648. }
  649. //小数部分
  650. if (decimalNum != "") {
  651. var decLen = decimalNum.length;
  652. for (var i = 0; i < decLen; i++) {
  653. var n = decimalNum.substr(i, 1);
  654. if (n != "0") {
  655. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  656. }
  657. }
  658. }
  659. if (chineseStr == "") {
  660. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  661. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  662. chineseStr += cnInteger;
  663. }
  664. return chineseStr;
  665. },
  666. },
  667. };
  668. </script>
  669. <style>
  670. .single-select-table thead .el-table-column--selection .cell {
  671. display: none;
  672. }
  673. </style>