移动端
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

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