移动端
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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