移动端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1103 строки
42 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar
  4. left-arrow
  5. fixed
  6. placeholder
  7. @click-left="$router.back(-1)"
  8. >
  9. <template #title>
  10. <p style="font-weight: bold;">修改代管转账申请</p>
  11. </template>
  12. </van-nav-bar>
  13. <van-form @submit="getChange" @failed="getError" :show-error-message="false" scroll-to-error validate-first>
  14. <p class="main_title">基础信息</p>
  15. <div class="main_box">
  16. <van-field
  17. readonly
  18. clickable
  19. required
  20. :rules="[{ required: true , message:'请选择申请时间' }]"
  21. v-model="form.applyDate"
  22. label="申请时间"
  23. placeholder="请选择申请时间"
  24. @click="showlasj = true"
  25. input-align="right"
  26. right-icon="arrow-down"
  27. />
  28. <van-popup v-model="showlasj" position="bottom">
  29. <van-datetime-picker
  30. v-model="currentDate"
  31. type="date"
  32. title="选择年月日"
  33. :min-date="minDate"
  34. :max-date="maxDate"
  35. @confirm="onConfirmLasj"
  36. @cancel="showlasj = false"
  37. />
  38. </van-popup>
  39. <van-field
  40. readonly
  41. clickable
  42. required
  43. :rules="[{ required: true , message:'请选择资金支出类别' }]"
  44. label="资金支出类别"
  45. placeholder="请选择"
  46. v-model="capitalExpenditureType"
  47. @click="showcapital = true"
  48. input-align="right"
  49. right-icon="arrow-down"
  50. label-width="auto"
  51. />
  52. <van-popup v-model="showcapital" position="bottom">
  53. <van-picker
  54. show-toolbar
  55. :columns="capitalExpenditureTypeOptions"
  56. @confirm="onConfirmCapital"
  57. @cancel="showcapital = false"
  58. />
  59. </van-popup>
  60. <van-field
  61. readonly
  62. required
  63. label="支出总金额"
  64. v-model="form.expenditureAmount"
  65. placeholder="根据下方收款金额自动核算"
  66. input-align="right"
  67. label-width="auto"
  68. />
  69. <van-field name="radio" label="审批模式" input-align="right" autocomplete="off" required
  70. :rules="[{ required: true , message:'请选择审批模式' }]">
  71. <template #input>
  72. <van-radio-group v-model="form.approvalMode" direction="horizontal">
  73. <van-radio name="1">线上审批</van-radio>
  74. <van-radio name="2">线下审批</van-radio>
  75. </van-radio-group>
  76. </template>
  77. </van-field>
  78. </div>
  79. <div class="main_box" style="margin-top: 10px;">
  80. <van-field
  81. label="付款事由"
  82. v-model="form.remark"
  83. type="textarea"
  84. placeholder="请输入付款事由"
  85. input-align="right"
  86. rows="3"
  87. label-width="auto"
  88. required
  89. :rules="[{ required: true , message:'请输入付款事由' }]"
  90. />
  91. </div>
  92. <div class="main_box" style="margin-top: 10px;">
  93. <van-field label="说明情况" v-model="form.explainSituation" type="textarea" placeholder="请输入说明情况" input-align="right" rows="3" label-width="auto"/>
  94. </div>
  95. <p class="main_title" v-if="capitalExpenditureOpen">关联项目</p>
  96. <div class="main_box" v-if="capitalExpenditureOpen" style="margin-bottom: 10px;margin-top: 10px;position:relative;">
  97. <van-field
  98. readonly
  99. clickable
  100. label="项目名称"
  101. placeholder="请选择"
  102. v-model="projectForm.projectName"
  103. @click="showproject = true"
  104. input-align="right"
  105. right-icon="arrow-down"
  106. required
  107. :rules="[{ required: true , message:'请选择项目名称' }]"
  108. />
  109. <van-popup v-model="showproject" position="bottom">
  110. <van-picker
  111. show-toolbar
  112. :columns="projectList"
  113. @confirm="onConfirmProject"
  114. @cancel="showproject = false"
  115. />
  116. </van-popup>
  117. <van-field required :rules="[{ required: true , message:'请输入承建单位' }]" v-model="projectForm.projectContractor" label="承建单位" placeholder="请输入承建单位" input-align="right" label-width="auto"/>
  118. <van-field required :rules="[{ required: true , message:'请输入合同价款(元)' }]" v-model="projectForm.projectAmount" label="合同价款(元)" placeholder="请输入合同价款(元)" input-align="right" label-width="auto"/>
  119. <van-field
  120. readonly
  121. clickable
  122. label="工程款类型"
  123. placeholder="请选择"
  124. v-model="projectFundType"
  125. @click="showFundType = true"
  126. input-align="right"
  127. right-icon="arrow-down"
  128. required
  129. :rules="[{ required: true , message:'请选择工程款类型' }]"
  130. />
  131. <van-popup v-model="showFundType" position="bottom">
  132. <van-picker
  133. show-toolbar
  134. :columns="projectFundTypeOptions"
  135. @confirm="onConfirmFundType"
  136. @cancel="showFundType = false"
  137. />
  138. </van-popup>
  139. <van-field required :rules="[{ required: true , message:'请输入工程发票号' }]" v-model="projectForm.projectBillNum" label="工程发票号" placeholder="请输入工程发票号" input-align="right" label-width="auto"/>
  140. </div>
  141. <p class="main_title" v-if="contractOpen">关联合同</p>
  142. <div class="main_box" v-if="contractOpen" style="margin-bottom: 10px;margin-top: 10px;position:relative;">
  143. <van-field
  144. readonly
  145. clickable
  146. label="合同"
  147. placeholder="请选择"
  148. v-model="infoForm.name"
  149. @click="showcontract = true"
  150. input-align="right"
  151. right-icon="arrow-down"
  152. required
  153. :rules="[{ required: true , message:'请选择项目名称' }]"
  154. />
  155. <van-popup v-model="showcontract" position="bottom">
  156. <van-picker
  157. show-toolbar
  158. :columns="infoList"
  159. @confirm="onConfirmContract"
  160. @cancel="showcontract = false"
  161. />
  162. </van-popup>
  163. <van-field required :rules="[{ required: true , message:'请输入合同编码' }]" v-model="infoForm.code" label="合同编码" placeholder="请输入合同编码" input-align="right" label-width="auto"/>
  164. <van-field required :rules="[{ required: true , message:'请输入合同价款' }]" v-model="infoForm.totalAmount" label="合同价款(元)" placeholder="请输入合同价款(元)" input-align="right" label-width="auto"/>
  165. </div>
  166. <p class="main_title">付款方信息</p>
  167. <div class="main_box">
  168. <!-- <van-field label="付款方" v-model="form.payer" placeholder="请输入付款方" input-align="right" label-width="auto"/>-->
  169. <van-field
  170. readonly
  171. clickable
  172. label="付款方"
  173. placeholder="请选择付款方"
  174. v-model="form.payer"
  175. @click="showpayer = true"
  176. input-align="right"
  177. right-icon="arrow-down"
  178. label-width="auto"
  179. required
  180. :rules="[{ required: true , message:'请选择付款方' }]"
  181. />
  182. <van-popup v-model="showpayer" position="bottom">
  183. <van-picker
  184. show-toolbar
  185. :columns="payerOptions"
  186. @confirm="onConfirmPayer($event)"
  187. @cancel="showpayer = false"
  188. />
  189. </van-popup>
  190. <van-field :rules="[{ required: true , message:'请输入账户' }]" required label="付款方账户" v-model="form.payerAccount" placeholder="请输入账户" input-align="right" label-width="auto"/>
  191. </div>
  192. <p class="main_title">收款方信息<van-button icon="plus" @click="addChargeItme(chargeItme.length)" size="mini" type="info" native-type="button" class="addFamily"/></p>
  193. <div class="main_box" style="margin-bottom: 15px;">
  194. <van-cell title="收款账户类型" v-if="form.bankType==1">
  195. <template #right-icon>
  196. <van-radio-group direction="horizontal" v-model="form.accountType" @change="accountTypeChange">
  197. <van-radio name="1">公户</van-radio>
  198. <van-radio name="2">私户</van-radio>
  199. </van-radio-group>
  200. </template>
  201. </van-cell>
  202. <van-cell title="是否与付款方同行" v-if="form.bankType==2||form.bankType==4">
  203. <template #right-icon>
  204. <van-radio-group direction="horizontal" v-model="form.isPeers" @change="accountTypeChange1">
  205. <van-radio name="Y">是</van-radio>
  206. <van-radio name="N">否</van-radio>
  207. </van-radio-group>
  208. </template>
  209. </van-cell>
  210. </div>
  211. <div :style="{position:'relative',padding: index == 0 ? '':'10px 0 0 0'}" v-for="(item, index) in chargeItme" :key="index">
  212. <van-button icon="minus" size="mini" type="danger" class="deleteFamily" native-type="button" v-if="index!=0" @click="deleteChargeItme(index)" />
  213. <div class="main_box" style="margin-bottom: 10px;position:relative;">
  214. <van-field
  215. readonly
  216. clickable
  217. label="收款方"
  218. placeholder="请选择"
  219. v-model="item.payee"
  220. @click="item.showPayee = true"
  221. input-align="right"
  222. right-icon="arrow-down"
  223. required
  224. :rules="[{ required: true , message:'请选择收款方' }]"
  225. />
  226. <van-popup v-model="item.showPayee" position="bottom">
  227. <van-picker
  228. show-toolbar
  229. :columns="payeeList"
  230. @confirm="onConfirmPayee($event,index)"
  231. @cancel="item.showPayee = false"
  232. />
  233. </van-popup>
  234. <van-field required :rules="[{ required: true , message:'请输入账户' }]" v-model="item.payeeAccount" label="收款账户" placeholder="请输入账户" input-align="right" label-width="auto"/>
  235. <van-field required :rules="[{ required: true , message:'请输入银行' }]" v-model="item.bankDeposit" label="开户银行" placeholder="请输入银行" input-align="right" label-width="auto"/>
  236. <van-field required :rules="[{ required: true , message:'请输入金额' }]" v-model="item.incomeAmount" label="收入金额" placeholder="请输入金额" input-align="right" label-width="auto" @change="moneyChange"/>
  237. <van-field
  238. readonly
  239. clickable
  240. label="所属银行"
  241. placeholder=""
  242. v-model="item.bankTypeText"
  243. input-align="right"
  244. required
  245. :rules="[{ required: true , message:'请选择所属银行' }]"
  246. />
  247. <van-popup v-model="item.showbankType" position="bottom">
  248. <van-picker
  249. show-toolbar
  250. :columns="bankTypeDictionaries"
  251. @confirm="onConfirmBankType($event,index)"
  252. @cancel="item.showbankType = false"
  253. />
  254. </van-popup>
  255. </div>
  256. </div>
  257. <p class="main_title">上传附件</p>
  258. <div class="main_box" style="padding: 5px 0 0 8px;">
  259. <van-uploader v-model="fileList" :after-read="beforeRead" @delete="deleteFile"></van-uploader>
  260. </div>
  261. <div style="padding: 16px 0;">
  262. <van-row>
  263. <van-col span="12" align="center">
  264. <van-button type="info" native-type="submit" @click="buttonType='update'" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  265. </van-col>
  266. <van-col span="12" align="center">
  267. <van-button type="info" native-type="submit" @click="buttonType='add'" class="submitButton">保存并提交</van-button>
  268. </van-col>
  269. </van-row>
  270. <div class="clear"></div>
  271. </div>
  272. </van-form>
  273. </div>
  274. </template>
  275. <script>
  276. import { getAccount , getTransfer , queryTransferDetail , listPayee , updateTransfer , getProjectto , listProject , addProjectto , customSubmit ,getQmyeFlow,listInfo ,getInfoto ,addInfoto} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  277. import {
  278. attachmentList,
  279. commonAttach, listVaccount, listVaccount1,
  280. systemAttachment
  281. } from "../../../../api/onlineHome/bankAgriculture/paymentApproval";
  282. import request from '@/utils/request';
  283. import Dialog from "vant/lib/dialog";
  284. export default {
  285. name: "approvalModify4",
  286. data() {
  287. return {
  288. showcontract:false,
  289. showcapital:false,
  290. showpayee:false,
  291. showlasj:false,
  292. showbankType:false,
  293. showproject:false,
  294. showFundType:false,
  295. showpayer:false,
  296. minDate: new Date(2000, 1, 1),
  297. maxDate: new Date(2050, 12, 31),
  298. currentDate: new Date(),
  299. form:{},
  300. capitalExpenditureType:'',
  301. payee:'',
  302. bankType:'',
  303. buttonType:'a',
  304. wfydlxDictionaries:[],
  305. jglxDictionaries:[],
  306. sysDictionaries:[],
  307. capitalExpenditureTypeOptions:[],
  308. bankTypeDictionaries:[],
  309. infoList:[],
  310. projectList:[],
  311. projectFundTypeOptions:[],
  312. projectFundTypeDictionaries:[],
  313. payerOptions:[],
  314. chargeItme:[],
  315. chargeItmeShow:[],
  316. payeeList:[],
  317. // 查询参数
  318. queryParams: {
  319. transferType:"",
  320. orderByColumn: "id",
  321. isAsc: "desc",
  322. },
  323. capitalExpenditureOpen:false,
  324. contractOpen:false,
  325. projectForm:{
  326. projectId:null,
  327. projectName:null,
  328. projectContractor:null,
  329. projectAmount:null,
  330. projectBillNum:null,
  331. projectFundType:'1',
  332. outId:null,
  333. ynType:'1'
  334. },
  335. infoForm:{
  336. infoId:null,
  337. name:null,
  338. code:null,
  339. totalAmount:null,
  340. contractionId:null,
  341. transferId:null
  342. },
  343. // 合同信息查询参数
  344. queryContractionParams: {
  345. pageNum: 1,
  346. pageSize: 100,
  347. contractionStatus: '1',
  348. orderByColumn: "endTime",
  349. isAsc: "desc",
  350. },
  351. projectFundType:'',
  352. fileList:[],
  353. uploadFiles:[],
  354. };
  355. },
  356. created() {
  357. let queryParams={
  358. pageNum: 1,
  359. pageSize: 100,
  360. }
  361. listProject(queryParams).then(response => {
  362. this.projectList = response.rows;
  363. for (var i = 0; i < response.rows.length; i++) {
  364. this.$set(this.projectList[i],"text",response.rows[i].projectName)
  365. this.$set(this.projectList[i],"value",response.rows[i].id)
  366. }
  367. });
  368. listInfo(this.queryContractionParams).then(response => {
  369. this.infoList = response.rows;
  370. for (let i = 0; i < response.rows.length; i++) {
  371. this.$set(this.infoList[i],"text",response.rows[i].name)
  372. this.$set(this.infoList[i],"value",response.rows[i].code)
  373. }
  374. });
  375. this.getDicts("project_fund_type").then((response) => {
  376. for (var i = 0; i < response.data.length; i++) {
  377. this.projectFundTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  378. }
  379. this.projectFundTypeDictionaries = response.data;
  380. });
  381. let params1={
  382. villageAccountType:'1',
  383. "params":{townAccountType:'1'}
  384. }
  385. listVaccount1(params1).then((response) => {
  386. this.payerOptions = response.rows;
  387. response.rows.map((res,index) => {
  388. res['payerFrom'] = '1'
  389. this.payerOptions[index].text = res.payee;
  390. this.payerOptions[index].value = res.id;
  391. })
  392. });
  393. this.getDictionaries();
  394. this.getFileList();
  395. },
  396. methods: {
  397. getDictionaries(){
  398. getTransfer(this.$route.query.id).then((response) => {
  399. this.getDicts("capital_expenditure_type").then((res) => {
  400. for (var i = 0; i < res.data.length; i++) {
  401. this.capitalExpenditureTypeOptions.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  402. }
  403. this.capitalExpenditureType = this.selectDictLabel(res.data, response.data.capitalExpenditureType);
  404. });
  405. if(response.data.capitalExpenditureType==2){
  406. this.capitalExpenditureOpen = true
  407. let param={
  408. 'outId' : response.data.id,
  409. 'ynType' : '1'
  410. }
  411. getProjectto(param).then(res => {
  412. console.log(this.selectDictLabel(this.projectFundTypeDictionaries, res.data.projectFundType))
  413. this.projectFundType = this.selectDictLabel(this.projectFundTypeDictionaries, res.data.projectFundType);
  414. this.projectForm = res.data
  415. console.log(res.data)
  416. })
  417. }else if(response.data.capitalExpenditureType==4){
  418. this.contractOpen = true
  419. let param={
  420. 'transferId' : response.data.id
  421. }
  422. console.log(param)
  423. getInfoto(param).then(res => {
  424. this.infoForm = res.data
  425. })
  426. }else{
  427. this.showproject = false
  428. }
  429. this.form = response.data;
  430. });
  431. queryTransferDetail(this.$route.query.id).then((response) => {
  432. this.getDicts("bank_type").then(res => {
  433. for (var i = 0; i < res.data.length; i++) {
  434. this.bankTypeDictionaries.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  435. }
  436. for (var j = 0 ; j < response.rows.length ; j++){
  437. // response.rows[j].payeeText = response.rows[j].payee;
  438. response.rows[j].bankTypeText = this.selectDictLabel(res.data, response.rows[j].bankType);
  439. response.rows[j].showPayee = false;
  440. }
  441. this.chargeItme = response.rows;
  442. });
  443. this.getPayeeList();
  444. });
  445. },
  446. getChange(){
  447. console.log(this.buttonType)
  448. if(this.buttonType == 'update'){
  449. console.log('update')
  450. this.goUpdate();
  451. }else if(this.buttonType == 'add'){
  452. console.log('add')
  453. this.goAdd();
  454. }
  455. },
  456. getError(e){
  457. console.log(e)
  458. this.$notify({ type: 'danger', message: e.errors[0].message });
  459. },
  460. addChargeItme(index){
  461. if(this.chargeItme.length>0&&this.chargeItme[this.chargeItme.length-1].payee == ''){
  462. this.$notify({ type: 'danger', message: '请勿添加多个空列表信息' });
  463. return;
  464. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].incomeAmount == ''){
  465. this.$notify({ type: 'danger', message: '请输入收入金额!' });
  466. return;
  467. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].payeeAccount == ''){
  468. this.$notify({ type: 'danger', message: '请输入收款账户!' });
  469. return;
  470. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankDeposit == ''){
  471. this.$notify({ type: 'danger', message: '请输入开户银行!' });
  472. return;
  473. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankType == ''){
  474. this.$notify({ type: 'danger', message: '请选择所属银行!' });
  475. return;
  476. }
  477. this.getDicts("bank_type").then(res => {
  478. this.chargeItme.splice(index + 1, 0, {
  479. payeeId: "", //收款方ID
  480. payee: "", //收款方
  481. payeeAccount: "", //收款账户
  482. bankDeposit: "", //开户银行
  483. incomeAmount: "", //收入金额
  484. bankType:null, //所属银行
  485. bankTypeText:"", //所属银行
  486. showPayee:false,
  487. showbankType:false
  488. });
  489. });
  490. },
  491. getPayeeList() {
  492. //普通转账
  493. this.queryParams.accountType = this.form.accountType
  494. this.queryParams.status = "0"
  495. listPayee(this.queryParams).then((response) => {
  496. this.payeeList = response.rows;
  497. response.rows.map((res,index) => {
  498. if(res.payeeType==1||res.payeeType==2){
  499. this.payeeList[index].text = res.payee;
  500. this.payeeList[index].value = res.id;}
  501. })
  502. });
  503. },
  504. payeeDictLabel(datas, value) {
  505. var actions = [];
  506. Object.keys(datas).some((key) => {
  507. if (datas[key].payeeId == ('' + value)) {
  508. actions.push(datas[key].payee);
  509. return true;
  510. }
  511. })
  512. return actions.join('');
  513. },
  514. onConfirmCapital(data){
  515. if (data.value == 2){
  516. this.capitalExpenditureOpen = true;
  517. this.contractOpen = false
  518. this.infoForm = {};
  519. }else if(data.value == 4){
  520. this.capitalExpenditureOpen = false;
  521. this.contractOpen = true
  522. this.projectForm = {};
  523. }else{
  524. this.capitalExpenditureOpen = false;
  525. this.contractOpen = false
  526. this.projectForm = {};
  527. this.infoForm = {};
  528. }
  529. this.capitalExpenditureType = data.text;
  530. this.form.capitalExpenditureType = data.value;
  531. this.showcapital = false;
  532. },
  533. onConfirmFundType(data){
  534. console.log(data)
  535. this.projectForm.projectFundType = data.value;
  536. this.projectFundType = data.text;
  537. this.showFundType = false;
  538. },
  539. onConfirmProject(data){
  540. this.projectList.map(res => {
  541. if(res.projectName==data.text){
  542. this.projectForm.projectId = res.id
  543. this.projectForm.projectName = res.projectName
  544. this.projectForm.projectContractor = res.projectContractor
  545. this.projectForm.projectAmount = res.projectAmount
  546. }
  547. })
  548. this.showproject = false;
  549. },
  550. onConfirmContract(data){
  551. this.infoList.map(res => {
  552. if(res.name==data.text){
  553. this.infoForm.contractionId = res.id;
  554. this.infoForm.name = res.name;
  555. this.infoForm.code = res.code;
  556. this.infoForm.totalAmount = res.totalAmount;
  557. }
  558. })
  559. this.showcontract = false;
  560. },
  561. onConfirmPayee(data,index){
  562. for (let i = 0 ; i < this.chargeItme.length ; i++){
  563. this.chargeItme[i].showPayee = false;
  564. }
  565. this.chargeItme[index].payee = data.text;
  566. this.chargeItme[index].payeeId = data.value;
  567. this.chargeItme[index].showpayee = false;
  568. this.payeeSelectChange(data.value , index)
  569. this.onConfirmBankType(data,index)
  570. },
  571. onConfirmBankType(data,index){
  572. console.log(this.bankTypeDictionaries)
  573. this.bankTypeDictionaries.map(res => {
  574. if(res.value==data.bankType){
  575. this.chargeItme[index].bankTypeText = res.text;
  576. this.chargeItme[index].bankType = res.value;
  577. }
  578. })
  579. },
  580. onConfirmPayer(data){
  581. this.form.payer = data.text;
  582. this.form.cashierId = data.value;
  583. this.showpayer = false;
  584. this.selectChange(data.value)
  585. },
  586. onConfirmLasj(data){
  587. this.form.applyDate = this.getNowFormatDate(data).substr(0,10);
  588. this.showlasj = false;
  589. },
  590. accountTypeChange(e){
  591. this.payeeList = [];
  592. this.chargeItme = [];
  593. this.queryParams.accountType = this.form.accountType
  594. this.queryParams.bankType = this.form.bankType
  595. this.queryParams.status = "0"
  596. listPayee(this.queryParams).then((response) => {
  597. response.rows.map((res,index) => {
  598. if(res.payeeType==1||res.payeeType==2){
  599. response.rows[index].text = res.payee;
  600. response.rows[index].value = res.id;
  601. this.payeeList.push(res)
  602. }
  603. })
  604. });
  605. },
  606. accountTypeChange1(e){
  607. this.payeeList = [];
  608. this.chargeItme = [];
  609. this.queryParams.isPeers = this.form.isPeers
  610. this.queryParams.bankType = this.form.bankType
  611. this.queryParams.status = "0"
  612. listPayee(this.queryParams).then((response) => {
  613. response.rows.map((res,index) => {
  614. if(res.payeeType==1||res.payeeType==2){
  615. response.rows[index].text = res.payee;
  616. response.rows[index].value = res.id;
  617. this.payeeList.push(res)
  618. }
  619. })
  620. });
  621. },
  622. // 钱计算
  623. moneyChange(input) {
  624. console.log(input)
  625. let obj = {};
  626. obj = this.chargeItme.find((account) => {
  627. //model就是上面的数据源
  628. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  629. });
  630. let total = 0;
  631. this.chargeItme.forEach((money) => {
  632. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  633. });
  634. this.$set(this.form, "expenditureAmount", total);
  635. },
  636. goAdd(){
  637. if(this.chargeItme.length<1){
  638. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  639. return;
  640. }
  641. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  642. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  643. return;
  644. }
  645. if(this.form.capitalExpenditureType==2){
  646. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  647. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  648. return;
  649. }
  650. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  651. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  652. return;
  653. }
  654. }
  655. if(this.form.capitalExpenditureType==4){
  656. if(this.infoForm.name==""||this.infoForm.name==null){
  657. this.$notify({ type: 'danger', message: '请选择合同名称!' });
  658. return;
  659. }
  660. if(this.infoForm.code==""||this.infoForm.code==null){
  661. this.$notify({ type: 'danger', message: '请输入合同编码!' });
  662. return;
  663. }
  664. if(this.infoForm.totalAmount==""||this.infoForm.totalAmount==null){
  665. this.$notify({ type: 'danger', message: '请输入合同价款!' });
  666. return;
  667. }
  668. }
  669. if((this.uploadFiles==null||this.uploadFiles.length==0)&&(this.fileList==null||this.fileList.length==0)){
  670. Dialog.confirm({
  671. title: '提示',
  672. message: '此申请单中未上传任何附件,是否确认提交?',
  673. })
  674. .then(() => {
  675. this.$set(this.form, "payeeList", this.chargeItme);
  676. this.$set(this.form, "bankTypeList", this.chargeItme);
  677. this.$set(this.form, "accountTypeList", this.chargeItme);
  678. this.$set(this.form, "transferStatusList", this.chargeItme);
  679. updateTransfer(this.form).then(response => {
  680. this.projectForm.outId = this.form.id
  681. this.infoForm.transferId = this.form.id
  682. this.$set(this.projectForm, "ynType", '1');
  683. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  684. this.uploadFiles.map(rr => {
  685. const params = new FormData();
  686. params.append("tableId", this.form.id);
  687. params.append("tableName", "t_yinnong_transfer");
  688. params.append("bizPath", "upload");
  689. params.append("fileType", "0");
  690. params.append("file", rr);
  691. commonAttach(params).then((r) => {
  692. })
  693. })
  694. if(this.form.capitalExpenditureType==2){
  695. addProjectto(this.projectForm).then(res => {
  696. customSubmit(this.form.id).then(res => {
  697. this.$toast.success('提交成功');
  698. setTimeout(function(){
  699. history.go(-1)
  700. },2000)
  701. })
  702. })
  703. }else if(this.form.capitalExpenditureType==4){
  704. addInfoto(this.infoForm).then(res => {
  705. customSubmit(this.form.id).then(res => {
  706. this.$toast.success('提交成功');
  707. setTimeout(function(){
  708. history.go(-1)
  709. },2000)
  710. })
  711. })
  712. }else{
  713. customSubmit(this.form.id).then(res => {
  714. this.$toast.success('提交成功');
  715. setTimeout(function(){
  716. history.go(-1)
  717. },2000)
  718. })
  719. }
  720. }else{
  721. if(this.form.capitalExpenditureType==2){
  722. addProjectto(this.projectForm).then(res => {
  723. customSubmit(this.form.id).then(res => {
  724. this.$toast.success('提交成功');
  725. setTimeout(function(){
  726. history.go(-1)
  727. },2000)
  728. })
  729. })
  730. }else if(this.form.capitalExpenditureType==4){
  731. addInfoto(this.infoForm).then(res => {
  732. customSubmit(this.form.id).then(res => {
  733. this.$toast.success('提交成功');
  734. setTimeout(function(){
  735. history.go(-1)
  736. },2000)
  737. })
  738. })
  739. }else{
  740. customSubmit(this.form.id).then(res => {
  741. this.$toast.success('提交成功');
  742. setTimeout(function(){
  743. history.go(-1)
  744. },2000)
  745. })
  746. }
  747. }
  748. });
  749. })
  750. .catch(() => {
  751. return false;
  752. });
  753. }else{
  754. this.$set(this.form, "payeeList", this.chargeItme);
  755. this.$set(this.form, "bankTypeList", this.chargeItme);
  756. this.$set(this.form, "accountTypeList", this.chargeItme);
  757. this.$set(this.form, "transferStatusList", this.chargeItme);
  758. updateTransfer(this.form).then(response => {
  759. this.projectForm.outId = this.form.id
  760. this.infoForm.transferId = this.form.id
  761. this.$set(this.projectForm, "ynType", '1');
  762. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  763. this.uploadFiles.map(rr => {
  764. const params = new FormData();
  765. params.append("tableId", this.form.id);
  766. params.append("tableName", "t_yinnong_transfer");
  767. params.append("bizPath", "upload");
  768. params.append("fileType", "0");
  769. params.append("file", rr);
  770. commonAttach(params).then((r) => {
  771. })
  772. })
  773. if(this.form.capitalExpenditureType==2){
  774. addProjectto(this.projectForm).then(res => {
  775. customSubmit(this.form.id).then(res => {
  776. this.$toast.success('提交成功');
  777. setTimeout(function(){
  778. history.go(-1)
  779. },2000)
  780. })
  781. })
  782. } else if(this.form.capitalExpenditureType==4){
  783. addInfoto(this.infoForm).then(res => {
  784. customSubmit(this.form.id).then(res => {
  785. this.$toast.success('提交成功');
  786. setTimeout(function(){
  787. history.go(-1)
  788. },2000)
  789. })
  790. })
  791. }else{
  792. customSubmit(this.form.id).then(res => {
  793. this.$toast.success('提交成功');
  794. setTimeout(function(){
  795. history.go(-1)
  796. },2000)
  797. })
  798. }
  799. }else{
  800. if(this.form.capitalExpenditureType==2){
  801. addProjectto(this.projectForm).then(res => {
  802. customSubmit(this.form.id).then(res => {
  803. this.$toast.success('提交成功');
  804. setTimeout(function(){
  805. history.go(-1)
  806. },2000)
  807. })
  808. })
  809. } else if(this.form.capitalExpenditureType==4){
  810. addInfoto(this.infoForm).then(res => {
  811. customSubmit(this.form.id).then(res => {
  812. this.$toast.success('提交成功');
  813. setTimeout(function(){
  814. history.go(-1)
  815. },2000)
  816. })
  817. })
  818. }else{
  819. customSubmit(this.form.id).then(res => {
  820. this.$toast.success('提交成功');
  821. setTimeout(function(){
  822. history.go(-1)
  823. },2000)
  824. })
  825. }
  826. }
  827. });
  828. }
  829. },
  830. goUpdate(){
  831. if(this.chargeItme.length<1){
  832. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  833. return;
  834. }
  835. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  836. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  837. return;
  838. }
  839. if(this.form.capitalExpenditureType==2){
  840. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  841. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  842. return;
  843. }
  844. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  845. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  846. return;
  847. }
  848. }
  849. if(this.form.capitalExpenditureType==4){
  850. if(this.infoForm.name==""||this.infoForm.name==null){
  851. this.$notify({ type: 'danger', message: '请选择合同名称!' });
  852. return;
  853. }
  854. if(this.infoForm.code==""||this.infoForm.code==null){
  855. this.$notify({ type: 'danger', message: '请输入合同编码!' });
  856. return;
  857. }
  858. if(this.infoForm.totalAmount==""||this.infoForm.totalAmount==null){
  859. this.$notify({ type: 'danger', message: '请输入合同价款!' });
  860. return;
  861. }
  862. }
  863. this.$set(this.form, "payeeList", this.chargeItme);
  864. this.$set(this.form, "bankTypeList", this.chargeItme);
  865. this.$set(this.form, "accountTypeList", this.chargeItme);
  866. this.$set(this.form, "transferStatusList", this.chargeItme);
  867. updateTransfer(this.form).then((response) => {
  868. this.projectForm.outId = this.form.id
  869. this.infoForm.transferId = this.form.id
  870. this.$set(this.projectForm, "ynType", '1');
  871. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  872. this.uploadFiles.map(rr => {
  873. const params = new FormData();
  874. params.append("tableId", this.form.id);
  875. params.append("tableName", "t_yinnong_transfer");
  876. params.append("bizPath", "upload");
  877. params.append("fileType", "0");
  878. params.append("file", rr);
  879. commonAttach(params).then((r) => {
  880. })
  881. })
  882. if(this.form.capitalExpenditureType==2){
  883. addProjectto(this.projectForm).then(res => {
  884. this.$toast.success('保存成功');
  885. setTimeout(function(){
  886. history.go(-1)
  887. },2000)
  888. })
  889. }else if(this.form.capitalExpenditureType==4){
  890. addInfoto(this.infoForm).then(res => {
  891. this.$toast.success('保存成功');
  892. setTimeout(function(){
  893. history.go(-1)
  894. },2000)
  895. })
  896. }else{
  897. this.$toast.success('保存成功');
  898. setTimeout(function(){
  899. history.go(-1)
  900. },2000)
  901. }
  902. }else{
  903. if(this.form.capitalExpenditureType==2){
  904. addProjectto(this.projectForm).then(res => {
  905. this.$toast.success('保存成功');
  906. setTimeout(function(){
  907. history.go(-1)
  908. },2000)
  909. })
  910. }else if(this.form.capitalExpenditureType==4){
  911. addInfoto(this.infoForm).then(res => {
  912. this.$toast.success('保存成功');
  913. setTimeout(function(){
  914. history.go(-1)
  915. },2000)
  916. })
  917. }else{
  918. this.$toast.success('保存成功');
  919. setTimeout(function(){
  920. history.go(-1)
  921. },2000)
  922. }
  923. }
  924. });
  925. },
  926. payeeSelectChange(select, i) {
  927. let obj = {};
  928. let fuzhitype = 0;
  929. let _this = this
  930. obj = this.payeeList.find((account) => {
  931. //model就是上面的数据源
  932. return account.id === select ; //筛选出匹配数据
  933. });
  934. if(this.chargeItme != [] && this.chargeItme.length>1){
  935. this.chargeItme.some((value, index) => {
  936. if(value.payeeAccount != undefined &&value.payeeAccount != '' && obj.payeeAccount == value.payeeAccount&&index!=i){
  937. fuzhitype = 2;
  938. return true;
  939. }
  940. if(value.accountType != undefined &&value.accountType != '' && obj.accountType != value.accountType&&index!=i){
  941. fuzhitype = 1;
  942. return true;
  943. }
  944. });
  945. }
  946. if(fuzhitype == 0){
  947. this.$set(this.chargeItme[i], "payee",obj.payee)
  948. this.$set(this.chargeItme[i], "bankType", obj.bankType)
  949. this.$set(this.chargeItme[i], "payeeId", obj.id);
  950. this.$set(this.chargeItme[i], "payeeAccount", obj.payeeAccount);
  951. this.$set(this.chargeItme[i], "bankDeposit", obj.bankDeposit);
  952. this.$set(this.chargeItme[i], "accountType", obj.accountType);
  953. this.$set(this.chargeItme[i], "payeePaymentLines", obj.payeePaymentLines);
  954. _this.bankTypeDictionaries.map(rr => {
  955. if(rr.value==obj.bankType){
  956. this.$set(this.chargeItme[i], "bankTypeText", rr.text);
  957. }
  958. })
  959. }else if(fuzhitype == 1){
  960. this.$set(this.chargeItme[i], "payee",'')
  961. this.$set(this.chargeItme[i], "bankType",'')
  962. this.$set(this.chargeItme[i], "payeeId", '');
  963. this.$set(this.chargeItme[i], "payeeAccount", '');
  964. this.$set(this.chargeItme[i], "bankDeposit", '');
  965. this.$set(this.chargeItme[i], "accountType", '');
  966. this.$set(this.chargeItme[i], "payeePaymentLines", '');
  967. this.$set(this.chargeItme[i], "bankTypeText", '');
  968. this.$notify({ type: 'danger', message: '请选择账户类型相同的收款方!' });
  969. }else if(fuzhitype == 2){
  970. this.$set(this.chargeItme[i], "payee",'')
  971. this.$set(this.chargeItme[i], "bankType",'')
  972. this.$set(this.chargeItme[i], "payeeId", '');
  973. this.$set(this.chargeItme[i], "payeeAccount", '');
  974. this.$set(this.chargeItme[i], "bankDeposit", '');
  975. this.$set(this.chargeItme[i], "accountType", '');
  976. this.$set(this.chargeItme[i], "payeePaymentLines", '');
  977. this.$set(this.chargeItme[i], "bankTypeText", '');
  978. this.$notify({ type: 'danger', message: '收款方已存在!' });
  979. }
  980. },
  981. selectChange(select) {
  982. let obj = {};
  983. obj = this.payerOptions.find((account) => {
  984. //model就是上面的数据源
  985. return account.id === select; //筛选出匹配数据
  986. });
  987. this.$set(this.form, "bookId", obj.bookId);
  988. this.$set(this.form, "deptId", obj.deptId);
  989. this.$set(this.form, "cashierId", obj.id);
  990. this.$set(this.form, "payer", obj.payee);
  991. this.$set(this.form, "payerAccount", obj.payeeAccount);
  992. this.$set(this.form, "operatorCode", obj.operatorCode);
  993. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  994. this.$set(this.form, "bankType", obj.bankType);
  995. this.$set(this.form, "payerFrom", '1');
  996. if(obj.bankType==1){
  997. this.form.accountType = "1"
  998. this.form.isPeers = null
  999. this.accountTypeChange();
  1000. }else if(obj.bankType==2||obj.bankType==4){
  1001. this.form.accountType = null
  1002. this.form.isPeers = "Y"
  1003. this.accountTypeChange1();
  1004. }
  1005. },
  1006. beforeRead(file) {
  1007. this.uploadFiles.push(file.file);
  1008. },
  1009. deleteFile(file){
  1010. console.log(file)
  1011. this.uploadFiles.map((response,index) => {
  1012. if(file.file == response){
  1013. this.uploadFiles.splice(index,1)
  1014. }
  1015. })
  1016. if(file.id){
  1017. systemAttachment(file.id).then((res) => {
  1018. });
  1019. }
  1020. },
  1021. getFileList(){
  1022. let oData= {
  1023. tableId: this.$route.query.id,
  1024. tableName: "t_yinnong_transfer",
  1025. bizPath: "upload",
  1026. fileType: "0",
  1027. }
  1028. attachmentList(oData).then(res => {
  1029. console.log(res)
  1030. console.log(location.protocol+"//"+location.host+request.defaults.baseURL)
  1031. res.rows.map(r => {
  1032. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  1033. this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{}),"id":r.id})
  1034. console.log(r)
  1035. })
  1036. })
  1037. },
  1038. goBack(){
  1039. window.history.go(-1)
  1040. },
  1041. //删除家庭成员
  1042. deleteChargeItme(index){
  1043. this.chargeItme.splice(index,1)
  1044. },
  1045. },
  1046. }
  1047. </script>
  1048. <style scoped lang="scss">
  1049. .app-container {
  1050. padding: 2% 0;
  1051. }
  1052. .main_title{
  1053. font-size: 0.4rem;
  1054. color: #1D6FE9;
  1055. margin: 0.2rem 6%;
  1056. position: relative;
  1057. }
  1058. .main_box{
  1059. width: 96%;
  1060. margin: 0 auto;
  1061. border-radius: 6px;
  1062. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  1063. overflow: hidden;
  1064. background-color: #FFF;
  1065. }
  1066. .submitButton{
  1067. width: 80%;
  1068. margin: 0 auto;
  1069. background-color: #1D6FE9;
  1070. }
  1071. .addFamily{
  1072. position: absolute;
  1073. top: -2px;
  1074. right: 0;
  1075. border-radius: 50%;
  1076. }
  1077. .deleteFamily{
  1078. position: absolute;
  1079. top: 0rem;
  1080. right: 6%;
  1081. z-index: 9;
  1082. border-radius: 50%;
  1083. }
  1084. </style>