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

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