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

approvalModify11.vue 40 KiB

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