paymentRequestDetails.vue 15 KB

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