移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

approvalAdd3.vue 35 KiB

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