移动端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

1051 行
40 KiB

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