移动端
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.

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