paymentRequestDetails.vue 16 KB

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