paymentSettleDetailsPage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <div class="borderless">
  3. <div class="main-head">
  4. <div class="main-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="warning"
  10. class="el-button--small-yh"
  11. @click.stop="confirmSettlement"
  12. >结算
  13. </el-button>
  14. <el-button class="el-button--small-yh"
  15. type="primary"
  16. @click.stop="confirmSettlement"
  17. >{{this.id?"确认修改" :"确认新增"}}
  18. </el-button>
  19. </div>
  20. </div>
  21. </div>
  22. <div style="margin-top: 60px">
  23. <containerTitle title="基础信息"></containerTitle>
  24. <basic-container>
  25. <avue-form ref="form" v-model="form" :option="option">
  26. <template slot="corpId">
  27. <select-component
  28. v-model="form.corpId"
  29. @returnBack="returnBack"
  30. :configuration="configuration"
  31. ></select-component>
  32. </template>
  33. <template slot="accountNo">
  34. <el-select v-model="form.accountNo"
  35. placeholder="请选择"
  36. @change="accountNoChange"
  37. clearable
  38. filterable>
  39. <el-option v-for="(item,index) in form.bankList"
  40. :key="index"
  41. :label="item.accountNo"
  42. :value="item.accountNo"
  43. >
  44. </el-option>
  45. </el-select>
  46. </template>
  47. </avue-form>
  48. </basic-container>
  49. <basic-container>
  50. <avue-crud :option="itemsOption"
  51. :data="dataList"
  52. ref="crud"
  53. v-model="itemsForm"
  54. :page.sync="page"
  55. @search-reset="searchReset"
  56. @selection-change="selectionChange"
  57. @current-change="currentChange"
  58. @size-change="sizeChange"
  59. @refresh-change="refreshChange">
  60. <template slot="menuLeft">
  61. <el-button type="primary"
  62. size="small"
  63. icon="el-icon-shopping-cart-2"
  64. @click="selectPurchase">选择采购合同
  65. </el-button>
  66. </template>
  67. <template slot-scope="scope" slot="menu">
  68. <el-button
  69. type="text"
  70. size="small"
  71. @click.stop="rowCell(scope.row,scope.index)"
  72. > {{ scope.row.$cellEdit ? '修改完成' : '修改' }}
  73. </el-button>
  74. <el-button
  75. type="text"
  76. size="small"
  77. @click.stop="rowDel(scope.row,scope.index)"
  78. >删除
  79. </el-button>
  80. </template>
  81. <template slot="thisAmount" slot-scope="{ row }">
  82. <el-input
  83. v-if="row.$cellEdit"
  84. v-model="row.thisAmount"
  85. placeholder="请输入"
  86. size="small"
  87. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  88. @change="thisAmountChange(row)"
  89. ></el-input>
  90. <span v-else>{{ row.thisAmount }}</span>
  91. </template>
  92. </avue-crud>
  93. </basic-container>
  94. <el-dialog
  95. title="导入采购"
  96. append-to-body
  97. class="el-dialogDeep"
  98. :visible.sync="billDetailDialog"
  99. width="60%"
  100. :close-on-click-modal="false"
  101. :destroy-on-close="true"
  102. :close-on-press-escape="false"
  103. top="10vh"
  104. v-dialog-drag>
  105. <bill-detail
  106. :corpId="corpId"
  107. :billType="billType"
  108. @closeFun="!billDetailDialog"
  109. @importProMent="importProMent"
  110. >
  111. </bill-detail>
  112. </el-dialog>
  113. </div>
  114. </div>
  115. </template>
  116. <script>
  117. import option from "./configuration/detailsPage.json";
  118. import { getDetail,editFinance } from "@/api/financialManagement/financialManagement"
  119. import { getDetails,modify } from "@/api/financialManagement/paymentRequest";
  120. import { contrastObj,contrastList } from "@/util/contrastData";
  121. import billDetail from "@/components/bill/billDetailList";
  122. import { getlistBankBy } from "@/api/financialManagement/paymentRequest";
  123. import _ from "lodash";
  124. export default {
  125. name: "paymentDetailsPage",
  126. props: {
  127. detailData: {
  128. type: Object
  129. }
  130. },
  131. data() {
  132. return {
  133. form: {},
  134. itemsForm:{},
  135. itemsOption: option,
  136. billDetailDialog:false,
  137. billType:"申请",
  138. corpId:"",
  139. id:"",
  140. dataList: [],
  141. currencyDic:[],
  142. page: {
  143. pageSize: 10,
  144. pagerCount: 5,
  145. total: 0,
  146. },
  147. query:{},
  148. option: {
  149. menuBtn: false,
  150. labelWidth: 100,
  151. column: [
  152. {
  153. label: '系统号',
  154. prop: 'sysNo',
  155. span: 8,
  156. disabled: true
  157. },{
  158. label: '合同号',
  159. prop: 'srcOrderno',
  160. span: 8,
  161. rules: [
  162. {
  163. required: true,
  164. message: ' ',
  165. trigger: 'blur'
  166. }
  167. ]
  168. }, {
  169. label: '客户名称',
  170. prop: 'corpId',
  171. sort:true,
  172. span: 8,
  173. rules: [
  174. {
  175. required: false,
  176. message: ' ',
  177. trigger: 'blur'
  178. }
  179. ]
  180. },
  181. {
  182. label: '银行账号',
  183. prop: 'accountNo',
  184. span: 8,
  185. rules: [
  186. {
  187. required: false,
  188. message: ' ',
  189. trigger: 'blur'
  190. }
  191. ]
  192. },
  193. {
  194. label: '开户银行',
  195. prop: 'accountBank',
  196. span: 8,
  197. rules: [
  198. {
  199. required: false,
  200. message: ' ',
  201. trigger: 'blur'
  202. }
  203. ]
  204. }, {
  205. label: '银行户头',
  206. prop: 'accountName',
  207. span: 8,
  208. rules: [
  209. {
  210. required: false,
  211. message: ' ',
  212. trigger: 'blur'
  213. }
  214. ]
  215. },
  216. {
  217. label: '总金额',
  218. prop: 'amount',
  219. span: 8,
  220. rules: [
  221. {
  222. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  223. message: ' ',
  224. trigger: 'blur'
  225. }
  226. ]
  227. },
  228. {
  229. label: '制单人',
  230. prop: 'createUserName',
  231. span: 8,
  232. disabled:true,
  233. rules: [
  234. {
  235. required: false,
  236. message: ' ',
  237. trigger: 'blur'
  238. }
  239. ]
  240. }, {
  241. label: '制单日期',
  242. prop: 'createTime',
  243. span: 8,
  244. type:"date",
  245. disabled:true,
  246. rules: [
  247. {
  248. required: false,
  249. message: ' ',
  250. trigger: 'blur'
  251. }
  252. ]
  253. },
  254. {
  255. label: '备注',
  256. prop: 'remark',
  257. span:24,
  258. row:2,
  259. rules: [
  260. {
  261. required: false,
  262. message: ' ',
  263. trigger: 'blur'
  264. }
  265. ]
  266. },
  267. ],
  268. },
  269. //客户组件配置控制
  270. configuration:{
  271. multipleChoices:false,
  272. multiple:false,
  273. disabled:false,
  274. searchShow:true,
  275. collapseTags:false,
  276. placeholder:'请点击右边按钮选择',
  277. dicData:[]
  278. },
  279. financeStatusDic:[{
  280. label:'正常',
  281. value:0
  282. },{
  283. label:'停用',
  284. value:1
  285. }],
  286. //顶部from数据
  287. oldForm:{},
  288. oldDataList:[],
  289. }
  290. },
  291. components:{
  292. billDetail
  293. },
  294. created() {
  295. //币别
  296. this.getWorkDicts("currency").then(res =>{
  297. this.currencyDic = res.data.data
  298. })
  299. if (this.detailData.id) {
  300. this.id = BigInt(this.detailData.id);//字符串转数字 超长用BigInt
  301. getDetail(this.id).then(res => {
  302. this.form = res.data.data;
  303. this.oldForm = Object.assign({},res.data.data);
  304. if(res.data.data.itemsList){
  305. this.dataList = res.data.data.itemsList
  306. this.oldDataList = this.deepClone(res.data.data.itemsList)
  307. }
  308. })
  309. }
  310. if(this.detailData.params){
  311. getDetails(this.detailData.params).then(res =>{
  312. delete res.data.data.id;
  313. delete res.data.data.sysNo;
  314. delete res.data.data.billType;
  315. res.data.data.itemsList.map((items)=>{
  316. delete items.id ;
  317. items.thisAmount = items.amount
  318. })
  319. this.form = res.data.data;
  320. this.oldForm = Object.assign({},res.data.data);
  321. if(res.data.data.itemsList){
  322. this.dataList = res.data.data.itemsList
  323. this.oldDataList = this.deepClone(res.data.data.itemsList)
  324. }
  325. })
  326. }
  327. },
  328. mounted() {
  329. option.height = window.innerHeight - 640 ;
  330. },
  331. methods: {
  332. //选择客户
  333. returnBack(corpValue){
  334. this.corpId = corpValue
  335. getlistBankBy(corpValue).then(res =>{
  336. this.$set(this.form,"bankList",res.data)
  337. })
  338. },
  339. //选择卡号
  340. accountNoChange(value){
  341. this.form.bankList.forEach(item =>{
  342. if(item.accountNo == value){
  343. this.$set(this.form,"accountBank",item.accountBank)
  344. this.$set(this.form,"accountName",item.accountName)
  345. }
  346. })
  347. },
  348. thisAmountChange(row){
  349. if(row.thisAmount > row.amount){
  350. this.$message.error("本次金额不得大于金额!")
  351. row.thisAmount = 0;
  352. }
  353. },
  354. selectPurchase(){
  355. this.billDetailDialog = true;
  356. },
  357. importProMent(list){
  358. list.forEach((item,index) =>{
  359. item.accId = item.id;
  360. delete item.id;
  361. this.$refs.crud.rowCellAdd(item);
  362. })
  363. this.billDetailDialog = false;
  364. },
  365. rowCell(row,index){
  366. this.$refs.crud.rowCell(row, index)
  367. },
  368. rowDel(row,index){
  369. this.dataList.splice(index, 1);
  370. },
  371. searchReset() {
  372. console.log('1')
  373. },
  374. selectionChange() {
  375. console.log('1')
  376. },
  377. currentChange() {
  378. console.log('1')
  379. },
  380. sizeChange() {
  381. console.log('1')
  382. },
  383. refreshChange() {
  384. console.log('1')
  385. },
  386. confirmSettlement(status){
  387. this.$refs["form"].validate((valid) => {
  388. if(valid){
  389. this.$confirm("是否确认结算?", "提示", {
  390. confirmButtonText: "保存",
  391. cancelButtonText: "取消",
  392. type: "warning",
  393. }).then(()=>{
  394. for (let i = 0; i < this.dataList.length; i++) {
  395. if (this.dataList[i].thisAmount == null) {
  396. return this.$message.error(`第${i + 1}行的本次金额不能为空`);
  397. }
  398. if (this.dataList[i].thisAmount === 0) {
  399. return this.$message.error(`第${i + 1}行的本次金额不能为0`);
  400. }
  401. }
  402. this.form.billNo = this.dataList.map(item =>{return item.billNo}).join(",")
  403. const params = {
  404. ...this.form,
  405. billType:"付费",
  406. itemsList:this.dataList
  407. }
  408. modify(params).then(res =>{
  409. this.$message.success("操作成功!")
  410. this.form = res.data.data;
  411. this.oldForm = Object.assign({},res.data.data);
  412. if(res.data.data.itemsList){
  413. this.dataList = res.data.data.itemsList
  414. this.oldDataList = this.deepClone(res.data.data.itemsList)
  415. }
  416. })
  417. })
  418. if(status === true){
  419. this.$emit("goBack");
  420. }
  421. }
  422. })
  423. },
  424. backToList() {
  425. if(contrastObj(this.form,this.oldForm) || contrastList(this.dataList,this.oldDataList)
  426. ){
  427. this.$confirm("是否保存当前页面?", "提示", {
  428. confirmButtonText: "保存",
  429. cancelButtonText: "取消",
  430. type: "warning",
  431. }).then(() => {
  432. this.editCustomer(true)
  433. }).catch(()=>{
  434. this.$emit("goBack");
  435. })
  436. }else{
  437. this.$emit("goBack");
  438. }
  439. },
  440. }
  441. }
  442. </script>
  443. <style scoped>
  444. ::v-deep .el-form-item {
  445. margin-bottom: 0;
  446. }
  447. .main-head {
  448. position: fixed;
  449. top: 105px;
  450. width: 100%;
  451. margin-left: -10px;
  452. height: 62px;
  453. background: #ffffff;
  454. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  455. z-index: 999;
  456. }
  457. .main-back {
  458. cursor: pointer;
  459. line-height: 62px;
  460. font-size: 16px;
  461. color: #323233;
  462. font-weight: 400;
  463. }
  464. .upper_right_button{
  465. display: flex;
  466. position: fixed;
  467. right: 20px;
  468. top: 115px;
  469. }
  470. </style>