fininvoicesDetails.vue 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button type="success" size="small" :disabled="!form.id" plain @click="newbillFun">新建发票
  11. </el-button>
  12. <el-button size="small" type="warning" plain style="margin-right: 8px" :disabled="!form.id || editPower"
  13. v-if="form.status == 3" :loading="saveLoading" @click="fininvoicesRevokeFinInvoicesfun">撤销开票
  14. </el-button>
  15. <el-button size="small" type="success" plain style="margin-right: 8px" :disabled="!form.id || editPower"
  16. v-else :loading="saveLoading" @click="submit('开票')">确认开票
  17. </el-button>
  18. <el-button size="small" type="primary" :disabled="statusType || editPower" style="margin-right: 8px"
  19. v-if="editSave" :loading="saveLoading" @click="editHandle">编 辑
  20. </el-button>
  21. <el-button size="small" type="primary" :disabled="statusType" style="margin-right: 8px" v-else
  22. :loading="saveLoading" @click="editCustomer()">保 存
  23. </el-button>
  24. </div>
  25. </div>
  26. <div style="margin: 55px 5px 0px 5px;'">
  27. <el-form :model="form" ref="form" :rules="rules" label-width="90px" class="demo-ruleForm">
  28. <trade-card title="基础信息" styleIocup="color:#4b9fe9">
  29. <el-row>
  30. <el-col :span="10">
  31. <div class="flexBoxLeft">
  32. <el-row>
  33. <el-col :span="12">
  34. <el-form-item label="发票号码" prop="invoiceNo">
  35. <el-input style="width: 100%;" v-model="form.invoiceNo" size="small"
  36. autocomplete="off" :disabled="true" clearable placeholder="发票号码">
  37. </el-input>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="12">
  41. <el-form-item label="开票日期" prop="invoiceDate">
  42. <el-date-picker v-model="form.invoiceDate" clearable style="width: 100%;"
  43. type="date" size="small" :disabled="editSave" value-format="yyyy-MM-dd"
  44. placeholder="选择开票日期">
  45. </el-date-picker>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="24">
  49. <el-form-item label="开票单位" prop="invCorpCnName">
  50. <search-query :datalist="invCorpData" :selectValue="form.invCorpCnName"
  51. :clearable="true" :disabled="editSave || !form.corpId" :buttonIf="false"
  52. :remote="true" :filterable="true" placeholder="请选择开票单位"
  53. :forParameter="{ key: 'id', label: 'invoiceHeader', value: 'id' }"
  54. @corpChange="corpChange($event, 'invCorpCnName')"
  55. @remoteMethod="invcorpsinvoiceheaderListfun"
  56. @corpFocus="invcorpsinvoiceheaderListfun">
  57. </search-query>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="12">
  61. <el-form-item label="税号" prop="invCorpTaxNo">
  62. <el-input style="width: 100%;" v-model="form.invCorpTaxNo" size="small"
  63. autocomplete="off" :disabled="true" clearable placeholder="请输入税号">
  64. </el-input>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="12">
  68. <el-form-item label="发票币种" prop="invCurCode">
  69. <search-query :datalist="invCurCodeData" :selectValue="form.invCurCode"
  70. :filterable="true" :clearable="true" :disabled="editSave"
  71. :buttonIf="false" placeholder="请选择发票币种"
  72. :forParameter="{ key: 'id', label: 'code', value: 'code' }"
  73. @corpChange="corpChange($event, 'invCurCode')"
  74. @corpFocus="invCurCodeRateListfun">
  75. </search-query>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="12">
  79. <el-form-item label="美元银行" prop="invCorpAccountBankUsd">
  80. <el-input style="width: 100%;" v-model="form.invCorpAccountBankUsd"
  81. size="small" autocomplete="off" :disabled="true" clearable
  82. placeholder="请输入美元银行">
  83. </el-input>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="12">
  87. <el-form-item label="美元账户" prop="invCorpAccountNoUsd">
  88. <el-input style="width: 100%;" v-model="form.invCorpAccountNoUsd"
  89. size="small" autocomplete="off" :disabled="true" clearable
  90. placeholder="请输入美元账户">
  91. </el-input>
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. <el-row v-show="showForm">
  96. <el-col :span="12">
  97. <el-form-item label="人民币银行" prop="invCorpAccountBankCny">
  98. <el-input style="width: 100%;" v-model="form.invCorpAccountBankCny"
  99. size="small" autocomplete="off" :disabled="true" clearable
  100. placeholder="请输入美元银行">
  101. </el-input>
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="12">
  105. <el-form-item label="人民币账户" prop="invCorpAccountNoCny">
  106. <el-input style="width: 100%;" v-model="form.invCorpAccountNoCny"
  107. size="small" autocomplete="off" :disabled="true" clearable
  108. placeholder="请输入人民币账户">
  109. </el-input>
  110. </el-form-item>
  111. </el-col>
  112. <el-col :span="12">
  113. <el-form-item label="船名/航次" prop="vesselVoyno">
  114. <el-input style="width: 100%;" v-model="form.vesselVoyno" size="small"
  115. autocomplete="off" :disabled="editSave" clearable
  116. placeholder="请输入船名/航次">
  117. </el-input>
  118. </el-form-item>
  119. </el-col>
  120. <el-col :span="12">
  121. <el-form-item label="开航日期" prop="etd">
  122. <el-date-picker v-model="form.etd" clearable style="width: 100%;"
  123. type="date" size="small" :disabled="editSave"
  124. value-format="yyyy-MM-dd HH:mm:ss" placeholder="请输入开航日期">
  125. </el-date-picker>
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="12">
  129. <el-form-item label="装货港" prop="pol">
  130. <search-query :datalist="polData" :selectValue="form.pol" :filterable="true"
  131. :clearable="true" :remote="true" :disabled="editSave" :buttonIf="false"
  132. placeholder="请选择装货港"
  133. :forParameter="{ key: 'id', label: 'enName', value: 'enName' }"
  134. @corpChange="corpChange($event, 'pol')" @remoteMethod="polBportsListfun"
  135. @corpFocus="polBportsListfun">
  136. </search-query>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="12">
  140. <el-form-item label="卸货港" prop="pod">
  141. <search-query :datalist="podData" :selectValue="form.pod" :filterable="true"
  142. :clearable="true" :remote="true" :disabled="editSave" :buttonIf="false"
  143. placeholder="请选择卸货港"
  144. :forParameter="{ key: 'id', label: 'enName', value: 'enName' }"
  145. @corpChange="corpChange($event, 'pod')" @remoteMethod="podBportsListfun"
  146. @corpFocus="podBportsListfun">
  147. </search-query>
  148. </el-form-item>
  149. </el-col>
  150. <el-col :span="12">
  151. <el-form-item label="目的地" prop="destination">
  152. <search-query :datalist="destinationData" :selectValue="form.destination"
  153. :filterable="true" :clearable="true" :remote="true" :disabled="editSave"
  154. :buttonIf="false" placeholder="请选择目的地"
  155. :forParameter="{ key: 'id', label: 'enName', value: 'enName' }"
  156. @corpChange="corpChange($event, 'destination')"
  157. @remoteMethod="destinationBportsListfun"
  158. @corpFocus="destinationBportsListfun">
  159. </search-query>
  160. </el-form-item>
  161. </el-col>
  162. <el-col :span="12">
  163. <el-form-item label="箱型箱量" prop="containers">
  164. <el-input style="width: 100%;" v-model="form.containers" size="small"
  165. autocomplete="off" :disabled="editSave" clearable placeholder="请输入箱型箱量">
  166. </el-input>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="8">
  170. <el-form-item label="开票CNY:" prop="amountCny">
  171. <span>¥{{ form.amountCny }}</span>
  172. </el-form-item>
  173. </el-col>
  174. <el-col :span="8">
  175. <el-form-item label="开票USD:" prop="amountUsd">
  176. <span>${{ form.amountUsd }}</span>
  177. </el-form-item>
  178. </el-col>
  179. <el-col :span="8">
  180. <el-form-item label="开票合计:" prop="amountLoc">
  181. <span>¥{{ form.amountLoc }}</span>
  182. </el-form-item>
  183. </el-col>
  184. </el-row>
  185. </div>
  186. </el-col>
  187. <el-col :span="14">
  188. <div class="flexBoxRight">
  189. <!--<el-row>-->
  190. <!-- <el-col :span="4">-->
  191. <!-- <el-switch-->
  192. <!-- v-model="form.stlMode"-->
  193. <!-- active-value="1"-->
  194. <!-- inactive-value="0"-->
  195. <!-- active-color="#66dd7a"-->
  196. <!-- inactive-color="#4ea6ea"-->
  197. <!-- active-text="票结"-->
  198. <!-- inactive-text="月结">-->
  199. <!-- </el-switch>-->
  200. <!-- </el-col>-->
  201. <!-- <el-col :span="6">-->
  202. <!-- <el-checkbox style="margin-left: 10%" size="medium" :true-label="1" :false-label="0"-->
  203. <!-- :disabled="editSave"-->
  204. <!-- v-model="form.isDk">整票(不列费用明细)-->
  205. <!-- </el-checkbox>-->
  206. <!-- </el-col>-->
  207. <!-- <el-col :span="5">-->
  208. <!-- <el-checkbox style="margin-left: 10%" size="medium" :true-label="1" :false-label="0"-->
  209. <!-- :disabled="editSave"-->
  210. <!-- v-model="form.isRp">只提取开票费用-->
  211. <!-- </el-checkbox>-->
  212. <!-- </el-col>-->
  213. <!-- <el-col :span="3">-->
  214. <!-- <el-checkbox style="margin-left: 10%" size="medium" :true-label="1" :false-label="0"-->
  215. <!-- :disabled="editSave"-->
  216. <!-- v-model="form.isExportMblno">主单号-->
  217. <!-- </el-checkbox>-->
  218. <!-- </el-col>-->
  219. <!-- <el-col :span="3">-->
  220. <!-- <el-checkbox style="margin-left: 10%" size="medium" :true-label="1" :false-label="0"-->
  221. <!-- :disabled="editSave"-->
  222. <!-- v-model="form.isExportVslvoy">船名航次-->
  223. <!-- </el-checkbox>-->
  224. <!-- </el-col>-->
  225. <!-- <el-col :span="3">-->
  226. <!-- <el-checkbox style="margin-left: 10%" size="medium" :true-label="1" :false-label="0"-->
  227. <!-- :disabled="editSave"-->
  228. <!-- v-model="form.isExportHblno">分单号-->
  229. <!-- </el-checkbox>-->
  230. <!-- </el-col>-->
  231. <!--</el-row>-->
  232. <el-row>
  233. <el-col :span="8">
  234. <el-form-item label="结算单位" prop="corpCnName">
  235. <search-query :datalist="corpData" :selectValue="form.corpCnName"
  236. :clearable="true" :disabled="editSave" :buttonIf="false" :remote="true"
  237. :filterable="true" placeholder="请输入结算单位"
  238. :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  239. @corpChange="corpChange($event, 'corpCnName')"
  240. @remoteMethod="corpBcorpsListfun" @corpFocus="corpBcorpsListfun">
  241. </search-query>
  242. </el-form-item>
  243. </el-col>
  244. <el-col :span="8">
  245. <el-form-item label="费用名称" prop="feeCnName">
  246. <dic-select v-model="form.feeCnName" placeholder="费用名称" key="id"
  247. label="cnName" url="/blade-los/bfees/listAll" :filterable="true"
  248. :multiple="true" :collapseTags="true" :disabled="editSave"></dic-select>
  249. </el-form-item>
  250. </el-col>
  251. <el-col :span="8">
  252. <el-form-item label="税控发票号" prop="taxInvoiceNo">
  253. <el-input style="width: 100%;" v-model="form.taxInvoiceNo" size="small"
  254. autocomplete="off" :disabled="editSave" clearable
  255. placeholder="请输入税控发票号">
  256. </el-input>
  257. </el-form-item>
  258. </el-col>
  259. <el-col :span="8">
  260. <el-form-item label="业务开始日期" prop="accountDateFrom">
  261. <el-date-picker v-model="form.accountDateFrom" clearable
  262. style="width: 100%;" type="date" size="small" :disabled="editSave"
  263. value-format="yyyy-MM-dd" placeholder="选择业务日期">
  264. </el-date-picker>
  265. </el-form-item>
  266. </el-col>
  267. <el-col :span="8">
  268. <el-form-item label="业务结束日期" prop="accountDateTo">
  269. <el-date-picker v-model="form.accountDateTo" clearable style="width: 100%;"
  270. type="date" size="small" :disabled="editSave" value-format="yyyy-MM-dd"
  271. placeholder="选择业务日期">
  272. </el-date-picker>
  273. </el-form-item>
  274. </el-col>
  275. <el-col :span="8">
  276. <el-form-item label="发票汇率" prop="exrate">
  277. <el-input style="width: 100%;" v-model="form.exrate" size="small"
  278. autocomplete="off" :disabled="editSave" clearable placeholder="请输入发票汇率">
  279. </el-input>
  280. </el-form-item>
  281. </el-col>
  282. <el-col :span="16">
  283. <el-form-item label="业务编号" prop="businessNo">
  284. <el-input style="width: 100%;" v-model="form.businessNo" size="small"
  285. autocomplete="off" :disabled="editSave" clearable placeholder="请输入业务编号">
  286. </el-input>
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="8">
  290. <el-form-item label="发票类型" prop="invType">
  291. <search-query :datalist="invTypeData" :selectValue="form.invType"
  292. :clearable="true" :disabled="editSave" :buttonIf="false"
  293. placeholder="请输入发票类型"
  294. :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }"
  295. @corpChange="corpChange($event, 'invType')"
  296. @corpFocus="invTypeWorkDictsfun">
  297. </search-query>
  298. </el-form-item>
  299. </el-col>
  300. <el-col :span="16">
  301. <el-form-item label="主单编号" prop="mblno">
  302. <el-input style="width: 100%;" v-model="form.mblno" size="small"
  303. autocomplete="off" :disabled="editSave" clearable placeholder="请输入主单编号">
  304. </el-input>
  305. </el-form-item>
  306. </el-col>
  307. <el-col :span="8">
  308. <el-form-item label="对账单号" prop="checkNo">
  309. <el-input style="width: 100%;" v-model="form.checkNo" size="small"
  310. autocomplete="off" :disabled="editSave" clearable placeholder="请输入对账单号">
  311. </el-input>
  312. </el-form-item>
  313. </el-col>
  314. </el-row>
  315. <el-row v-show="showForm">
  316. <el-col :span="16">
  317. <el-form-item label="分单编号" prop="hblno">
  318. <el-input style="width: 100%;" v-model="form.hblno" size="small"
  319. autocomplete="off" :disabled="editSave" clearable placeholder="请输入分单编号">
  320. </el-input>
  321. </el-form-item>
  322. </el-col>
  323. <el-col :span="8">
  324. <el-form-item label="申请单号" prop="applyNo">
  325. <el-input style="width: 100%;" v-model="form.applyNo" size="small"
  326. autocomplete="off" :disabled="editSave" clearable placeholder="请输入申请单号">
  327. </el-input>
  328. </el-form-item>
  329. </el-col>
  330. <el-col :span="8">
  331. <el-form-item label="BOOK NO" prop="bookingNo">
  332. <el-input style="width: 100%;" v-model="form.bookingNo" size="small"
  333. autocomplete="off" :disabled="editSave" clearable
  334. placeholder="请输入BOOK NO">
  335. </el-input>
  336. </el-form-item>
  337. </el-col>
  338. <el-col :span="8">
  339. <el-form-item label="业务类型" prop="businessTypes">
  340. <search-query :datalist="businessTypesData"
  341. :selectValue="form.businessTypes" :clearable="true" :disabled="editSave"
  342. :buttonIf="false" :multiple="true" :collapseTags="true"
  343. placeholder="请输入业务类型" @corpChange="corpChange($event, 'businessTypes')">
  344. </search-query>
  345. </el-form-item>
  346. </el-col>
  347. <el-col :span="8">
  348. <el-form-item label="税率(%)" prop="taxRate">
  349. <el-input style="width: 100%;" v-model="form.taxRate" size="small"
  350. autocomplete="off" :disabled="editSave" clearable placeholder="请输入税率">
  351. </el-input>
  352. </el-form-item>
  353. </el-col>
  354. <el-col :span="8">
  355. <el-form-item label="选择币种" prop="curCode">
  356. <search-query :datalist="curData" :selectValue="form.curCode"
  357. :filterable="true" :clearable="true" :disabled="editSave" :remote="true"
  358. :buttonIf="false" placeholder="请输入选择币种"
  359. :forParameter="{ key: 'id', label: 'code', value: 'code' }"
  360. @remoteMethod="getRateListfun"
  361. @corpChange="corpChange($event, 'curCode')" @corpFocus="getRateListfun">
  362. </search-query>
  363. </el-form-item>
  364. </el-col>
  365. <el-col :span="16">
  366. <el-form-item label="邮箱" prop="yx">
  367. <el-input style="width: 100%;" v-model="form.yx" size="small"
  368. autocomplete="off" :disabled="editSave" clearable placeholder="请输入邮箱">
  369. </el-input>
  370. </el-form-item>
  371. </el-col>
  372. <el-col :span="24">
  373. <el-form-item label="全电发票:" prop="elecRemarks">
  374. <el-input style="width: 100%;" v-model="form.elecRemarks" size="small"
  375. autocomplete="off" type="textarea" clearable placeholder="请输入全电发票备注">
  376. </el-input>
  377. </el-form-item>
  378. </el-col>
  379. </el-row>
  380. </div>
  381. </el-col>
  382. </el-row>
  383. <div style="display: flex;justify-content: flex-end;align-items: center;">
  384. <el-checkbox style="margin-left: 10%" size="medium" :true-label="1" :false-label="0"
  385. :disabled="editSave" v-model="form.isExchangeToCny">转换成人民币
  386. </el-checkbox>
  387. <el-checkbox v-model="appendType" :disabled="editSave" false-label="检索"
  388. true-label="追加">追加</el-checkbox>
  389. <el-button type="primary" size="small"
  390. :disabled="editSave || (tableData.length > 0 && appendType == '检索')" plain
  391. @click="finstlbillslistAccBillV1fun(appendType)">提取费用
  392. </el-button>
  393. <el-button size="small" :disabled="tableData.length > 0" @click="ResetFilter">重置条件
  394. </el-button>
  395. <el-button icon="el-icon-arrow-down" type="text" size="small" v-if="!showForm"
  396. @click="showForm = true">开展</el-button>
  397. <el-button icon="el-icon-arrow-up" type="text" size="small" v-if="showForm"
  398. @click="showForm = false">收缩</el-button>
  399. </div>
  400. </trade-card>
  401. <el-card style="margin-top: 10px">
  402. <el-tabs v-model="detailTabs" type="card">
  403. <el-tab-pane label="费用明细" name="first">
  404. <div style="margin-bottom: 10px;display: flex;">
  405. <search-query :datalist="serverData" :selectValue="form.serverName" :clearable="true"
  406. :buttonIf="false" :filterable="true"
  407. :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictValue' }"
  408. placeholder="请选择开票项目" @corpChange="corpChange($event, 'serverName')"
  409. @corpFocus="serverWorkDictsfun">
  410. </search-query>
  411. <el-button style="margin-left: 10px" :disabled="editSave" size="small" type="primary"
  412. @click="invoicingfun">生成开票明细</el-button>
  413. <el-button style="margin-left: 10px" :disabled="editSave" size="small" type="warning"
  414. @click="invoicingRevokefun">撤销开票明细</el-button>
  415. <el-button size="small" :disabled="editSave" type="danger"
  416. @click="batchDeletefun">一键删除</el-button>
  417. <el-input style="width: 10%;margin-left: 10px;" v-model="invoiceAmountCNY" size="small"
  418. autocomplete="off" type="numbers" clearable placeholder="开票金额">
  419. <span style="line-height: 32px;" slot="suffix">CNY</span>
  420. </el-input>
  421. <el-input style="width: 10%;margin-left: 5px;" v-model="invoiceAmountUSD" size="small"
  422. autocomplete="off" type="numbers" clearable placeholder="开票金额">
  423. <span style="line-height: 32px;" slot="suffix">USD</span>
  424. </el-input>
  425. <el-button style="margin-left: 10px" :disabled="statusType" size="small" type="primary"
  426. @click="invoiceMatchingfun()">匹配金额</el-button>
  427. </div>
  428. <fininvoicesitems ref="fininvoicesitems" :tableData="tableData" :form="form"
  429. :handleSelectionData="handleSelectionData" :editSave="editSave"
  430. @handleSelectionChange="handleSelectionChange" @deletefun="detailsdeletionfun">
  431. </fininvoicesitems>
  432. </el-tab-pane>
  433. <el-tab-pane label="开票明细" name="second">
  434. <div style="margin-bottom: 10px;display: flex;">
  435. <el-button size="small" :disabled="editSave" type="danger"
  436. @click="invoicingBatchDelete">一键删除</el-button>
  437. </div>
  438. <fininvoiceitemdetail :tableData="InvoicingList"
  439. :handleSelectionData="invoicingCheckboxData"
  440. @handleSelectionChange="invoicingCheckboxChange" @deletefun="invoiceDeletionfun"
  441. @savefun="invoiceSavefun">
  442. </fininvoiceitemdetail>
  443. </el-tab-pane>
  444. </el-tabs>
  445. </el-card>
  446. <el-card class="box-card" style="margin-top: 10px">
  447. <el-row>
  448. <el-col :span="5">
  449. <el-form-item label="业务编号" prop="billNo">
  450. <el-input style="width: 100%;" v-model="form.billNo" size="small" autocomplete="off"
  451. :disabled="true" clearable placeholder="请输入业务编号">
  452. </el-input>
  453. </el-form-item>
  454. </el-col>
  455. <el-col :span="5">
  456. <el-form-item label="单据日期" prop="billDate">
  457. <el-date-picker v-model="form.billDate" clearable style="width: 100%;" type="date"
  458. size="small" :disabled="true" value-format="yyyy-MM-dd HH:mm" placeholder="选择单据日期">
  459. </el-date-picker>
  460. </el-form-item>
  461. </el-col>
  462. <el-col :span="5">
  463. <el-form-item label="制单人" prop="createUserName">
  464. <el-input style="width: 100%;" v-model="form.createUserName" size="small"
  465. autocomplete="off" :disabled="true" clearable placeholder="请输入制单人">
  466. </el-input>
  467. </el-form-item>
  468. </el-col>
  469. </el-row>
  470. </el-card>
  471. </el-form>
  472. </div>
  473. </div>
  474. </template>
  475. <script>
  476. import fininvoicesitems from "@/views/iosBasicData/fininvoicesApplyfor/assembly/fininvoicesitems.vue";
  477. import fininvoiceitemdetail from "@/views/iosBasicData/fininvoicesApplyfor/assembly/fininvoiceitemdetail.vue";
  478. import { getRateList } from "@/api/iosBasicData/rateManagement";
  479. import { finstlbillsGetByDetail, finstlbillsitemsRemove, finstlbillslistAccBillV1 } from "@/api/iosBasicData/finstlbills";
  480. import { bcorpsbankList, corpsinvoiceheaderList, getBcorpsList } from "@/api/iosBasicData/bcorps";
  481. import { bportsList } from "@/api/iosBasicData/bports";
  482. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  483. import {
  484. finInvoicesApprove,
  485. fininvoicesDetail,
  486. revokeFinInvoicesApprove,
  487. fininvoicesSubmit,
  488. fininvoicesitemsRemove,
  489. generateFinInvoicesDetail,
  490. fininvoiceitemdetailRemove,
  491. revokeFinInvoicesDetail,
  492. fininvoiceitemdetailSubmit,
  493. fininvoicesGenerateFinInvoices,
  494. fininvoicesConfirmFinInvoices, fininvoicesRevokeFinInvoices
  495. } from "@/api/iosBasicData/fininvoices";
  496. import { getWorkDicts } from "@/api/system/dictbiz";
  497. import { getCurrentDate } from "@/util/date";
  498. import dicSelect from "@/components/dicSelect/main";
  499. export default {
  500. components: { SearchQuery, fininvoicesitems, fininvoiceitemdetail, dicSelect },
  501. data() {
  502. return {
  503. showForm: false,
  504. invoiceAmountCNY: 0, // 费用明细开票金额输入框CNY
  505. invoiceAmountUSD: 0, // 费用明细开票金额输入框USD
  506. statusType: false, // 是否确认开票
  507. serverData: [], // 开票项目数据
  508. detailTabs: 'first',
  509. appendType: '检索',
  510. pageLoading: false, // 全屏加载
  511. saveLoading: false, // 按钮加载
  512. form: {
  513. invCurCode: 'CNY',
  514. isRp: 1,
  515. invType: '全电发票',
  516. taxRate: 0,
  517. isExchangeToCny: 0,
  518. invoiceDate: getCurrentDate(),
  519. },
  520. tableData: [], // 费用明细数据
  521. InvoicingList: [], // 开票明细数据
  522. handleSelectionData: [], // 费用明细选择的数据
  523. invoicingCheckboxData: [], // 开票明细选择的数据
  524. corpData: [], // 结算单位数据
  525. invCorpData: [], // 开票单位
  526. bankReceiptData: [], // 结算单位银行账号数据
  527. // 业务类型
  528. businessTypesData: [
  529. {
  530. label: '海运出口',
  531. value: 'SE'
  532. }, {
  533. label: '海运进口',
  534. value: 'SI'
  535. }
  536. ],
  537. curData: [], // 币别
  538. destinationData: [], // 目的港
  539. podData: [], // 卸货港
  540. polData: [], // 装货港
  541. invCurCodeData: [], // 发票币种
  542. invTypeData: [], // 发票类型
  543. rules: {
  544. corpCnName: [
  545. { required: true, message: '请输入付费对象', trigger: 'blur' },
  546. ],
  547. invoiceDate: [
  548. { required: true, message: '请输入开票日期', trigger: 'blur' },
  549. ],
  550. exrate: [
  551. { required: true, message: '请输入导入汇率', trigger: 'blur' },
  552. ],
  553. taxRate: [
  554. { required: true, message: '请输入所属税率', trigger: 'blur' },
  555. ],
  556. invCurCode: [
  557. { required: true, message: '请输入所属发票币别', trigger: 'blur' },
  558. ],
  559. },
  560. roleName: [], // 当前的角色权限
  561. saberUserInfo: {}, // 当前登录人信息
  562. editPower: false, // 当前是否可以编辑
  563. }
  564. },
  565. props: {
  566. editSave: {
  567. type: Boolean,
  568. default: false
  569. }
  570. },
  571. watch: {
  572. // 监听 状态
  573. "form.status": {
  574. // 执行方法
  575. handler(oldValue, newValue) {
  576. if (oldValue == 3) {
  577. this.statusType = true
  578. } else {
  579. this.statusType = false
  580. }
  581. },
  582. deep: true, // 深度监听
  583. immediate: true // 第一次改变就执行
  584. },
  585. },
  586. created() {
  587. this.roleName = localStorage.getItem('roleName').split(',')
  588. // 获取当前登录人个人信息
  589. this.saberUserInfo = JSON.parse(localStorage.getItem('saber-userInfo')).content
  590. if (!this.form.id) {
  591. getRateList({ current: 1, size: 30 }).then(res => {
  592. for (let item of res.data.data.records) {
  593. if (item.code == "USD") {
  594. this.$set(this.form, 'exrate', item.exrate)
  595. }
  596. }
  597. })
  598. }
  599. },
  600. methods: {
  601. ResetFilter() {
  602. this.form = {
  603. invCurCode: 'CNY',
  604. isRp: 1,
  605. invType: '全电发票',
  606. taxRate: 0,
  607. isExchangeToCny: 0,
  608. invoiceDate: getCurrentDate(),
  609. }
  610. getRateList({ current: 1, size: 30 }).then(res => {
  611. for (let item of res.data.data.records) {
  612. if (item.code == "USD") {
  613. this.$set(this.form, 'exrate', item.exrate)
  614. }
  615. }
  616. })
  617. },
  618. // 开票明细编辑完成保存
  619. invoiceSavefun(row) {
  620. row.amountRate = this.form.taxRate
  621. // 销售额/(1+税率)×税率
  622. row.amountTax = (row.amount / (1 + (Number(row.amountRate) / 100)) * (Number(row.amountRate) / 100)).toFixed(2)
  623. fininvoiceitemdetailSubmit(row).then(res => {
  624. this.$message.success('操作成功')
  625. this.fininvoicesDetailfun(this.form.id)
  626. })
  627. },
  628. // 确认开票信息
  629. invoicingfun() {
  630. if (this.handleSelectionData.length == 0) {
  631. this.$message.warning('请选择数据')
  632. return;
  633. }
  634. if (!this.form.serverName) {
  635. this.$message.warning('请选择开票项目')
  636. return
  637. }
  638. let obj = this.form
  639. obj.finInvoicesItemsList = []
  640. obj.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  641. obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  642. //开票日期
  643. if (this.form.invoiceDate) {
  644. obj.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  645. }
  646. // 业务日期
  647. if (this.form.accountDateFrom) {
  648. obj.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  649. }
  650. if (this.form.accountDateTo) {
  651. obj.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  652. }
  653. for (let item of this.handleSelectionData) {
  654. // 拿未开票的数据
  655. if (item.status == 0) {
  656. if (item.currentCurCode == 'CNY') {
  657. item.currentAmount = item.currentAmountCNY
  658. } else {
  659. item.currentAmount = item.currentAmountUSD
  660. }
  661. obj.finInvoicesItemsList.push(item)
  662. }
  663. }
  664. if (obj.finInvoicesItemsList.length == 0) {
  665. this.$message.warning('请选择未生成发票的数据')
  666. return
  667. }
  668. // 开票项目
  669. generateFinInvoicesDetail(obj).then(res => {
  670. this.$message.warning('操作成功')
  671. this.fininvoicesDetailfun(this.form.id)
  672. })
  673. this.detailTabs = 'second'
  674. },
  675. // 撤销开票信息
  676. invoicingRevokefun() {
  677. if (this.handleSelectionData.length == 0) {
  678. this.$message.warning('请选择数据')
  679. return;
  680. }
  681. let obj = this.form
  682. obj.finInvoicesItemsList = []
  683. obj.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  684. obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  685. //开票日期
  686. if (this.form.invoiceDate) {
  687. obj.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  688. }
  689. // 业务日期
  690. if (this.form.accountDateFrom) {
  691. obj.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  692. }
  693. if (this.form.accountDateTo) {
  694. obj.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  695. }
  696. for (let item of this.handleSelectionData) {
  697. // 拿未开票的数据
  698. if (item.status == 1) {
  699. if (item.currentCurCode == 'CNY') {
  700. item.currentAmount = item.currentAmountCNY
  701. } else {
  702. item.currentAmount = item.currentAmountUSD
  703. }
  704. obj.finInvoicesItemsList.push(item)
  705. }
  706. }
  707. if (obj.finInvoicesItemsList.length == 0) {
  708. this.$message.warning('请选择已生成发票的数据')
  709. return
  710. }
  711. // 撤销开票项目
  712. revokeFinInvoicesDetail(obj).then(res => {
  713. this.$message.warning('操作成功')
  714. this.fininvoicesDetailfun(this.form.id)
  715. })
  716. },
  717. // 费用明细开票匹配
  718. invoiceMatchingfun() {
  719. if (this.invoiceAmountCNY != 0 || this.invoiceAmountUSD != 0) {
  720. let dataCNY = JSON.parse(JSON.stringify(this.invoiceAmountCNY))
  721. let dataUSD = JSON.parse(JSON.stringify(this.invoiceAmountUSD))
  722. for (let item of this.tableData) {
  723. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, false)
  724. if (this.invoiceAmountCNY != 0) {
  725. if (dataCNY < 0) {
  726. dataCNY = 0
  727. }
  728. if (dataCNY > 1500) {
  729. if (item.currentCurCode == 'CNY') {
  730. this.$set(item, 'currentAmountCNY', 1500)
  731. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  732. dataCNY -= 1500
  733. }
  734. } else {
  735. if (item.currentCurCode == 'CNY') {
  736. if (dataCNY != 0) {
  737. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  738. }
  739. this.$set(item, 'currentAmountCNY', dataCNY)
  740. dataCNY -= 1500
  741. }
  742. }
  743. }
  744. if (this.invoiceAmountUSD != 0) {
  745. if (dataUSD < 0) {
  746. dataUSD = 0
  747. }
  748. if (dataUSD > 1500) {
  749. if (item.currentCurCode == 'USD') {
  750. this.$set(item, 'currentAmountUSD', 1500)
  751. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  752. dataUSD -= 1500
  753. }
  754. } else {
  755. if (item.currentCurCode == 'USD') {
  756. this.$set(item, 'currentAmountUSD', dataUSD)
  757. if (dataUSD != 0) {
  758. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  759. }
  760. dataUSD -= 1500
  761. }
  762. }
  763. }
  764. }
  765. }
  766. },
  767. // 费用明细一键删除
  768. batchDeletefun() {
  769. if (this.handleSelectionData.length == 0) {
  770. return this.$message.warning('请选择要删除的数据')
  771. }
  772. this.$confirm("确定将选择数据删除?", {
  773. confirmButtonText: "确定",
  774. cancelButtonText: "取消",
  775. type: "warning"
  776. }).then(() => {
  777. // 获取有id 的数据
  778. const itemsWithId = this.handleSelectionData.filter(item => item.hasOwnProperty('id'));
  779. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  780. // 把选中的删除掉
  781. this.handleSelectionData.forEach((item) => {
  782. for (let index in this.tableData) {
  783. if (item.accBillNo == this.tableData[index].accBillNo) {
  784. this.tableData.splice(Number(index), 1)
  785. }
  786. }
  787. })
  788. // 有id 的处理
  789. if (itemsWithId.length != 0) {
  790. fininvoicesitemsRemove(arrIds.join(',')).then(res => {
  791. this.$message.success('操作成功')
  792. })
  793. }
  794. })
  795. },
  796. // 费用明细单个删除
  797. detailsdeletionfun(id, index) {
  798. this.$confirm("确定将选择数据删除?", {
  799. confirmButtonText: "确定",
  800. cancelButtonText: "取消",
  801. type: "warning"
  802. }).then(() => {
  803. if (id) {
  804. fininvoicesitemsRemove(id).then(res => {
  805. this.$message.success('操作成功')
  806. })
  807. }
  808. this.tableData.splice(index, 1)
  809. })
  810. },
  811. // 开票一键删除
  812. invoicingBatchDelete() {
  813. if (this.invoicingCheckboxData.length == 0) {
  814. return this.$message.warning('请选择要删除的数据')
  815. }
  816. this.$confirm("确定将选择数据删除?", {
  817. confirmButtonText: "确定",
  818. cancelButtonText: "取消",
  819. type: "warning"
  820. }).then(() => {
  821. // 获取有id 的数据
  822. const itemsWithId = this.invoicingCheckboxData.filter(item => item.hasOwnProperty('id'));
  823. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  824. // 把选中的删除掉
  825. this.invoicingCheckboxData.forEach((item) => {
  826. for (let index in this.InvoicingList) {
  827. if (item.id == this.InvoicingList[index].id) {
  828. this.InvoicingList.splice(Number(index), 1)
  829. }
  830. }
  831. })
  832. // 有id 的处理
  833. if (itemsWithId.length != 0) {
  834. fininvoiceitemdetailRemove(arrIds.join(',')).then(res => {
  835. this.$message.success('操作成功')
  836. })
  837. }
  838. })
  839. },
  840. // 开票明细单个删除
  841. invoiceDeletionfun(id, index) {
  842. this.$confirm("确定将选择数据删除?", {
  843. confirmButtonText: "确定",
  844. cancelButtonText: "取消",
  845. type: "warning"
  846. }).then(() => {
  847. if (id) {
  848. fininvoiceitemdetailRemove(id).then(res => {
  849. this.$message.success('操作成功')
  850. })
  851. }
  852. this.InvoicingList.splice(index, 1)
  853. })
  854. },
  855. // 下拉框的回调
  856. corpChange(value, name) {
  857. // 结算单位
  858. if (name == 'corpCnName') {
  859. if (!value) {
  860. this.$set(this.form, 'corpId', '')
  861. this.$set(this.form, 'corpCnName', '')
  862. this.$set(this.form, 'corpEnName', '')
  863. return
  864. }
  865. for (let item of this.corpData) {
  866. if (item.cnName == value) {
  867. this.$set(this.form, 'corpId', item.id)
  868. this.$set(this.form, 'corpCnName', item.cnName)
  869. this.$set(this.form, 'corpEnName', item.enName)
  870. bcorpsbankList(1, 10, { pid: this.form.corpId }).then(res => {
  871. if (res.data.data.records.length != 0) {
  872. this.$set(this.form, 'bankReceiptAccountNo', res.data.data.records[0].accountNo)
  873. this.$set(this.form, 'bankReceiptBankName', res.data.data.records[0].accountBank)
  874. }
  875. })
  876. // 带出开票单位数据
  877. corpsinvoiceheaderList(1, 20, { pid: this.form.corpId }).then(res => {
  878. if (res.data.data.records.length != 0) {
  879. this.$set(this.form, 'invCorpId', res.data.data.records[0].id)
  880. this.$set(this.form, 'invCorpCnName', res.data.data.records[0].invoiceHeader)
  881. this.$set(this.form, 'invCorpTaxNo', res.data.data.records[0].uscc) // 税号
  882. this.$set(this.form, 'invCorpAccountBankUsd', res.data.data.records[0].accountBankUsd) // 美元银行
  883. this.$set(this.form, 'invCorpAccountNoUsd', res.data.data.records[0].accountNoUsd) // 美元账户
  884. this.$set(this.form, 'invCorpAccountBankCny', res.data.data.records[0].accountBankUsd) // 人民币银行
  885. this.$set(this.form, 'invCorpAccountNoCny', res.data.data.records[0].accountNoUsd) // 人民币账户
  886. }
  887. })
  888. }
  889. }
  890. }
  891. // 开票单位
  892. else if (name == 'invCorpCnName') {
  893. this.$set(this.form, 'invCorpAccountBankUsd', '')
  894. this.$set(this.form, 'invCorpAccountNoUsd', '')
  895. this.$set(this.form, 'invCorpAccountBankCny', '')
  896. this.$set(this.form, 'invCorpAccountNoCny', '')
  897. if (!value) {
  898. this.$set(this.form, 'invCorpId', '')
  899. this.$set(this.form, 'invCorpCnName', '')
  900. return
  901. }
  902. for (let item of this.invCorpData) {
  903. if (item.id == value) {
  904. this.$set(this.form, 'invCorpId', item.id)
  905. this.$set(this.form, 'invCorpCnName', item.invoiceHeader)
  906. this.$set(this.form, 'invCorpTaxNo', item.uscc) // 税号
  907. this.$set(this.form, 'invCorpAccountBankUsd', item.accountBankUsd) // 美元银行
  908. this.$set(this.form, 'invCorpAccountNoUsd', item.accountNoUsd) // 美元账户
  909. this.$set(this.form, 'invCorpAccountBankCny', item.accountBankUsd) // 人民币银行
  910. this.$set(this.form, 'invCorpAccountNoCny', item.accountNoUsd) // 人民币账户
  911. }
  912. }
  913. }
  914. // 结算单位银行账户
  915. else if (name == 'bankReceiptAccountNo') {
  916. for (let item of this.bankReceiptData) {
  917. if (item.accountNo == value) {
  918. this.$set(this.form, 'bankReceiptAccountNo', item.accountNo)
  919. this.$set(this.form, 'bankReceiptBankName', item.accountBank)
  920. }
  921. }
  922. }
  923. else {
  924. this.$set(this.form, name, value)
  925. }
  926. },
  927. // 费用明细表格多选
  928. handleSelectionChange(arr) {
  929. this.handleSelectionData = arr
  930. },
  931. // 开票明细表格多选
  932. invoicingCheckboxChange(arr) {
  933. this.invoicingCheckboxData = arr
  934. },
  935. // 编辑事件
  936. editHandle() {
  937. this.editSave = false
  938. },
  939. newbillFun() {
  940. if (this.statusType) {
  941. this.$emit('toAddEdit')
  942. } else {
  943. this.$confirm('是否需要保存?', '提示', {
  944. confirmButtonText: '确定',
  945. cancelButtonText: '取消',
  946. type: 'warning'
  947. }).then(() => {
  948. this.editCustomer('toAddEdit')
  949. }).catch(() => {
  950. this.$emit('toAddEdit')
  951. });
  952. }
  953. },
  954. submit(type) {
  955. this.$confirm("确定进行确认开票操作?", {
  956. confirmButtonText: "确定",
  957. cancelButtonText: "取消",
  958. type: "warning"
  959. }).then(() => {
  960. this.editCustomer(type)
  961. })
  962. },
  963. // 保存按钮事件
  964. editCustomer(type) {
  965. this.$refs.form.validate((valid) => {
  966. if (!valid) return
  967. if (!this.form.id) {
  968. // 是否选择从表数据
  969. if (this.handleSelectionData.length == 0) {
  970. this.$message.warning('请选择结算数据');
  971. return;
  972. }
  973. }
  974. this.form.type = '进项'
  975. this.form.billNoFormat = 'JXFP'
  976. this.form.businessTypeCode = 'JXFP'
  977. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  978. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  979. //开票日期
  980. if (this.form.invoiceDate) {
  981. this.form.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  982. }
  983. // 业务日期
  984. if (this.form.accountDateFrom) {
  985. this.form.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  986. }
  987. if (this.form.accountDateTo) {
  988. this.form.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  989. }
  990. if (this.form.id) {
  991. this.form.finInvoicesItemsList = this.form.finInvoicesItemsList.map(item => {
  992. if (item.currentCurCode == 'CNY') {
  993. item.currentAmount = item.currentAmountCNY
  994. } else {
  995. item.currentAmount = item.currentAmountUSD
  996. }
  997. return item
  998. })
  999. } else {
  1000. this.form.finInvoicesItemsList = this.handleSelectionData.map(item => {
  1001. if (item.currentCurCode == 'CNY') {
  1002. item.currentAmount = item.currentAmountCNY
  1003. } else {
  1004. item.currentAmount = item.currentAmountUSD
  1005. }
  1006. return item
  1007. })
  1008. }
  1009. this.form.finInvoiceItemDetailList = this.InvoicingList
  1010. if (type == '开票') {
  1011. this.saveLoading = true
  1012. this.pageLoading = true
  1013. fininvoicesSubmit(this.form).then(res => {
  1014. this.form = res.data.data
  1015. this.fininvoicesConfirmFinInvoicesfun()
  1016. }).catch(() => {
  1017. this.pageLoading = false
  1018. this.saveLoading = false
  1019. });
  1020. } else if (type == 'toAddEdit') {
  1021. fininvoicesSubmit(this.form).then(res => {
  1022. this.$message.success('操作成功');
  1023. this.saveLoading = false // 关闭按钮动画
  1024. this.$emit(type)
  1025. }).catch(() => {
  1026. this.saveLoading = false
  1027. })
  1028. } else {
  1029. this.fininvoicesSubmitfun(this.form)
  1030. }
  1031. })
  1032. },
  1033. // 检索
  1034. finstlbillslistAccBillV1fun(type) {
  1035. if (!this.form.corpId) {
  1036. this.$message.warning('请选择结算单位');
  1037. return
  1038. }
  1039. let obj = {}
  1040. //开票日期
  1041. if (this.form.invoiceDate) {
  1042. obj.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  1043. }
  1044. // 业务日期
  1045. if (this.form.accountDateFrom) {
  1046. obj.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  1047. }
  1048. if (this.form.accountDateTo) {
  1049. obj.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  1050. }
  1051. obj.type = '3'
  1052. obj.billNo = this.form.bookingNo // 账单号
  1053. obj.businessBillNo = this.form.billNo // 业务编号
  1054. obj.mblno = this.form.mblno // 主单编号
  1055. obj.hblno = this.form.hblno // 分单编号
  1056. obj.bookingNo = this.form.bookingNo // 订舱号(BOOK NO)
  1057. obj.curCode = this.form.curCode // 币种
  1058. obj.businessType = this.form.businessTypes ? this.form.businessTypes.join(',') : '' // 业务类型
  1059. obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1060. // 判断是否有对账单号
  1061. if (this.form.checkNo) {
  1062. obj.corpId = this.form.corpId // 结算单位
  1063. obj.checkNo = this.form.checkNo // CHK NO 对账单号
  1064. finstlbillsGetByDetail(obj).then(res => {
  1065. let arr = res.data.data.finStlBillsItemsList.map((item, index) => {
  1066. item.lineNo = Number(index) + 1 // 行号
  1067. item.currentCurCode = item.curCode
  1068. item.currentExrate = item.exrate
  1069. if (item.currentCurCode == 'CNY') {
  1070. // 本次发票金额
  1071. this.$set(item, 'currentAmountCNY', item.appliedInvoiceCurrentAmount)
  1072. } else {
  1073. // 本次发票金额
  1074. this.$set(item, 'currentAmountUSD', item.appliedInvoiceCurrentAmount)
  1075. }
  1076. delete item.id
  1077. return item
  1078. })
  1079. if (type == '追加') {
  1080. let a = [...this.tableData, ...arr,]
  1081. this.tableData = a.filter((obj, index) => {
  1082. return a.findIndex((elem) => {
  1083. return elem.accBillNo === obj.accBillNo
  1084. }) === index;
  1085. });
  1086. } else {
  1087. // 获取有id 的数据
  1088. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  1089. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  1090. // 有id 的处理
  1091. if (itemsWithId.length != 0) {
  1092. finstlbillsitemsRemove(arrIds.join(',')).then(res => {
  1093. this.$message.success('操作成功')
  1094. })
  1095. }
  1096. if (arr.length == 0) {
  1097. this.$message.warning('当前检索暂无数据!')
  1098. }
  1099. this.tableData = arr
  1100. }
  1101. })
  1102. } else {
  1103. obj.corpCnName = this.form.corpId // 结算单位
  1104. obj.checkBillNo = this.form.checkNo // 对账单号
  1105. finstlbillslistAccBillV1(obj).then(res => {
  1106. let arr = res.data.data.map((item, index) => {
  1107. item.lineNo = Number(index) + 1 // 行号
  1108. item.accBillId = item.id
  1109. item.accBillNo = item.billNo
  1110. item.accDate = item.createTime
  1111. item.currentCurCode = item.curCode
  1112. item.currentExrate = item.exrate
  1113. if (item.currentCurCode == 'CNY') {
  1114. // 本次发票金额
  1115. this.$set(item, 'currentAmountCNY', item.appliedInvoiceCurrentAmount)
  1116. } else {
  1117. // 本次发票金额
  1118. this.$set(item, 'currentAmountUSD', item.appliedInvoiceCurrentAmount)
  1119. }
  1120. delete item.id
  1121. return item
  1122. })
  1123. if (type == '追加') {
  1124. let a = [...this.tableData, ...arr,]
  1125. this.tableData = a.filter((obj, index) => {
  1126. return a.findIndex((elem) => {
  1127. return elem.accBillNo === obj.accBillNo
  1128. }) === index;
  1129. });
  1130. } else {
  1131. // 获取有id 的数据
  1132. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  1133. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  1134. // 有id 的处理
  1135. if (itemsWithId.length != 0) {
  1136. fininvoicesitemsRemove(arrIds.join(',')).then(res => {
  1137. this.$message.success('操作成功')
  1138. })
  1139. }
  1140. if (arr.length == 0) {
  1141. this.$message.warning('当前检索暂无数据!')
  1142. }
  1143. this.tableData = arr
  1144. }
  1145. })
  1146. }
  1147. },
  1148. // 保存接口
  1149. fininvoicesSubmitfun(obj) {
  1150. fininvoicesSubmit(obj).then(res => {
  1151. this.saveLoading = false
  1152. this.$message.success('操作成功');
  1153. this.fininvoicesDetailfun(res.data.data.id)
  1154. })
  1155. },
  1156. // 详情接口
  1157. fininvoicesDetailfun(id) {
  1158. this.pageLoading = true
  1159. fininvoicesDetail(id).then(res => {
  1160. this.form = res.data.data
  1161. if (this.roleName.indexOf('admin') == -1 ? this.roleName.indexOf('允许修改他人业务') == -1 ? this.saberUserInfo.user_id != this.form.createUser : false : false) {
  1162. this.editPower = true
  1163. } else {
  1164. this.editPower = false
  1165. }
  1166. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.split(',') : [] // 业务类型转换成数组显示
  1167. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.split(',') : []
  1168. this.tableData = this.form.finInvoicesItemsList.map(item => {
  1169. if (item.currentCurCode == 'CNY') {
  1170. item.currentAmountCNY = item.currentAmount
  1171. } else {
  1172. item.currentAmountUSD = item.currentAmount
  1173. }
  1174. return item
  1175. })
  1176. this.InvoicingList = this.form.finInvoiceItemDetailList.map(item => {
  1177. item.edit = false
  1178. return item
  1179. })
  1180. }).finally(() => {
  1181. this.pageLoading = false
  1182. });
  1183. },
  1184. // 开票获取数据
  1185. fininvoicesGenerateFinInvoicesfun(billId) {
  1186. this.pageLoading = true
  1187. fininvoicesGenerateFinInvoices({ billId }).then(res => {
  1188. this.form = res.data.data
  1189. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.split(',') : [] // 业务类型转换成数组显示
  1190. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.split(',') : []
  1191. // 判断是否是数组
  1192. if (Array.isArray(this.form.finInvoicesItemsList)) {
  1193. this.tableData = this.form.finInvoicesItemsList.map(item => {
  1194. if (item.currentCurCode == 'CNY') {
  1195. item.currentAmountCNY = item.currentAmount
  1196. } else {
  1197. item.currentAmountUSD = item.currentAmount
  1198. }
  1199. return item
  1200. })
  1201. }
  1202. // 判断是否是数组
  1203. if (Array.isArray(this.form.finInvoiceItemDetailList)) {
  1204. this.InvoicingList = this.form.finInvoiceItemDetailList.map(item => {
  1205. item.edit = false
  1206. return item
  1207. })
  1208. }
  1209. }).finally(() => {
  1210. this.pageLoading = false
  1211. });
  1212. },
  1213. // 确认申请
  1214. fininvoicesConfirmFinInvoicesfun() {
  1215. this.pageLoading = true
  1216. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  1217. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1218. fininvoicesConfirmFinInvoices(this.form).then(res => {
  1219. this.pageLoading = false
  1220. this.$message.success('操作成功');
  1221. this.fininvoicesDetailfun(res.data.data.id)
  1222. }).finally(() => {
  1223. this.pageLoading = false
  1224. this.saveLoading = false
  1225. });
  1226. },
  1227. // 撤销申请
  1228. fininvoicesRevokeFinInvoicesfun() {
  1229. this.$confirm("确定进行撤销确认发票操作?", {
  1230. confirmButtonText: "确定",
  1231. cancelButtonText: "取消",
  1232. type: "warning"
  1233. }).then(res => {
  1234. this.pageLoading = true
  1235. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  1236. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1237. fininvoicesRevokeFinInvoices(this.form).then(res => {
  1238. this.$message.success('操作成功');
  1239. this.fininvoicesDetailfun(res.data.data.id)
  1240. }).finally(() => {
  1241. this.pageLoading = false
  1242. });
  1243. })
  1244. },
  1245. //返回列表
  1246. backToList() {
  1247. this.$emit('goBack')
  1248. },
  1249. // 获取客户名称数据 往来单位数据
  1250. corpBcorpsListfun(cnName) {
  1251. getBcorpsList(1, 10, { cnName }).then(res => {
  1252. this.corpData = res.data.data.records
  1253. })
  1254. },
  1255. // 根据往来单位选择调用获取银行数据
  1256. bcorpsbankListfun(accountNo) {
  1257. bcorpsbankList(1, 10, {
  1258. // curNo:this.cntyCode,
  1259. pid: this.form.corpId,
  1260. accountNo: accountNo
  1261. }).then(res => {
  1262. this.bankReceiptData = res.data.data.records
  1263. })
  1264. },
  1265. // 根据往来单位选择调用获取发票抬头数据 开票单位数据
  1266. invcorpsinvoiceheaderListfun(cnName) {
  1267. corpsinvoiceheaderList(1, 20, { pid: this.form.corpId, cnName }).then(res => {
  1268. this.invCorpData = res.data.data.records
  1269. })
  1270. },
  1271. // 获取币别数据
  1272. getRateListfun(cnName) {
  1273. getRateList({ current: 1, size: 10, cnName }).then(res => {
  1274. this.curData = res.data.data.records
  1275. })
  1276. },
  1277. // 获取发票币别数据
  1278. invCurCodeRateListfun(cnName) {
  1279. getRateList({ current: 1, size: 20, cnName }).then(res => {
  1280. this.invCurCodeData = res.data.data.records
  1281. })
  1282. },
  1283. // 目的地
  1284. destinationBportsListfun(enName) {
  1285. bportsList(1, 10, { enName }).then(res => {
  1286. this.destinationData = res.data.data.records
  1287. })
  1288. },
  1289. // 卸货港
  1290. podBportsListfun(enName) {
  1291. bportsList(1, 10, { enName }).then(res => {
  1292. this.podData = res.data.data.records
  1293. })
  1294. },
  1295. // 装货港
  1296. polBportsListfun(enName) {
  1297. bportsList(1, 10, { enName }).then(res => {
  1298. this.polData = res.data.data.records
  1299. })
  1300. },
  1301. // 发票类型字典数据
  1302. invTypeWorkDictsfun() {
  1303. getWorkDicts('inv_type_los').then(res => {
  1304. this.invTypeData = res.data.data;
  1305. })
  1306. },
  1307. serverWorkDictsfun() {
  1308. getWorkDicts('Invoice_information_los').then(res => {
  1309. this.serverData = res.data.data;
  1310. })
  1311. },
  1312. },
  1313. }
  1314. </script>
  1315. <style scoped>
  1316. ::v-deep.el-form-item {
  1317. margin-bottom: 0;
  1318. }
  1319. .cardBox {
  1320. background: #fff;
  1321. width: 100%;
  1322. height: 100%;
  1323. padding: 20px;
  1324. box-sizing: border-box;
  1325. border-radius: 4px;
  1326. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  1327. }
  1328. .flexBox {
  1329. display: flex;
  1330. }
  1331. .flexBoxLeft {
  1332. flex: 2;
  1333. margin-right: 10px;
  1334. //padding-bottom: 40px;
  1335. }
  1336. .flexBoxRight {
  1337. flex: 3;
  1338. //padding-bottom: 40px;
  1339. }
  1340. </style>