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

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