paymentRequestDetails.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. <div v-if="!auditDisabled" class="upper_right_button">
  9. <el-dropdown style="padding: 0 8px;line-height: 0">
  10. <el-button
  11. type="warning"
  12. :loading="buttonLoading"
  13. size="small"
  14. >
  15. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  16. </el-button>
  17. <el-dropdown-menu slot="dropdown">
  18. <el-dropdown-item
  19. :loading="buttonLoading"
  20. :disabled="checkDisabled"
  21. @click.native="paymentCheck">{{form.checkStatus == '审核中'?'审核中':'请核'}}
  22. </el-dropdown-item>
  23. <el-dropdown-item
  24. :loading="buttonLoading"
  25. @click.native="checkScheduleDialog = true,checkId=form.id">审核进度
  26. </el-dropdown-item>
  27. <el-dropdown-item
  28. :disabled="!checkDisabled"
  29. @click.native="cancelAudit">撤销审核
  30. </el-dropdown-item>
  31. </el-dropdown-menu>
  32. </el-dropdown>
  33. <!-- <el-button type="info"-->
  34. <!-- size="small"-->
  35. <!-- class="el-button&#45;&#45;small-yh"-->
  36. <!-- :loading="buttonLoading"-->
  37. <!-- :disabled="checkDisabled"-->
  38. <!-- @click.stop="paymentCheck">-->
  39. <!-- {{form.checkStatus == '审核中'?'审核中':'申请'}}-->
  40. <!-- </el-button>-->
  41. <el-button type="warning"
  42. size="small"
  43. :loading="buttonLoading"
  44. class="el-button--small-yh"
  45. :disabled="!checkDisabled || form.checkStatus == '审核中'"
  46. @click.stop="settlement">结算
  47. </el-button>
  48. <el-button type="primary"
  49. size="small"
  50. :loading="buttonLoading"
  51. class="el-button--small-yh"
  52. @click.stop="confirmEdit">保存数据
  53. </el-button>
  54. </div>
  55. <div v-if="auditDisabled" class="upper_right_button">
  56. <el-button type="primary"
  57. size="small"
  58. class="el-button--small-yh"
  59. :loading="buttonLoading"
  60. :disabled="buttonDisabled"
  61. @click.stop="openCheckDialog">
  62. 审核
  63. </el-button>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="customer-main">
  68. <containerTitle title="基础信息"></containerTitle>
  69. <basic-container>
  70. <avue-form class="trading-form" ref="form" v-model="form" :option="option">
  71. <template slot="corpId">
  72. <select-component
  73. v-model="form.corpId"
  74. @returnBack="returnBack"
  75. :configuration="configuration"
  76. :disabled="checkDisabled || auditDisabled"
  77. ></select-component>
  78. </template>
  79. <template slot="accountNo">
  80. <el-select v-model="form.accountNo"
  81. placeholder="请选择"
  82. @change="accountNoChange"
  83. :disabled="checkDisabled || auditDisabled"
  84. clearable
  85. allow-create
  86. default-first-option
  87. filterable>
  88. <el-option v-for="(item,index) in form.bankList"
  89. :key="index"
  90. :label="item.accountNo"
  91. :value="item.accountNo"
  92. >
  93. </el-option>
  94. </el-select>
  95. </template>
  96. </avue-form>
  97. </basic-container>
  98. <containerTitle title="明细列表"></containerTitle>
  99. <basic-container>
  100. <avue-crud :option="itemOption"
  101. :data="dataList"
  102. ref="crud"
  103. v-model="itemForm"
  104. :page.sync="page"
  105. @search-reset="searchReset"
  106. @row-update="rowUpdate"
  107. @selection-change="selectionChange"
  108. @current-change="currentChange"
  109. @size-change="sizeChange"
  110. @refresh-change="refreshChange">
  111. <template slot-scope="scope" slot="menu">
  112. <el-button
  113. type="text"
  114. size="small"
  115. icon="el-icon-edit"
  116. :disabled="checkDisabled || auditDisabled"
  117. @click="rowCell(scope.row,scope.index)"
  118. >{{ scope.row.$cellEdit ? '修改完成' : '修改' }}
  119. </el-button>
  120. <el-button
  121. type="text"
  122. size="small"
  123. icon="el-icon-delete"
  124. :disabled="checkDisabled || auditDisabled"
  125. @click.stop="rowDel(scope.row,scope.index)"
  126. >删除
  127. </el-button>
  128. </template>
  129. <template slot="costType" slot-scope="{ row }">
  130. <breakdown-select
  131. v-if="row.$cellEdit"
  132. v-model="row.costType"
  133. :configuration="breakConfiguration">
  134. </breakdown-select>
  135. <span v-else>{{ row.itemName }}</span>
  136. </template>
  137. <template slot="price" slot-scope="{ row }">
  138. <el-input
  139. v-if="row.$cellEdit"
  140. v-model="row.price"
  141. placeholder="请输入"
  142. size="small"
  143. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  144. ></el-input>
  145. <span v-else>{{ row.price }}</span>
  146. </template>
  147. <template slot="currency" slot-scope="{row,index}">
  148. <el-select v-if="row.$cellEdit"
  149. v-model="row.currency"
  150. size="small"
  151. @change="currencyChange(row)"
  152. clearable
  153. filterable>
  154. <el-option v-for="(item,index) in currencyDic"
  155. :key="index"
  156. :label="item.dictValue"
  157. :value="item.dictValue"></el-option>
  158. </el-select>
  159. <span v-else>{{ row.currency }}</span>
  160. </template>
  161. </avue-crud>
  162. </basic-container>
  163. </div>
  164. <el-dialog
  165. append-to-body
  166. title="审核进度"
  167. class="el-dialogDeep"
  168. :visible.sync="checkScheduleDialog"
  169. width="40%"
  170. :close-on-click-modal="false"
  171. :destroy-on-close="true"
  172. :close-on-press-escape="false"
  173. v-dialog-drag
  174. >
  175. <check-schedule
  176. :checkId="checkId"
  177. @choceScheduleFun="choceScheduleFun"
  178. >
  179. </check-schedule>
  180. </el-dialog>
  181. <el-dialog
  182. append-to-body
  183. title="审批"
  184. class="el-dialogDeep"
  185. :visible.sync="checkDialog"
  186. width="50%"
  187. :close-on-click-modal="false"
  188. :destroy-on-close="true"
  189. :close-on-press-escape="false"
  190. v-dialog-drag
  191. >
  192. <check
  193. :checkData="checkData"
  194. @choceCheckFun="choceCheckFun"
  195. >
  196. </check>
  197. </el-dialog>
  198. </div>
  199. </template>
  200. <script>
  201. import itemOption from "./configuration/detailsPage.json";
  202. import { contrastObj,contrastList } from "@/util/contrastData";
  203. import { getDetails,modify,submit, paymentCheck,getlistBankBy,saveOrEdit } from "@/api/financialManagement/paymentRequest";
  204. import _ from "lodash";
  205. import { approvePass } from "@/api/approveData/main"
  206. import checkSchedule from "../../../components/check/checkSchedule";
  207. import check from "@/components/check/check";
  208. import { cancelCheck } from "@/api/check/check";
  209. export default {
  210. name: "paymentDetailsPage",
  211. props: {
  212. detailData: {
  213. type: Object
  214. }
  215. },
  216. components:{
  217. checkSchedule,
  218. check
  219. },
  220. data() {
  221. return {
  222. form:{},
  223. itemForm: {},
  224. checkData:{},
  225. itemOption: itemOption,
  226. checkDisabled:false,
  227. auditDisabled:false,
  228. buttonDisabled:true,
  229. buttonLoading:false,
  230. checkScheduleDialog:false,
  231. checkDialog:false,
  232. checkId:'',
  233. parentId:0,
  234. id:"",
  235. dataList: [],
  236. currencyDic:[],
  237. page: {
  238. pageSize: 10,
  239. pagerCount: 5,
  240. total: 0,
  241. },
  242. breakConfiguration:{
  243. multipleChoices:false,
  244. multiple:false,
  245. disabled:false,
  246. searchShow:true,
  247. collapseTags:false,
  248. placeholder:'请点击右边按钮选择',
  249. dicData:[]
  250. },
  251. query:{},
  252. option: {
  253. menuBtn: false,
  254. labelWidth: 100,
  255. column: [
  256. {
  257. label: '系统号',
  258. prop: 'sysNo',
  259. span: 8,
  260. disabled: true
  261. },{
  262. label: '合同号',
  263. prop: 'srcOrderno',
  264. span: 8,
  265. rules: [
  266. {
  267. required: true,
  268. message: ' ',
  269. trigger: 'blur'
  270. }
  271. ]
  272. }, {
  273. label: '客户名称',
  274. prop: 'corpId',
  275. sort:true,
  276. span: 8,
  277. rules: [
  278. {
  279. required: false,
  280. message: ' ',
  281. trigger: 'blur'
  282. }
  283. ]
  284. },
  285. {
  286. label: '银行账号',
  287. prop: 'accountNo',
  288. type:"select",
  289. span: 8,
  290. rules: [
  291. {
  292. required: false,
  293. message: ' ',
  294. trigger: 'blur'
  295. }
  296. ]
  297. },
  298. {
  299. label: '开户银行',
  300. prop: 'accountBank',
  301. span: 8,
  302. rules: [
  303. {
  304. required: false,
  305. message: ' ',
  306. trigger: 'blur'
  307. }
  308. ]
  309. }, {
  310. label: '银行户头',
  311. prop: 'accountName',
  312. span: 8,
  313. rules: [
  314. {
  315. required: false,
  316. message: ' ',
  317. trigger: 'blur'
  318. }
  319. ]
  320. },
  321. {
  322. label: '人民币金额',
  323. prop: 'amount',
  324. span: 8,
  325. rules: [
  326. {
  327. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  328. message: ' ',
  329. trigger: 'blur'
  330. }
  331. ]
  332. },
  333. {
  334. label: '外币金额',
  335. prop: 'foreignAmount',
  336. span: 8,
  337. rules: [
  338. {
  339. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  340. message: ' ',
  341. trigger: 'blur'
  342. }
  343. ]
  344. },
  345. {
  346. label: '申请人',
  347. prop: 'createUserName',
  348. span: 8,
  349. disabled:true,
  350. rules: [
  351. {
  352. required: false,
  353. message: ' ',
  354. trigger: 'blur'
  355. }
  356. ]
  357. }, {
  358. label: '申请日期',
  359. prop: 'createTime',
  360. span: 8,
  361. type:"date",
  362. disabled:true,
  363. rules: [
  364. {
  365. required: false,
  366. message: ' ',
  367. trigger: 'blur'
  368. }
  369. ]
  370. },
  371. {
  372. label: '备注',
  373. prop: 'remark',
  374. span:24,
  375. minRows: 2,
  376. rules: [
  377. {
  378. required: false,
  379. message: ' ',
  380. trigger: 'blur'
  381. }
  382. ]
  383. },
  384. ],
  385. },
  386. //客户组件配置控制
  387. configuration:{
  388. multipleChoices:false,
  389. multiple:false,
  390. searchShow:true,
  391. collapseTags:false,
  392. placeholder:'请点击右边按钮选择',
  393. dicData:[]
  394. },
  395. oldForm:{},
  396. oldDataList:[],
  397. }
  398. },
  399. created() {
  400. //是否需要根据 登录人所属公司 区分不用option
  401. //币别
  402. this.getWorkDicts("currency").then(res =>{
  403. this.currencyDic = res.data.data
  404. })
  405. if (this.detailData.id) {
  406. this.id = this.detailData.id;
  407. this.buttonLoading = true;
  408. getDetails(this.id).then(res => {
  409. this.afterEcho(res.data.data)
  410. }).finally(()=>{
  411. this.buttonLoading = false
  412. })
  413. }
  414. if(this.detailData.check){
  415. //待审批状态才可选择通过或者驳回
  416. if(this.detailData.check.auditStatus === "S"){
  417. this.buttonDisabled = false
  418. }
  419. this.auditDisabled = true
  420. this.buttonLoading = true;
  421. getDetails(this.detailData.check.srcBillId).then(res => {
  422. this.afterEcho(res.data.data)
  423. }).finally(()=>{
  424. this.buttonLoading = false;
  425. })
  426. }
  427. },
  428. methods: {
  429. //选择客户
  430. returnBack(corpValue){
  431. getlistBankBy(corpValue).then(res =>{
  432. this.form.bankList = res.data
  433. })
  434. },
  435. //选择银行账号
  436. accountNoChange(value){
  437. this.form.bankList.forEach(item =>{
  438. if(item.accountNo == value){
  439. this.$set(this.form,"accountBank",item.accountBank)
  440. this.$set(this.form,"accountName",item.accountName)
  441. }
  442. })
  443. },
  444. //打开审核
  445. openCheckDialog(){
  446. this.checkData = this.detailData.check
  447. this.checkDialog = true;
  448. },
  449. //关闭审核
  450. choceCheckFun(){
  451. this.checkDialog = false;
  452. },
  453. //选择费用
  454. returnBreak(breakValue){
  455. },
  456. //撤销审核
  457. cancelAudit(){
  458. cancelCheck(this.form.id).then(res =>{
  459. if(res.data.success){
  460. this.$message.success("操作成功!")
  461. this.afterEcho(res.data.data)
  462. }
  463. })
  464. },
  465. choceScheduleFun(){
  466. this.checkScheduleDialog = false
  467. },
  468. //选择币别 带汇率
  469. currencyChange(row){
  470. if(row.currency === "CNY"){
  471. row.exchangeRate = 1
  472. }else if(row.currency === "USD"){
  473. row.exchangeRate = 6.384300
  474. }else{
  475. row.exchangeRate = 7.174900
  476. }
  477. },
  478. rowUpdate(row, index, done, loading) {
  479. done(row);
  480. },
  481. rowCell(row, index) {
  482. this.$refs.crud.rowCell(row, index)
  483. },
  484. rowDel(row,index){
  485. this.dataList.splice(index, 1);
  486. },
  487. //验证新旧数据
  488. verification(){
  489. let verification;
  490. if(contrastObj(this.form,this.oldForm) || contrastList(this.dataList,this.oldDataList)){
  491. this.$confirm("您已改动数据,是否先保存在进行操作!", {
  492. confirmButtonText: "保存",
  493. cancelButtonText: "取消",
  494. type: "warning"
  495. }).then(() => {
  496. this.confirmEdit()
  497. }).catch(()=>{
  498. verification = false; //取消改动数据
  499. })
  500. }else{
  501. verification = true; //没有动过数据
  502. }
  503. return verification
  504. },
  505. //请核
  506. paymentCheck(){
  507. if(this.verification()){
  508. this.$confirm("您确定请核此次申请吗?", {
  509. confirmButtonText: "确定",
  510. cancelButtonText: "取消",
  511. type: "warning"
  512. }).then(()=>{
  513. const params ={
  514. id : this.form.id,
  515. billType: this.form.billType
  516. }
  517. this.buttonLoading = true
  518. paymentCheck(params).then(res =>{
  519. if(res.data.success){
  520. this.$message.success("申请成功!");
  521. this.afterEcho(res.data.data)
  522. }
  523. }).finally(()=>{
  524. this.buttonLoading = false
  525. })
  526. })
  527. }
  528. },
  529. //结算
  530. settlement(){
  531. if(this.verification()){
  532. if(this.$store.getters.takeStatus){
  533. this.$alert("结算页面已存在,请关闭收货单再进行操作", "温馨提示", {
  534. confirmButtonText: "确定",
  535. type: 'warning',
  536. callback: action => {
  537. }
  538. });
  539. }else{
  540. //关闭一下存在的列表页 跳转
  541. this.$router.$avueRouter.closeTag('/financialManagement/paymentSettle/paymentSettle');
  542. this.$router.push({
  543. path: "/financialManagement/paymentSettle/paymentSettle",
  544. query: {params: this.form.id},
  545. });
  546. }
  547. }
  548. },
  549. searchReset() {
  550. console.log('1')
  551. },
  552. selectionChange() {
  553. console.log('1')
  554. },
  555. currentChange() {
  556. console.log('1')
  557. },
  558. sizeChange() {
  559. console.log('1')
  560. },
  561. refreshChange() {
  562. console.log('1')
  563. },
  564. confirmEdit(status){
  565. this.$refs["form"].validate((valid,done) => {
  566. done();
  567. if(valid){
  568. this.form.billNo = this.dataList.map(item =>{return item.billNo}).join(",")
  569. const params = {
  570. ...this.form,
  571. billType:"申请",
  572. itemsList:this.dataList
  573. }
  574. this.buttonLoading = true
  575. saveOrEdit(params).then(res =>{
  576. this.$message.success("操作成功!")
  577. this.afterEcho(res.data.data)
  578. }).finally(()=>{
  579. this.buttonLoading = false
  580. })
  581. if(status === true){
  582. this.$emit("goBack");
  583. }
  584. }
  585. })
  586. },
  587. afterEcho(data){
  588. this.form = data;
  589. this.oldForm = Object.assign({},data);
  590. this.checkDisabled = data.checkStatus === "未请核"?false:true;
  591. this.option.column.forEach(item =>{
  592. if( item.prop == "remark" ){
  593. this.$set(item,"disabled",(this.auditDisabled || false))
  594. }else if( item.prop == "createUserName" || item.prop == "createTime" ){
  595. this.$set(item,"disabled",true)
  596. }else{
  597. this.$set(item,"disabled",this.checkDisabled)
  598. }
  599. })
  600. if(data.itemsList){
  601. this.dataList = data.itemsList
  602. this.oldDataList = this.deepClone(data.itemsList)
  603. }
  604. },
  605. backToList() {
  606. if(contrastObj(this.form,this.oldForm) || contrastList(this.dataList,this.oldDataList)
  607. ){
  608. this.$confirm("是否保存当前页面?", "提示", {
  609. confirmButtonText: "保存",
  610. cancelButtonText: "取消",
  611. type: "warning",
  612. }).then(() => {
  613. this.editCustomer(true)
  614. }).catch(()=>{
  615. this.$emit("goBack");
  616. })
  617. }else{
  618. this.$emit("goBack");
  619. }
  620. },
  621. }
  622. }
  623. </script>
  624. <style lang="scss" scoped>
  625. ::v-deep .el-form-item {
  626. margin-bottom: 0;
  627. }
  628. .trading-form ::v-deep .el-form-item {
  629. margin-bottom: 8px !important;
  630. }
  631. .upper_right_button{
  632. display: flex;
  633. position: fixed;
  634. right: 12px;
  635. top: 47px;
  636. }
  637. </style>