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

approvalAdd11.vue 44 KiB

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