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

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