fininvoicesDetails.vue 75 KB

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