amendsCostdetails.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  1. <template>
  2. <div>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="tableData"
  6. v-model="form"
  7. id="out-table"
  8. :header-cell-class-name="headerClassName"
  9. ref="crud"
  10. :row-style="{height:'20px'}"
  11. :cell-style="{padding:'0px'}"
  12. @selection-change="handleSelectionChange"
  13. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 322.1)"
  14. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 322.1)" >
  15. <template slot="menuLeft">
  16. <el-button type="danger" plain size="small" :disabled="disabled"
  17. @click="batchDelete" >一键删除
  18. </el-button>
  19. <el-button type="info" plain size="small" :disabled="disabled"
  20. @click="feecenterSubmitListfun">一键保存
  21. </el-button>
  22. <el-button type="info" plain size="small" :disabled="disabled"
  23. @click="oneclickEditingfun">一键编辑
  24. </el-button>
  25. <el-button type="primary" plain size="small" :disabled="!form.id"
  26. @click="printingCostsfun()">打印账单</el-button>
  27. </template>
  28. <template slot="indexHeader" slot-scope="scope">
  29. <el-button type="primary" size="small" icon="el-icon-plus" circle
  30. :disabled="disabled"
  31. @click="addfun"></el-button>
  32. </template>
  33. <template slot="index" slot-scope="scope">
  34. <span>{{scope.index + 1}}</span>
  35. </template>
  36. <template slot="accStatus" slot-scope="{row,size}">
  37. <span>{{row.accStatus?'是':'否'}}</span>
  38. </template>
  39. <template slot="dc" slot-scope="{row,size}">
  40. <search-query v-if="row.editType"
  41. :datalist="dcData"
  42. :selectValue="row.dc"
  43. :filterable="true"
  44. :clearable="true"
  45. :remote="true"
  46. :buttonIf="false"
  47. :disabled="dcDisabled"
  48. @corpChange="corpChange($event,'dc',row)"
  49. placeholder="请选择收/付">
  50. </search-query>
  51. <span v-else >{{row.dc}}</span>
  52. </template>
  53. <template slot="corpCnName" slot-scope="{ row }">
  54. <search-query v-if="row.editType"
  55. :datalist="corpCnNameData"
  56. :selectValue="row.corpCnName"
  57. :filterable="true"
  58. :clearable="true"
  59. :remote="true"
  60. :buttonIf="false"
  61. placeholder="请选择往来单位"
  62. :forParameter="{key:'id',label:'cnName',value:'cnName'}"
  63. @remoteMethod="getBcorpsListfun($event,'corpCnName')"
  64. @corpChange="corpChange($event,'corpCnName',row)"
  65. @corpFocus="getBcorpsListfun($event,'corpCnName')" >
  66. </search-query>
  67. <span v-else style="color: #1e9fff" @click="corpClick(row)" >{{row.corpCnName}}</span>
  68. </template>
  69. <template slot="feeCnName" slot-scope="{ row }">
  70. <search-query v-if="row.editType"
  71. :datalist="feeCnNameData"
  72. :selectValue="row.feeCnName"
  73. :filterable="true"
  74. :clearable="true"
  75. :remote="true"
  76. :buttonIf="false"
  77. placeholder="请选择费用简称"
  78. :forParameter="{key:'id',label:'cnName',value:'cnName'}"
  79. @remoteMethod="bfeesListfun($event,'feeCnName')"
  80. @corpChange="corpChange($event,'feeCnName',row)"
  81. @corpFocus="bfeesListfun($event,'feeCnName')" >
  82. </search-query>
  83. <span v-else >{{row.feeCnName}}</span>
  84. </template>
  85. <template slot="elementsCnName" slot-scope="{ row }">
  86. <search-query v-if="row.editType"
  87. :datalist="elementsData"
  88. :selectValue="row.elementsCnName"
  89. :filterable="true"
  90. :clearable="true"
  91. :remote="true"
  92. :buttonIf="false"
  93. placeholder="请选择核算要素"
  94. :forParameter="{key:'id',label:'cnName',value:'cnName'}"
  95. @remoteMethod="getBaccelementsListfun($event,'elementsCnName')"
  96. @corpChange="corpChange($event,'elementsCnName',row,)"
  97. @corpFocus="getBaccelementsListfun($event,'elementsCnName')" >
  98. </search-query>
  99. <span v-else >{{row.elementsCnName}}</span>
  100. </template>
  101. <template slot="paymode" slot-scope="{ row }">
  102. <search-query v-if="row.editType"
  103. :datalist="paymodeData"
  104. :selectValue="row.paymode"
  105. :clearable="true"
  106. :buttonIf="false"
  107. placeholder="请选择预付/到付"
  108. :forParameter="{key:'dictKey',label:'dictValue',value:'dictKey'}"
  109. @corpChange="corpChange($event,'paymode',row)"
  110. @corpFocus="paymodeWorkDictsfun" >
  111. </search-query>
  112. <span v-else>{{row.paymode}}</span>
  113. </template>
  114. <template slot="unitNo" slot-scope="{ row }">
  115. <search-query v-if="row.editType"
  116. :datalist="unitNoData"
  117. :selectValue="row.unitNo"
  118. :filterable="true"
  119. :clearable="true"
  120. :remote="true"
  121. :buttonIf="false"
  122. placeholder="请选择计量单位"
  123. :forParameter="{key:'id',label:'code',value:'code',disabled:'status'}"
  124. @corpFocus="getBunitsPagefun"
  125. @corpChange="corpChange($event,'unitNo',row)" >
  126. </search-query>
  127. <span v-else>{{row.unitNo}}</span>
  128. </template>
  129. <template slot="curCode" slot-scope="{ row }">
  130. <search-query v-if="row.editType"
  131. :datalist="curCodeData"
  132. :selectValue="row.curCode"
  133. :filterable="true"
  134. :clearable="true"
  135. :remote="true"
  136. :buttonIf="false"
  137. placeholder="请选择币种"
  138. :forParameter="{key:'id',label:'code',value:'code'}"
  139. @remoteMethod="bcurrencyGetExratefun(row.dc)"
  140. @corpChange="corpChange($event,'curCode',row)"
  141. @corpFocus="bcurrencyGetExratefun(row.dc)" >
  142. </search-query>
  143. <span v-else>{{row.curCode}}</span>
  144. </template>
  145. <template slot="isTax" slot-scope="{row}">
  146. <span>{{row.isTax?'是':'否'}}</span>
  147. </template>
  148. <template slot="price" slot-scope="{ row }">
  149. <el-input-number v-if="row.editType" :controls="false" v-model="row.price" size="small" :min="1"
  150. placeholder="请输入单价" @blur="priceinputfun($event,row)"></el-input-number>
  151. <span v-else>{{row.price}}</span>
  152. </template>
  153. <template slot="quantity" slot-scope="{ row }">
  154. <el-input-number v-if="row.editType" :controls="false" v-model="row.quantity" size="small" :min="1"
  155. placeholder="请输入数量" @blur="quantityinputfun(row)"></el-input-number>
  156. <span v-else>{{row.quantity}}</span>
  157. </template>
  158. <template slot="remarks" slot-scope="{ row }">
  159. <el-input v-if="row.editType" v-model="row.remarks" size="small"
  160. placeholder="请输入备注" ></el-input>
  161. <span v-else>{{row.remarks}}</span>
  162. </template>
  163. <!--<template slot-scope="scope" slot="menu">-->
  164. <!-- <el-button type="text" size="small" :disabled="scope.row.accStatus || disabled" @click="deletefun(scope.row,scope.index,)">删除</el-button>-->
  165. <!--</template>-->
  166. </avue-crud>
  167. <!--往来单位弹窗-->
  168. <el-dialog
  169. title="提示"
  170. :visible.sync="corpVisible"
  171. append-to-body
  172. width="70%"
  173. :close-on-click-modal="false">
  174. <span slot="title">
  175. <el-button type="primary" size="mini" @click.stop="exportfun" >导出</el-button>
  176. </span>
  177. <div style="padding-bottom: 30px;" >
  178. <el-table
  179. :data="corpDialog"
  180. border
  181. size="mini"
  182. :row-style="{height:'20px',padding:'0px',fontSize:'12px'}"
  183. :cell-style="{padding:'0px',fontSize:'12px'}"
  184. style="width: 100%">
  185. <el-table-column prop="corpCnName" label="客户名称" width="140px" >
  186. <template slot-scope="{ row }">
  187. <span class="textoverflow">{{row.corpCnName}}</span>
  188. </template>
  189. </el-table-column>
  190. <el-table-column prop="mblno" label="MB/L NO" width="140px" />
  191. <el-table-column prop="amountDr" label="应收金额" />
  192. <el-table-column prop="amountCr" label="应付金额" />
  193. <el-table-column prop="amountDrUsd" label="应收金额USD" width="140px" />
  194. <el-table-column prop="amountCrUsd" label="应付金额USD" width="140px" />
  195. <el-table-column prop="amountDrLoc" label="应收金额合计" width="140px" />
  196. <el-table-column prop="amountCrLoc" label="应付金额合计" width="140px" />
  197. <el-table-column prop="stlAmountDr" label="已结算应收金额" width="140px" />
  198. <el-table-column prop="stlAmountCr" label="已结算应付金额" width="140px" />
  199. <el-table-column prop="stlAmountDrUsd" label="已结算应收金额USD" width="140px" />
  200. <el-table-column prop="stlAmountCrUsd" label="已结算应付金额USD" width="140px" />
  201. <el-table-column prop="stlAmountDrLoc" label="已结算应收金额合计" width="140px" />
  202. <el-table-column prop="stlAmountCrLoc" label="已结算应付金额合计" width="140px" />
  203. </el-table>
  204. </div>
  205. </el-dialog>
  206. </div>
  207. </template>
  208. <script>
  209. import {getBcorpsDetail, getBcorpsList} from "@/api/iosBasicData/bcorps";
  210. import {bfeesList} from "@/api/iosBasicData/bfees";
  211. import {getBaccelementsList} from "@/api/iosBasicData/baccelements";
  212. import {bcurrencyGetExrate} from "@/api/iosBasicData/rateManagement";
  213. import {getWorkDicts} from "@/api/system/dictbiz";
  214. import {getBunitsPage} from "@/api/iosBasicData/bunits";
  215. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  216. import {dateFormat} from "@/util/date";
  217. import {
  218. feecenterRemove,
  219. feecenterSubmitList
  220. } from "@/api/iosBasicData/feecenter";
  221. import {listFeeCountByCorp} from "@/api/iosBasicData/bills";
  222. import {amendsDetail} from "@/api/iosBasicData/amends";
  223. import {getToken} from "@/util/auth";
  224. export default {
  225. components: {SearchQuery},
  226. props:{
  227. tableData:{
  228. type:Array,
  229. default:[]
  230. },
  231. form:{
  232. type:Object,
  233. default:{}
  234. },
  235. disabled:{
  236. type:Boolean,
  237. default:false
  238. },
  239. // dc 列禁用
  240. dcDisabled:{
  241. type:Boolean,
  242. default:false
  243. }
  244. },
  245. data(){
  246. return {
  247. option:{},
  248. optionBack:{
  249. stripe:true,
  250. maxHeight:'250',
  251. calcHeight: 30,
  252. tip: false,
  253. searchShow: true,
  254. searchMenuSpan: 6,
  255. border: true,
  256. selection: true,
  257. dialogClickModal: false,
  258. addBtn:false,
  259. viewBtn:false,
  260. delBtn:false,
  261. editBtn:false,
  262. menuWidth:'100',
  263. refreshBtn:false,
  264. menu:false,
  265. column:[
  266. {
  267. label: "index",
  268. prop: "index",
  269. width: "55",
  270. headerslot:true,
  271. },
  272. {
  273. label: "账单",
  274. prop: "accStatus",
  275. width: "60",
  276. },
  277. {
  278. label: "收/付",
  279. prop: "dc",
  280. width: "100",
  281. },
  282. {
  283. label: "往来单位",
  284. prop: "corpCnName",
  285. width: "160",
  286. overHidden:true,
  287. },
  288. {
  289. label: "费用简称",
  290. prop: "feeCnName",
  291. width: "120",
  292. overHidden:true,
  293. },
  294. {
  295. label: "预付/到付",
  296. prop: "paymode",
  297. width: "120",
  298. },
  299. {
  300. label: "计量单位",
  301. prop: "unitNo",
  302. width: "120",
  303. },
  304. {
  305. label: "币种",
  306. prop: "curCode",
  307. width: "120",
  308. },
  309. {
  310. label: "汇率",
  311. prop: "exrate",
  312. width: "100",
  313. },
  314. {
  315. label: "单价",
  316. prop: "price",
  317. width: "120",
  318. },
  319. {
  320. label: "数量",
  321. prop: "quantity",
  322. width: "120",
  323. },
  324. {
  325. label: "CNY(含税)",
  326. prop: "rmbAmount",
  327. width: "100",
  328. },
  329. {
  330. label: "USD(含税)",
  331. prop: "usdAmount",
  332. width: "100",
  333. },
  334. {
  335. label: "CNY(净额)",
  336. prop: "rmbAmountNet",
  337. width: "100",
  338. },
  339. {
  340. label: "USD(净额)",
  341. prop: "usdAmountNet",
  342. width: "100",
  343. },
  344. {
  345. label: "核算要素",
  346. prop: "elementsCnName",
  347. width: "120",
  348. overHidden:true,
  349. },
  350. {
  351. label: "付费申请金额",
  352. prop: "appliedAmount",
  353. width: "120",
  354. },
  355. {
  356. label: "发票申请金额",
  357. prop: "appliedInvoiceAmount",
  358. width: "120",
  359. },
  360. {
  361. label: "已开票金额",
  362. prop: "uninvoicedAmount",
  363. width: "120",
  364. },
  365. {
  366. label: "已结算金额",
  367. prop: "stlTtlAmount",
  368. width: "120",
  369. },
  370. {
  371. label: "备注",
  372. prop: "remarks",
  373. width: "100",
  374. },
  375. {
  376. label: "单价是否含税",
  377. prop: "isTax",
  378. width: "120",
  379. },
  380. ]
  381. },
  382. loading:false,
  383. form:{},
  384. // 收/付
  385. dcData:[
  386. {
  387. label:'收',
  388. value:'D'
  389. },
  390. {
  391. label:'付',
  392. value:'C'
  393. }
  394. ],
  395. corpCnNameData:[], // 往来单位数据
  396. feeCnNameData:[], // 费用数据
  397. elementsData:[], // 核算要素
  398. paymodeData:[], // 预付到付数据
  399. unitNoData:[], // 计算单位数据
  400. curCodeData:[], // 币别数据
  401. handleSelectionData:[], // 多选选择的数据
  402. corpVisible:false, // 往来单位弹窗
  403. corpDialog:[], // 往来单位弹窗数据
  404. corpRow:{}, // 往来单位弹窗数据
  405. }
  406. },
  407. async created() {
  408. this.option = await this.getColumnData(this.getColumnName(322.1), this.optionBack);
  409. },
  410. methods:{
  411. // 弹窗导出
  412. exportfun(){
  413. const routeData = this.$router.resolve({
  414. path: '/api/blade-los/finaccbills/listFeeCountByCorpExport',//跳转目标窗口的地址
  415. query: {
  416. dc: this.corpRow.dc,
  417. corpId:this.corpRow.corpId
  418. }
  419. })
  420. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  421. },
  422. // 往来单位弹窗开启
  423. corpClick(row){
  424. this.corpVisible = true
  425. listFeeCountByCorp({
  426. corpId:row.corpId,
  427. dc:row.dc
  428. }).then(res=>{
  429. this.corpRow = row
  430. this.corpDialog = res.data.data
  431. })
  432. },
  433. printingCostsfun(){
  434. this.$emit('printingCostsfun')
  435. },
  436. // 应收新增
  437. addfun(){
  438. this.$emit('addfun')
  439. },
  440. // 一键编辑
  441. oneclickEditingfun(){
  442. this.$emit('oneclickEditingfun')
  443. },
  444. // 一键删除
  445. batchDelete(){
  446. this.$confirm("确定将选择数据删除?", {
  447. confirmButtonText: "确定",
  448. cancelButtonText: "取消",
  449. type: "warning"
  450. }).then(()=>{
  451. let multiList = this.handleSelectionData
  452. let arr = this.tableData
  453. // 获取有id 的数据
  454. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  455. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  456. // 把选中的删除掉
  457. multiList.forEach((item)=>{
  458. for (let index in arr) {
  459. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  460. arr.splice(Number(index),1)
  461. }
  462. }
  463. })
  464. // 有id 的处理
  465. if(itemsWithId.length != 0) {
  466. feecenterRemove(arrIds.join(',')).then(res=>{
  467. this.$message.success('操作成功')
  468. // this.$emit('billsDetailfun')
  469. })
  470. }
  471. })
  472. },
  473. // 小删除
  474. deletefun(row,index) {
  475. this.$confirm("确定将选择数据删除?", {
  476. confirmButtonText: "确定",
  477. cancelButtonText: "取消",
  478. type: "warning"
  479. }).then(()=>{
  480. if (row.id) {
  481. // 删除接口
  482. feecenterRemove(row.id).then(res=>{
  483. this.$message({
  484. type: "success",
  485. message: "操作成功!"
  486. });
  487. this.$emit('amendsDetailfun')
  488. })
  489. }else {
  490. this.tableData.splice(index, 1)
  491. }
  492. })
  493. },
  494. // 下拉的回调
  495. async corpChange(value,name,row) {
  496. if (name == 'corpCnName') {
  497. if (!value) {
  498. this.$set(row,'corpCnName','')
  499. this.$set(row,'corpEnName','')
  500. this.$set(row,'corpId','')
  501. }
  502. for(let item of this.corpCnNameData) {
  503. if (item.cnName == value){
  504. this.$set(row,'corpCnName',item.cnName)
  505. this.$set(row,'corpEnName',item.enName)
  506. this.$set(row,'corpId',item.id)
  507. }
  508. }
  509. }else if (name == 'feeCnName') {
  510. if (!value) {
  511. this.$set(row,'feeCnName','')
  512. this.$set(row,'feeEnName','')
  513. this.$set(row,'feeId','')
  514. this.$set(row,'feeCode','')
  515. // 选择费用简称带出核算要素
  516. this.$set(row,'elementsId','')
  517. this.$set(row,'elementsCnName','')
  518. this.$set(row,'elementsCode','')
  519. this.$set(row,'elementsEnName','')
  520. }
  521. for(let item of this.feeCnNameData) {
  522. if (item.cnName == value){
  523. if (value == 'PS') {
  524. // 查询当前客户的 ps规则是否等于零和null
  525. const psres = await getBcorpsDetail(this.form.corpId)
  526. if (!psres.data.data.psRate || Number(psres.data.data.psRate) == 0) {
  527. this.$confirm('PS规则为零不能添加费用', {
  528. confirmButtonText: "确定",
  529. cancelButtonText: "取消",
  530. type: "warning"
  531. })
  532. this.$set(row,'feeCnName','')
  533. this.$set(row,'feeEnName','')
  534. this.$set(row,'feeId','')
  535. this.$set(row,'feeCode','')
  536. // 核算要素
  537. this.$set(row,'elementsId','')
  538. this.$set(row,'elementsCnName','')
  539. this.$set(row,'elementsCode','')
  540. this.$set(row,'elementsEnName','')
  541. return
  542. }
  543. }
  544. this.$set(row,'feeCnName',item.cnName)
  545. this.$set(row,'feeEnName',item.enName)
  546. this.$set(row,'feeId',item.id)
  547. this.$set(row,'feeCode',item.code)
  548. // 选择费用简称带出核算要素
  549. this.$set(row,'elementsId',item.accElementId)
  550. this.$set(row,'elementsCnName',item.accElementName)
  551. this.$set(row,'elementsCode',item.elementsCode)
  552. this.$set(row,'elementsEnName',item.elementsEnName)
  553. // 拿取费用简称下的计量单位
  554. this.getBunitsPagefun(true,item,row)
  555. // 币别
  556. if (value == 'PS') {
  557. this.$set(row,'curCode','USD')
  558. }else {
  559. this.$set(row,'curCode',item.curNo)
  560. }
  561. // 汇率
  562. bcurrencyGetExrate({
  563. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  564. dc:row.dc
  565. }).then(res=>{
  566. for (let item of res.data.data) {
  567. if (item.code == row.curCode) {
  568. this.$set(row,'exrate',item.exrate)
  569. }
  570. }
  571. })
  572. // 计算金额
  573. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  574. if (row.curCode == 'CNY') {
  575. this.$set(row,'rmbAmount',row.amount)
  576. this.$set(row,'usdAmount','')
  577. this.$set(row,'rmbAmountNet',row.amount)
  578. this.$set(row,'usdAmountNet','')
  579. }else {
  580. this.$set(row,'usdAmount',row.amount)
  581. this.$set(row,'rmbAmount','')
  582. this.$set(row,'usdAmountNet',row.amount)
  583. this.$set(row,'rmbAmountNet','')
  584. }
  585. }
  586. }
  587. }else if (name == 'unitNo') {
  588. // 计量单位
  589. this.$set(row,name,value)
  590. for (let item of this.unitNoData) {
  591. if (item.code == value) {
  592. // 按箱型
  593. if (item.quantityRule == 1) {
  594. // 选择的箱那边的数据
  595. if (item.boxquantity) {
  596. this.$set(row,'quantity',item.boxquantity)
  597. }
  598. }
  599. // 按票
  600. if (item.quantityRule == 2) {
  601. this.$set(row,'quantity',1)
  602. }
  603. // 按重量
  604. if (item.quantityRule == 3) {
  605. this.$set(row,'quantity',this.form.grossWeight)
  606. }
  607. // 按TEU
  608. if (item.quantityRule == 4) {
  609. this.$set(row,'quantity',item.boxquantity)
  610. }
  611. // 按尺码
  612. if (item.quantityRule == 5) {
  613. this.$set(row,'quantity',this.form.measurement)
  614. }
  615. // 按件数
  616. if (item.quantityRule == 6) {
  617. this.$set(row,'quantity',this.form.quantity)
  618. }
  619. }
  620. }
  621. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity?row.quantity:0))
  622. if (row.curCode == 'CNY') {
  623. this.$set(row,'rmbAmount',row.amount)
  624. this.$set(row,'usdAmount','')
  625. this.$set(row,'rmbAmountNet',row.amount)
  626. this.$set(row,'usdAmountNet','')
  627. }else {
  628. this.$set(row,'usdAmount',row.amount)
  629. this.$set(row,'rmbAmount','')
  630. this.$set(row,'usdAmountNet',row.amount)
  631. this.$set(row,'rmbAmountNet','')
  632. }
  633. } else if (name == 'elementsCnName') {
  634. if (!value) {
  635. this.$set(row,'elementsId','')
  636. this.$set(row,'elementsCnName','')
  637. this.$set(row,'elementsCode','')
  638. this.$set(row,'elementsEnName','')
  639. }
  640. // 核算要素
  641. for (let item of this.elementsData) {
  642. if (item.cnName == value) {
  643. this.$set(row,'elementsId',item.id)
  644. this.$set(row,'elementsCnName',item.cnName)
  645. this.$set(row,'elementsCode',item.code)
  646. this.$set(row,'elementsEnName',item.enName)
  647. }
  648. }
  649. }else if (name == 'curCode') {
  650. if (row.feeCnName == 'PS') {
  651. this.$set(row,'curCode','')
  652. value = 'USD'
  653. }
  654. for(let item of this.curCodeData) {
  655. if (item.code == value){
  656. if (item.code == 'USD') {
  657. if (Number(item.exrate) <= 1) {
  658. this.$message.warning('当前选择的币别汇率不能小于零')
  659. return
  660. }
  661. }else {
  662. if (Number(item.exrate) == 0) {
  663. this.$message.warning('当前选择的币别汇率不能为零')
  664. return
  665. }
  666. }
  667. this.$set(row,'curCode',item.code)
  668. this.$set(row,'exrate',item.exrate)
  669. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  670. if (row.curCode == 'CNY') {
  671. this.$set(row,'rmbAmount',row.amount)
  672. this.$set(row,'usdAmount','')
  673. this.$set(row,'rmbAmountNet',row.amount)
  674. this.$set(row,'usdAmountNet','')
  675. }else {
  676. this.$set(row,'usdAmount',row.amount)
  677. this.$set(row,'rmbAmount','')
  678. this.$set(row,'usdAmountNet',row.amount)
  679. this.$set(row,'rmbAmountNet','')
  680. }
  681. }
  682. }
  683. } else {
  684. this.$set(row,name,value)
  685. }
  686. },
  687. // 费用信息明细保存按钮
  688. feecenterSubmitListfun(){
  689. if (!this.form.id) {
  690. return this.$message.warning('请先保存数据')
  691. }
  692. // 判断必填项
  693. let sum = '请输入'
  694. for (let item of this.tableData) {
  695. if (!item.dc) {
  696. sum += ` 应收序号${item.$index + 1}收/付`
  697. }
  698. if (!item.corpId) {
  699. sum += ` 应收序号${item.$index + 1}往来单位`
  700. }
  701. if (!item.feeId) {
  702. sum += ` 应收序号${item.$index + 1}费用简称`
  703. }
  704. if (!item.elementsId) {
  705. sum += ` 应收序号${item.$index + 1}核算要素`
  706. }
  707. if (!item.curCode) {
  708. sum += ` 应收序号${item.$index + 1}币种`
  709. }
  710. }
  711. if(sum != '请输入') {
  712. this.$confirm(sum, {
  713. confirmButtonText: "确定",
  714. cancelButtonText: "取消",
  715. type: "warning"
  716. })
  717. return;
  718. }
  719. this.tableData.map((row,index)=>{
  720. row.dc = row.dc
  721. row.pid = this.form.id
  722. row.sort = Number(index) + 1
  723. row.businessType = this.form.businessType // 业务类型
  724. row.billType = this.form.billType // 单据类型
  725. row.billNo = this.form.billNo // 单据编号
  726. row.billDate = this.form.billDate // 单据日期
  727. row.billCorpId = this.form.corpId // 主表客户 id
  728. row.billCorpCnName = this.form.corpCnName // 主表客户中文名称
  729. row.billCorpEnName = this.form.corpEnName // 主表客户英文名称
  730. row.lineId = this.form.lineId // 航线 id
  731. row.lineCnName = this.form.lineCnName // 航线中文名称
  732. row.lineEnName = this.form.lineEnName // 航线英文名称
  733. row.vesselId = this.form.vesselId // 船名 id
  734. row.vesselCnName = this.form.vesselCnName // 中文船名
  735. row.vesselEnName = this.form.vesselEnName // 英文船名
  736. row.voyageNo = this.form.voyageNo // 航次
  737. row.mblno = this.form.mblno // MB/L NO
  738. row.hblno = this.form.hblno // HB/L NO
  739. row.etd = this.form.etd // 开船日期
  740. row.eta = this.form.eta // 到港日期
  741. row.polId = this.form.polId // 装货港 id
  742. row.polCode = this.form.polCode // 装货港代码
  743. row.polCnName = this.form.polCnName // 装货港中文名称
  744. row.polEnName = this.form.polEnName // 装货港英文名称
  745. row.podId = this.form.podId // 卸货港 id
  746. row.podCode = this.form.podCode // 卸货港代码
  747. row.podCnName = this.form.podCnName // 卸货港中文名称
  748. row.podEnName = this.form.podEnName // 卸货港英文名称
  749. row.corpArgreementNo = this.form.corpArgreementNo // 客户约号
  750. })
  751. feecenterSubmitList(this.tableData).then(res=>{
  752. this.$message({
  753. type: "success",
  754. message: "操作成功!"
  755. });
  756. this.$emit('amendsDetailfun')
  757. })
  758. },
  759. // 单价
  760. priceinputfun(value,row){
  761. if (Number(value) <= 0) {
  762. this.$message({
  763. type: "warning",
  764. message: "单价不能输入负数!"
  765. });
  766. return
  767. }
  768. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  769. // 判断是否有币种
  770. if (!row.curCode) {
  771. return;
  772. }
  773. if (row.curCode == 'CNY') {
  774. this.$set(row,'rmbAmount',row.amount)
  775. this.$set(row,'usdAmount','')
  776. this.$set(row,'rmbAmountNet',row.amount)
  777. this.$set(row,'usdAmountNet','')
  778. }else {
  779. this.$set(row,'usdAmount',row.amount)
  780. this.$set(row,'rmbAmount','')
  781. this.$set(row,'usdAmountNet',row.amount)
  782. this.$set(row,'rmbAmountNet','')
  783. }
  784. },
  785. // 数量
  786. quantityinputfun(row) {
  787. if (row.quantity <= 0) {
  788. this.$message({
  789. type: "warning",
  790. message: "数量不能输入负数!"
  791. });
  792. this.$set(row,'quantity',1)
  793. return
  794. }
  795. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity))
  796. // 判断是否有币种
  797. if (!row.curCode) {
  798. return;
  799. }
  800. if (row.curCode == 'CNY') {
  801. this.$set(row,'rmbAmount',row.amount)
  802. this.$set(row,'usdAmount','')
  803. }else {
  804. this.$set(row,'usdAmount',row.amount)
  805. this.$set(row,'rmbAmount','')
  806. }
  807. },
  808. // 获取客户数据
  809. getBcorpsListfun(cnName){
  810. getBcorpsList(1,10,{cnName}).then(res=>{
  811. this.corpCnNameData = res.data.data.records
  812. })
  813. },
  814. // 获取费用数据
  815. bfeesListfun(cnName){
  816. bfeesList(1,10,{cnName}).then(res=>{
  817. this.feeCnNameData = res.data.data.records
  818. })
  819. },
  820. // 获取费用信息 核算要素信息
  821. getBaccelementsListfun(cnName){
  822. getBaccelementsList(1,10,{cnName}).then(res=>{
  823. this.elementsData = res.data.data.records
  824. })
  825. },
  826. // 获取预付到付字典数据
  827. paymodeWorkDictsfun(){
  828. getWorkDicts('payment_method_los').then((res) => {
  829. this.paymodeData = res.data.data
  830. })
  831. },
  832. // 获取币别数据
  833. bcurrencyGetExratefun(dc){
  834. bcurrencyGetExrate({
  835. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  836. dc:dc
  837. }).then(res=>{
  838. this.curCodeData = res.data.data
  839. })
  840. },
  841. // 获取计算属性
  842. async getBunitsPagefun(type,feeRow,row){
  843. let srcBillId = null
  844. if (this.form.billType == 'MH') {
  845. srcBillId = this.form.masterId
  846. }else {
  847. srcBillId = this.form.id
  848. }
  849. const res = await getBunitsPage({srcBillId})
  850. this.unitNoData = []
  851. let boxarr40 = ['40HC','40GP']
  852. let boxarr20 = ['20GP']
  853. let teunum = 0
  854. for (let item of res.data.data) {
  855. // 按箱型
  856. if (item.quantityRule != 1) {
  857. // TEU
  858. if (item.quantityRule == 4) {
  859. for (let data of this.form.preContainersList) {
  860. if (boxarr40.indexOf(data.cntrTypeCode) != -1) {
  861. teunum += Number(data.quantity) * 2
  862. }else if (boxarr20.indexOf(data.cntrTypeCode) != -1) {
  863. teunum += Number(data.quantity)
  864. }
  865. }
  866. this.unitNoData.push({...item, boxquantity: teunum})
  867. }else {
  868. this.unitNoData.push(item) // 不是TEU和不是箱的走这个
  869. }
  870. }
  871. }
  872. let arr = this.form.preContainersList.map(item=>{
  873. return {
  874. quantityRule:1, // 1 是按箱量
  875. code:item.cntrTypeCode,
  876. boxquantity:item.quantity,
  877. }
  878. })
  879. this.unitNoData = [...arr,...this.unitNoData]
  880. // 选择费用时带出第一条
  881. if (type) {
  882. let feeunitNodata = []
  883. for (let item of this.unitNoData) {
  884. if (item.quantityRule == feeRow.unitNo) {
  885. feeunitNodata.push(item)
  886. }
  887. }
  888. this.corpChange(feeunitNodata[0].code,'unitNo',row)
  889. }
  890. },
  891. // 多选选择的数据
  892. handleSelectionChange(arr){
  893. // this.$emit('handleSelectionChange',arr)
  894. this.handleSelectionData = arr
  895. },
  896. //自定义列保存
  897. async saveColumnTwo(ref, option, optionBack, code) {
  898. /**
  899. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  900. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  901. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  902. */
  903. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  904. if (inSave) {
  905. this.$message.success("保存成功");
  906. //关闭窗口
  907. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  908. }
  909. },
  910. //自定义列重置
  911. async resetColumnTwo(ref, option, optionBack, code) {
  912. this[option] = this[optionBack];
  913. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  914. if (inSave) {
  915. this.$message.success("重置成功");
  916. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  917. }
  918. },
  919. // 更改表格颜色
  920. headerClassName(tab) {
  921. //颜色间隔
  922. let back = ""
  923. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  924. if (tab.columnIndex % 2 === 0) {
  925. back = "back-one"
  926. } else if (tab.columnIndex % 2 === 1) {
  927. back = "back-two"
  928. }
  929. }
  930. return back;
  931. },
  932. },
  933. }
  934. </script>
  935. <style scoped>
  936. ::v-deep#out-table .back-one {
  937. background: #ecf5ff !important;
  938. text-align: center;
  939. padding: 4px 0;
  940. }
  941. ::v-deep#out-table .back-two {
  942. background: #ecf5ff !important;
  943. text-align: center;
  944. padding: 4px 0;
  945. }
  946. .textoverflow {
  947. width: 100%;
  948. overflow: hidden;
  949. white-space: nowrap;
  950. text-overflow: ellipsis;
  951. }
  952. </style>