移动端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

approvalAdd11.vue 39 KiB

2 年前
2 年前
2 年前
2 年前
2 年前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  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" @change="moneyChange"/>
  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. // 钱计算
  548. moneyChange(input) {
  549. if(this.form.cashType=='11'){
  550. console.log(input)
  551. if(this.form.payerAccount==0){
  552. this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' });
  553. this.chargeItme = []
  554. this.addChargeItme();
  555. return false;
  556. }else {
  557. let obj = {};
  558. obj = this.chargeItme.find((account) => {
  559. //model就是上面的数据源
  560. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  561. });
  562. let total = 0;
  563. this.chargeItme.forEach((money) => {
  564. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  565. });
  566. this.$set(this.form, "expenditureAmount", total);
  567. if(parseFloat(this.form.payerAccount)<parseFloat(this.form.expenditureAmount)){
  568. this.$notify({ type: 'danger', message: '申请使用金额不能大于可用余额!' });
  569. this.form.expenditureAmount=""
  570. this.chargeItme = []
  571. this.addChargeItme();
  572. return false;
  573. }
  574. }
  575. }else{
  576. let obj = {};
  577. obj = this.chargeItme.find((account) => {
  578. //model就是上面的数据源
  579. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  580. });
  581. let total = 0;
  582. this.chargeItme.forEach((money) => {
  583. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  584. });
  585. this.$set(this.form, "expenditureAmount", total);
  586. }
  587. },
  588. goAdd(){
  589. if(this.chargeItme.length<1){
  590. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  591. return;
  592. }
  593. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  594. this.$notify({ type: 'danger', message: '转账附言禁止包含!' });
  595. return;
  596. }
  597. if(this.form.capitalExpenditureType==2){
  598. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  599. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  600. return;
  601. }
  602. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  603. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  604. return;
  605. }
  606. }
  607. if(this.form.capitalExpenditureType==4){
  608. if(this.infoForm.name==""||this.infoForm.name==null){
  609. this.$notify({ type: 'danger', message: '请选择合同名称!' });
  610. return;
  611. }
  612. if(this.infoForm.code==""||this.infoForm.code==null){
  613. this.$notify({ type: 'danger', message: '请输入合同编码!' });
  614. return;
  615. }
  616. if(this.infoForm.totalAmount==""||this.infoForm.totalAmount==null){
  617. this.$notify({ type: 'danger', message: '请输入合同价款!' });
  618. return;
  619. }
  620. }
  621. if(this.uploadFiles==null||this.uploadFiles.length==0){
  622. Dialog.confirm({
  623. title: '提示',
  624. message: '此申请单中未上传任何附件,是否确认提交?',
  625. })
  626. .then(() => {
  627. addCash(this.form).then((response) => {
  628. this.chargeItme.map(res => {
  629. res.cashId = response.data.id
  630. addCashdetail(res).then(r => {
  631. if(this.form.capitalExpenditureType==2){
  632. this.projectForm.outId = response.data.id
  633. this.$set(this.projectForm, "ynType", '2');
  634. addProjectto(this.projectForm).then(res => {
  635. cashSubmit(response.data.id).then(res => {
  636. this.$toast.success('提交成功');
  637. setTimeout(function(){
  638. history.go(-1)
  639. },2000)
  640. })
  641. })
  642. }else if(this.form.capitalExpenditureType==4){
  643. this.infoForm.transferId = response.data.id
  644. addInfoto(this.infoForm).then(res => {
  645. cashSubmit(response.data.id).then(res => {
  646. this.$toast.success('提交成功');
  647. setTimeout(function(){
  648. history.go(-1)
  649. },2000)
  650. })
  651. })
  652. }else{
  653. cashSubmit(response.data.id).then(res => {
  654. this.$toast.success('提交成功');
  655. setTimeout(function(){
  656. history.go(-1)
  657. },2000)
  658. })
  659. }
  660. })
  661. })
  662. });
  663. })
  664. }else{
  665. addCash(this.form).then((response) => {
  666. console.log(this.uploadFiles)
  667. this.uploadFiles.map(rr => {
  668. const params = new FormData();
  669. params.append("tableId", response.data.id);
  670. params.append("tableName", "t_yinnong_cash");
  671. params.append("bizPath", "upload");
  672. params.append("fileType", "0");
  673. params.append("file", rr);
  674. commonAttach(params).then((r) => {
  675. })
  676. })
  677. this.chargeItme.map(res => {
  678. res.cashId = response.data.id
  679. addCashdetail(res).then(r => {
  680. if(this.form.capitalExpenditureType==2){
  681. this.projectForm.outId = response.data.id
  682. this.$set(this.projectForm, "ynType", '2');
  683. addProjectto(this.projectForm).then(res => {
  684. cashSubmit(response.data.id).then(res => {
  685. this.$toast.success('提交成功');
  686. setTimeout(function(){
  687. history.go(-1)
  688. },2000)
  689. })
  690. })
  691. }else if(this.form.capitalExpenditureType==4){
  692. this.infoForm.transferId = response.data.id
  693. addInfoto(this.infoForm).then(res => {
  694. cashSubmit(response.data.id).then(res => {
  695. this.$toast.success('提交成功');
  696. setTimeout(function(){
  697. history.go(-1)
  698. },2000)
  699. })
  700. })
  701. }else{
  702. cashSubmit(response.data.id).then(res => {
  703. this.$toast.success('提交成功');
  704. setTimeout(function(){
  705. history.go(-1)
  706. },2000)
  707. })
  708. }
  709. })
  710. })
  711. });
  712. }
  713. },
  714. goUpdate(){
  715. if(this.chargeItme.length<1){
  716. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  717. return;
  718. }
  719. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  720. this.$notify({ type: 'danger', message: '转账附言禁止包含!' });
  721. return;
  722. }
  723. if(this.form.capitalExpenditureType==2){
  724. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  725. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  726. return;
  727. }
  728. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  729. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  730. return;
  731. }
  732. }
  733. if(this.form.capitalExpenditureType==4){
  734. if(this.infoForm.name==""||this.infoForm.name==null){
  735. this.$notify({ type: 'danger', message: '请选择合同名称!' });
  736. return;
  737. }
  738. if(this.infoForm.code==""||this.infoForm.code==null){
  739. this.$notify({ type: 'danger', message: '请输入合同编码!' });
  740. return;
  741. }
  742. if(this.infoForm.totalAmount==""||this.infoForm.totalAmount==null){
  743. this.$notify({ type: 'danger', message: '请输入合同价款!' });
  744. return;
  745. }
  746. }
  747. if(this.uploadFiles==null||this.uploadFiles.length==0){
  748. addCash(this.form).then((response) => {
  749. this.chargeItme.map(res => {
  750. res.cashId = response.data.id
  751. addCashdetail(res).then(r => {
  752. if(this.form.capitalExpenditureType==2){
  753. this.projectForm.outId = response.data.id
  754. this.$set(this.projectForm, "ynType", '2');
  755. addProjectto(this.projectForm).then(res => {
  756. this.$toast.success('保存成功');
  757. setTimeout(function(){
  758. history.go(-1)
  759. },2000)
  760. })
  761. }else if(this.form.capitalExpenditureType==4){
  762. this.infoForm.transferId = response.data.id
  763. addInfoto(this.infoForm).then(res => {
  764. this.$toast.success('保存成功');
  765. setTimeout(function(){
  766. history.go(-1)
  767. },2000)
  768. })
  769. }else{
  770. this.$toast.success('保存成功');
  771. setTimeout(function(){
  772. history.go(-1)
  773. },2000)
  774. }
  775. })
  776. })
  777. });
  778. }else{
  779. addCash(this.form).then((response) => {
  780. console.log(this.uploadFiles)
  781. this.uploadFiles.map(rr => {
  782. const params = new FormData();
  783. params.append("tableId", response.data.id);
  784. params.append("tableName", "t_yinnong_cash");
  785. params.append("bizPath", "upload");
  786. params.append("fileType", "0");
  787. params.append("file", rr);
  788. commonAttach(params).then((r) => {
  789. })
  790. })
  791. this.chargeItme.map(res => {
  792. res.cashId = response.data.id
  793. addCashdetail(res).then(r => {
  794. if(this.form.capitalExpenditureType==2){
  795. this.projectForm.outId = response.data.id
  796. this.$set(this.projectForm, "ynType", '2');
  797. addProjectto(this.projectForm).then(res => {
  798. this.$toast.success('保存成功');
  799. setTimeout(function(){
  800. history.go(-1)
  801. },2000)
  802. })
  803. }else if(this.form.capitalExpenditureType==4){
  804. this.infoForm.transferId = response.data.id
  805. addInfoto(this.infoForm).then(res => {
  806. this.$toast.success('保存成功');
  807. setTimeout(function(){
  808. history.go(-1)
  809. },2000)
  810. })
  811. }else{
  812. this.$toast.success('保存成功');
  813. setTimeout(function(){
  814. history.go(-1)
  815. },2000)
  816. }
  817. })
  818. })
  819. });
  820. }
  821. },
  822. payeeSelectChange(select, i) {
  823. let obj = {};
  824. let fuzhitype = 0;
  825. obj = this.payeeList.find((account) => {
  826. //model就是上面的数据源
  827. return account.id === select ; //筛选出匹配数据
  828. });
  829. if(this.chargeItme != [] && this.chargeItme.length>1){
  830. this.chargeItme.some((value, index) => {
  831. if(value.payeeAccount != undefined &&value.payeeAccount != '' && obj.payeeAccount == value.payeeAccount&&index!=i){
  832. fuzhitype = 2;
  833. return true;
  834. }
  835. if(value.accountType != undefined &&value.accountType != '' && obj.accountType != value.accountType&&index!=i){
  836. fuzhitype = 1;
  837. return true;
  838. }
  839. });
  840. }
  841. if(fuzhitype == 0){
  842. this.$set(this.chargeItme[i], "payee",obj.payee)
  843. this.$set(this.chargeItme[i], "bankType", obj.bankType)
  844. this.$set(this.chargeItme[i], "payeeId", obj.id);
  845. this.$set(this.chargeItme[i], "payeeAccount", obj.payeeAccount);
  846. this.$set(this.chargeItme[i], "bankDeposit", obj.bankDeposit);
  847. this.$set(this.chargeItme[i], "accountType", obj.accountType);
  848. }else if(fuzhitype == 1){
  849. this.$set(this.chargeItme[i], "payee",'')
  850. this.$set(this.chargeItme[i], "bankType",'')
  851. this.$set(this.chargeItme[i], "payeeId", '');
  852. this.$set(this.chargeItme[i], "payeeAccount", '');
  853. this.$set(this.chargeItme[i], "bankDeposit", '');
  854. this.$set(this.chargeItme[i], "accountType", '');
  855. this.$notify({ type: 'danger', message: '请选择账户类型相同的收款方!' });
  856. }else if(fuzhitype == 2){
  857. this.$set(this.chargeItme[i], "payee",'')
  858. this.$set(this.chargeItme[i], "bankType",'')
  859. this.$set(this.chargeItme[i], "payeeId", '');
  860. this.$set(this.chargeItme[i], "payeeAccount", '');
  861. this.$set(this.chargeItme[i], "bankDeposit", '');
  862. this.$set(this.chargeItme[i], "accountType", '');
  863. this.$notify({ type: 'danger', message: '收款方已存在!' });
  864. }
  865. },
  866. selectChange(select) {
  867. let obj = {};
  868. obj = this.payerOptions.find((account) => {
  869. //model就是上面的数据源
  870. return account.id === select; //筛选出匹配数据
  871. });
  872. if(obj.accountPassword != null && obj.accountPassword != "" &&
  873. obj.bankType != null && obj.bankType != ""){
  874. this.$set(this.form, "bookId", obj.bookId);
  875. this.$set(this.form, "deptId", obj.deptId);
  876. this.$set(this.form, "cashierId", obj.id);
  877. this.$set(this.form, "payer", obj.accountName);
  878. this.$set(this.form, "payerAccount", obj.bankAccountNumber);
  879. this.$set(this.form, "operatorCode", obj.operatorCode);
  880. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  881. this.$set(this.form, "bankType", obj.bankType);
  882. this.$set(this.form, "bankAccountType", obj.bankAccountType);
  883. this.$set(this.form, "villageAccountType", obj.villageAccountType);
  884. this.$set(this.form, "taccountId", obj.taccountId);
  885. this.$set(this.form, "accountNo", obj.accountNo);
  886. this.$set(this.form, "cifNo", obj.cifNo);
  887. this.$set(this.form, "payerFrom", '1');
  888. if(obj.bankType==1){
  889. this.form.accountType = "1"
  890. this.form.isPeers = null
  891. this.accountTypeChange();
  892. }else if(obj.bankType==2||obj.bankType==3){
  893. this.form.accountType = null
  894. this.form.isPeers = "Y"
  895. this.accountTypeChange1();
  896. }
  897. }else{
  898. if(obj.payerFrom==1){
  899. this.diglogStatus = false;
  900. this.$notify({ type: 'danger', message: "请完善付款方“操作员代码”、“企业编码”、“支付口令”等信息!" });
  901. this.$set(this.form,"payer","")
  902. this.$set(this.form,"payerAccount","")
  903. }else{
  904. this.$set(this.form, "payerFrom", obj.parerFrom);
  905. if(obj.operatorCode!=null&&obj.operatorCode!=''){
  906. this.$set(this.form, "operatorCode", obj.operatorCode);
  907. }else{
  908. this.$set(this.form, "operatorCode", '');
  909. }
  910. if(obj.enterpriseCode!=null&&obj.enterpriseCode!=''){
  911. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  912. }else{
  913. this.$set(this.form, "enterpriseCode", '');
  914. }
  915. if(obj.accountPassword!=null&&obj.accountPassword!=''){
  916. this.$set(this.form, "accountPassword", obj.accountPassword);
  917. }else{
  918. this.$set(this.form, "accountPassword", '');
  919. }
  920. this.$set(this.form, "bookId",'');
  921. this.$set(this.form, "deptId", '');
  922. this.$set(this.form, "cashierId", obj.id);
  923. this.$set(this.form, "payer", obj.accountName);
  924. this.$set(this.form, "bankType", obj.bankType);
  925. if(obj.payerFrom==6){
  926. getQmyeFlow(obj.bankAccountNumber).then((response) => {
  927. this.$set(this.form, "payerAccount", response.data);
  928. });
  929. }else {
  930. this.$set(this.form, "payerAccount", obj.bankAccountNumber);
  931. }
  932. }
  933. }
  934. },
  935. beforeRead(file) {
  936. this.uploadFiles.push(file.file);
  937. },
  938. deleteFile(file){
  939. this.uploadFiles.map((response,index) => {
  940. if(file.file == response){
  941. this.uploadFiles.splice(index,1)
  942. }
  943. })
  944. },
  945. getFileList(){
  946. let oData= {
  947. tableId: this.$route.query.id,
  948. tableName: "t_yinnong_cash",
  949. bizPath: "upload",
  950. fileType: "0",
  951. }
  952. attachmentList(oData).then(res => {
  953. console.log(res)
  954. console.log(location.protocol+"//"+location.host+request.defaults.baseURL)
  955. res.rows.map(r => {
  956. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  957. this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{})})
  958. console.log(r)
  959. })
  960. })
  961. },
  962. goBack(){
  963. window.history.go(-1)
  964. },
  965. //删除家庭成员
  966. deleteChargeItme(index){
  967. this.chargeItme.splice(index,1)
  968. },
  969. },
  970. }
  971. </script>
  972. <style scoped lang="scss">
  973. .app-container {
  974. padding: 2% 0;
  975. }
  976. .main_title{
  977. font-size: 0.4rem;
  978. color: #1D6FE9;
  979. margin: 0.2rem 6%;
  980. position: relative;
  981. }
  982. .main_box{
  983. width: 96%;
  984. margin: 0 auto;
  985. border-radius: 6px;
  986. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  987. overflow: hidden;
  988. background-color: #FFF;
  989. }
  990. .submitButton{
  991. width: 80%;
  992. margin: 0 auto;
  993. background-color: #1D6FE9;
  994. }
  995. .addFamily{
  996. position: absolute;
  997. top: -2px;
  998. right: 0;
  999. border-radius: 50%;
  1000. }
  1001. .deleteFamily{
  1002. position: absolute;
  1003. top: 0rem;
  1004. right: 6%;
  1005. z-index: 9;
  1006. border-radius: 50%;
  1007. }
  1008. </style>