fee-info.vue 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199
  1. <template>
  2. <div>
  3. <avue-crud :option="optionD" :table-loading="loading" :data="form.feeCenterListD" id="out-table" ref="crudD"
  4. @selection-change="selectionDChange" @resetColumn="resetColumn('crudD', 'optionD', 'optionDBack', 381)"
  5. @saveColumn="saveColumn('crudD', 'optionD', 'optionDBack', 381)">
  6. <template slot="menuLeft">
  7. <div style="display: inline-block;margin-right: 20px" class="disabledBox fontSize">
  8. <i class="el-icon-coin"></i>
  9. <span>应收费用</span>
  10. </div>
  11. <el-button type="info" plain size="small" :disabled="disabled"
  12. @click="allClick('一键保存', 'D')">一键保存</el-button>
  13. <el-button type="info" plain size="small" :disabled="disabled"
  14. @click="allClick('一键编辑', 'D')">一键编辑</el-button>
  15. <el-button type="danger" plain size="small" :disabled="disabled || selectionDList.length == 0"
  16. @click="allClick('批量删除', 'D')">批量删除</el-button>
  17. <el-button type="primary" plain size="small" :disabled="disabled || selectionDList.length == 0"
  18. @click="allClick('生成账单', 'D')">生成账单</el-button>
  19. <el-button type="danger" plain size="small" :disabled="disabled || selectionDList.length == 0"
  20. @click="allClick('撤销账单', 'D')">撤销账单</el-button>
  21. <el-button type="primary" plain size="small" @click="$refs.printD.openDialog()">打印账单</el-button>
  22. <el-button type="success" plain size="small" :disabled="disabled"
  23. @click="allClick('应收模板', 'D')">应收模板</el-button>
  24. <!-- <el-button type="primary" plain size="small" :disabled="disabled"
  25. @click="allClick('生成应收', 'D')">生成应收</el-button> -->
  26. </template>
  27. <template slot="indexHeader" slot-scope="{row,index}">
  28. <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="disabled" circle @click="addRow('D')">
  29. </el-button>
  30. </template>
  31. <template slot="index" slot-scope="{row,index}">
  32. <span>{{ index + 1 }}</span>
  33. </template>
  34. <template slot="corpCnNameForm" slot-scope="{ row }">
  35. <dic-select v-if="row.$cellEdit" v-model="row.corpCnName" placeholder="往来单位" key="id" label="cnName"
  36. res="records" url="/blade-los/bcorps/listByType?corpTypeName=客户" :filterable="true" :remote="true"
  37. dataName="cnName" @selectChange="rowDicChange('corpCnName', $event, row)"></dic-select>
  38. <span v-else>{{ row.corpCnName }}</span>
  39. </template>
  40. <template slot="feeCnNameForm" slot-scope="{ row }">
  41. <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" placeholder="费用名称" key="id" label="cnName"
  42. res="records" url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"
  43. @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
  44. <span v-else>{{ row.feeCnName }}</span>
  45. </template>
  46. <template slot="unitNoForm" slot-scope="{ row }">
  47. <dic-select v-if="row.$cellEdit" v-model="row.unitNo" placeholder="收费标准" key="id" label="code"
  48. url="/blade-los/bunits/selectList" :filterable="true"
  49. @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
  50. <span v-else>{{ row.unitNo }}</span>
  51. </template>
  52. <tempalte slot="quantityForm" slot-scope="{ row }">
  53. <el-input-number v-if="row.$cellEdit" v-model="row.quantity" @change="countChange(row)" :controls="false"
  54. placeholder="请输入 数量" size="small" style="width: 100%;"></el-input-number>
  55. <span v-else>{{ row.quantity }}</span>
  56. </tempalte>
  57. <tempalte slot="priceForm" slot-scope="{ row }">
  58. <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" :controls="false"
  59. placeholder="请输入 单价" size="small" style="width: 100%;"></el-input-number>
  60. <span v-else>{{ row.price }}</span>
  61. </tempalte>
  62. <template slot="curCodeForm" slot-scope="{ row }">
  63. <dic-select v-if="row.$cellEdit" v-model="row.curCode" placeholder="币别" key="id" label="code"
  64. :url="'/blade-los/bcurrency/getExrate?date=' + form.contractDate + '&dc=' + row.dc" :filterable="true"
  65. @selectChange="rowDicChange('curCode', $event, row)"></dic-select>
  66. <span v-else>{{ row.curCode }}</span>
  67. </template>
  68. <tempalte slot="exrate" slot-scope="{ row }">
  69. <el-input-number v-if="row.$cellEdit" v-model="row.exrate" @change="countChange(row)" :controls="false"
  70. placeholder="请输入 汇率" size="small" style="width: 100%;"></el-input-number>
  71. <span v-else>{{ row.exrate }}</span>
  72. </tempalte>
  73. <tempalte slot="stlExrate" slot-scope="{ row }">
  74. <el-input-number v-if="row.$cellEdit" v-model="row.stlExrate" :controls="false" placeholder="请输入 结算汇率"
  75. size="small" style="width: 100%;"></el-input-number>
  76. <span v-else>{{ row.stlExrate }}</span>
  77. </tempalte>
  78. </avue-crud>
  79. <avue-crud style="margin-top: 10px;" :option="optionC" :table-loading="loading" :data="form.feeCenterListC"
  80. id="out-table" ref="crudC" @selection-change="selectionCChange"
  81. @resetColumn="resetColumn('crudC', 'optionC', 'optionCBack', 382)"
  82. @saveColumn="saveColumn('crudC', 'optionC', 'optionCBack', 382)">
  83. <template slot="menuLeft">
  84. <div style="display: inline-block;margin-right: 20px" class="disabledBox fontSize">
  85. <i class="el-icon-coin"></i>
  86. <span>应付费用</span>
  87. </div>
  88. <el-button type="info" plain size="small" :disabled="disabled"
  89. @click="allClick('一键保存', 'C')">一键保存</el-button>
  90. <el-button type="info" plain size="small" :disabled="disabled"
  91. @click="allClick('一键编辑', 'C')">一键编辑</el-button>
  92. <el-button type="danger" plain size="small" :disabled="disabled || selectionCList.length == 0"
  93. @click="allClick('批量删除', 'C')">批量删除</el-button>
  94. <el-button type="primary" plain size="small" :disabled="disabled || selectionCList.length == 0"
  95. @click="allClick('生成账单', 'C')">生成账单</el-button>
  96. <el-button type="danger" plain size="small" :disabled="disabled || selectionCList.length == 0"
  97. @click="allClick('撤销账单', 'C')">撤销账单</el-button>
  98. <el-button type="primary" plain size="small" @click="$refs.printC.openDialog()">打印账单</el-button>
  99. <el-button type="success" plain size="small" :disabled="disabled"
  100. @click="allClick('应付模板', 'C')">应付模板</el-button>
  101. <!-- <el-button type="primary" plain size="small" :disabled="disabled"
  102. @click="allClick('生成应付', 'C')">生成应付</el-button> -->
  103. </template>
  104. <template slot="indexHeader" slot-scope="{row,index}">
  105. <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="disabled" circle @click="addRow('C')">
  106. </el-button>
  107. </template>
  108. <template slot="index" slot-scope="{row,index}">
  109. <span>{{ index + 1 }}</span>
  110. </template>
  111. <template slot="corpCnNameForm" slot-scope="{ row }">
  112. <dic-select v-if="row.$cellEdit" v-model="row.corpCnName" placeholder="往来单位" key="id" label="cnName"
  113. res="records" url="/blade-los/bcorps/listByType?corpTypeName=客户" :filterable="true" :remote="true"
  114. dataName="cnName" @selectChange="rowDicChange('corpCnName', $event, row)"></dic-select>
  115. <span v-else>{{ row.corpCnName }}</span>
  116. </template>
  117. <template slot="feeCnNameForm" slot-scope="{ row }">
  118. <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" placeholder="费用名称" key="id" label="cnName"
  119. res="records" url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"
  120. @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
  121. <span v-else>{{ row.feeCnName }}</span>
  122. </template>
  123. <template slot="unitNoForm" slot-scope="{ row }">
  124. <dic-select v-if="row.$cellEdit" v-model="row.unitNo" placeholder="收费标准" key="id" label="code"
  125. url="/blade-los/bunits/selectList" :filterable="true"
  126. @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
  127. <span v-else>{{ row.unitNo }}</span>
  128. </template>
  129. <tempalte slot="quantityForm" slot-scope="{ row }">
  130. <el-input-number v-if="row.$cellEdit" v-model="row.quantity" @change="countChange(row)" :controls="false"
  131. placeholder="请输入 数量" size="small" style="width: 100%;"></el-input-number>
  132. <span v-else>{{ row.quantity }}</span>
  133. </tempalte>
  134. <tempalte slot="priceForm" slot-scope="{ row }">
  135. <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" :controls="false"
  136. placeholder="请输入 单价" size="small" style="width: 100%;"></el-input-number>
  137. <span v-else>{{ row.price }}</span>
  138. </tempalte>
  139. <template slot="curCodeForm" slot-scope="{ row }">
  140. <dic-select v-if="row.$cellEdit" v-model="row.curCode" placeholder="币别" key="id" label="code"
  141. :url="'/blade-los/bcurrency/getExrate?date=' + form.contractDate + '&dc=' + row.dc" :filterable="true"
  142. @selectChange="rowDicChange('curCode', $event, row)"></dic-select>
  143. <span v-else>{{ row.curCode }}</span>
  144. </template>
  145. <tempalte slot="exrate" slot-scope="{ row }">
  146. <el-input-number v-if="row.$cellEdit" v-model="row.exrate" @change="countChange(row)" :controls="false"
  147. placeholder="请输入 汇率" size="small" style="width: 100%;"></el-input-number>
  148. <span v-else>{{ row.exrate }}</span>
  149. </tempalte>
  150. <tempalte slot="stlExrate" slot-scope="{ row }">
  151. <el-input-number v-if="row.$cellEdit" v-model="row.stlExrate" :controls="false" placeholder="请输入 结算汇率"
  152. size="small" style="width: 100%;"></el-input-number>
  153. <span v-else>{{ row.stlExrate }}</span>
  154. </tempalte>
  155. </avue-crud>
  156. <business-reports :id="form.id" :itemIds="itemIds" ref="printD" businessValue="MYDL" classifyCode="费用"
  157. groupCode="应收" :selecList="selectionDList"></business-reports>
  158. <business-reports :id="form.id" :itemIds="itemIds" ref="printC" businessValue="MYDL" classifyCode="费用"
  159. groupCode="应付" :selecList="selectionCList"></business-reports>
  160. <!--模板弹窗-->
  161. <el-dialog title="提示" :visible.sync="templateVisible" append-to-body width="70%" :close-on-click-modal="false"
  162. :before-close="handleClose">
  163. <div>
  164. <el-row>
  165. <el-col :span="5">
  166. <basic-container>
  167. <avue-tree :option="treeOption" :data="templateData" @node-click="nodeClick">
  168. </avue-tree>
  169. </basic-container>
  170. </el-col>
  171. <el-col :span="19">
  172. <avue-crud :option="templateOption" :data="templateRightData" ref="templateRef"
  173. @selection-change="feeselectionChange">
  174. </avue-crud>
  175. </el-col>
  176. </el-row>
  177. </div>
  178. <span slot="footer" class="dialog-footer">
  179. <el-button size="mini" @click="templateVisible = false; feesselectionList = []; templateRightData = []">取
  180. 消</el-button>
  181. <el-button type="primary" size="mini" @click="templateExport">导 入</el-button>
  182. </span>
  183. </el-dialog>
  184. </div>
  185. </template>
  186. <script>
  187. import dicSelect from "@/components/dicSelect/main";
  188. import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
  189. import { submitListTrade, feeRemove, generateBill, revokeBill, feecenterTemplateImport } from "@/api/tradeAgency/tradeAgency";
  190. import { losbfeestemplateDetail } from "@/api/iosBasicData/losbfeestemplate";
  191. import { losbfeestemplateGetListTemplate } from "@/api/iosBasicData/bills";
  192. import businessReports from "@/components/tradeAgency/businessReports.vue";
  193. import _ from "lodash";
  194. export default {
  195. components: {
  196. dicSelect,
  197. businessReports
  198. },
  199. props: {
  200. detailData: {},
  201. disabled: {
  202. type: Boolean,
  203. default: false,
  204. },
  205. form: {
  206. type: Object,
  207. default: () => {
  208. }
  209. }
  210. },
  211. data() {
  212. return {
  213. treeOption: {
  214. nodeKey: "id",
  215. // lazy: true,
  216. addBtn: false,
  217. menu: false,
  218. size: "small",
  219. props: {
  220. labelText: "标题",
  221. label: "cnName",
  222. value: "value",
  223. children: "children"
  224. }
  225. },
  226. templateOption: {
  227. height: 400,
  228. menu: false,
  229. tip: false,
  230. stripe: true,
  231. addBtn: false,
  232. editBtn: false,
  233. delBtn: false,
  234. viewBtn: false,
  235. index: true,
  236. selection: true,
  237. header: false,
  238. column: [
  239. {
  240. label: '客户',
  241. prop: 'corpCnName',
  242. overHidden: true,
  243. },
  244. {
  245. label: '客户类型',
  246. prop: 'corpType',
  247. overHidden: true,
  248. },
  249. {
  250. label: '费用',
  251. prop: 'feeCnName',
  252. overHidden: true,
  253. },
  254. {
  255. label: '数量',
  256. prop: 'quantity',
  257. overHidden: true,
  258. },
  259. {
  260. label: '单价',
  261. prop: 'price',
  262. overHidden: true,
  263. },
  264. {
  265. label: '计量单位',
  266. prop: 'unitNo',
  267. overHidden: true,
  268. },
  269. {
  270. label: '币别',
  271. prop: 'curCode',
  272. overHidden: true,
  273. }
  274. ]
  275. },
  276. templateVisible: false,
  277. optionD: {},
  278. optionDBack: {
  279. maxHeight: 300,
  280. calcHeight: 30,
  281. menuWidth: 140,
  282. tip: false,
  283. border: true,
  284. addBtn: false,
  285. viewBtn: false,
  286. editBtn: false,
  287. delBtn: false,
  288. menu: false,
  289. refreshBtn: false,
  290. selection: true,
  291. align: 'center',
  292. column: [
  293. {
  294. label: "index",
  295. prop: "index",
  296. width: "55",
  297. headerslot: true,
  298. },
  299. {
  300. label: "账单",
  301. prop: "accStatus",
  302. width: '80',
  303. overHidden: true,
  304. dicData: [{
  305. label: '否',
  306. value: 0
  307. }, {
  308. label: '是',
  309. value: 1
  310. }]
  311. },
  312. {
  313. label: "往来单位",
  314. prop: "corpCnName",
  315. width: '160',
  316. cell: true,
  317. slot: true,
  318. formslot: true,
  319. overHidden: true,
  320. rules: [
  321. {
  322. required: true,
  323. message: '请选择往来单位',
  324. trigger: 'blur'
  325. }
  326. ]
  327. },
  328. {
  329. label: "提单号",
  330. prop: "mblno",
  331. width: '160',
  332. overHidden: true,
  333. },
  334. {
  335. label: "费用名称",
  336. prop: "feeCnName",
  337. width: '120',
  338. cell: true,
  339. slot: true,
  340. formslot: true,
  341. overHidden: true,
  342. rules: [
  343. {
  344. required: true,
  345. message: '请选择费用名称',
  346. trigger: 'blur'
  347. }
  348. ]
  349. },
  350. {
  351. label: "收费标准",
  352. prop: "unitNo",
  353. width: '120',
  354. overHidden: true,
  355. },
  356. {
  357. label: "单价",
  358. prop: "price",
  359. cell: true,
  360. slot: true,
  361. formslot: true,
  362. overHidden: true,
  363. rules: [
  364. {
  365. required: true,
  366. message: '请输入单价',
  367. trigger: 'blur'
  368. }
  369. ]
  370. },
  371. {
  372. label: "数量",
  373. prop: "quantity",
  374. cell: true,
  375. slot: true,
  376. formslot: true,
  377. overHidden: true,
  378. rules: [
  379. {
  380. required: true,
  381. message: '请输入数量',
  382. trigger: 'blur'
  383. }
  384. ]
  385. },
  386. {
  387. label: "金额",
  388. prop: "amount",
  389. overHidden: true,
  390. },
  391. {
  392. label: "币别",
  393. prop: "curCode",
  394. cell: true,
  395. slot: true,
  396. formslot: true,
  397. overHidden: true,
  398. rules: [
  399. {
  400. required: true,
  401. message: '请选择币别',
  402. trigger: 'blur'
  403. }
  404. ]
  405. },
  406. {
  407. label: "外币金额",
  408. prop: "amountLoc",
  409. overHidden: true,
  410. },
  411. {
  412. label: "汇率",
  413. prop: "exrate",
  414. overHidden: true,
  415. },
  416. {
  417. label: "结算汇率",
  418. prop: "stlExrate",
  419. overHidden: true,
  420. },
  421. {
  422. label: "结算日期",
  423. prop: "stlDate",
  424. width: "120",
  425. // cell: true,
  426. type: "date",
  427. format: "yyyy-MM-dd",
  428. valueFormat: "yyyy-MM-dd 00:00:00",
  429. overHidden: true
  430. },
  431. {
  432. label: "备注",
  433. prop: "remarks",
  434. cell: true,
  435. width: '200',
  436. overHidden: true,
  437. },
  438. ]
  439. },
  440. optionC: {},
  441. optionCBack: {
  442. maxHeight: 300,
  443. calcHeight: 30,
  444. menuWidth: 140,
  445. tip: false,
  446. border: true,
  447. addBtn: false,
  448. viewBtn: false,
  449. editBtn: false,
  450. delBtn: false,
  451. menu: false,
  452. refreshBtn: false,
  453. selection: true,
  454. align: 'center',
  455. column: [
  456. {
  457. label: "index",
  458. prop: "index",
  459. width: "55",
  460. headerslot: true,
  461. },
  462. {
  463. label: "账单",
  464. prop: "accStatus",
  465. width: '80',
  466. overHidden: true,
  467. dicData: [{
  468. label: '否',
  469. value: 0
  470. }, {
  471. label: '是',
  472. value: 1
  473. }]
  474. },
  475. {
  476. label: "往来单位",
  477. prop: "corpCnName",
  478. width: '160',
  479. cell: true,
  480. slot: true,
  481. formslot: true,
  482. overHidden: true,
  483. rules: [
  484. {
  485. required: true,
  486. message: '请选择往来单位',
  487. trigger: 'blur'
  488. }
  489. ]
  490. },
  491. {
  492. label: "提单号",
  493. prop: "mblno",
  494. width: '160',
  495. overHidden: true,
  496. },
  497. {
  498. label: "费用名称",
  499. prop: "feeCnName",
  500. width: '120',
  501. cell: true,
  502. slot: true,
  503. formslot: true,
  504. overHidden: true,
  505. rules: [
  506. {
  507. required: true,
  508. message: '请选择费用名称',
  509. trigger: 'blur'
  510. }
  511. ]
  512. },
  513. {
  514. label: "收费标准",
  515. prop: "unitNo",
  516. width: '120',
  517. overHidden: true,
  518. },
  519. {
  520. label: "单价",
  521. prop: "price",
  522. cell: true,
  523. slot: true,
  524. formslot: true,
  525. overHidden: true,
  526. rules: [
  527. {
  528. required: true,
  529. message: '请输入单价',
  530. trigger: 'blur'
  531. }
  532. ]
  533. },
  534. {
  535. label: "数量",
  536. prop: "quantity",
  537. cell: true,
  538. slot: true,
  539. formslot: true,
  540. overHidden: true,
  541. rules: [
  542. {
  543. required: true,
  544. message: '请输入数量',
  545. trigger: 'blur'
  546. }
  547. ]
  548. },
  549. {
  550. label: "金额",
  551. prop: "amount",
  552. overHidden: true,
  553. },
  554. {
  555. label: "币别",
  556. prop: "curCode",
  557. cell: true,
  558. slot: true,
  559. formslot: true,
  560. overHidden: true,
  561. rules: [
  562. {
  563. required: true,
  564. message: '请选择币别',
  565. trigger: 'blur'
  566. }
  567. ]
  568. },
  569. {
  570. label: "外币金额",
  571. prop: "amountLoc",
  572. overHidden: true,
  573. },
  574. {
  575. label: "汇率",
  576. prop: "exrate",
  577. overHidden: true,
  578. },
  579. {
  580. label: "结算汇率",
  581. prop: "stlExrate",
  582. overHidden: true,
  583. },
  584. {
  585. label: "结算日期",
  586. prop: "stlDate",
  587. width: "120",
  588. // cell: true,
  589. type: "date",
  590. format: "yyyy-MM-dd",
  591. valueFormat: "yyyy-MM-dd 00:00:00",
  592. overHidden: true
  593. },
  594. {
  595. label: "优惠汇率",
  596. prop: "discountExrate",
  597. cell: true,
  598. type: 'number',
  599. controls: false,
  600. width: "120",
  601. overHidden: true
  602. },
  603. {
  604. label: "利润",
  605. prop: "profit",
  606. overHidden: true,
  607. },
  608. {
  609. label: "备注",
  610. prop: "remarks",
  611. cell: true,
  612. width: '200',
  613. overHidden: true,
  614. },
  615. ]
  616. },
  617. selectionDList: [],
  618. selectionCList: [],
  619. templateData: [],
  620. lefttemplate: {}, // 左侧选择的数据
  621. feesselectionList: [], // 清空多选
  622. templateRightData: [],
  623. itemIds: null,
  624. }
  625. },
  626. async created() {
  627. this.optionD = await this.getColumnData(this.getColumnName(381), this.optionDBack);
  628. this.optionC = await this.getColumnData(this.getColumnName(382), this.optionCBack);
  629. },
  630. methods: {
  631. // 模板导入
  632. templateExport() {
  633. if (!this.lefttemplate.id) {
  634. this.$message.warning('请选择左侧客户')
  635. return
  636. }
  637. if (this.feesselectionList.length > 0) {
  638. feecenterTemplateImport({
  639. ...this.lefttemplate,
  640. feesTemplateItemsList: this.feesselectionList,
  641. billNoId: this.form.id
  642. }).then(res => {
  643. if (res.data.msg.indexOf('未导入') >= 0) {
  644. this.$message({
  645. type: "error",
  646. message: res.data.msg
  647. });
  648. } else {
  649. this.$message({
  650. type: "success",
  651. message: res.data.msg
  652. });
  653. }
  654. this.feesselectionList = [] // 清空多选
  655. this.templateRightData = [] // 清空数据
  656. this.lefttemplate = {}//左侧数据
  657. this.$emit('getDetails', this.form.id)
  658. this.templateVisible = false
  659. })
  660. } else {
  661. this.$message.warning('请先选择要导入的数据')
  662. }
  663. },
  664. // 模板
  665. // 左侧选择
  666. nodeClick(e) {
  667. this.lefttemplate = e
  668. losbfeestemplateDetail(e.id).then(res => {
  669. this.templateRightData = res.data.data.feesTemplateItemsList
  670. })
  671. },
  672. // 关闭弹窗
  673. handleClose(done) {
  674. this.feesselectionList = [] // 清空多选
  675. this.templateRightData = [] // 清空数据
  676. done();
  677. },
  678. feeselectionChange(list) {
  679. this.feesselectionList = list;
  680. },
  681. addRow(type) {
  682. if (!this.form.id) return this.$message.error('请保存数据');
  683. if (type == 'D') {
  684. if (this.form.feeCenterListD.length == 0) {
  685. this.form.feeCenterListD.push({
  686. $cellEdit: true,
  687. pid: this.form.id,
  688. dc: type,
  689. accStatus: 0,
  690. businessType: this.form.businessType,
  691. billNo: this.form.businessNo,
  692. billDate: this.form.businessDate,
  693. discountExrate: 0,
  694. })
  695. } else {
  696. this.form.feeCenterListD.push({
  697. $cellEdit: true,
  698. pid: this.form.id,
  699. dc: type,
  700. accStatus: 0,
  701. businessType: this.form.businessType,
  702. billNo: this.form.businessNo,
  703. billDate: this.form.businessDate,
  704. discountExrate: 0,
  705. corpCnName: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].corpCnName,
  706. corpId: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].corpId,
  707. corpEnName: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].corpEnName,
  708. billCorpId: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].billCorpId,
  709. billCorpCnName: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].billCorpCnName,
  710. })
  711. }
  712. }
  713. if (type == 'C') {
  714. if (this.form.feeCenterListC.length == 0) {
  715. this.form.feeCenterListC.push({
  716. $cellEdit: true,
  717. pid: this.form.id,
  718. dc: type,
  719. accStatus: 0,
  720. businessType: this.form.businessType,
  721. billNo: this.form.businessNo,
  722. billDate: this.form.businessDate,
  723. discountExrate: 0,
  724. })
  725. } else {
  726. this.form.feeCenterListC.push({
  727. $cellEdit: true,
  728. pid: this.form.id,
  729. dc: type,
  730. accStatus: 0,
  731. businessType: this.form.businessType,
  732. billNo: this.form.businessNo,
  733. billDate: this.form.businessDate,
  734. discountExrate: 0,
  735. corpCnName: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].corpCnName,
  736. corpId: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].corpId,
  737. corpEnName: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].corpEnName,
  738. billCorpId: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].billCorpId,
  739. billCorpCnName: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].billCorpCnName,
  740. })
  741. }
  742. }
  743. },
  744. countChange(row) {
  745. row.amount = _.multiply(Number(row.quantity ? row.quantity : 0), Number(row.price ? row.price : 0))
  746. if (row.feeCode == 'SFK' || row.feeCode == 'WK') {
  747. row.amount = _.multiply(Number(row.amountLoc ? row.amountLoc : 0), Number(row.exrate ? row.exrate : 0))
  748. }
  749. },
  750. selectionDChange(list) {
  751. let ids = []
  752. list.forEach(e => {
  753. ids.push(e.id)
  754. })
  755. if (ids.length) {
  756. this.itemIds = ids.join(',')
  757. } else {
  758. this.itemIds = null
  759. }
  760. this.selectionDList = list
  761. },
  762. selectionCChange(list) {
  763. let ids = []
  764. list.forEach(e => {
  765. ids.push(e.id)
  766. })
  767. if (ids.length) {
  768. this.itemIds = ids.join(',')
  769. } else {
  770. this.itemIds = null
  771. }
  772. this.selectionCList = list
  773. },
  774. rowDicChange(name, row, el) {
  775. if (name == 'corpCnName') {
  776. if (row) {
  777. el.corpId = row.id
  778. el.corpEnName = row.enName
  779. el.billCorpId = row.id
  780. el.billCorpCnName = row.cnName
  781. } else {
  782. el.corpId = null
  783. el.corpEnName = null
  784. el.billCorpId = null
  785. el.billCorpCnName = null
  786. }
  787. }
  788. if (name == 'feeCnName') {
  789. if (row) {
  790. el.feeId = row.id
  791. el.feeCode = row.code
  792. el.feeEnName = row.enName
  793. el.curCode = row.curNo
  794. el.elementsId = row.accElementId
  795. el.elementsCode = row.elementsCode
  796. el.elementsCnName = row.accElementName
  797. el.elementsEnName = row.elementsEnName
  798. bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
  799. res.data.data.forEach(e => {
  800. if (row.curNo == e.code) {
  801. this.$set(el, 'exrate', e.exrate)
  802. }
  803. })
  804. })
  805. } else {
  806. el.feeId = null
  807. el.feeCode = null
  808. el.feeEnName = null
  809. el.curCode = null
  810. el.elementsId = null
  811. el.elementsCode = null
  812. el.elementsCnName = null
  813. el.elementsEnName = null
  814. }
  815. }
  816. if (name == 'curCode') {
  817. if (row) {
  818. bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
  819. res.data.data.forEach(e => {
  820. if (el.curCode == e.code) {
  821. this.$set(el, 'exrate', e.exrate)
  822. }
  823. })
  824. })
  825. } else {
  826. el.exrate = null
  827. }
  828. }
  829. },
  830. allClick(name, type) {
  831. if (name == '一键保存') {
  832. if (type == 'D') {
  833. for (let row of this.form.feeCenterListD) {
  834. if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
  835. this.$refs.crudD.rowCell(row, row.$index)
  836. return this.$message.error("请完善应收费用信息");
  837. }
  838. }
  839. this.form.feeCenterListD.forEach(e => {
  840. this.$set(e, '$cellEdit', false)
  841. })
  842. const loading = this.$loading({
  843. lock: true,
  844. text: '加载中',
  845. spinner: 'el-icon-loading',
  846. background: 'rgba(255,255,255,0.7)'
  847. });
  848. submitListTrade(this.form.feeCenterListD).then(res => {
  849. this.form.feeCenterListD = res.data.data
  850. this.$message.success("保存成功");
  851. }).finally(() => {
  852. loading.close();
  853. })
  854. }
  855. if (type == 'C') {
  856. for (let row of this.form.feeCenterListC) {
  857. if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
  858. this.$refs.crudC.rowCell(row, row.$index)
  859. return this.$message.error("请完善应付费用信息");
  860. }
  861. }
  862. for (let index in this.form.feeCenterListC) {
  863. if (this.form.feeCenterListC[index].feeCnName == '首款' || this.form.feeCenterListC[index].feeCnName == '尾款' || this.form.feeCenterListC[index].feeCnName == '手续费') {
  864. this.$refs.crudC.rowCell(this.form.feeCenterListC[index], index)
  865. if (!this.form.feeCenterListC[index].discountExrate) return this.$message.error("第" + (Number(index) + 1) + "行" + this.form.feeCenterListC[index].feeCnName + "费用优惠汇率不能为空");
  866. }
  867. }
  868. this.form.feeCenterListC.forEach(e => {
  869. this.$set(e, '$cellEdit', false)
  870. })
  871. const loading = this.$loading({
  872. lock: true,
  873. text: '加载中',
  874. spinner: 'el-icon-loading',
  875. background: 'rgba(255,255,255,0.7)'
  876. });
  877. submitListTrade(this.form.feeCenterListC).then(res => {
  878. this.form.feeCenterListC = res.data.data
  879. this.$message.success("保存成功");
  880. }).finally(() => {
  881. loading.close();
  882. })
  883. }
  884. }
  885. if (name == '一键编辑') {
  886. if (type == 'D') {
  887. this.form.feeCenterListD.forEach(e => {
  888. this.$set(e, '$cellEdit', true)
  889. })
  890. }
  891. if (type == 'C') {
  892. this.form.feeCenterListC.forEach(e => {
  893. this.$set(e, '$cellEdit', true)
  894. })
  895. }
  896. }
  897. if (name == '批量删除') {
  898. let multiList = []
  899. let arr = []
  900. for (let index in this.selectionDList) {
  901. if (this.selectionDList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionDList[index].$index) + 1) + "行不允许删除");
  902. }
  903. for (let index in this.selectionCList) {
  904. if (this.selectionCList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionCList[index].$index) + 1) + "行不允许删除");
  905. }
  906. if (type == 'D') {
  907. this.$confirm("确定将选择数据删除?", {
  908. confirmButtonText: "确定",
  909. cancelButtonText: "取消",
  910. type: "warning"
  911. }).then(() => {
  912. multiList = this.selectionDList
  913. arr = this.form.feeCenterListD
  914. // 获取有id 的数据
  915. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  916. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  917. // 把选中的删除掉
  918. multiList.forEach((item) => {
  919. for (let index in arr) {
  920. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  921. arr.splice(Number(index), 1)
  922. }
  923. }
  924. })
  925. if (itemsWithId.length != 0) {
  926. const loading = this.$loading({
  927. lock: true,
  928. text: '加载中',
  929. spinner: 'el-icon-loading',
  930. background: 'rgba(255,255,255,0.7)'
  931. });
  932. feeRemove({ ids: arrIds.join(',') }).then(res => {
  933. this.$message.success("删除成功");
  934. }).finally(() => {
  935. loading.close();
  936. })
  937. }
  938. })
  939. }
  940. if (type == 'C') {
  941. this.$confirm("确定将选择数据删除?", {
  942. confirmButtonText: "确定",
  943. cancelButtonText: "取消",
  944. type: "warning"
  945. }).then(() => {
  946. multiList = this.selectionCList
  947. arr = this.form.feeCenterListC
  948. // 获取有id 的数据
  949. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  950. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  951. // 把选中的删除掉
  952. multiList.forEach((item) => {
  953. for (let index in arr) {
  954. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  955. arr.splice(Number(index), 1)
  956. }
  957. }
  958. })
  959. if (itemsWithId.length != 0) {
  960. const loading = this.$loading({
  961. lock: true,
  962. text: '加载中',
  963. spinner: 'el-icon-loading',
  964. background: 'rgba(255,255,255,0.7)'
  965. });
  966. feeRemove({ ids: arrIds.join(',') }).then(res => {
  967. this.$message.success("删除成功");
  968. }).finally(() => {
  969. loading.close();
  970. })
  971. }
  972. })
  973. }
  974. }
  975. if (name == '生成账单') {
  976. if (type == 'D') {
  977. for (let index in this.selectionDList) {
  978. if (this.selectionDList[index].accStatus != 0) {
  979. return this.$message.error("已生成账单");
  980. }
  981. }
  982. this.$confirm("确定将选择数据生成账单?", {
  983. confirmButtonText: "确定",
  984. cancelButtonText: "取消",
  985. type: "warning"
  986. }).then(() => {
  987. const loading = this.$loading({
  988. lock: true,
  989. text: '加载中',
  990. spinner: 'el-icon-loading',
  991. background: 'rgba(255,255,255,0.7)'
  992. });
  993. generateBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
  994. this.$message.success("成功生成账单");
  995. this.$emit('getDetails', this.form.id)
  996. }).finally(() => {
  997. loading.close();
  998. })
  999. })
  1000. }
  1001. if (type == 'C') {
  1002. for (let index in this.selectionCList) {
  1003. if (this.selectionCList[index].accStatus != 0) {
  1004. return this.$message.error("已生成账单");
  1005. }
  1006. }
  1007. this.$confirm("确定将选择数据生成账单?", {
  1008. confirmButtonText: "确定",
  1009. cancelButtonText: "取消",
  1010. type: "warning"
  1011. }).then(() => {
  1012. const loading = this.$loading({
  1013. lock: true,
  1014. text: '加载中',
  1015. spinner: 'el-icon-loading',
  1016. background: 'rgba(255,255,255,0.7)'
  1017. });
  1018. generateBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
  1019. this.$message.success("成功生成账单");
  1020. this.$emit('getDetails', this.form.id)
  1021. }).finally(() => {
  1022. loading.close();
  1023. })
  1024. })
  1025. }
  1026. }
  1027. if (name == '撤销账单') {
  1028. if (type == 'D') {
  1029. for (let index in this.selectionDList) {
  1030. if (this.selectionDList[index].accStatus != 1) {
  1031. return this.$message.error("未生成账单");
  1032. }
  1033. }
  1034. this.$confirm("确定将选择数据撤销账单?", {
  1035. confirmButtonText: "确定",
  1036. cancelButtonText: "取消",
  1037. type: "warning"
  1038. }).then(() => {
  1039. const loading = this.$loading({
  1040. lock: true,
  1041. text: '加载中',
  1042. spinner: 'el-icon-loading',
  1043. background: 'rgba(255,255,255,0.7)'
  1044. });
  1045. revokeBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
  1046. this.$message.success("成功撤销账单");
  1047. this.$emit('getDetails', this.form.id)
  1048. }).finally(() => {
  1049. loading.close();
  1050. })
  1051. })
  1052. }
  1053. if (type == 'C') {
  1054. for (let index in this.selectionCList) {
  1055. if (this.selectionCList[index].accStatus != 1) {
  1056. return this.$message.error("未生成账单");
  1057. }
  1058. }
  1059. this.$confirm("确定将选择数据撤销账单?", {
  1060. confirmButtonText: "确定",
  1061. cancelButtonText: "取消",
  1062. type: "warning"
  1063. }).then(() => {
  1064. const loading = this.$loading({
  1065. lock: true,
  1066. text: '加载中',
  1067. spinner: 'el-icon-loading',
  1068. background: 'rgba(255,255,255,0.7)'
  1069. });
  1070. revokeBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
  1071. this.$message.success("成功撤销账单");
  1072. this.$emit('getDetails', this.form.id)
  1073. }).finally(() => {
  1074. loading.close();
  1075. })
  1076. })
  1077. }
  1078. }
  1079. if (name == '应收模板') {
  1080. this.templateVisible = true
  1081. losbfeestemplateGetListTemplate(1, 50, {
  1082. dc: type,
  1083. status: 0,
  1084. type: 'MYDL'
  1085. }).then(res => {
  1086. this.templateData = res.data.data.records
  1087. // 查第一条的明细
  1088. losbfeestemplateDetail(this.templateData[0].id).then(res => {
  1089. this.templateRightData = res.data.data.feesTemplateItemsList
  1090. })
  1091. })
  1092. }
  1093. if (name == '应付模板') {
  1094. this.templateVisible = true
  1095. losbfeestemplateGetListTemplate(1, 50, {
  1096. dc: type,
  1097. status: 0,
  1098. type: 'MYDL'
  1099. }).then(res => {
  1100. this.templateData = res.data.data.records
  1101. // 查第一条的明细
  1102. losbfeestemplateDetail(this.templateData[0].id).then(res => {
  1103. this.templateRightData = res.data.data.feesTemplateItemsList
  1104. })
  1105. })
  1106. }
  1107. },
  1108. submitValidate() {
  1109. for (let row of this.form.feeCenterListD) {
  1110. if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
  1111. this.$refs.crudD.rowCell(row, row.$index)
  1112. this.$message.error("请完善应收费用信息");
  1113. return false
  1114. }
  1115. }
  1116. for (let row of this.form.feeCenterListC) {
  1117. if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
  1118. this.$refs.crudC.rowCell(row, row.$index)
  1119. this.$message.error("请完善应付费用信息");
  1120. return false
  1121. }
  1122. }
  1123. for (let index in this.form.feeCenterListC) {
  1124. if (this.form.feeCenterListC[index].feeCnName == '首款' || this.form.feeCenterListC[index].feeCnName == '尾款' || this.form.feeCenterListC[index].feeCnName == '手续费') {
  1125. if (!this.form.feeCenterListC[index].discountExrate) {
  1126. this.$message.error("第" + (Number(index) + 1) + "行" + this.form.feeCenterListC[index].feeCnName + "费用优惠汇率不能为空");
  1127. return false
  1128. }
  1129. }
  1130. }
  1131. return true
  1132. },
  1133. //自定义列保存
  1134. async saveColumn(ref, option, optionBack, code) {
  1135. /**
  1136. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1137. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1138. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1139. */
  1140. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1141. if (inSave) {
  1142. this.$message.success("保存成功");
  1143. //关闭窗口
  1144. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1145. }
  1146. },
  1147. //自定义列重置
  1148. async resetColumn(ref, option, optionBack, code) {
  1149. this[option] = this[optionBack];
  1150. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1151. if (inSave) {
  1152. this.$message.success("重置成功");
  1153. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1154. }
  1155. },
  1156. },
  1157. }
  1158. </script>
  1159. <style scoped lang="scss">
  1160. .disabledBox {
  1161. display: flex;
  1162. align-items: center;
  1163. }
  1164. .fontSize {
  1165. font-size: 16px;
  1166. color: #81B337;
  1167. }
  1168. .meetSize {
  1169. font-size: 16px;
  1170. color: #54BCBD;
  1171. }
  1172. ::v-deep#out-table .back-one {
  1173. background: #ecf5ff !important;
  1174. text-align: center;
  1175. padding: 4px 0;
  1176. }
  1177. ::v-deep#out-table .back-two {
  1178. background: #ecf5ff !important;
  1179. text-align: center;
  1180. padding: 4px 0;
  1181. }
  1182. ::v-deep .el-table--small td,
  1183. .el-table--small th {
  1184. padding: 2px !important;
  1185. }
  1186. </style>