paymentRequestDetails.vue 23 KB

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