移动端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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