移动端
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.

approvalModify12.vue 32 KiB

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