移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

929 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. clickable
  198. label="所属银行"
  199. placeholder="请选择"
  200. v-model="item.bankTypeText"
  201. @click="item.showbankType = true"
  202. input-align="right"
  203. required
  204. :rules="[{ required: true , message:'请选择所属银行' }]"
  205. />
  206. </div>
  207. </div>
  208. <p class="main_title">上传附件</p>
  209. <div class="main_box" style="padding: 5px 0 0 8px;">
  210. <van-uploader v-model="fileList" :after-read="beforeRead" @delete="deleteFile"></van-uploader>
  211. </div>
  212. <div style="padding: 16px 0;">
  213. <van-row>
  214. <van-col span="12" align="center">
  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. <van-button type="info" native-type="submit" @click="buttonType='add'" class="submitButton">保存并提交</van-button>
  219. </van-col>
  220. </van-row>
  221. <div class="clear"></div>
  222. </div>
  223. </van-form>
  224. </div>
  225. </template>
  226. <script>
  227. import { getAccount , getTransfer , queryTransferDetail , listPayee , updateTransfer , getProjectto , listProject , addProjectto , customSubmit ,getQmyeFlow} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  228. import request from '@/utils/request';
  229. import {
  230. addTransfer,
  231. attachmentList,
  232. commonAttach, listTaccount,
  233. listVaccount, systemAttachment
  234. } from "../../../../api/onlineHome/bankAgriculture/paymentApproval";
  235. import Dialog from "vant/lib/dialog";
  236. export default {
  237. name: "approvalModify5",
  238. data() {
  239. return {
  240. showcapital:false,
  241. showpayee:false,
  242. showlasj:false,
  243. showbankType:false,
  244. showproject:false,
  245. showFundType:false,
  246. showpayer:false,
  247. minDate: new Date(2000, 1, 1),
  248. maxDate: new Date(2050, 12, 31),
  249. currentDate: new Date(),
  250. form:{},
  251. capitalExpenditureType:'',
  252. payee:'',
  253. bankType:'',
  254. buttonType:'a',
  255. wfydlxDictionaries:[],
  256. jglxDictionaries:[],
  257. sysDictionaries:[],
  258. capitalExpenditureTypeOptions:[],
  259. bankTypeDictionaries:[],
  260. projectList:[],
  261. projectFundTypeOptions:[],
  262. projectFundTypeDictionaries:[],
  263. projectListShow:[],
  264. payerOptions:[],
  265. chargeItme:[],
  266. chargeItmeShow:[],
  267. payeeList:[],
  268. // 查询参数
  269. queryParams: {
  270. transferType:"",
  271. orderByColumn: "id",
  272. isAsc: "desc",
  273. },
  274. capitalExpenditureOpen:false,
  275. projectForm:{
  276. projectId:null,
  277. projectName:null,
  278. projectContractor:null,
  279. projectAmount:null,
  280. projectBillNum:null,
  281. projectFundType:'1',
  282. outId:null,
  283. ynType:'1'
  284. },
  285. projectFundType:'',
  286. fileList:[],
  287. uploadFiles:[],
  288. };
  289. },
  290. created() {
  291. let queryParams={
  292. pageNum: 1,
  293. pageSize: 100,
  294. }
  295. listProject(queryParams).then(response => {
  296. this.projectList = response.rows;
  297. for (var i = 0; i < response.rows.length; i++) {
  298. this.projectListShow.push({text: response.rows[i].projectName, value: response.rows[i].id});
  299. }
  300. });
  301. this.getDicts("project_fund_type").then((response) => {
  302. for (var i = 0; i < response.data.length; i++) {
  303. this.projectFundTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  304. }
  305. this.projectFundTypeDictionaries = response.data;
  306. });
  307. let params1={
  308. townAccountType:'2'
  309. }
  310. listTaccount(params1).then((response) => {
  311. response.rows.map((res,index) => {
  312. if(res.townAccountType=='2'){
  313. res['payerFrom'] = '2'
  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. this.getPayeeList();
  349. });
  350. queryTransferDetail(this.$route.query.id).then((response) => {
  351. this.getDicts("bank_type").then(res => {
  352. for (var i = 0; i < res.data.length; i++) {
  353. this.bankTypeDictionaries.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  354. }
  355. for (var j = 0 ; j < response.rows.length ; j++){
  356. // response.rows[j].payeeText = response.rows[j].payee;
  357. response.rows[j].bankTypeText = this.selectDictLabel(res.data, response.rows[j].bankType);
  358. response.rows[j].showPayee = false;
  359. }
  360. this.chargeItme = response.rows;
  361. });
  362. });
  363. },
  364. getChange(){
  365. if(this.buttonType == 'update'){
  366. this.goUpdate();
  367. }else if(this.buttonType == 'add'){
  368. this.goAdd();
  369. }
  370. },
  371. getError(e){
  372. this.$notify({ type: 'danger', message: e.errors[0].message });
  373. },
  374. addChargeItme(index){
  375. if(this.chargeItme.length>0&&this.chargeItme[this.chargeItme.length-1].payee == ''){
  376. this.$notify({ type: 'danger', message: '请勿添加多个空列表信息' });
  377. return;
  378. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].incomeAmount == ''){
  379. this.$notify({ type: 'danger', message: '请输入收入金额!' });
  380. return;
  381. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].payeeAccount == ''){
  382. this.$notify({ type: 'danger', message: '请输入收款账户!' });
  383. return;
  384. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankDeposit == ''){
  385. this.$notify({ type: 'danger', message: '请输入开户银行!' });
  386. return;
  387. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].bankType == ''){
  388. this.$notify({ type: 'danger', message: '请选择所属银行!' });
  389. return;
  390. }
  391. this.getDicts("bank_type").then(res => {
  392. this.chargeItme.splice(index + 1, 0, {
  393. payeeId: "", //收款方ID
  394. payee: "", //收款方
  395. payeeAccount: "", //收款账户
  396. bankDeposit: "", //开户银行
  397. incomeAmount: "", //收入金额
  398. bankType: "", //所属银行
  399. bankTypeText: "", //所属银行
  400. showPayee:false,
  401. showbankType:false
  402. });
  403. });
  404. },
  405. getPayeeList() {
  406. //普通转账
  407. this.queryParams.accountType = this.form.accountType
  408. this.queryParams.status = "0"
  409. if(this.form.cashierId==null||this.form.cashierId==""){
  410. this.$notify({ type: 'danger', message: '请先选择付款方!' });
  411. return;
  412. }else {
  413. this.queryParams.taccountId = parseInt(this.form.cashierId)
  414. listVaccount(this.queryParams).then((response) => {
  415. this.payeeList = response.rows;
  416. response.rows.map((res,index) => {
  417. this.payeeList[index].text = res.payee;
  418. this.payeeList[index].value = res.id;
  419. })
  420. });
  421. }
  422. },
  423. payeeDictLabel(datas, value) {
  424. var actions = [];
  425. Object.keys(datas).some((key) => {
  426. if (datas[key].payeeId == ('' + value)) {
  427. actions.push(datas[key].payee);
  428. return true;
  429. }
  430. })
  431. return actions.join('');
  432. },
  433. onConfirmCapital(data){
  434. if (data.value != 2){
  435. this.capitalExpenditureOpen = false;
  436. this.projectForm = [];
  437. }else{
  438. this.capitalExpenditureOpen = true;
  439. }
  440. this.capitalExpenditureType = data.text;
  441. this.form.capitalExpenditureType = data.value;
  442. this.showcapital = false;
  443. },
  444. onConfirmFundType(data){
  445. console.log(data)
  446. this.projectForm.projectFundType = data.value;
  447. this.projectFundType = data.text;
  448. this.showFundType = false;
  449. },
  450. onConfirmProject(data){
  451. this.projectList.map(res => {
  452. if(res.projectName==data.text){
  453. this.projectForm.projectId = res.id
  454. this.projectForm.projectName = res.projectName
  455. this.projectForm.projectContractor = res.projectContractor
  456. this.projectForm.projectAmount = res.projectAmount
  457. }
  458. })
  459. this.showproject = false;
  460. },
  461. onConfirmPayee(data,index){
  462. console.log(data)
  463. for (var 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.payeeSelectChange(data.value , index)
  469. this.onConfirmBankType(data,index)
  470. },
  471. onConfirmBankType(data,index){
  472. console.log(this.bankTypeDictionaries)
  473. this.bankTypeDictionaries.map(res => {
  474. if(res.value==data.bankType){
  475. this.chargeItme[index].bankTypeText = res.text;
  476. this.chargeItme[index].bankType = res.value;
  477. }
  478. })
  479. },
  480. onConfirmPayer(data){
  481. this.form.payer = data.text;
  482. this.form.cashierId = data.value;
  483. this.showpayer = false;
  484. this.selectChange(data.value)
  485. },
  486. onConfirmLasj(data){
  487. this.form.applyDate = this.getNowFormatDate(data).substr(0,10);
  488. this.showlasj = false;
  489. },
  490. accountTypeChange(e){
  491. this.payeeList = [];
  492. this.chargeItme = [];
  493. this.queryParams.accountType = this.form.accountType
  494. if(this.form.cashierId==null||this.form.cashierId==""){
  495. this.$notify({ type: 'danger', message: '请先选择付款方!' });
  496. return;
  497. }else {
  498. this.queryParams.taccountId = parseInt(this.form.cashierId)
  499. console.log(this.queryParams)
  500. listVaccount(this.queryParams).then((response) => {
  501. this.payeeList = response.rows;
  502. response.rows.map((res,index) => {
  503. this.payeeList[index].text = res.payee;
  504. this.payeeList[index].value = res.id;
  505. })
  506. });
  507. }
  508. },
  509. // 钱计算
  510. moneyChange(input) {
  511. console.log(input)
  512. let obj = {};
  513. obj = this.chargeItme.find((account) => {
  514. //model就是上面的数据源
  515. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  516. });
  517. let total = 0;
  518. this.chargeItme.forEach((money) => {
  519. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  520. });
  521. this.$set(this.form, "expenditureAmount", total);
  522. },
  523. goAdd(){
  524. if(this.chargeItme.length<1){
  525. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  526. return;
  527. }
  528. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  529. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  530. return;
  531. }
  532. if(this.form.capitalExpenditureType==2){
  533. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  534. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  535. return;
  536. }
  537. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  538. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  539. return;
  540. }
  541. }
  542. if((this.uploadFiles==null||this.uploadFiles.length==0)&&(this.fileList==null||this.fileList.length==0)){
  543. Dialog.confirm({
  544. title: '提示',
  545. message: '此申请单中未上传任何附件,是否确认提交?',
  546. })
  547. .then(() => {
  548. this.$set(this.form, "payeeList", this.chargeItme);
  549. this.$set(this.form, "bankTypeList", this.chargeItme);
  550. this.$set(this.form, "accountTypeList", this.chargeItme);
  551. this.$set(this.form, "transferStatusList", this.chargeItme);
  552. updateTransfer(this.form).then(response => {
  553. this.projectForm.outId = this.form.id
  554. this.$set(this.projectForm, "ynType", '1');
  555. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  556. this.uploadFiles.map(rr => {
  557. const params = new FormData();
  558. params.append("tableId", this.form.id);
  559. params.append("tableName", "t_yinnong_transfer");
  560. params.append("bizPath", "upload");
  561. params.append("fileType", "0");
  562. params.append("file", rr);
  563. commonAttach(params).then((r) => {
  564. })
  565. })
  566. if(this.form.capitalExpenditureType==2){
  567. addProjectto(this.projectForm).then(res => {
  568. customSubmit(this.form.id).then(res => {
  569. this.$toast.success('提交成功');
  570. setTimeout(function(){
  571. history.go(-1)
  572. },2000)
  573. })
  574. })
  575. }else{
  576. customSubmit(this.form.id).then(res => {
  577. this.$toast.success('提交成功');
  578. setTimeout(function(){
  579. history.go(-1)
  580. },2000)
  581. })
  582. }
  583. }else{
  584. if(this.form.capitalExpenditureType==2){
  585. addProjectto(this.projectForm).then(res => {
  586. customSubmit(this.form.id).then(res => {
  587. this.$toast.success('提交成功');
  588. setTimeout(function(){
  589. history.go(-1)
  590. },2000)
  591. })
  592. })
  593. }else{
  594. customSubmit(this.form.id).then(res => {
  595. this.$toast.success('提交成功');
  596. setTimeout(function(){
  597. history.go(-1)
  598. },2000)
  599. })
  600. }
  601. }
  602. });
  603. })
  604. .catch(() => {
  605. return false;
  606. });
  607. }else{
  608. this.$set(this.form, "payeeList", this.chargeItme);
  609. this.$set(this.form, "bankTypeList", this.chargeItme);
  610. this.$set(this.form, "accountTypeList", this.chargeItme);
  611. this.$set(this.form, "transferStatusList", this.chargeItme);
  612. updateTransfer(this.form).then(response => {
  613. this.projectForm.outId = this.form.id
  614. this.$set(this.projectForm, "ynType", '1');
  615. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  616. this.uploadFiles.map(rr => {
  617. const params = new FormData();
  618. params.append("tableId", this.form.id);
  619. params.append("tableName", "t_yinnong_transfer");
  620. params.append("bizPath", "upload");
  621. params.append("fileType", "0");
  622. params.append("file", rr);
  623. commonAttach(params).then((r) => {
  624. })
  625. })
  626. if(this.form.capitalExpenditureType==2){
  627. addProjectto(this.projectForm).then(res => {
  628. customSubmit(this.form.id).then(res => {
  629. this.$toast.success('提交成功');
  630. setTimeout(function(){
  631. history.go(-1)
  632. },2000)
  633. })
  634. })
  635. }else{
  636. customSubmit(this.form.id).then(res => {
  637. this.$toast.success('提交成功');
  638. setTimeout(function(){
  639. history.go(-1)
  640. },2000)
  641. })
  642. }
  643. }else{
  644. if(this.form.capitalExpenditureType==2){
  645. addProjectto(this.projectForm).then(res => {
  646. customSubmit(this.form.id).then(res => {
  647. this.$toast.success('提交成功');
  648. setTimeout(function(){
  649. history.go(-1)
  650. },2000)
  651. })
  652. })
  653. }else{
  654. customSubmit(this.form.id).then(res => {
  655. this.$toast.success('提交成功');
  656. setTimeout(function(){
  657. history.go(-1)
  658. },2000)
  659. })
  660. }
  661. }
  662. });
  663. }
  664. },
  665. goUpdate(){
  666. if(this.chargeItme.length<1){
  667. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  668. return;
  669. }
  670. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  671. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  672. return;
  673. }
  674. if(this.form.capitalExpenditureType==2){
  675. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  676. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  677. return;
  678. }
  679. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  680. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  681. return;
  682. }
  683. }
  684. this.$set(this.form, "payeeList", this.chargeItme);
  685. this.$set(this.form, "bankTypeList", this.chargeItme);
  686. this.$set(this.form, "accountTypeList", this.chargeItme);
  687. this.$set(this.form, "transferStatusList", this.chargeItme);
  688. updateTransfer(this.form).then((response) => {
  689. this.projectForm.outId = this.form.id
  690. this.$set(this.projectForm, "ynType", '1');
  691. if(this.uploadFiles!=null&&this.uploadFiles.length>0){
  692. console.log(this.uploadFiles)
  693. this.uploadFiles.map(rr => {
  694. const params = new FormData();
  695. params.append("tableId", this.form.id);
  696. params.append("tableName", "t_yinnong_transfer");
  697. params.append("bizPath", "upload");
  698. params.append("fileType", "0");
  699. params.append("file", rr);
  700. commonAttach(params).then((r) => {
  701. })
  702. })
  703. if(this.form.capitalExpenditureType==2){
  704. addProjectto(this.projectForm).then(res => {
  705. this.$toast.success('保存成功');
  706. setTimeout(function(){
  707. history.go(-1)
  708. },2000)
  709. })
  710. }else{
  711. this.$toast.success('保存成功');
  712. setTimeout(function(){
  713. history.go(-1)
  714. },2000)
  715. }
  716. }else{
  717. if(this.form.capitalExpenditureType==2){
  718. addProjectto(this.projectForm).then(res => {
  719. this.$toast.success('保存成功');
  720. setTimeout(function(){
  721. history.go(-1)
  722. },2000)
  723. })
  724. }else{
  725. this.$toast.success('保存成功');
  726. setTimeout(function(){
  727. history.go(-1)
  728. },2000)
  729. }
  730. }
  731. });
  732. },
  733. payeeSelectChange(select, i) {
  734. let obj = {};
  735. let fuzhitype = 0;
  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. console.log(file)
  836. this.uploadFiles.map((response,index) => {
  837. if(file.file == response){
  838. this.uploadFiles.splice(index,1)
  839. }
  840. })
  841. if(file.id){
  842. systemAttachment(file.id).then((res) => {
  843. });
  844. }
  845. },
  846. getFileList(){
  847. let oData= {
  848. tableId: this.$route.query.id,
  849. tableName: "t_yinnong_transfer",
  850. bizPath: "upload",
  851. fileType: "0",
  852. }
  853. attachmentList(oData).then(res => {
  854. console.log(res)
  855. console.log(location.protocol+"//"+location.host+request.defaults.baseURL)
  856. res.rows.map(r => {
  857. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  858. this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{}),"id":r.id})
  859. console.log(r)
  860. })
  861. })
  862. },
  863. goBack(){
  864. window.history.go(-1)
  865. },
  866. //删除家庭成员
  867. deleteChargeItme(index){
  868. this.chargeItme.splice(index,1)
  869. },
  870. },
  871. }
  872. </script>
  873. <style scoped lang="scss">
  874. .app-container {
  875. padding: 2% 0;
  876. }
  877. .main_title{
  878. font-size: 0.4rem;
  879. color: #1D6FE9;
  880. margin: 0.2rem 6%;
  881. position: relative;
  882. }
  883. .main_box{
  884. width: 96%;
  885. margin: 0 auto;
  886. border-radius: 6px;
  887. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  888. overflow: hidden;
  889. background-color: #FFF;
  890. }
  891. .submitButton{
  892. width: 80%;
  893. margin: 0 auto;
  894. background-color: #1D6FE9;
  895. }
  896. .addFamily{
  897. position: absolute;
  898. top: -2px;
  899. right: 0;
  900. border-radius: 50%;
  901. }
  902. .deleteFamily{
  903. position: absolute;
  904. top: 0rem;
  905. right: 6%;
  906. z-index: 9;
  907. border-radius: 50%;
  908. }
  909. </style>