移动端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

900 rindas
33 KiB

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