移动端
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

934 lines
35 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 readonly :rules="[{ required: true , message:'请输入账户' }]" v-model="item.payeeAccount" label="收款账户" placeholder="请输入账户" input-align="right" label-width="auto"/>
  193. <van-field required readonly :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. label="所属银行"
  198. placeholder="请选择"
  199. v-model="item.bankTypeText"
  200. @click="item.showbankType = true"
  201. input-align="right"
  202. required
  203. :rules="[{ required: true , message:'请选择所属银行' }]"
  204. />
  205. </div>
  206. </div>
  207. <p class="main_title">上传附件</p>
  208. <div class="main_box" style="padding: 5px 0 0 8px;">
  209. <van-uploader v-model="fileList" :after-read="beforeRead" @delete="deleteFile"></van-uploader>
  210. </div>
  211. <div style="padding: 16px 0;">
  212. <van-row>
  213. <van-col span="12" align="center">
  214. <van-button type="info" native-type="submit" @click="buttonType='update'" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  215. </van-col>
  216. <van-col span="12" align="center">
  217. <van-button type="info" native-type="submit" @click="buttonType='add'" class="submitButton">保存并提交</van-button>
  218. </van-col>
  219. </van-row>
  220. <div class="clear"></div>
  221. </div>
  222. </van-form>
  223. </div>
  224. </template>
  225. <script>
  226. import { getAccount , getTransfer , queryTransferDetail , listPayee , updateTransfer , getProjectto , listProject , addProjectto , customSubmit ,getQmyeFlow} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  227. import {
  228. addCash, attachmentList,
  229. commonAttach,
  230. listTaccount,
  231. listVaccount, systemAttachment
  232. } from "../../../../api/onlineHome/bankAgriculture/paymentApproval";
  233. import request from '@/utils/request';
  234. import Dialog from "vant/lib/dialog";
  235. export default {
  236. name: "approvalModify3",
  237. data() {
  238. return {
  239. showcapital:false,
  240. showpayee:false,
  241. showlasj:false,
  242. showbankType:false,
  243. showproject:false,
  244. showFundType:false,
  245. showpayer:false,
  246. minDate: new Date(2000, 1, 1),
  247. maxDate: new Date(2050, 12, 31),
  248. currentDate: new Date(),
  249. form:{},
  250. capitalExpenditureType:'',
  251. payee:'',
  252. bankType:'',
  253. buttonType:'a',
  254. wfydlxDictionaries:[],
  255. jglxDictionaries:[],
  256. sysDictionaries:[],
  257. capitalExpenditureTypeOptions:[],
  258. bankTypeDictionaries:[],
  259. projectList:[],
  260. projectFundTypeOptions:[],
  261. projectFundTypeDictionaries:[],
  262. projectListShow:[],
  263. payerOptions:[],
  264. chargeItme:[],
  265. chargeItmeShow:[],
  266. payeeList:[],
  267. // 查询参数
  268. queryParams: {
  269. transferType:"",
  270. orderByColumn: "id",
  271. isAsc: "desc",
  272. },
  273. capitalExpenditureOpen:false,
  274. projectForm:{
  275. projectId:null,
  276. projectName:null,
  277. projectContractor:null,
  278. projectAmount:null,
  279. projectBillNum:null,
  280. projectFundType:'1',
  281. outId:null,
  282. ynType:'1'
  283. },
  284. projectFundType:'',
  285. fileList:[],
  286. uploadFiles:[],
  287. };
  288. },
  289. created() {
  290. let queryParams={
  291. pageNum: 1,
  292. pageSize: 100,
  293. }
  294. listProject(queryParams).then(response => {
  295. this.projectList = response.rows;
  296. for (var i = 0; i < response.rows.length; i++) {
  297. this.projectListShow.push({text: response.rows[i].projectName, value: response.rows[i].id});
  298. }
  299. });
  300. this.getDicts("project_fund_type").then((response) => {
  301. for (var i = 0; i < response.data.length; i++) {
  302. this.projectFundTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  303. }
  304. this.projectFundTypeDictionaries = response.data;
  305. });
  306. let params1={
  307. townAccountType:'3'
  308. }
  309. listTaccount(params1).then((response) => {
  310. console.log(response)
  311. response.rows.map((res,index) => {
  312. if(res.townAccountType=='3'){
  313. res['payerFrom'] = '3'
  314. this.payerOptions.push(res);
  315. this.payerOptions[index].text = res.payee;
  316. this.payerOptions[index].value = res.id;
  317. }
  318. })
  319. });
  320. this.getDictionaries();
  321. this.getFileList();
  322. },
  323. methods: {
  324. getDictionaries(){
  325. getTransfer(this.$route.query.id).then((response) => {
  326. this.getDicts("capital_expenditure_type").then((res) => {
  327. for (var i = 0; i < res.data.length; i++) {
  328. this.capitalExpenditureTypeOptions.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  329. }
  330. this.capitalExpenditureType = this.selectDictLabel(res.data, response.data.capitalExpenditureType);
  331. });
  332. if(response.data.capitalExpenditureType==2){
  333. this.capitalExpenditureOpen = true
  334. let param={
  335. 'outId' : response.data.id,
  336. 'ynType' : '1'
  337. }
  338. getProjectto(param).then(res => {
  339. console.log(this.selectDictLabel(this.projectFundTypeDictionaries, res.data.projectFundType))
  340. this.projectFundType = this.selectDictLabel(this.projectFundTypeDictionaries, res.data.projectFundType);
  341. this.projectForm = res.data
  342. console.log(res.data)
  343. })
  344. }else{
  345. this.showproject = false
  346. }
  347. this.form = response.data;
  348. });
  349. queryTransferDetail(this.$route.query.id).then((response) => {
  350. this.getDicts("bank_type").then(res => {
  351. for (var i = 0; i < res.data.length; i++) {
  352. this.bankTypeDictionaries.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  353. }
  354. for (var j = 0 ; j < response.rows.length ; j++){
  355. // response.rows[j].payeeText = response.rows[j].payee;
  356. response.rows[j].bankTypeText = this.selectDictLabel(res.data, response.rows[j].bankType);
  357. response.rows[j].showPayee = false;
  358. }
  359. this.chargeItme = response.rows;
  360. });
  361. this.getPayeeList();
  362. });
  363. },
  364. getChange(){
  365. console.log(this.buttonType)
  366. if(this.buttonType == 'update'){
  367. console.log('update')
  368. this.goUpdate();
  369. }else if(this.buttonType == 'add'){
  370. console.log('add')
  371. this.goAdd();
  372. }
  373. },
  374. getError(e){
  375. console.log(e)
  376. this.$notify({ type: 'danger', message: e.errors[0].message });
  377. },
  378. addChargeItme(index){
  379. if(this.chargeItme.length>0&&this.chargeItme[this.chargeItme.length-1].payee == ''){
  380. this.$notify({ type: 'danger', message: '请勿添加多个空列表信息' });
  381. return;
  382. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].incomeAmount == ''){
  383. this.$notify({ type: 'danger', message: '请输入收入金额!' });
  384. return;
  385. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].payeeAccount == ''){
  386. this.$notify({ type: 'danger', message: '请输入收款账户!' });
  387. return;
  388. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankDeposit == ''){
  389. this.$notify({ type: 'danger', message: '请输入开户银行!' });
  390. return;
  391. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankType == ''){
  392. this.$notify({ type: 'danger', message: '请选择所属银行!' });
  393. return;
  394. }
  395. this.getDicts("bank_type").then(res => {
  396. this.chargeItme.splice(index + 1, 0, {
  397. payeeId: "", //收款方ID
  398. payee: "", //收款方
  399. payeeAccount: "", //收款账户
  400. bankDeposit: "", //开户银行
  401. incomeAmount: "", //收入金额
  402. bankType: "1", //所属银行
  403. bankTypeText:this.selectDictLabel(res.data, 1), //所属银行
  404. showPayee:false,
  405. showbankType:false
  406. });
  407. });
  408. },
  409. getPayeeList() {
  410. let params = {
  411. villageAccountType : 1,
  412. status:'0',
  413. accountType : this.form.accountType
  414. }
  415. listVaccount(params).then(response => {
  416. console.log(response)
  417. if(response.rows.length>0){
  418. this.payeeList = response.rows;
  419. response.rows.map((res,index) => {
  420. this.payeeList[index].text = res.payee;
  421. this.payeeList[index].value = res.id;
  422. })
  423. }
  424. });
  425. },
  426. payeeDictLabel(datas, value) {
  427. var actions = [];
  428. Object.keys(datas).some((key) => {
  429. if (datas[key].payeeId == ('' + value)) {
  430. actions.push(datas[key].payee);
  431. return true;
  432. }
  433. })
  434. return actions.join('');
  435. },
  436. onConfirmCapital(data){
  437. console.log(data)
  438. if (data.value != 2){
  439. this.capitalExpenditureOpen = false;
  440. this.projectForm = [];
  441. }else{
  442. this.capitalExpenditureOpen = true;
  443. }
  444. this.capitalExpenditureType = data.text;
  445. this.form.capitalExpenditureType = data.value;
  446. this.showcapital = false;
  447. },
  448. onConfirmFundType(data){
  449. console.log(data)
  450. this.projectForm.projectFundType = data.value;
  451. this.projectFundType = data.text;
  452. this.showFundType = false;
  453. },
  454. onConfirmProject(data){
  455. this.projectList.map(res => {
  456. if(res.projectName==data.text){
  457. this.projectForm.projectId = res.id
  458. this.projectForm.projectName = res.projectName
  459. this.projectForm.projectContractor = res.projectContractor
  460. this.projectForm.projectAmount = res.projectAmount
  461. }
  462. })
  463. this.showproject = false;
  464. },
  465. onConfirmPayee(data,index){
  466. console.log(data)
  467. for (var i = 0 ; i < this.chargeItme.length ; i++){
  468. this.chargeItme[i].showPayee = false;
  469. }
  470. this.chargeItme[index].payee = data.text;
  471. this.chargeItme[index].payeeId = data.value;
  472. this.payeeSelectChange(data.value , index)
  473. },
  474. onConfirmBankType(data,index){
  475. for (var i = 0 ; i < this.chargeItme.length ; i++){
  476. this.chargeItme[i].showbankType = false;
  477. }
  478. this.chargeItme[index].bankTypeText = data.text;
  479. this.chargeItme[index].bankType = data.value;
  480. this.chargeItme[index].showbankType = false;
  481. },
  482. onConfirmPayer(data){
  483. console.log(data)
  484. this.form.payer = data.text;
  485. this.form.cashierId = data.value;
  486. this.form.payerAccount = data.payeeAccount
  487. this.showpayer = false;
  488. //this.selectChange(data.value);
  489. this.accountTypeChange();
  490. },
  491. onConfirmLasj(data){
  492. this.form.applyDate = this.getNowFormatDate(data).substr(0,10);
  493. this.showlasj = false;
  494. },
  495. accountTypeChange(e){
  496. this.chargeItme = [];
  497. this.payeeList = [];
  498. let params = {
  499. villageAccountType : 1,
  500. status:'0',
  501. accountType : this.form.accountType,
  502. taccountId:this.form.cashierId
  503. }
  504. listVaccount(params).then(response => {
  505. console.log(response)
  506. if(response.rows.length>0){
  507. this.payeeList = response.rows;
  508. response.rows.map((res,index) => {
  509. this.payeeList[index].text = res.payee;
  510. this.payeeList[index].value = res.id;
  511. })
  512. }
  513. });
  514. },
  515. // 钱计算
  516. moneyChange(input) {
  517. console.log(input)
  518. let obj = {};
  519. obj = this.chargeItme.find((account) => {
  520. //model就是上面的数据源
  521. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  522. });
  523. let total = 0;
  524. this.chargeItme.forEach((money) => {
  525. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  526. });
  527. this.$set(this.form, "expenditureAmount", total);
  528. },
  529. goAdd(){
  530. if(this.chargeItme.length<1){
  531. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  532. return;
  533. }
  534. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  535. this.$notify({ type: 'danger', message: '转账附言禁止包含!' });
  536. return;
  537. }
  538. if(this.form.capitalExpenditureType==2){
  539. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  540. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  541. return;
  542. }
  543. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  544. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  545. return;
  546. }
  547. }
  548. if((this.uploadFiles==null||this.uploadFiles.length==0)&&(this.fileList==null||this.fileList.length==0)){
  549. Dialog.confirm({
  550. title: '提示',
  551. message: '此申请单中未上传任何附件,是否确认提交?',
  552. })
  553. .then(() => {
  554. this.$set(this.form, "payeeList", this.chargeItme);
  555. this.$set(this.form, "bankTypeList", this.chargeItme);
  556. this.$set(this.form, "accountTypeList", this.chargeItme);
  557. this.$set(this.form, "transferStatusList", this.chargeItme);
  558. updateTransfer(this.form).then(response => {
  559. this.projectForm.outId = this.form.id
  560. this.$set(this.projectForm, "ynType", '1');
  561. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  562. this.uploadFiles.map(rr => {
  563. const params = new FormData();
  564. params.append("tableId", this.form.id);
  565. params.append("tableName", "t_yinnong_transfer");
  566. params.append("bizPath", "upload");
  567. params.append("fileType", "0");
  568. params.append("file", rr);
  569. commonAttach(params).then((r) => {
  570. })
  571. })
  572. if(this.form.capitalExpenditureType==2){
  573. addProjectto(this.projectForm).then(res => {
  574. customSubmit(this.form.id).then(res => {
  575. this.$toast.success('提交成功');
  576. setTimeout(function(){
  577. history.go(-1)
  578. },2000)
  579. })
  580. })
  581. }else{
  582. customSubmit(this.form.id).then(res => {
  583. this.$toast.success('提交成功');
  584. setTimeout(function(){
  585. history.go(-1)
  586. },2000)
  587. })
  588. }
  589. }else{
  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. }
  608. });
  609. })
  610. .catch(() => {
  611. return false;
  612. });
  613. }else{
  614. this.$set(this.form, "payeeList", this.chargeItme);
  615. this.$set(this.form, "bankTypeList", this.chargeItme);
  616. this.$set(this.form, "accountTypeList", this.chargeItme);
  617. this.$set(this.form, "transferStatusList", this.chargeItme);
  618. updateTransfer(this.form).then(response => {
  619. this.projectForm.outId = this.form.id
  620. this.$set(this.projectForm, "ynType", '1');
  621. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  622. this.uploadFiles.map(rr => {
  623. const params = new FormData();
  624. params.append("tableId", this.form.id);
  625. params.append("tableName", "t_yinnong_transfer");
  626. params.append("bizPath", "upload");
  627. params.append("fileType", "0");
  628. params.append("file", rr);
  629. commonAttach(params).then((r) => {
  630. })
  631. })
  632. if(this.form.capitalExpenditureType==2){
  633. addProjectto(this.projectForm).then(res => {
  634. customSubmit(this.form.id).then(res => {
  635. this.$toast.success('提交成功');
  636. setTimeout(function(){
  637. history.go(-1)
  638. },2000)
  639. })
  640. })
  641. }else{
  642. customSubmit(this.form.id).then(res => {
  643. this.$toast.success('提交成功');
  644. setTimeout(function(){
  645. history.go(-1)
  646. },2000)
  647. })
  648. }
  649. }else{
  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. }
  668. });
  669. }
  670. },
  671. goUpdate(){
  672. if(this.chargeItme.length<1){
  673. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  674. return;
  675. }
  676. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  677. this.$notify({ type: 'danger', message: '转账附言禁止包含!' });
  678. return;
  679. }
  680. if(this.form.capitalExpenditureType==2){
  681. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  682. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  683. return;
  684. }
  685. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  686. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  687. return;
  688. }
  689. }
  690. this.$set(this.form, "payeeList", this.chargeItme);
  691. this.$set(this.form, "bankTypeList", this.chargeItme);
  692. this.$set(this.form, "accountTypeList", this.chargeItme);
  693. this.$set(this.form, "transferStatusList", this.chargeItme);
  694. updateTransfer(this.form).then((response) => {
  695. this.projectForm.outId = this.form.id
  696. this.$set(this.projectForm, "ynType", '1');
  697. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  698. console.log(this.uploadFiles)
  699. this.uploadFiles.map(rr => {
  700. const params = new FormData();
  701. params.append("tableId", this.form.id);
  702. params.append("tableName", "t_yinnong_transfer");
  703. params.append("bizPath", "upload");
  704. params.append("fileType", "0");
  705. params.append("file", rr);
  706. commonAttach(params).then((r) => {
  707. })
  708. })
  709. if(this.form.capitalExpenditureType==2){
  710. addProjectto(this.projectForm).then(res => {
  711. this.$toast.success('保存成功');
  712. setTimeout(function(){
  713. history.go(-1)
  714. },2000)
  715. })
  716. }else{
  717. this.$toast.success('保存成功');
  718. setTimeout(function(){
  719. history.go(-1)
  720. },2000)
  721. }
  722. }else{
  723. if(this.form.capitalExpenditureType==2){
  724. addProjectto(this.projectForm).then(res => {
  725. this.$toast.success('保存成功');
  726. setTimeout(function(){
  727. history.go(-1)
  728. },2000)
  729. })
  730. }else{
  731. this.$toast.success('保存成功');
  732. setTimeout(function(){
  733. history.go(-1)
  734. },2000)
  735. }
  736. }
  737. });
  738. },
  739. payeeSelectChange(select, i) {
  740. let obj = {};
  741. let fuzhitype = 0;
  742. obj = this.payeeList.find((account) => {
  743. //model就是上面的数据源
  744. return account.id === select ; //筛选出匹配数据
  745. });
  746. if(this.chargeItme != [] && this.chargeItme.length>1){
  747. this.chargeItme.some((value, index) => {
  748. if(value.payeeAccount != undefined &&value.payeeAccount != '' && obj.payeeAccount == value.payeeAccount&&index!=i){
  749. fuzhitype = 2;
  750. return true;
  751. }
  752. if(value.accountType != undefined &&value.accountType != '' && obj.accountType != value.accountType&&index!=i){
  753. fuzhitype = 1;
  754. return true;
  755. }
  756. });
  757. }
  758. if(fuzhitype == 0){
  759. this.$set(this.chargeItme[i], "payee",obj.payee)
  760. this.$set(this.chargeItme[i], "bankType", obj.bankType)
  761. this.$set(this.chargeItme[i], "payeeId", obj.id);
  762. this.$set(this.chargeItme[i], "payeeAccount", obj.payeeAccount);
  763. this.$set(this.chargeItme[i], "bankDeposit", obj.bankDeposit);
  764. this.$set(this.chargeItme[i], "accountType", obj.accountType);
  765. }else if(fuzhitype == 1){
  766. this.$set(this.chargeItme[i], "payee",'')
  767. this.$set(this.chargeItme[i], "bankType",'')
  768. this.$set(this.chargeItme[i], "payeeId", '');
  769. this.$set(this.chargeItme[i], "payeeAccount", '');
  770. this.$set(this.chargeItme[i], "bankDeposit", '');
  771. this.$set(this.chargeItme[i], "accountType", '');
  772. this.$notify({ type: 'danger', message: '请选择账户类型相同的收款方!' });
  773. }else if(fuzhitype == 2){
  774. this.$set(this.chargeItme[i], "payee",'')
  775. this.$set(this.chargeItme[i], "bankType",'')
  776. this.$set(this.chargeItme[i], "payeeId", '');
  777. this.$set(this.chargeItme[i], "payeeAccount", '');
  778. this.$set(this.chargeItme[i], "bankDeposit", '');
  779. this.$set(this.chargeItme[i], "accountType", '');
  780. this.$notify({ type: 'danger', message: '收款方已存在!' });
  781. }
  782. },
  783. selectChange(select) {
  784. let obj = {};
  785. obj = this.payerOptions.find((account) => {
  786. //model就是上面的数据源
  787. return account.id === select; //筛选出匹配数据
  788. });
  789. if(obj.payerFrom==1&&obj.operatorCode != null && obj.operatorCode != "" &&
  790. obj.enterpriseCode != null && obj.enterpriseCode != "" &&
  791. obj.accountPassword != null && obj.accountPassword != ""){
  792. this.$set(this.form, "bookId", obj.bookId);
  793. this.$set(this.form, "deptId", obj.deptId);
  794. this.$set(this.form, "cashierId", obj.id);
  795. this.$set(this.form, "payer", obj.accountName);
  796. this.$set(this.form, "payerAccount", obj.bankAccountNumber);
  797. this.$set(this.form, "operatorCode", obj.operatorCode);
  798. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  799. this.$set(this.form, "payerFrom", '1');
  800. }else{
  801. if(obj.payerFrom==1){
  802. this.diglogStatus = false;
  803. this.$notify({ type: 'danger', message: "请完善付款方“操作员代码”、“企业编码”、“支付口令”等信息!" });
  804. this.$set(this.form,"payer","")
  805. this.$set(this.form,"payerAccount","")
  806. }else{
  807. this.$set(this.form, "payerFrom", obj.parerFrom);
  808. if(obj.operatorCode!=null&&obj.operatorCode!=''){
  809. this.$set(this.form, "operatorCode", obj.operatorCode);
  810. }else{
  811. this.$set(this.form, "operatorCode", '');
  812. }
  813. if(obj.enterpriseCode!=null&&obj.enterpriseCode!=''){
  814. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  815. }else{
  816. this.$set(this.form, "enterpriseCode", '');
  817. }
  818. if(obj.accountPassword!=null&&obj.accountPassword!=''){
  819. this.$set(this.form, "accountPassword", obj.accountPassword);
  820. }else{
  821. this.$set(this.form, "accountPassword", '');
  822. }
  823. this.$set(this.form, "bookId",'');
  824. this.$set(this.form, "deptId", '');
  825. this.$set(this.form, "cashierId", obj.id);
  826. this.$set(this.form, "payer", obj.accountName);
  827. if(obj.payerFrom==6){
  828. getQmyeFlow(obj.bankAccountNumber).then((response) => {
  829. this.$set(this.form, "payerAccount", response.data);
  830. });
  831. }else {
  832. this.$set(this.form, "payerAccount", obj.bankAccountNumber);
  833. }
  834. }
  835. }
  836. },
  837. beforeRead(file) {
  838. this.uploadFiles.push(file.file);
  839. },
  840. deleteFile(file){
  841. console.log(file)
  842. this.uploadFiles.map((response,index) => {
  843. if(file.file == response){
  844. this.uploadFiles.splice(index,1)
  845. }
  846. })
  847. if(file.id){
  848. systemAttachment(file.id).then((res) => {
  849. });
  850. }
  851. },
  852. getFileList(){
  853. let oData= {
  854. tableId: this.$route.query.id,
  855. tableName: "t_yinnong_transfer",
  856. bizPath: "upload",
  857. fileType: "0",
  858. }
  859. attachmentList(oData).then(res => {
  860. console.log(res)
  861. console.log(location.protocol+"//"+location.host+request.defaults.baseURL)
  862. res.rows.map(r => {
  863. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  864. this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{}),"id":r.id})
  865. console.log(r)
  866. })
  867. })
  868. },
  869. goBack(){
  870. window.history.go(-1)
  871. },
  872. //删除家庭成员
  873. deleteChargeItme(index){
  874. this.chargeItme.splice(index,1)
  875. },
  876. },
  877. }
  878. </script>
  879. <style scoped lang="scss">
  880. .app-container {
  881. padding: 2% 0;
  882. }
  883. .main_title{
  884. font-size: 0.4rem;
  885. color: #1D6FE9;
  886. margin: 0.2rem 6%;
  887. position: relative;
  888. }
  889. .main_box{
  890. width: 96%;
  891. margin: 0 auto;
  892. border-radius: 6px;
  893. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  894. overflow: hidden;
  895. background-color: #FFF;
  896. }
  897. .submitButton{
  898. width: 80%;
  899. margin: 0 auto;
  900. background-color: #1D6FE9;
  901. }
  902. .addFamily{
  903. position: absolute;
  904. top: -2px;
  905. right: 0;
  906. border-radius: 50%;
  907. }
  908. .deleteFamily{
  909. position: absolute;
  910. top: 0rem;
  911. right: 6%;
  912. z-index: 9;
  913. border-radius: 50%;
  914. }
  915. </style>