paymentRequestDetails.vue 20 KB

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