移动端
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

891 rader
33 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. </div>
  70. <div class="main_box" style="margin-top: 10px;">
  71. <van-field
  72. label="付款事由"
  73. v-model="form.remark"
  74. type="textarea"
  75. placeholder="请输入付款事由"
  76. input-align="right"
  77. rows="3"
  78. label-width="auto"
  79. required
  80. :rules="[{ required: true , message:'请输入付款事由' }]"
  81. />
  82. </div>
  83. <div class="main_box" style="margin-top: 10px;">
  84. <van-field label="说明情况" v-model="form.explainSituation" type="textarea" placeholder="请输入说明情况" input-align="right" rows="3" label-width="auto"/>
  85. </div>
  86. <p class="main_title" v-if="capitalExpenditureOpen">关联项目</p>
  87. <div class="main_box" v-if="capitalExpenditureOpen" style="margin-bottom: 10px;margin-top: 10px;position:relative;">
  88. <van-field
  89. readonly
  90. clickable
  91. label="项目名称"
  92. placeholder="请选择"
  93. v-model="projectForm.projectName"
  94. @click="showproject = true"
  95. input-align="right"
  96. right-icon="arrow-down"
  97. required
  98. :rules="[{ required: true , message:'请选择项目名称' }]"
  99. />
  100. <van-popup v-model="showproject" position="bottom">
  101. <van-picker
  102. show-toolbar
  103. :columns="projectListShow"
  104. @confirm="onConfirmProject"
  105. @cancel="showproject = false"
  106. />
  107. </van-popup>
  108. <van-field required :rules="[{ required: true , message:'请输入承建单位' }]" v-model="projectForm.projectContractor" label="承建单位" placeholder="请输入承建单位" input-align="right" label-width="auto"/>
  109. <van-field required :rules="[{ required: true , message:'请输入合同价款(元)' }]" v-model="projectForm.projectAmount" label="合同价款(元)" placeholder="请输入合同价款(元)" input-align="right" label-width="auto"/>
  110. <van-field
  111. readonly
  112. clickable
  113. label="工程款类型"
  114. placeholder="请选择"
  115. v-model="projectFundType"
  116. @click="showFundType = true"
  117. input-align="right"
  118. right-icon="arrow-down"
  119. required
  120. :rules="[{ required: true , message:'请选择工程款类型' }]"
  121. />
  122. <van-popup v-model="showFundType" position="bottom">
  123. <van-picker
  124. show-toolbar
  125. :columns="projectFundTypeOptions"
  126. @confirm="onConfirmFundType"
  127. @cancel="showFundType = false"
  128. />
  129. </van-popup>
  130. <van-field required :rules="[{ required: true , message:'请输入工程发票号' }]" v-model="projectForm.projectBillNum" label="工程发票号" placeholder="请输入工程发票号" input-align="right" label-width="auto"/>
  131. </div>
  132. <p class="main_title">付款方信息</p>
  133. <div class="main_box">
  134. <!-- <van-field label="付款方" v-model="form.payer" placeholder="请输入付款方" input-align="right" label-width="auto"/>-->
  135. <van-field
  136. readonly
  137. clickable
  138. label="付款方"
  139. placeholder="请选择付款方"
  140. v-model="form.payer"
  141. @click="showpayer = true"
  142. input-align="right"
  143. right-icon="arrow-down"
  144. label-width="auto"
  145. required
  146. :rules="[{ required: true , message:'请选择付款方' }]"
  147. />
  148. <van-popup v-model="showpayer" position="bottom">
  149. <van-picker
  150. show-toolbar
  151. :columns="payerOptions"
  152. @confirm="onConfirmPayer($event)"
  153. @cancel="showpayer = false"
  154. />
  155. </van-popup>
  156. <van-field :rules="[{ required: true , message:'请输入账户' }]" required label="付款方账户" v-model="form.payerAccount" placeholder="请输入账户" input-align="right" label-width="auto"/>
  157. </div>
  158. <p class="main_title">收款方信息<van-button icon="plus" @click="addChargeItme(chargeItme.length)" size="mini" type="info" native-type="button" class="addFamily"/></p>
  159. <div class="main_box" style="margin-bottom: 15px;">
  160. <van-cell title="收款账户类型">
  161. <template #right-icon>
  162. <van-radio-group direction="horizontal" v-model="form.accountType" @change="accountTypeChange">
  163. <van-radio name="1">公户</van-radio>
  164. <van-radio name="2">私户</van-radio>
  165. </van-radio-group>
  166. </template>
  167. </van-cell>
  168. </div>
  169. <div :style="{position:'relative',padding: index == 0 ? '':'10px 0 0 0'}" v-for="(item, index) in chargeItme" :key="index">
  170. <van-button icon="minus" size="mini" type="danger" class="deleteFamily" native-type="button" v-if="index!=0" @click="deleteChargeItme(index)" />
  171. <div class="main_box" style="margin-bottom: 10px;position:relative;">
  172. <van-field
  173. readonly
  174. clickable
  175. label="收款方"
  176. placeholder="请选择"
  177. v-model="item.payee"
  178. @click="item.showPayee = true"
  179. input-align="right"
  180. right-icon="arrow-down"
  181. required
  182. :rules="[{ required: true , message:'请选择收款方' }]"
  183. />
  184. <van-popup v-model="item.showPayee" position="bottom">
  185. <van-picker
  186. show-toolbar
  187. :columns="payeeList"
  188. @confirm="onConfirmPayee($event,index)"
  189. @cancel="item.showPayee = false"
  190. />
  191. </van-popup>
  192. <van-field required :rules="[{ required: true , message:'请输入账户' }]" v-model="item.payeeAccount" label="收款账户" placeholder="请输入账户" input-align="right" label-width="auto"/>
  193. <van-field required :rules="[{ required: true , message:'请输入银行' }]" v-model="item.bankDeposit" label="开户银行" placeholder="请输入银行" input-align="right" label-width="auto"/>
  194. <van-field required :rules="[{ required: true , message:'请输入金额' }]" v-model="item.incomeAmount" label="收入金额" placeholder="请输入金额" input-align="right" label-width="auto" @change="moneyChange"/>
  195. <van-field
  196. readonly
  197. clickable
  198. label="所属银行"
  199. placeholder="请选择"
  200. v-model="item.bankTypeText"
  201. @click="item.showbankType = true"
  202. input-align="right"
  203. right-icon="arrow-down"
  204. required
  205. :rules="[{ required: true , message:'请选择所属银行' }]"
  206. />
  207. <van-popup v-model="item.showbankType" position="bottom">
  208. <van-picker
  209. show-toolbar
  210. :columns="bankTypeDictionaries"
  211. @confirm="onConfirmBankType($event,index)"
  212. @cancel="item.showbankType = false"
  213. />
  214. </van-popup>
  215. </div>
  216. </div>
  217. <p class="main_title">上传附件</p>
  218. <div class="main_box" style="padding: 5px 0 0 8px;">
  219. <van-uploader v-model="fileList" :after-read="beforeRead" @delete="deleteFile"></van-uploader>
  220. </div>
  221. <div style="padding: 16px 0;">
  222. <van-row>
  223. <van-col span="12" align="center">
  224. <van-button type="info" native-type="submit" @click="buttonType='update'" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  225. </van-col>
  226. <van-col span="12" align="center">
  227. <van-button type="info" native-type="submit" @click="buttonType='add'" class="submitButton">保存并提交</van-button>
  228. </van-col>
  229. </van-row>
  230. <div class="clear"></div>
  231. </div>
  232. </van-form>
  233. </div>
  234. </template>
  235. <script>
  236. import { getAccount , getTransfer , queryTransferDetail , listPayee , updateTransfer , getProjectto , listProject , addProjectto , customSubmit ,getQmyeFlow} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  237. import {
  238. attachmentList,
  239. commonAttach, listVaccount, listVaccount1,
  240. systemAttachment
  241. } from "../../../../api/onlineHome/bankAgriculture/paymentApproval";
  242. import request from '@/utils/request';
  243. import Dialog from "vant/lib/dialog";
  244. export default {
  245. name: "approvalModify4",
  246. data() {
  247. return {
  248. showcapital:false,
  249. showpayee:false,
  250. showlasj:false,
  251. showbankType:false,
  252. showproject:false,
  253. showFundType:false,
  254. showpayer:false,
  255. minDate: new Date(2000, 1, 1),
  256. maxDate: new Date(2050, 12, 31),
  257. currentDate: new Date(),
  258. form:{},
  259. capitalExpenditureType:'',
  260. payee:'',
  261. bankType:'',
  262. buttonType:'a',
  263. wfydlxDictionaries:[],
  264. jglxDictionaries:[],
  265. sysDictionaries:[],
  266. capitalExpenditureTypeOptions:[],
  267. bankTypeDictionaries:[],
  268. projectList:[],
  269. projectFundTypeOptions:[],
  270. projectFundTypeDictionaries:[],
  271. projectListShow:[],
  272. payerOptions:[],
  273. chargeItme:[],
  274. chargeItmeShow:[],
  275. payeeList:[],
  276. // 查询参数
  277. queryParams: {
  278. transferType:"",
  279. orderByColumn: "id",
  280. isAsc: "desc",
  281. },
  282. capitalExpenditureOpen:false,
  283. projectForm:{
  284. projectId:null,
  285. projectName:null,
  286. projectContractor:null,
  287. projectAmount:null,
  288. projectBillNum:null,
  289. projectFundType:'1',
  290. outId:null,
  291. ynType:'1'
  292. },
  293. projectFundType:'',
  294. fileList:[],
  295. uploadFiles:[],
  296. };
  297. },
  298. created() {
  299. let queryParams={
  300. pageNum: 1,
  301. pageSize: 100,
  302. }
  303. listProject(queryParams).then(response => {
  304. this.projectList = response.rows;
  305. for (var i = 0; i < response.rows.length; i++) {
  306. this.projectListShow.push({text: response.rows[i].projectName, value: response.rows[i].id});
  307. }
  308. });
  309. this.getDicts("project_fund_type").then((response) => {
  310. for (var i = 0; i < response.data.length; i++) {
  311. this.projectFundTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  312. }
  313. this.projectFundTypeDictionaries = response.data;
  314. });
  315. let params1={
  316. villageAccountType:'1',
  317. "params":{townAccountType:'1'}
  318. }
  319. listVaccount1(params1).then((response) => {
  320. this.payerOptions = response.rows;
  321. response.rows.map((res,index) => {
  322. res['payerFrom'] = '1'
  323. console.log(res)
  324. this.payerOptions[index].text = res.payee;
  325. this.payerOptions[index].value = res.id;
  326. })
  327. });
  328. this.getDictionaries();
  329. this.getFileList();
  330. },
  331. methods: {
  332. getDictionaries(){
  333. getTransfer(this.$route.query.id).then((response) => {
  334. this.getDicts("capital_expenditure_type").then((res) => {
  335. for (var i = 0; i < res.data.length; i++) {
  336. this.capitalExpenditureTypeOptions.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  337. }
  338. this.capitalExpenditureType = this.selectDictLabel(res.data, response.data.capitalExpenditureType);
  339. });
  340. if(response.data.capitalExpenditureType==2){
  341. this.capitalExpenditureOpen = true
  342. let param={
  343. 'outId' : response.data.id,
  344. 'ynType' : '1'
  345. }
  346. getProjectto(param).then(res => {
  347. console.log(this.selectDictLabel(this.projectFundTypeDictionaries, res.data.projectFundType))
  348. this.projectFundType = this.selectDictLabel(this.projectFundTypeDictionaries, res.data.projectFundType);
  349. this.projectForm = res.data
  350. console.log(res.data)
  351. })
  352. }else{
  353. this.showproject = false
  354. }
  355. this.form = response.data;
  356. });
  357. queryTransferDetail(this.$route.query.id).then((response) => {
  358. this.getDicts("bank_type").then(res => {
  359. for (var i = 0; i < res.data.length; i++) {
  360. this.bankTypeDictionaries.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  361. }
  362. for (var j = 0 ; j < response.rows.length ; j++){
  363. // response.rows[j].payeeText = response.rows[j].payee;
  364. response.rows[j].bankTypeText = this.selectDictLabel(res.data, response.rows[j].bankType);
  365. response.rows[j].showPayee = false;
  366. }
  367. this.chargeItme = response.rows;
  368. });
  369. this.getPayeeList();
  370. });
  371. },
  372. getChange(){
  373. console.log(this.buttonType)
  374. if(this.buttonType == 'update'){
  375. console.log('update')
  376. this.goUpdate();
  377. }else if(this.buttonType == 'add'){
  378. console.log('add')
  379. this.goAdd();
  380. }
  381. },
  382. getError(e){
  383. console.log(e)
  384. this.$notify({ type: 'danger', message: e.errors[0].message });
  385. },
  386. addChargeItme(index){
  387. if(this.chargeItme.length>0&&this.chargeItme[this.chargeItme.length-1].payee == ''){
  388. this.$notify({ type: 'danger', message: '请勿添加多个空列表信息' });
  389. return;
  390. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].incomeAmount == ''){
  391. this.$notify({ type: 'danger', message: '请输入收入金额!' });
  392. return;
  393. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].payeeAccount == ''){
  394. this.$notify({ type: 'danger', message: '请输入收款账户!' });
  395. return;
  396. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankDeposit == ''){
  397. this.$notify({ type: 'danger', message: '请输入开户银行!' });
  398. return;
  399. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankType == ''){
  400. this.$notify({ type: 'danger', message: '请选择所属银行!' });
  401. return;
  402. }
  403. this.getDicts("bank_type").then(res => {
  404. this.chargeItme.splice(index + 1, 0, {
  405. payeeId: "", //收款方ID
  406. payee: "", //收款方
  407. payeeAccount: "", //收款账户
  408. bankDeposit: "", //开户银行
  409. incomeAmount: "", //收入金额
  410. bankType: "1", //所属银行
  411. bankTypeText:this.selectDictLabel(res.data, 1), //所属银行
  412. showPayee:false,
  413. showbankType:false
  414. });
  415. });
  416. },
  417. getPayeeList() {
  418. //普通转账
  419. this.queryParams.accountType = this.form.accountType
  420. this.queryParams.status = "0"
  421. listPayee(this.queryParams).then((response) => {
  422. this.payeeList = response.rows;
  423. response.rows.map((res,index) => {
  424. this.payeeList[index].text = res.payee;
  425. this.payeeList[index].value = res.id;
  426. })
  427. });
  428. },
  429. payeeDictLabel(datas, value) {
  430. var actions = [];
  431. Object.keys(datas).some((key) => {
  432. if (datas[key].payeeId == ('' + value)) {
  433. actions.push(datas[key].payee);
  434. return true;
  435. }
  436. })
  437. return actions.join('');
  438. },
  439. onConfirmCapital(data){
  440. console.log(data)
  441. if (data.value != 2){
  442. this.capitalExpenditureOpen = false;
  443. this.projectForm = [];
  444. }else{
  445. this.capitalExpenditureOpen = true;
  446. }
  447. this.capitalExpenditureType = data.text;
  448. this.form.capitalExpenditureType = data.value;
  449. this.showcapital = false;
  450. },
  451. onConfirmFundType(data){
  452. console.log(data)
  453. this.projectForm.projectFundType = data.value;
  454. this.projectFundType = data.text;
  455. this.showFundType = false;
  456. },
  457. onConfirmProject(data){
  458. this.projectList.map(res => {
  459. if(res.projectName==data.text){
  460. this.projectForm.projectId = res.id
  461. this.projectForm.projectName = res.projectName
  462. this.projectForm.projectContractor = res.projectContractor
  463. this.projectForm.projectAmount = res.projectAmount
  464. }
  465. })
  466. this.showproject = false;
  467. },
  468. onConfirmPayee(data,index){
  469. for (let i = 0 ; i < this.chargeItme.length ; i++){
  470. this.chargeItme[i].showPayee = false;
  471. }
  472. this.chargeItme[index].payee = data.text;
  473. this.chargeItme[index].payeeId = data.value;
  474. this.chargeItme[index].showpayee = false;
  475. this.payeeSelectChange(data.value , index)
  476. this.onConfirmBankType(data,index)
  477. },
  478. onConfirmBankType(data,index){
  479. console.log(this.bankTypeDictionaries)
  480. this.bankTypeDictionaries.map(res => {
  481. if(res.value==data.bankType){
  482. this.chargeItme[index].bankTypeText = res.text;
  483. this.chargeItme[index].bankType = res.value;
  484. }
  485. })
  486. },
  487. onConfirmPayer(data){
  488. this.form.payer = data.text;
  489. this.form.cashierId = data.value;
  490. this.showpayer = false;
  491. this.selectChange(data.value)
  492. },
  493. onConfirmLasj(data){
  494. this.form.applyDate = this.getNowFormatDate(data).substr(0,10);
  495. this.showlasj = false;
  496. },
  497. accountTypeChange(e){
  498. this.payeeList = [];
  499. this.chargeItme = [];
  500. this.queryParams.accountType = this.form.accountType
  501. this.queryParams.status = "0"
  502. listPayee(this.queryParams).then((response) => {
  503. this.payeeList = response.rows;
  504. response.rows.map((res,index) => {
  505. this.payeeList[index].text = res.payee;
  506. this.payeeList[index].value = res.id;
  507. })
  508. });
  509. },
  510. // 钱计算
  511. moneyChange(input) {
  512. console.log(input)
  513. let obj = {};
  514. obj = this.chargeItme.find((account) => {
  515. //model就是上面的数据源
  516. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  517. });
  518. let total = 0;
  519. this.chargeItme.forEach((money) => {
  520. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  521. });
  522. this.$set(this.form, "expenditureAmount", total);
  523. },
  524. goAdd(){
  525. if(this.chargeItme.length<1){
  526. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  527. return;
  528. }
  529. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  530. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  531. return;
  532. }
  533. if(this.form.capitalExpenditureType==2){
  534. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  535. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  536. return;
  537. }
  538. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  539. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  540. return;
  541. }
  542. }
  543. if((this.uploadFiles==null||this.uploadFiles.length==0)&&(this.fileList==null||this.fileList.length==0)){
  544. Dialog.confirm({
  545. title: '提示',
  546. message: '此申请单中未上传任何附件,是否确认提交?',
  547. })
  548. .then(() => {
  549. this.$set(this.form, "payeeList", this.chargeItme);
  550. this.$set(this.form, "bankTypeList", this.chargeItme);
  551. this.$set(this.form, "accountTypeList", this.chargeItme);
  552. this.$set(this.form, "transferStatusList", this.chargeItme);
  553. updateTransfer(this.form).then(response => {
  554. this.projectForm.outId = this.form.id
  555. this.$set(this.projectForm, "ynType", '1');
  556. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  557. this.uploadFiles.map(rr => {
  558. const params = new FormData();
  559. params.append("tableId", this.form.id);
  560. params.append("tableName", "t_yinnong_transfer");
  561. params.append("bizPath", "upload");
  562. params.append("fileType", "0");
  563. params.append("file", rr);
  564. commonAttach(params).then((r) => {
  565. })
  566. })
  567. if(this.form.capitalExpenditureType==2){
  568. addProjectto(this.projectForm).then(res => {
  569. customSubmit(this.form.id).then(res => {
  570. this.$toast.success('提交成功');
  571. setTimeout(function(){
  572. history.go(-1)
  573. },2000)
  574. })
  575. })
  576. }else{
  577. customSubmit(this.form.id).then(res => {
  578. this.$toast.success('提交成功');
  579. setTimeout(function(){
  580. history.go(-1)
  581. },2000)
  582. })
  583. }
  584. }else{
  585. if(this.form.capitalExpenditureType==2){
  586. addProjectto(this.projectForm).then(res => {
  587. customSubmit(this.form.id).then(res => {
  588. this.$toast.success('提交成功');
  589. setTimeout(function(){
  590. history.go(-1)
  591. },2000)
  592. })
  593. })
  594. }else{
  595. customSubmit(this.form.id).then(res => {
  596. this.$toast.success('提交成功');
  597. setTimeout(function(){
  598. history.go(-1)
  599. },2000)
  600. })
  601. }
  602. }
  603. });
  604. })
  605. .catch(() => {
  606. return false;
  607. });
  608. }else{
  609. this.$set(this.form, "payeeList", this.chargeItme);
  610. this.$set(this.form, "bankTypeList", this.chargeItme);
  611. this.$set(this.form, "accountTypeList", this.chargeItme);
  612. this.$set(this.form, "transferStatusList", this.chargeItme);
  613. updateTransfer(this.form).then(response => {
  614. this.projectForm.outId = this.form.id
  615. this.$set(this.projectForm, "ynType", '1');
  616. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  617. this.uploadFiles.map(rr => {
  618. const params = new FormData();
  619. params.append("tableId", this.form.id);
  620. params.append("tableName", "t_yinnong_transfer");
  621. params.append("bizPath", "upload");
  622. params.append("fileType", "0");
  623. params.append("file", rr);
  624. commonAttach(params).then((r) => {
  625. })
  626. })
  627. if(this.form.capitalExpenditureType==2){
  628. addProjectto(this.projectForm).then(res => {
  629. customSubmit(this.form.id).then(res => {
  630. this.$toast.success('提交成功');
  631. setTimeout(function(){
  632. history.go(-1)
  633. },2000)
  634. })
  635. })
  636. }else{
  637. customSubmit(this.form.id).then(res => {
  638. this.$toast.success('提交成功');
  639. setTimeout(function(){
  640. history.go(-1)
  641. },2000)
  642. })
  643. }
  644. }else{
  645. if(this.form.capitalExpenditureType==2){
  646. addProjectto(this.projectForm).then(res => {
  647. customSubmit(this.form.id).then(res => {
  648. this.$toast.success('提交成功');
  649. setTimeout(function(){
  650. history.go(-1)
  651. },2000)
  652. })
  653. })
  654. }else{
  655. customSubmit(this.form.id).then(res => {
  656. this.$toast.success('提交成功');
  657. setTimeout(function(){
  658. history.go(-1)
  659. },2000)
  660. })
  661. }
  662. }
  663. });
  664. }
  665. },
  666. goUpdate(){
  667. if(this.chargeItme.length<1){
  668. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  669. return;
  670. }
  671. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  672. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  673. return;
  674. }
  675. if(this.form.capitalExpenditureType==2){
  676. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  677. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  678. return;
  679. }
  680. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  681. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  682. return;
  683. }
  684. }
  685. this.$set(this.form, "payeeList", this.chargeItme);
  686. this.$set(this.form, "bankTypeList", this.chargeItme);
  687. this.$set(this.form, "accountTypeList", this.chargeItme);
  688. this.$set(this.form, "transferStatusList", this.chargeItme);
  689. updateTransfer(this.form).then((response) => {
  690. this.projectForm.outId = this.form.id
  691. this.$set(this.projectForm, "ynType", '1');
  692. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  693. console.log(this.uploadFiles)
  694. this.uploadFiles.map(rr => {
  695. const params = new FormData();
  696. params.append("tableId", this.form.id);
  697. params.append("tableName", "t_yinnong_transfer");
  698. params.append("bizPath", "upload");
  699. params.append("fileType", "0");
  700. params.append("file", rr);
  701. commonAttach(params).then((r) => {
  702. })
  703. })
  704. if(this.form.capitalExpenditureType==2){
  705. addProjectto(this.projectForm).then(res => {
  706. this.$toast.success('保存成功');
  707. setTimeout(function(){
  708. history.go(-1)
  709. },2000)
  710. })
  711. }else{
  712. this.$toast.success('保存成功');
  713. setTimeout(function(){
  714. history.go(-1)
  715. },2000)
  716. }
  717. }else{
  718. if(this.form.capitalExpenditureType==2){
  719. addProjectto(this.projectForm).then(res => {
  720. this.$toast.success('保存成功');
  721. setTimeout(function(){
  722. history.go(-1)
  723. },2000)
  724. })
  725. }else{
  726. this.$toast.success('保存成功');
  727. setTimeout(function(){
  728. history.go(-1)
  729. },2000)
  730. }
  731. }
  732. });
  733. },
  734. payeeSelectChange(select, i) {
  735. let obj = {};
  736. let fuzhitype = 0;
  737. obj = this.payeeList.find((account) => {
  738. //model就是上面的数据源
  739. return account.id === select ; //筛选出匹配数据
  740. });
  741. if(this.chargeItme != [] && this.chargeItme.length>1){
  742. this.chargeItme.some((value, index) => {
  743. if(value.payeeAccount != undefined &&value.payeeAccount != '' && obj.payeeAccount == value.payeeAccount&&index!=i){
  744. fuzhitype = 2;
  745. return true;
  746. }
  747. if(value.accountType != undefined &&value.accountType != '' && obj.accountType != value.accountType&&index!=i){
  748. fuzhitype = 1;
  749. return true;
  750. }
  751. });
  752. }
  753. if(fuzhitype == 0){
  754. this.$set(this.chargeItme[i], "payee",obj.payee)
  755. this.$set(this.chargeItme[i], "bankType", obj.bankType)
  756. this.$set(this.chargeItme[i], "payeeId", obj.id);
  757. this.$set(this.chargeItme[i], "payeeAccount", obj.payeeAccount);
  758. this.$set(this.chargeItme[i], "bankDeposit", obj.bankDeposit);
  759. this.$set(this.chargeItme[i], "accountType", obj.accountType);
  760. }else if(fuzhitype == 1){
  761. this.$set(this.chargeItme[i], "payee",'')
  762. this.$set(this.chargeItme[i], "bankType",'')
  763. this.$set(this.chargeItme[i], "payeeId", '');
  764. this.$set(this.chargeItme[i], "payeeAccount", '');
  765. this.$set(this.chargeItme[i], "bankDeposit", '');
  766. this.$set(this.chargeItme[i], "accountType", '');
  767. this.$notify({ type: 'danger', message: '请选择账户类型相同的收款方!' });
  768. }else if(fuzhitype == 2){
  769. this.$set(this.chargeItme[i], "payee",'')
  770. this.$set(this.chargeItme[i], "bankType",'')
  771. this.$set(this.chargeItme[i], "payeeId", '');
  772. this.$set(this.chargeItme[i], "payeeAccount", '');
  773. this.$set(this.chargeItme[i], "bankDeposit", '');
  774. this.$set(this.chargeItme[i], "accountType", '');
  775. this.$notify({ type: 'danger', message: '收款方已存在!' });
  776. }
  777. },
  778. selectChange(select) {
  779. let obj = {};
  780. obj = this.payerOptions.find((account) => {
  781. //model就是上面的数据源
  782. return account.id === select; //筛选出匹配数据
  783. });
  784. console.log(obj)
  785. this.$set(this.form, "bookId", obj.bookId);
  786. this.$set(this.form, "deptId", obj.deptId);
  787. this.$set(this.form, "cashierId", obj.id);
  788. this.$set(this.form, "payer", obj.payee);
  789. this.$set(this.form, "payerAccount", obj.payeeAccount);
  790. this.$set(this.form, "operatorCode", obj.operatorCode);
  791. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  792. this.$set(this.form, "payerFrom", '1');
  793. },
  794. beforeRead(file) {
  795. this.uploadFiles.push(file.file);
  796. },
  797. deleteFile(file){
  798. console.log(file)
  799. this.uploadFiles.map((response,index) => {
  800. if(file.file == response){
  801. this.uploadFiles.splice(index,1)
  802. }
  803. })
  804. if(file.id){
  805. systemAttachment(file.id).then((res) => {
  806. });
  807. }
  808. },
  809. getFileList(){
  810. let oData= {
  811. tableId: this.$route.query.id,
  812. tableName: "t_yinnong_transfer",
  813. bizPath: "upload",
  814. fileType: "0",
  815. }
  816. attachmentList(oData).then(res => {
  817. console.log(res)
  818. console.log(location.protocol+"//"+location.host+request.defaults.baseURL)
  819. res.rows.map(r => {
  820. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  821. this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{}),"id":r.id})
  822. console.log(r)
  823. })
  824. })
  825. },
  826. goBack(){
  827. window.history.go(-1)
  828. },
  829. //删除家庭成员
  830. deleteChargeItme(index){
  831. this.chargeItme.splice(index,1)
  832. },
  833. },
  834. }
  835. </script>
  836. <style scoped lang="scss">
  837. .app-container {
  838. padding: 2% 0;
  839. }
  840. .main_title{
  841. font-size: 0.4rem;
  842. color: #1D6FE9;
  843. margin: 0.2rem 6%;
  844. position: relative;
  845. }
  846. .main_box{
  847. width: 96%;
  848. margin: 0 auto;
  849. border-radius: 6px;
  850. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  851. overflow: hidden;
  852. background-color: #FFF;
  853. }
  854. .submitButton{
  855. width: 80%;
  856. margin: 0 auto;
  857. background-color: #1D6FE9;
  858. }
  859. .addFamily{
  860. position: absolute;
  861. top: -2px;
  862. right: 0;
  863. border-radius: 50%;
  864. }
  865. .deleteFamily{
  866. position: absolute;
  867. top: 0rem;
  868. right: 6%;
  869. z-index: 9;
  870. border-radius: 50%;
  871. }
  872. </style>