移动端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

1113 řádky
43 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.approvalMode" 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="projectList"
  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" v-if="contractOpen">关联合同</p>
  142. <div class="main_box" v-if="contractOpen" style="margin-bottom: 10px;margin-top: 10px;position:relative;">
  143. <van-field
  144. readonly
  145. clickable
  146. label="合同"
  147. placeholder="请选择"
  148. v-model="infoForm.name"
  149. @click="showcontract = true"
  150. input-align="right"
  151. right-icon="arrow-down"
  152. required
  153. :rules="[{ required: true , message:'请选择项目名称' }]"
  154. />
  155. <van-popup v-model="showcontract" position="bottom">
  156. <van-picker
  157. show-toolbar
  158. :columns="infoList"
  159. @confirm="onConfirmContract"
  160. @cancel="showcontract = false"
  161. />
  162. </van-popup>
  163. <van-field required :rules="[{ required: true , message:'请输入合同编码' }]" v-model="infoForm.code" label="合同编码" placeholder="请输入合同编码" input-align="right" label-width="auto"/>
  164. <van-field required :rules="[{ required: true , message:'请输入合同价款' }]" v-model="infoForm.totalAmount" label="合同价款(元)" placeholder="请输入合同价款(元)" input-align="right" label-width="auto"/>
  165. </div>
  166. <p class="main_title">付款方信息</p>
  167. <div class="main_box">
  168. <!-- <van-field label="付款方" v-model="form.payer" placeholder="请输入付款方" input-align="right" label-width="auto"/>-->
  169. <van-field
  170. readonly
  171. clickable
  172. label="付款方"
  173. placeholder="请选择付款方"
  174. v-model="form.payer"
  175. @click="showpayer = true"
  176. input-align="right"
  177. right-icon="arrow-down"
  178. label-width="auto"
  179. required
  180. :rules="[{ required: true , message:'请选择付款方' }]"
  181. />
  182. <van-popup v-model="showpayer" position="bottom">
  183. <van-picker
  184. show-toolbar
  185. :columns="payerOptions"
  186. @confirm="onConfirmPayer($event)"
  187. @cancel="showpayer = false"
  188. />
  189. </van-popup>
  190. <van-field :rules="[{ required: true , message:'可用余额不能为空' }]" required label="可用余额(元)" v-model="form.payerAccount" placeholder="请输入可用余额" input-align="right" label-width="auto"/>
  191. </div>
  192. <p class="main_title">收款方信息<van-button icon="plus" @click="addChargeItme(chargeItme.length)" size="mini" type="info" native-type="button" class="addFamily"/></p>
  193. <div :style="{position:'relative',padding: index == 0 ? '':'10px 0 0 0'}" v-for="(item, index) in chargeItme" :key="index">
  194. <van-button icon="minus" size="mini" type="danger" class="deleteFamily" native-type="button" v-if="index!=0" @click="deleteChargeItme(index)" />
  195. <div class="main_box" style="margin-bottom: 10px;position:relative;">
  196. <van-field required :rules="[{ required: true , message:'请输入收款方全称' }]" v-model="item.payee" label="收款方" placeholder="请输入收款方全称" input-align="right" label-width="auto"/>
  197. <van-field required :rules="[{ required: true , message:'请输入提款人' }]" v-model="item.drawer" label="提款人" placeholder="请输入提款人" input-align="right" label-width="auto"/>
  198. <van-field required :rules="[{ required: true , message:'请输入提款金额' }]" v-model="item.incomeAmount" type="number" label="提款金额(元)" placeholder="请输入提款金额" input-align="right" label-width="auto"/>
  199. <van-field required :rules="[{ required: true , message:'请输入资金用途' }]" v-model="item.remark" label="资金用途" placeholder="请输入资金用途" input-align="right" label-width="auto" />
  200. </div>
  201. </div>
  202. <p class="main_title">上传附件(收据)</p>
  203. <div class="main_box" style="padding: 5px 0 0 8px;">
  204. <van-uploader v-model="fileList1" :after-read="beforeRead1" @delete="deleteFile1"></van-uploader>
  205. </div>
  206. <p class="main_title">上传附件(发票)</p>
  207. <div class="main_box" style="padding: 5px 0 0 8px;">
  208. <van-uploader v-model="fileList2" :after-read="beforeRead2" @delete="deleteFile2"></van-uploader>
  209. </div>
  210. <p class="main_title">上传附件(其他)</p>
  211. <div class="main_box" style="padding: 5px 0 0 8px;">
  212. <van-uploader v-model="fileList3" :after-read="beforeRead3" @delete="deleteFile3"></van-uploader>
  213. </div>
  214. <div style="padding: 16px 0;">
  215. <van-row>
  216. <van-col span="12" align="center">
  217. <!-- @click="goUpdate"-->
  218. <van-button type="info" native-type="submit" @click="buttonType='update'" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  219. </van-col>
  220. <van-col span="12" align="center">
  221. <!-- @click="goAdd"-->
  222. <van-button type="info" native-type="submit" @click="buttonType='add'" class="submitButton">保存并提交</van-button>
  223. </van-col>
  224. </van-row>
  225. <div class="clear"></div>
  226. </div>
  227. </van-form>
  228. </div>
  229. </template>
  230. <script>
  231. import { addTransfer , listPayee , updateTransfer , getProjectto , listProject , addProjectto , cashSubmit , getAccount ,getQmyeFlow,listInfo ,getInfoto ,addInfoto} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  232. import request from '@/utils/request'
  233. import {
  234. addCash,
  235. addCashdetail, attachmentList,
  236. commonAttach, listAccount,
  237. updateCash
  238. } from "../../../../api/onlineHome/bankAgriculture/paymentApproval";
  239. import Dialog from "vant/lib/dialog";
  240. export default {
  241. name: "approvalAdd11",
  242. data() {
  243. return {
  244. showcontract:false,
  245. showcapital:false,
  246. showpayee:false,
  247. showlasj:false,
  248. showbankType:false,
  249. showproject:false,
  250. showFundType:false,
  251. showpayer:false,
  252. buttonType:'a',
  253. minDate: new Date(2000, 1, 1),
  254. maxDate: new Date(2050, 12, 31),
  255. currentDate: new Date(),
  256. form:{},
  257. fileList1:[],
  258. fileList2:[],
  259. fileList3:[],
  260. capitalExpenditureType:'',
  261. payee:'',
  262. bankType:'',
  263. wfydlxDictionaries:[],
  264. jglxDictionaries:[],
  265. sysDictionaries:[],
  266. capitalExpenditureTypeOptions:[],
  267. bankTypeDictionaries:[],
  268. projectFundTypeOptions:[],
  269. projectFundTypeDictionaries:[],
  270. projectList:[],
  271. infoList:[],
  272. payerOptions:[],
  273. chargeItme:[],
  274. chargeItmeShow:[],
  275. payeeList:[],
  276. // 查询参数
  277. queryParams: {
  278. cashType:11,
  279. orderByColumn: "id",
  280. isAsc: "desc",
  281. },
  282. capitalExpenditureOpen:false,
  283. contractOpen:false,
  284. projectForm:{
  285. projectId:null,
  286. projectName:null,
  287. projectContractor:null,
  288. projectAmount:null,
  289. projectBillNum:null,
  290. projectFundType:'1',
  291. outId:null,
  292. ynType:'2'
  293. },
  294. infoForm:{
  295. infoId:null,
  296. name:null,
  297. code:null,
  298. totalAmount:null,
  299. contractionId:null,
  300. transferId:null
  301. },
  302. // 合同信息查询参数
  303. queryContractionParams: {
  304. pageNum: 1,
  305. pageSize: 100,
  306. contractionStatus: '1',
  307. orderByColumn: "endTime",
  308. isAsc: "desc",
  309. },
  310. projectFundType:'',
  311. uploadFiles1:[],
  312. uploadFiles2:[],
  313. uploadFiles3:[],
  314. nowDate:""
  315. };
  316. },
  317. created() {
  318. this.getNowDate();
  319. this.reset();
  320. this.initProjectInfo();
  321. this.getDicts("project_fund_type").then((response) => {
  322. for (var i = 0; i < response.data.length; i++) {
  323. this.projectFundTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  324. }
  325. this.projectFundTypeDictionaries = response.data;
  326. });
  327. let queryParamsOld={
  328. accountType: "101",
  329. status: "N",
  330. }
  331. listAccount(queryParamsOld).then((response) => {
  332. response.rows.map(res => {
  333. res['accountName'] = this.$store.state.user.bookName
  334. res['id'] = this.$store.state.user.loginBookId
  335. res['text'] = this.$store.state.user.bookName
  336. res['value'] = this.$store.state.user.loginBookId
  337. res['bankAccountNumber'] = res.id
  338. res['payerFrom'] = '6'
  339. this.payerOptions.push(res)
  340. })
  341. });
  342. this.getDictionaries();
  343. this.addChargeItme();
  344. },
  345. methods: {
  346. getNowDate(){
  347. var _this = this;
  348. let yy = new Date().getFullYear();
  349. let mm = new Date().getMonth()+1;
  350. let dd = new Date().getDate();
  351. _this.nowDate = yy+'-'+mm+'-'+dd
  352. },
  353. initProjectInfo(){
  354. let _this = this
  355. let queryParams={
  356. pageNum: 1,
  357. pageSize: 100,
  358. }
  359. listProject(queryParams).then(response => {
  360. _this.projectList = response.rows;
  361. console.log(response)
  362. for (let i = 0; i < response.rows.length; i++) {
  363. //_this.projectList[i].set({text: response.rows[i].projectName, value: response.rows[i].id});
  364. _this.$set(_this.projectList[i],"text",response.rows[i].projectName)
  365. _this.$set(_this.projectList[i],"value",response.rows[i].id)
  366. }
  367. });
  368. listInfo(this.queryContractionParams).then(response => {
  369. console.log(response)
  370. _this.infoList = response.rows;
  371. for (let i = 0; i < response.rows.length; i++) {
  372. //_this.infoList[i].push({text: response.rows[i].name, value: response.rows[i].code});
  373. _this.$set(_this.infoList[i],"text",response.rows[i].name)
  374. _this.$set(_this.infoList[i],"value",response.rows[i].code)
  375. }
  376. });
  377. },
  378. // 表单重置
  379. reset() {
  380. this.form = {
  381. id: null,
  382. upId: null,
  383. applyDate:this.nowDate,
  384. approvalMode:'1',
  385. downId: null,
  386. orderId: null,
  387. cashierId: null,
  388. cashType: 11,
  389. accountType: '2',
  390. explainSituation: null,
  391. succeedAmount: null,
  392. payer: null,
  393. payerAccount: null,
  394. operatorCode: null,
  395. enterpriseCode: null,
  396. expenditureAmount: null,
  397. capitalExpenditureType: '1',
  398. remark: null,
  399. transferStatus: "0",
  400. auditStatus: "0",
  401. paymentState: "1",
  402. bankPriority: "0",
  403. clientPriority: "0"
  404. };
  405. this.processList = {}
  406. this.projectForm={
  407. projectId:null,
  408. projectName:null,
  409. projectContractor:null,
  410. projectAmount:null,
  411. projectBillNum:null,
  412. projectFundType:'1',
  413. outId:null,
  414. ynType:'2'
  415. }
  416. },
  417. getChange(){
  418. if(this.buttonType == 'update'){
  419. this.goUpdate();
  420. }else if(this.buttonType == 'add'){
  421. this.goAdd();
  422. }
  423. },
  424. getDictionaries(){
  425. this.getDicts("capital_expenditure_type").then((res) => {
  426. for (let i = 0; i < res.data.length; i++) {
  427. this.capitalExpenditureTypeOptions.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  428. }
  429. });
  430. this.getPayeeList();
  431. },
  432. getError(e){
  433. this.$notify({ type: 'danger', message: e.errors[0].message });
  434. },
  435. addChargeItme(index){
  436. if(this.chargeItme.length>0&&this.chargeItme[this.chargeItme.length-1].payee == ''){
  437. this.$notify({ type: 'danger', message: '请勿添加多个空列表信息' });
  438. return;
  439. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].incomeAmount == ''){
  440. this.$notify({ type: 'danger', message: '请输入提款金额!' });
  441. return;
  442. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].drawer == ''){
  443. this.$notify({ type: 'danger', message: '请输入提款人!' });
  444. return;
  445. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].remark == ''){
  446. this.$notify({ type: 'danger', message: '请输入资金用途!' });
  447. return;
  448. }
  449. this.getDicts("bank_type").then(res => {
  450. this.chargeItme.splice(index + 1, 0, {
  451. payeeId: "", //收款方ID
  452. payee: "", //收款方全称
  453. payeeAccount: "", //收款账户
  454. drawer: "", //提款人
  455. incomeAmount: "", //提款金额
  456. bankType: "", //资金用途
  457. showPayee:false,
  458. showbankType:false
  459. });
  460. });
  461. },
  462. getPayeeList() {
  463. //普通转账
  464. this.queryParams.accountType = this.form.accountType
  465. this.queryParams.status = "0"
  466. listPayee(this.queryParams).then((response) => {
  467. this.payeeList = response.rows;
  468. response.rows.map((res,index) => {
  469. this.payeeList[index].text = res.payee;
  470. this.payeeList[index].value = res.id;
  471. })
  472. });
  473. },
  474. payeeDictLabel(datas, value) {
  475. let actions = [];
  476. Object.keys(datas).some((key) => {
  477. if (datas[key].payeeId == ('' + value)) {
  478. actions.push(datas[key].payee);
  479. return true;
  480. }
  481. })
  482. return actions.join('');
  483. },
  484. onConfirmCapital(data){
  485. if (data.value == 2){
  486. this.capitalExpenditureOpen = true;
  487. this.contractOpen = false
  488. this.infoForm = {};
  489. }else if(data.value == 4){
  490. this.capitalExpenditureOpen = false;
  491. this.contractOpen = true
  492. this.projectForm = {};
  493. }else{
  494. this.capitalExpenditureOpen = false;
  495. this.contractOpen = false
  496. this.projectForm = {};
  497. this.infoForm = {};
  498. }
  499. this.capitalExpenditureType = data.text;
  500. this.form.capitalExpenditureType = data.value;
  501. this.showcapital = false;
  502. },
  503. onConfirmFundType(data){
  504. console.log(data)
  505. this.projectForm.projectFundType = data.value;
  506. this.projectFundType = data.text;
  507. this.showFundType = false;
  508. },
  509. onConfirmContract(data){
  510. this.infoList.map(res => {
  511. if(res.name==data.text){
  512. this.infoForm.contractionId = res.id;
  513. this.infoForm.name = res.name;
  514. this.infoForm.code = res.code;
  515. this.infoForm.totalAmount = res.totalAmount;
  516. }
  517. })
  518. this.showcontract = false;
  519. },
  520. onConfirmProject(data){
  521. this.projectList.map(res => {
  522. if(res.projectName==data.text){
  523. this.projectForm.projectId = res.id
  524. this.projectForm.projectName = res.projectName
  525. this.projectForm.projectContractor = res.projectContractor
  526. this.projectForm.projectAmount = res.projectAmount
  527. }
  528. })
  529. this.showproject = false;
  530. },
  531. onConfirmPayee(data,index){
  532. for (var i = 0 ; i < this.chargeItme.length ; i++){
  533. this.chargeItme[i].showPayee = false;
  534. }
  535. this.chargeItme[index].payee = data.text;
  536. this.chargeItme[index].payeeId = data.value;
  537. this.chargeItme[index].showpayee = false;
  538. this.payeeSelectChange(data.value , index)
  539. },
  540. onConfirmBankType(data,index){
  541. for (var i = 0 ; i < this.chargeItme.length ; i++){
  542. this.chargeItme[i].showbankType = false;
  543. }
  544. this.chargeItme[index].bankTypeText = data.text;
  545. this.chargeItme[index].bankType = data.value;
  546. this.chargeItme[index].showbankType = false;
  547. },
  548. onConfirmPayer(data){
  549. this.form.payer = data.text;
  550. this.form.cashierId = data.value;
  551. this.showpayer = false;
  552. this.selectChange(data.value)
  553. },
  554. onConfirmLasj(data){
  555. this.form.applyDate = this.getNowFormatDate(data).substr(0,10);
  556. this.showlasj = false;
  557. },
  558. accountTypeChange(e){
  559. this.payeeList = [];
  560. this.queryParams.accountType = this.form.accountType
  561. this.queryParams.status = "0"
  562. listPayee(this.queryParams).then((response) => {
  563. this.payeeList = response.rows;
  564. response.rows.map((res,index) => {
  565. this.payeeList[index].text = res.payee;
  566. this.payeeList[index].value = res.id;
  567. })
  568. });
  569. },
  570. goAdd(){
  571. if(this.form.payerAccount==0){
  572. this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' });
  573. return false;
  574. }else {
  575. let total = 0;
  576. this.chargeItme.forEach((money) => {
  577. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  578. });
  579. this.$set(this.form, "expenditureAmount", total);
  580. if(parseFloat(this.form.payerAccount)<parseFloat(this.form.expenditureAmount)){
  581. this.$notify({ type: 'danger', message: '申请使用金额不能大于可用余额!' });
  582. }else{
  583. if(this.chargeItme.length<1){
  584. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  585. return;
  586. }
  587. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  588. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  589. return;
  590. }
  591. if(this.form.capitalExpenditureType==2){
  592. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  593. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  594. return;
  595. }
  596. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  597. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  598. return;
  599. }
  600. }
  601. if(this.form.capitalExpenditureType==4){
  602. if(this.infoForm.name==""||this.infoForm.name==null){
  603. this.$notify({ type: 'danger', message: '请选择合同名称!' });
  604. return;
  605. }
  606. if(this.infoForm.code==""||this.infoForm.code==null){
  607. this.$notify({ type: 'danger', message: '请输入合同编码!' });
  608. return;
  609. }
  610. if(this.infoForm.totalAmount==""||this.infoForm.totalAmount==null){
  611. this.$notify({ type: 'danger', message: '请输入合同价款!' });
  612. return;
  613. }
  614. }
  615. if(this.uploadFiles==null||this.uploadFiles.length==0){
  616. Dialog.confirm({
  617. title: '提示',
  618. message: '此申请单中未上传任何附件,是否确认提交?',
  619. })
  620. .then(() => {
  621. console.log(this.form)
  622. addCash(this.form).then((response) => {
  623. this.chargeItme.map(res => {
  624. res.cashId = response.data.id
  625. addCashdetail(res).then(r => {})
  626. })
  627. if(this.form.capitalExpenditureType==2){
  628. this.projectForm.outId = response.data.id
  629. this.$set(this.projectForm, "ynType", '2');
  630. addProjectto(this.projectForm).then(res => {
  631. cashSubmit(response.data.id).then(res => {
  632. this.$toast.success('提交成功');
  633. setTimeout(function(){
  634. history.go(-1)
  635. },2000)
  636. })
  637. })
  638. }else if(this.form.capitalExpenditureType==4){
  639. this.infoForm.transferId = response.data.id
  640. addInfoto(this.infoForm).then(res => {
  641. cashSubmit(response.data.id).then(res => {
  642. this.$toast.success('提交成功');
  643. setTimeout(function(){
  644. history.go(-1)
  645. },2000)
  646. })
  647. })
  648. }else{
  649. cashSubmit(response.data.id).then(res => {
  650. this.$toast.success('提交成功');
  651. setTimeout(function(){
  652. history.go(-1)
  653. },2000)
  654. })
  655. }
  656. });
  657. })
  658. }else{
  659. addCash(this.form).then((response) => {
  660. console.log(this.uploadFiles)
  661. this.uploadFiles1.map(rr => {
  662. const params = new FormData();
  663. params.append("tableId", response.data.id);
  664. params.append("tableName", "t_yinnong_cash");
  665. params.append("bizPath", "yinnong");
  666. params.append("fileType", "1");
  667. params.append("file", rr);
  668. commonAttach(params).then((r) => {
  669. })
  670. })
  671. this.uploadFiles2.map(rr => {
  672. const params = new FormData();
  673. params.append("tableId", response.data.id);
  674. params.append("tableName", "t_yinnong_cash");
  675. params.append("bizPath", "yinnong");
  676. params.append("fileType", "2");
  677. params.append("file", rr);
  678. commonAttach(params).then((r) => {
  679. })
  680. })
  681. this.uploadFiles3.map(rr => {
  682. const params = new FormData();
  683. params.append("tableId", response.data.id);
  684. params.append("tableName", "t_yinnong_cash");
  685. params.append("bizPath", "yinnong");
  686. params.append("fileType", "3");
  687. params.append("file", rr);
  688. commonAttach(params).then((r) => {
  689. })
  690. })
  691. this.chargeItme.map(res => {
  692. res.cashId = response.data.id
  693. addCashdetail(res).then(r => {})
  694. })
  695. if(this.form.capitalExpenditureType==2){
  696. this.projectForm.outId = response.data.id
  697. this.$set(this.projectForm, "ynType", '2');
  698. addProjectto(this.projectForm).then(res => {
  699. cashSubmit(response.data.id).then(res => {
  700. this.$toast.success('提交成功');
  701. setTimeout(function(){
  702. history.go(-1)
  703. },2000)
  704. })
  705. })
  706. }else if(this.form.capitalExpenditureType==4){
  707. this.infoForm.transferId = response.data.id
  708. addInfoto(this.infoForm).then(res => {
  709. cashSubmit(response.data.id).then(res => {
  710. this.$toast.success('提交成功');
  711. setTimeout(function(){
  712. history.go(-1)
  713. },2000)
  714. })
  715. })
  716. }else{
  717. cashSubmit(response.data.id).then(res => {
  718. this.$toast.success('提交成功');
  719. setTimeout(function(){
  720. history.go(-1)
  721. },2000)
  722. })
  723. }
  724. });
  725. }
  726. }
  727. }
  728. },
  729. goUpdate(){
  730. if(this.form.payerAccount==0){
  731. this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' });;
  732. return false;
  733. }else {
  734. let total = 0;
  735. this.chargeItme.forEach((money) => {
  736. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  737. });
  738. this.$set(this.form, "expenditureAmount", total);
  739. console.log(this.form.expenditureAmount,this.form.payerAccount)
  740. if(parseFloat(this.form.payerAccount)<parseFloat(this.form.expenditureAmount)){
  741. this.$notify({ type: 'danger', message: '申请使用金额不能大于可用余额!' });
  742. return false;
  743. }else{
  744. if(this.chargeItme.length<1){
  745. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  746. return;
  747. }
  748. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  749. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  750. return;
  751. }
  752. if(this.form.capitalExpenditureType==2){
  753. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  754. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  755. return;
  756. }
  757. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  758. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  759. return;
  760. }
  761. }
  762. if(this.form.capitalExpenditureType==4){
  763. if(this.infoForm.name==""||this.infoForm.name==null){
  764. this.$notify({ type: 'danger', message: '请选择合同名称!' });
  765. return;
  766. }
  767. if(this.infoForm.code==""||this.infoForm.code==null){
  768. this.$notify({ type: 'danger', message: '请输入合同编码!' });
  769. return;
  770. }
  771. if(this.infoForm.totalAmount==""||this.infoForm.totalAmount==null){
  772. this.$notify({ type: 'danger', message: '请输入合同价款!' });
  773. return;
  774. }
  775. }
  776. if(this.uploadFiles==null||this.uploadFiles.length==0){
  777. addCash(this.form).then((response) => {
  778. this.chargeItme.map(res => {
  779. res.cashId = response.data.id
  780. addCashdetail(res).then(r => {})
  781. })
  782. if(this.form.capitalExpenditureType==2){
  783. this.projectForm.outId = response.data.id
  784. this.$set(this.projectForm, "ynType", '2');
  785. addProjectto(this.projectForm).then(res => {
  786. this.$toast.success('保存成功');
  787. setTimeout(function(){
  788. history.go(-1)
  789. },2000)
  790. })
  791. }else if(this.form.capitalExpenditureType==4){
  792. this.infoForm.transferId = response.data.id
  793. addInfoto(this.infoForm).then(res => {
  794. this.$toast.success('保存成功');
  795. setTimeout(function(){
  796. history.go(-1)
  797. },2000)
  798. })
  799. }else{
  800. this.$toast.success('保存成功');
  801. setTimeout(function(){
  802. history.go(-1)
  803. },2000)
  804. }
  805. });
  806. }else{
  807. addCash(this.form).then((response) => {
  808. console.log(this.uploadFiles)
  809. this.uploadFiles1.map(rr => {
  810. const params = new FormData();
  811. params.append("tableId", response.data.id);
  812. params.append("tableName", "t_yinnong_cash");
  813. params.append("bizPath", "yinnong");
  814. params.append("fileType", "1");
  815. params.append("file", rr);
  816. commonAttach(params).then((r) => {
  817. })
  818. })
  819. this.uploadFiles2.map(rr => {
  820. const params = new FormData();
  821. params.append("tableId", response.data.id);
  822. params.append("tableName", "t_yinnong_cash");
  823. params.append("bizPath", "yinnong");
  824. params.append("fileType", "2");
  825. params.append("file", rr);
  826. commonAttach(params).then((r) => {
  827. })
  828. })
  829. this.uploadFiles3.map(rr => {
  830. const params = new FormData();
  831. params.append("tableId", response.data.id);
  832. params.append("tableName", "t_yinnong_cash");
  833. params.append("bizPath", "yinnong");
  834. params.append("fileType", "3");
  835. params.append("file", rr);
  836. commonAttach(params).then((r) => {
  837. })
  838. })
  839. this.chargeItme.map(res => {
  840. res.cashId = response.data.id
  841. addCashdetail(res).then(r => {})
  842. })
  843. if(this.form.capitalExpenditureType==2){
  844. this.projectForm.outId = response.data.id
  845. this.$set(this.projectForm, "ynType", '2');
  846. addProjectto(this.projectForm).then(res => {
  847. this.$toast.success('保存成功');
  848. setTimeout(function(){
  849. history.go(-1)
  850. },2000)
  851. })
  852. }else if(this.form.capitalExpenditureType==4){
  853. this.infoForm.transferId = response.data.id
  854. addInfoto(this.infoForm).then(res => {
  855. this.$toast.success('保存成功');
  856. setTimeout(function(){
  857. history.go(-1)
  858. },2000)
  859. })
  860. }else{
  861. this.$toast.success('保存成功');
  862. setTimeout(function(){
  863. history.go(-1)
  864. },2000)
  865. }
  866. });
  867. }
  868. }
  869. }
  870. },
  871. payeeSelectChange(select, i) {
  872. let obj = {};
  873. let fuzhitype = 0;
  874. obj = this.payeeList.find((account) => {
  875. //model就是上面的数据源
  876. return account.id === select ; //筛选出匹配数据
  877. });
  878. if(this.chargeItme != [] && this.chargeItme.length>1){
  879. this.chargeItme.some((value, index) => {
  880. if(value.payeeAccount != undefined &&value.payeeAccount != '' && obj.payeeAccount == value.payeeAccount&&index!=i){
  881. fuzhitype = 2;
  882. return true;
  883. }
  884. if(value.accountType != undefined &&value.accountType != '' && obj.accountType != value.accountType&&index!=i){
  885. fuzhitype = 1;
  886. return true;
  887. }
  888. });
  889. }
  890. if(fuzhitype == 0){
  891. this.$set(this.chargeItme[i], "payee",obj.payee)
  892. this.$set(this.chargeItme[i], "bankType", obj.bankType)
  893. this.$set(this.chargeItme[i], "payeeId", obj.id);
  894. this.$set(this.chargeItme[i], "payeeAccount", obj.payeeAccount);
  895. this.$set(this.chargeItme[i], "bankDeposit", obj.bankDeposit);
  896. this.$set(this.chargeItme[i], "accountType", obj.accountType);
  897. }else if(fuzhitype == 1){
  898. this.$set(this.chargeItme[i], "payee",'')
  899. this.$set(this.chargeItme[i], "bankType",'')
  900. this.$set(this.chargeItme[i], "payeeId", '');
  901. this.$set(this.chargeItme[i], "payeeAccount", '');
  902. this.$set(this.chargeItme[i], "bankDeposit", '');
  903. this.$set(this.chargeItme[i], "accountType", '');
  904. this.$notify({ type: 'danger', message: '请选择账户类型相同的收款方!' });
  905. }else if(fuzhitype == 2){
  906. this.$set(this.chargeItme[i], "payee",'')
  907. this.$set(this.chargeItme[i], "bankType",'')
  908. this.$set(this.chargeItme[i], "payeeId", '');
  909. this.$set(this.chargeItme[i], "payeeAccount", '');
  910. this.$set(this.chargeItme[i], "bankDeposit", '');
  911. this.$set(this.chargeItme[i], "accountType", '');
  912. this.$notify({ type: 'danger', message: '收款方已存在!' });
  913. }
  914. },
  915. selectChange(select) {
  916. let obj = {};
  917. obj = this.payerOptions.find((account) => {
  918. //model就是上面的数据源
  919. return account.id === select; //筛选出匹配数据
  920. });
  921. if(obj.accountPassword != null && obj.accountPassword != "" &&
  922. obj.bankType != null && obj.bankType != ""){
  923. this.$set(this.form, "bookId", obj.bookId);
  924. this.$set(this.form, "deptId", obj.deptId);
  925. this.$set(this.form, "cashierId", obj.id);
  926. this.$set(this.form, "payer", obj.accountName);
  927. this.$set(this.form, "payerAccount", obj.bankAccountNumber);
  928. this.$set(this.form, "operatorCode", obj.operatorCode);
  929. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  930. this.$set(this.form, "bankType", obj.bankType);
  931. this.$set(this.form, "bankAccountType", obj.bankAccountType);
  932. this.$set(this.form, "villageAccountType", obj.villageAccountType);
  933. this.$set(this.form, "taccountId", obj.taccountId);
  934. this.$set(this.form, "accountNo", obj.accountNo);
  935. this.$set(this.form, "cifNo", obj.cifNo);
  936. this.$set(this.form, "payerFrom", '1');
  937. if(obj.bankType==1){
  938. this.form.accountType = "1"
  939. this.form.isPeers = null
  940. this.accountTypeChange();
  941. }else if(obj.bankType==2||obj.bankType==4){
  942. this.form.accountType = null
  943. this.form.isPeers = "Y"
  944. this.accountTypeChange1();
  945. }
  946. }else{
  947. if(obj.payerFrom==1){
  948. this.diglogStatus = false;
  949. this.$notify({ type: 'danger', message: "请完善付款方“操作员代码”、“企业编码”、“支付口令”等信息!" });
  950. this.$set(this.form,"payer","")
  951. this.$set(this.form,"payerAccount","")
  952. }else{
  953. this.$set(this.form, "payerFrom", obj.parerFrom);
  954. if(obj.operatorCode!=null&&obj.operatorCode!=''){
  955. this.$set(this.form, "operatorCode", obj.operatorCode);
  956. }else{
  957. this.$set(this.form, "operatorCode", '');
  958. }
  959. if(obj.enterpriseCode!=null&&obj.enterpriseCode!=''){
  960. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  961. }else{
  962. this.$set(this.form, "enterpriseCode", '');
  963. }
  964. if(obj.accountPassword!=null&&obj.accountPassword!=''){
  965. this.$set(this.form, "accountPassword", obj.accountPassword);
  966. }else{
  967. this.$set(this.form, "accountPassword", '');
  968. }
  969. this.$set(this.form, "bookId",'');
  970. this.$set(this.form, "deptId", '');
  971. this.$set(this.form, "cashierId", obj.id);
  972. this.$set(this.form, "payer", obj.accountName);
  973. this.$set(this.form, "bankType", obj.bankType);
  974. if(obj.payerFrom==6){
  975. getQmyeFlow(obj.bankAccountNumber).then((response) => {
  976. this.$set(this.form, "payerAccount", response.data);
  977. });
  978. }else {
  979. this.$set(this.form, "payerAccount", obj.bankAccountNumber);
  980. }
  981. }
  982. }
  983. },
  984. beforeRead1(file) {
  985. this.uploadFiles1.push(file.file);
  986. },
  987. deleteFile1(file){
  988. this.uploadFiles1.map((response,index) => {
  989. if(file.file == response){
  990. this.uploadFiles1.splice(index,1)
  991. }
  992. })
  993. },
  994. beforeRead2(file) {
  995. this.uploadFiles2.push(file.file);
  996. },
  997. deleteFile2(file){
  998. this.uploadFiles2.map((response,index) => {
  999. if(file.file == response){
  1000. this.uploadFiles2.splice(index,1)
  1001. }
  1002. })
  1003. },
  1004. beforeRead3(file) {
  1005. this.uploadFiles3.push(file.file);
  1006. },
  1007. deleteFile3(file){
  1008. this.uploadFiles3.map((response,index) => {
  1009. if(file.file == response){
  1010. this.uploadFiles3.splice(index,1)
  1011. }
  1012. })
  1013. },
  1014. getFileList(){
  1015. let oData1= {
  1016. tableId: this.$route.query.id,
  1017. tableName: "t_yinnong_cash",
  1018. bizPath: "yinnong",
  1019. fileType: "1",
  1020. }
  1021. attachmentList(oData1).then(res => {
  1022. res.rows.map(r => {
  1023. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  1024. this.fileList1.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{})})
  1025. })
  1026. })
  1027. let oData2= {
  1028. tableId: this.$route.query.id,
  1029. tableName: "t_yinnong_cash",
  1030. bizPath: "yinnong",
  1031. fileType: "2",
  1032. }
  1033. attachmentList(oData2).then(res => {
  1034. res.rows.map(r => {
  1035. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  1036. this.fileList2.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{})})
  1037. })
  1038. })
  1039. let oData3= {
  1040. tableId: this.$route.query.id,
  1041. tableName: "t_yinnong_cash",
  1042. bizPath: "yinnong",
  1043. fileType: "3",
  1044. }
  1045. attachmentList(oData3).then(res => {
  1046. res.rows.map(r => {
  1047. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  1048. this.fileList3.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{})})
  1049. })
  1050. })
  1051. },
  1052. goBack(){
  1053. window.history.go(-1)
  1054. },
  1055. //删除家庭成员
  1056. deleteChargeItme(index){
  1057. this.chargeItme.splice(index,1)
  1058. },
  1059. },
  1060. }
  1061. </script>
  1062. <style scoped lang="scss">
  1063. .app-container {
  1064. padding: 2% 0;
  1065. }
  1066. .main_title{
  1067. font-size: 0.4rem;
  1068. color: #1D6FE9;
  1069. margin: 0.2rem 6%;
  1070. position: relative;
  1071. }
  1072. .main_box{
  1073. width: 96%;
  1074. margin: 0 auto;
  1075. border-radius: 6px;
  1076. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  1077. overflow: hidden;
  1078. background-color: #FFF;
  1079. }
  1080. .submitButton{
  1081. width: 80%;
  1082. margin: 0 auto;
  1083. background-color: #1D6FE9;
  1084. }
  1085. .addFamily{
  1086. position: absolute;
  1087. top: -2px;
  1088. right: 0;
  1089. border-radius: 50%;
  1090. }
  1091. .deleteFamily{
  1092. position: absolute;
  1093. top: 0rem;
  1094. right: 6%;
  1095. z-index: 9;
  1096. border-radius: 50%;
  1097. }
  1098. </style>