paymentRequestDetails.vue 19 KB

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