paymentRequestDetails.vue 19 KB

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