fininvoicesDetails.vue 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517
  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="8">
  240. <el-form-item label="费用名称" prop="feeCnName">
  241. <dic-select v-model="form.feeCnName" placeholder="费用名称" key="id"
  242. label="cnName" url="/blade-los/bfees/listAll" :filterable="true"
  243. :multiple="true" :collapseTags="true" :disabled="editSave"></dic-select>
  244. </el-form-item>
  245. </el-col>
  246. <el-col :span="8">
  247. <el-form-item label="税控发票号" prop="taxInvoiceNo">
  248. <el-input style="width: 100%;" v-model="form.taxInvoiceNo" size="small"
  249. autocomplete="off" :disabled="editSave" clearable
  250. placeholder="请输入税控发票号">
  251. </el-input>
  252. </el-form-item>
  253. </el-col>
  254. <el-col :span="8">
  255. <el-form-item label="业务开始日期" prop="accountDateFrom">
  256. <el-date-picker v-model="form.accountDateFrom" 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="accountDateTo">
  264. <el-date-picker v-model="form.accountDateTo" clearable style="width: 100%;"
  265. type="date" size="small" :disabled="editSave" value-format="yyyy-MM-dd"
  266. placeholder="选择业务日期">
  267. </el-date-picker>
  268. </el-form-item>
  269. </el-col>
  270. <el-col :span="8">
  271. <el-form-item label="发票汇率" prop="exrate">
  272. <el-input style="width: 100%;" v-model="form.exrate" size="small"
  273. autocomplete="off" :disabled="editSave" clearable placeholder="请输入发票汇率">
  274. </el-input>
  275. </el-form-item>
  276. </el-col>
  277. <el-col :span="16">
  278. <el-form-item label="业务编号" prop="businessNo">
  279. <el-input style="width: 100%;" v-model="form.businessNo" size="small"
  280. autocomplete="off" :disabled="editSave" clearable placeholder="请输入业务编号">
  281. </el-input>
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="8">
  285. <el-form-item label="发票类型" prop="invType">
  286. <search-query :datalist="invTypeData" :selectValue="form.invType"
  287. :clearable="true" :disabled="editSave" :buttonIf="false"
  288. placeholder="请输入发票类型"
  289. :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }"
  290. @corpChange="corpChange($event, 'invType')"
  291. @corpFocus="invTypeWorkDictsfun">
  292. </search-query>
  293. </el-form-item>
  294. </el-col>
  295. <el-col :span="16">
  296. <el-form-item label="主单编号" prop="mblno">
  297. <el-input style="width: 100%;" v-model="form.mblno" size="small"
  298. autocomplete="off" :disabled="editSave" clearable placeholder="请输入主单编号">
  299. </el-input>
  300. </el-form-item>
  301. </el-col>
  302. <el-col :span="8">
  303. <el-form-item label="对账单号" prop="checkNo">
  304. <el-input style="width: 100%;" v-model="form.checkNo" size="small"
  305. autocomplete="off" :disabled="editSave" clearable placeholder="请输入对账单号">
  306. </el-input>
  307. </el-form-item>
  308. </el-col>
  309. </el-row>
  310. <el-row v-show="showForm">
  311. <el-col :span="16">
  312. <el-form-item label="分单编号" prop="hblno">
  313. <el-input style="width: 100%;" v-model="form.hblno" size="small"
  314. autocomplete="off" :disabled="editSave" clearable placeholder="请输入分单编号">
  315. </el-input>
  316. </el-form-item>
  317. </el-col>
  318. <el-col :span="8">
  319. <el-form-item label="申请单号" prop="applyNo">
  320. <el-input style="width: 100%;" v-model="form.applyNo" size="small"
  321. autocomplete="off" :disabled="editSave" clearable placeholder="请输入申请单号">
  322. </el-input>
  323. </el-form-item>
  324. </el-col>
  325. <el-col :span="8">
  326. <el-form-item label="BOOK NO" prop="bookingNo">
  327. <el-input style="width: 100%;" v-model="form.bookingNo" size="small"
  328. autocomplete="off" :disabled="editSave" clearable
  329. placeholder="请输入BOOK NO">
  330. </el-input>
  331. </el-form-item>
  332. </el-col>
  333. <el-col :span="8">
  334. <el-form-item label="业务类型" prop="businessTypes">
  335. <search-query :datalist="businessTypesData"
  336. :selectValue="form.businessTypes" :clearable="true" :disabled="editSave"
  337. :buttonIf="false" :multiple="true" :collapseTags="true"
  338. placeholder="请输入业务类型" @corpChange="corpChange($event, 'businessTypes')">
  339. </search-query>
  340. </el-form-item>
  341. </el-col>
  342. <el-col :span="8">
  343. <el-form-item label="税率(%)" prop="taxRate">
  344. <el-input style="width: 100%;" v-model="form.taxRate" size="small"
  345. autocomplete="off" :disabled="editSave" clearable placeholder="请输入税率">
  346. </el-input>
  347. </el-form-item>
  348. </el-col>
  349. <el-col :span="8">
  350. <el-form-item label="选择币种" prop="curCode">
  351. <search-query :datalist="curData" :selectValue="form.curCode"
  352. :filterable="true" :clearable="true" :disabled="editSave" :remote="true"
  353. :buttonIf="false" placeholder="请输入选择币种"
  354. :forParameter="{ key: 'id', label: 'code', value: 'code' }"
  355. @remoteMethod="getRateListfun"
  356. @corpChange="corpChange($event, 'curCode')" @corpFocus="getRateListfun">
  357. </search-query>
  358. </el-form-item>
  359. </el-col>
  360. <el-col :span="16">
  361. <el-form-item label="邮箱" prop="yx">
  362. <el-input style="width: 100%;" v-model="form.yx" size="small"
  363. autocomplete="off" :disabled="editSave" clearable placeholder="请输入邮箱">
  364. </el-input>
  365. </el-form-item>
  366. </el-col>
  367. <el-col :span="24">
  368. <el-form-item label="全电发票:" prop="elecRemarks">
  369. <el-input style="width: 100%;" v-model="form.elecRemarks" size="small"
  370. autocomplete="off" type="textarea" clearable 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" @tab-click="handleClick">
  405. <el-tab-pane label="费用明细" name="first">
  406. <div style="margin-bottom: 10px;display: flex;">
  407. <search-query :datalist="serverData" :selectValue="form.serverName" :clearable="true"
  408. :buttonIf="false" :filterable="true"
  409. :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictValue' }"
  410. placeholder="请选择开票项目" @corpChange="corpChange($event, 'serverName')"
  411. @corpFocus="serverWorkDictsfun">
  412. </search-query>
  413. <el-button style="margin-left: 10px" :disabled="editSave" size="small" type="primary"
  414. @click="invoicingfun">生成开票明细</el-button>
  415. <el-button style="margin-left: 10px" :disabled="editSave" size="small" type="warning"
  416. @click="invoicingRevokefun">撤销开票明细</el-button>
  417. <el-button size="small" :disabled="editSave" type="danger"
  418. @click="batchDeletefun">一键删除</el-button>
  419. <el-input style="width: 10%;margin-left: 10px;" v-model="invoiceAmountCNY" size="small"
  420. autocomplete="off" type="numbers" clearable placeholder="开票金额">
  421. <span style="line-height: 32px;" slot="suffix">CNY</span>
  422. </el-input>
  423. <el-input style="width: 10%;margin-left: 5px;" v-model="invoiceAmountUSD" size="small"
  424. autocomplete="off" type="numbers" clearable placeholder="开票金额">
  425. <span style="line-height: 32px;" slot="suffix">USD</span>
  426. </el-input>
  427. <el-button style="margin-left: 10px" :disabled="statusType" size="small" type="primary"
  428. @click="invoiceMatchingfun()">匹配金额</el-button>
  429. <span style="font-size: 18px;font-weight: 600;margin-left: 50px;">
  430. <span style="color: #67C23A;margin-right: 10px;">
  431. CNY:¥{{ amountSubSum }}元
  432. </span>
  433. <span style="color: #E6A23C;">
  434. USD:${{ amountSubUsdSum }}元
  435. </span>
  436. </span>
  437. </div>
  438. <fininvoicesitems ref="fininvoicesitems" :tableData="tableData"
  439. :handleSelectionData="handleSelectionData" :editSave="editSave" :form="form"
  440. @handleSelectionChange="handleSelectionChange" @deletefun="detailsdeletionfun">
  441. </fininvoicesitems>
  442. </el-tab-pane>
  443. <el-tab-pane label="开票明细" name="second">
  444. <div style="margin-bottom: 10px;display: flex;">
  445. <el-button size="small" :disabled="editSave" type="danger"
  446. @click="invoicingBatchDelete">一键删除</el-button>
  447. <span style="font-size: 18px;font-weight: 600;margin-left: 100px;">
  448. <span style="color: #67C23A;">
  449. CNY:¥{{ amountSubSum }}元
  450. </span>
  451. </span>
  452. </div>
  453. <fininvoiceitemdetail :tableData="InvoicingList"
  454. :handleSelectionData="invoicingCheckboxData"
  455. @handleSelectionChange="invoicingCheckboxChange" @deletefun="invoiceDeletionfun"
  456. @savefun="invoiceSavefun">
  457. </fininvoiceitemdetail>
  458. </el-tab-pane>
  459. </el-tabs>
  460. </el-card>
  461. <el-card class="box-card" style="margin-top: 10px">
  462. <el-row>
  463. <el-col :span="5">
  464. <el-form-item label="业务编号" prop="billNo">
  465. <el-input style="width: 100%;" v-model="form.billNo" size="small" autocomplete="off"
  466. :disabled="true" clearable placeholder="请输入业务编号">
  467. </el-input>
  468. </el-form-item>
  469. </el-col>
  470. <el-col :span="5">
  471. <el-form-item label="单据日期" prop="billDate">
  472. <el-date-picker v-model="form.billDate" clearable style="width: 100%;" type="date"
  473. size="small" :disabled="true" value-format="yyyy-MM-dd HH:mm" placeholder="选择单据日期">
  474. </el-date-picker>
  475. </el-form-item>
  476. </el-col>
  477. <el-col :span="5">
  478. <el-form-item label="制单人" prop="createUserName">
  479. <el-input style="width: 100%;" v-model="form.createUserName" size="small"
  480. autocomplete="off" :disabled="true" clearable placeholder="请输入制单人">
  481. </el-input>
  482. </el-form-item>
  483. </el-col>
  484. </el-row>
  485. </el-card>
  486. </el-form>
  487. </div>
  488. <el-dialog title="选择数据" :visible.sync="retrievePopupsType" append-to-body width="70%"
  489. :close-on-click-modal="false">
  490. <div>
  491. <avue-crud :option="retrievePopupsOption" :data="retrievePopupsData" ref="retrievePopupsRef"
  492. id="out-table">
  493. <template slot="menu" slot-scope="{ row }">
  494. <el-button type="text" size="small" @click.stop="retrievePopupsSelect(row)">选择
  495. </el-button>
  496. </template>
  497. </avue-crud>
  498. </div>
  499. </el-dialog>
  500. </div>
  501. </template>
  502. <script>
  503. import { bcurexrateList } from "@/api/iosBasicData/rateManagement";
  504. import fininvoicesitems from "@/views/iosBasicData/fininvoicesApplyfor/assembly/fininvoicesitems.vue";
  505. import fininvoiceitemdetail from "@/views/iosBasicData/fininvoicesApplyfor/assembly/fininvoiceitemdetail.vue";
  506. import { getRateList } from "@/api/iosBasicData/rateManagement";
  507. import { finstlbillsGetByDetail, finstlbillsitemsRemove, finstlbillslistAccBillV1 } from "@/api/iosBasicData/finstlbills";
  508. import { bcorpsbankList, corpsinvoiceheaderList, getBcorpsList } from "@/api/iosBasicData/bcorps";
  509. import { bportsList } from "@/api/iosBasicData/bports";
  510. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  511. import {
  512. fininvoicesDetail,
  513. fininvoicesSubmit,
  514. fininvoicesitemsRemove,
  515. generateFinInvoicesDetail,
  516. fininvoiceitemdetailRemove,
  517. revokeFinInvoicesDetail,
  518. fininvoiceitemdetailSubmit,
  519. fininvoicesGenerateFinInvoices,
  520. fininvoicesConfirmFinInvoices, fininvoicesRevokeFinInvoices
  521. } from "@/api/iosBasicData/fininvoices";
  522. import { getWorkDicts } from "@/api/system/dictbiz";
  523. import { getCurrentDate } from "@/util/date";
  524. import dicSelect from "@/components/dicSelect/main";
  525. import { finstlbillslistAccBillByCorp } from '@/api/iosBasicData/finstlbills';
  526. import { getMonthDate, getYearDate } from "@/util/date";
  527. export default {
  528. components: { SearchQuery, fininvoicesitems, fininvoiceitemdetail, dicSelect },
  529. data() {
  530. return {
  531. amountSubSum: 0,
  532. amountSubUsdSum: 0,
  533. options: [
  534. {
  535. value: null,
  536. label: '全部'
  537. }, {
  538. value: 'D',
  539. label: '收'
  540. }, {
  541. value: 'C',
  542. label: '付'
  543. }
  544. ],
  545. showForm: false,
  546. retrievePopupsType: false, // 弹窗开启关闭
  547. retrievePopupsData: [], // 选择弹窗数据
  548. retrievePopupsOption: {
  549. border: true,
  550. calcHeight: 30,
  551. tip: false,
  552. height: '500px',
  553. index: true,
  554. addBtn: false,
  555. viewBtn: false,
  556. delBtn: false,
  557. editBtn: false,
  558. refreshBtn: false,
  559. columnBtn: false,
  560. menuWidth: '60',
  561. header: false,
  562. column: [
  563. {
  564. label: "客户中文名",
  565. prop: "cnName",
  566. overHidden: true,
  567. },
  568. {
  569. label: "客户英文文名",
  570. prop: "cnName",
  571. overHidden: true,
  572. },
  573. ]
  574. },
  575. invoiceAmountCNY: 0, // 费用明细开票金额输入框CNY
  576. invoiceAmountUSD: 0, // 费用明细开票金额输入框USD
  577. statusType: false, // 是否确认开票
  578. serverData: [], // 开票项目数据
  579. detailTabs: 'first',
  580. appendType: '检索',
  581. pageLoading: false, // 全屏加载
  582. saveLoading: false, // 按钮加载
  583. form: {
  584. dc: 'D',
  585. invCurCode: 'CNY',
  586. isRp: 1,
  587. invType: '全电发票',
  588. taxRate: 0,
  589. isExchangeToCny: 0,
  590. invoiceDate: getCurrentDate(),
  591. },
  592. tableData: [], // 费用明细数据
  593. InvoicingList: [], // 开票明细数据
  594. handleSelectionData: [], // 费用明细选择的数据
  595. invoicingCheckboxData: [], // 开票明细选择的数据
  596. corpData: [], // 结算单位数据
  597. invCorpData: [], // 开票单位
  598. bankReceiptData: [], // 结算单位银行账号数据
  599. // 业务类型
  600. businessTypesData: [
  601. {
  602. label: '海运出口',
  603. value: 'SE'
  604. }, {
  605. label: '海运进口',
  606. value: 'SI'
  607. }
  608. ],
  609. curData: [], // 币别
  610. destinationData: [], // 目的港
  611. podData: [], // 卸货港
  612. polData: [], // 装货港
  613. invCurCodeData: [], // 发票币种
  614. invTypeData: [], // 发票类型
  615. rules: {
  616. corpCnName: [
  617. { required: true, message: '请输入付费对象', trigger: 'blur' },
  618. ],
  619. invoiceDate: [
  620. { required: true, message: '请输入开票日期', trigger: 'blur' },
  621. ],
  622. exrate: [
  623. { required: true, message: '请输入导入汇率', trigger: 'blur' },
  624. ],
  625. taxRate: [
  626. { required: true, message: '请输入所属税率', trigger: 'blur' },
  627. ],
  628. invCurCode: [
  629. { required: true, message: '请输入所属发票币别', trigger: 'blur' },
  630. ],
  631. },
  632. roleName: [], // 当前的角色权限
  633. saberUserInfo: {}, // 当前登录人信息
  634. editPower: false, // 当前是否可以编辑
  635. }
  636. },
  637. props: {
  638. editSave: {
  639. type: Boolean,
  640. default: false
  641. }
  642. },
  643. watch: {
  644. // 监听 状态
  645. "form.status": {
  646. // 执行方法
  647. handler(oldValue, newValue) {
  648. if (oldValue == 3) {
  649. this.statusType = true
  650. } else {
  651. this.statusType = false
  652. }
  653. },
  654. deep: true, // 深度监听
  655. immediate: true // 第一次改变就执行
  656. },
  657. },
  658. created() {
  659. this.roleName = localStorage.getItem('roleName').split(',')
  660. // 获取当前登录人个人信息
  661. this.saberUserInfo = JSON.parse(localStorage.getItem('saber-userInfo')).content
  662. if (!this.form.id) {
  663. bcurexrateList({ current: 1, size: 35, type: '月汇率', code: 'USD', exrateYear: getYearDate() }).then(res => {
  664. for (let item of res.data.data.records) {
  665. if (item.exrateMonth == getMonthDate()) {
  666. this.$set(this.form, 'exrate', item.exrateReceipts)
  667. }
  668. }
  669. })
  670. // getRateList({ current: 1, size: 30 }).then(res => {
  671. // for (let item of res.data.data.records) {
  672. // if (item.code == "USD") {
  673. // this.$set(this.form, 'exrate', item.exrate)
  674. // }
  675. // }
  676. // })
  677. }
  678. },
  679. methods: {
  680. handleClick() {
  681. this.amountSubSum = 0
  682. this.amountSubUsdSum = 0
  683. },
  684. ResetFilter() {
  685. this.form = {
  686. invCurCode: 'CNY',
  687. isRp: 1,
  688. invType: '全电发票',
  689. taxRate: 0,
  690. isExchangeToCny: 0,
  691. invoiceDate: getCurrentDate(),
  692. }
  693. getRateList({ current: 1, size: 30 }).then(res => {
  694. for (let item of res.data.data.records) {
  695. if (item.code == "USD") {
  696. this.$set(this.form, 'exrate', item.exrate)
  697. }
  698. }
  699. })
  700. },
  701. // 开票明细编辑完成保存
  702. invoiceSavefun(row) {
  703. row.amountRate = this.form.taxRate
  704. // 销售额/(1+税率)×税率
  705. row.amountTax = (row.amount / (1 + (Number(row.amountRate) / 100)) * (Number(row.amountRate) / 100)).toFixed(2)
  706. fininvoiceitemdetailSubmit(row).then(res => {
  707. this.$message.success('操作成功')
  708. this.fininvoicesDetailfun(this.form.id)
  709. })
  710. },
  711. // 确认开票信息
  712. invoicingfun() {
  713. if (this.handleSelectionData.length == 0) {
  714. this.$message.warning('请选择数据')
  715. return;
  716. }
  717. if (!this.form.serverName) {
  718. this.$message.warning('请选择开票项目')
  719. return
  720. }
  721. let obj = this.form
  722. obj.finInvoicesItemsList = []
  723. obj.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  724. obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  725. //开票日期
  726. if (this.form.invoiceDate) {
  727. obj.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  728. }
  729. // 业务日期
  730. if (this.form.accountDateFrom) {
  731. obj.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  732. }
  733. if (this.form.accountDateTo) {
  734. obj.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  735. }
  736. for (let item of this.handleSelectionData) {
  737. // 拿未开票的数据
  738. if (item.status == 0) {
  739. if (item.currentCurCode == 'CNY') {
  740. item.currentAmount = item.currentAmountCNY
  741. } else {
  742. item.currentAmount = item.currentAmountUSD
  743. }
  744. obj.finInvoicesItemsList.push(item)
  745. }
  746. }
  747. if (obj.finInvoicesItemsList.length == 0) {
  748. this.$message.warning('请选择未生成发票的数据')
  749. return
  750. }
  751. // 开票项目
  752. generateFinInvoicesDetail(obj).then(res => {
  753. this.$message.warning('操作成功')
  754. this.fininvoicesDetailfun(this.form.id)
  755. })
  756. this.detailTabs = 'second'
  757. },
  758. // 撤销开票信息
  759. invoicingRevokefun() {
  760. if (this.handleSelectionData.length == 0) {
  761. this.$message.warning('请选择数据')
  762. return;
  763. }
  764. let obj = this.form
  765. obj.finInvoicesItemsList = []
  766. obj.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  767. obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  768. //开票日期
  769. if (this.form.invoiceDate) {
  770. obj.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  771. }
  772. // 业务日期
  773. if (this.form.accountDateFrom) {
  774. obj.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  775. }
  776. if (this.form.accountDateTo) {
  777. obj.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  778. }
  779. for (let item of this.handleSelectionData) {
  780. // 拿未开票的数据
  781. if (item.status == 1) {
  782. if (item.currentCurCode == 'CNY') {
  783. item.currentAmount = item.currentAmountCNY
  784. } else {
  785. item.currentAmount = item.currentAmountUSD
  786. }
  787. obj.finInvoicesItemsList.push(item)
  788. }
  789. }
  790. if (obj.finInvoicesItemsList.length == 0) {
  791. this.$message.warning('请选择已生成发票的数据')
  792. return
  793. }
  794. // 撤销开票项目
  795. revokeFinInvoicesDetail(obj).then(res => {
  796. this.$message.warning('操作成功')
  797. this.fininvoicesDetailfun(this.form.id)
  798. })
  799. },
  800. // 费用明细开票匹配
  801. invoiceMatchingfun() {
  802. if (this.invoiceAmountCNY != 0 || this.invoiceAmountUSD != 0) {
  803. let dataCNY = JSON.parse(JSON.stringify(this.invoiceAmountCNY))
  804. let dataUSD = JSON.parse(JSON.stringify(this.invoiceAmountUSD))
  805. for (let item of this.tableData) {
  806. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, false)
  807. if (this.invoiceAmountCNY != 0) {
  808. if (dataCNY < 0) {
  809. dataCNY = 0
  810. }
  811. if (dataCNY > 1500) {
  812. if (item.currentCurCode == 'CNY') {
  813. this.$set(item, 'currentAmountCNY', 1500)
  814. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  815. dataCNY -= 1500
  816. }
  817. } else {
  818. if (item.currentCurCode == 'CNY') {
  819. if (dataCNY != 0) {
  820. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  821. }
  822. this.$set(item, 'currentAmountCNY', dataCNY)
  823. dataCNY -= 1500
  824. }
  825. }
  826. }
  827. if (this.invoiceAmountUSD != 0) {
  828. if (dataUSD < 0) {
  829. dataUSD = 0
  830. }
  831. if (dataUSD > 1500) {
  832. if (item.currentCurCode == 'USD') {
  833. this.$set(item, 'currentAmountUSD', 1500)
  834. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  835. dataUSD -= 1500
  836. }
  837. } else {
  838. if (item.currentCurCode == 'USD') {
  839. this.$set(item, 'currentAmountUSD', dataUSD)
  840. if (dataUSD != 0) {
  841. this.$refs.fininvoicesitems.$refs.tableRef.toggleRowSelection(item, true)
  842. }
  843. dataUSD -= 1500
  844. }
  845. }
  846. }
  847. }
  848. }
  849. },
  850. // 费用明细批量删除
  851. batchDeletefun() {
  852. if (this.handleSelectionData.length == 0) {
  853. return this.$message.warning('请选择要删除的数据')
  854. }
  855. this.$confirm("确定将选择数据删除?", {
  856. confirmButtonText: "确定",
  857. cancelButtonText: "取消",
  858. type: "warning"
  859. }).then(() => {
  860. // 获取有id 的数据
  861. const itemsWithId = this.handleSelectionData.filter(item => item.hasOwnProperty('id'));
  862. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  863. // 把选中的删除掉
  864. this.handleSelectionData.forEach((item) => {
  865. for (let index in this.tableData) {
  866. if (item.accBillNo == this.tableData[index].accBillNo) {
  867. this.tableData.splice(Number(index), 1)
  868. }
  869. }
  870. })
  871. // 有id 的处理
  872. if (itemsWithId.length != 0) {
  873. fininvoicesitemsRemove(arrIds.join(',')).then(res => {
  874. this.$message.success('操作成功')
  875. })
  876. }
  877. })
  878. },
  879. // 费用明细单个删除
  880. detailsdeletionfun(id, index) {
  881. this.$confirm("确定将选择数据删除?", {
  882. confirmButtonText: "确定",
  883. cancelButtonText: "取消",
  884. type: "warning"
  885. }).then(() => {
  886. if (id) {
  887. fininvoicesitemsRemove(id).then(res => {
  888. this.$message.success('操作成功')
  889. })
  890. }
  891. this.tableData.splice(index, 1)
  892. })
  893. },
  894. // 开票批量删除
  895. invoicingBatchDelete() {
  896. if (this.invoicingCheckboxData.length == 0) {
  897. return this.$message.warning('请选择要删除的数据')
  898. }
  899. this.$confirm("确定将选择数据删除?", {
  900. confirmButtonText: "确定",
  901. cancelButtonText: "取消",
  902. type: "warning"
  903. }).then(() => {
  904. // 获取有id 的数据
  905. const itemsWithId = this.invoicingCheckboxData.filter(item => item.hasOwnProperty('id'));
  906. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  907. // 把选中的删除掉
  908. this.invoicingCheckboxData.forEach((item) => {
  909. for (let index in this.InvoicingList) {
  910. if (item.id == this.InvoicingList[index].id) {
  911. this.InvoicingList.splice(Number(index), 1)
  912. }
  913. }
  914. })
  915. // 有id 的处理
  916. if (itemsWithId.length != 0) {
  917. fininvoiceitemdetailRemove(arrIds.join(',')).then(res => {
  918. this.$message.success('操作成功')
  919. })
  920. }
  921. })
  922. },
  923. // 开票明细单个删除
  924. invoiceDeletionfun(id, index) {
  925. this.$confirm("确定将选择数据删除?", {
  926. confirmButtonText: "确定",
  927. cancelButtonText: "取消",
  928. type: "warning"
  929. }).then(() => {
  930. if (id) {
  931. fininvoiceitemdetailRemove(id).then(res => {
  932. this.$message.success('操作成功')
  933. })
  934. }
  935. this.InvoicingList.splice(index, 1)
  936. })
  937. },
  938. // 下拉框的回调
  939. corpChange(value, name) {
  940. // 结算单位
  941. if (name == 'corpCnName') {
  942. if (!value) {
  943. this.$set(this.form, 'corpId', '')
  944. this.$set(this.form, 'corpCnName', '')
  945. this.$set(this.form, 'corpEnName', '')
  946. return
  947. }
  948. for (let item of this.corpData) {
  949. if (item.cnName == value) {
  950. this.$set(this.form, 'corpId', item.id)
  951. this.$set(this.form, 'corpCnName', item.cnName)
  952. this.$set(this.form, 'corpEnName', item.enName)
  953. bcorpsbankList(1, 10, { pid: this.form.corpId }).then(res => {
  954. if (res.data.data.records.length != 0) {
  955. this.$set(this.form, 'bankReceiptAccountNo', res.data.data.records[0].accountNo)
  956. this.$set(this.form, 'bankReceiptBankName', res.data.data.records[0].accountBank)
  957. }
  958. })
  959. // 带出开票单位数据
  960. corpsinvoiceheaderList(1, 20, { pid: this.form.corpId }).then(res => {
  961. if (res.data.data.records.length != 0) {
  962. this.$set(this.form, 'invCorpId', res.data.data.records[0].id)
  963. this.$set(this.form, 'invCorpCnName', res.data.data.records[0].invoiceHeader)
  964. this.$set(this.form, 'invCorpTaxNo', res.data.data.records[0].uscc) // 税号
  965. this.$set(this.form, 'invCorpAccountBankUsd', res.data.data.records[0].accountBankUsd) // 美元银行
  966. this.$set(this.form, 'invCorpAccountNoUsd', res.data.data.records[0].accountNoUsd) // 美元账户
  967. this.$set(this.form, 'invCorpAccountBankCny', res.data.data.records[0].accountBankUsd) // 人民币银行
  968. this.$set(this.form, 'invCorpAccountNoCny', res.data.data.records[0].accountNoUsd) // 人民币账户
  969. }
  970. })
  971. }
  972. }
  973. }
  974. // 开票单位
  975. else if (name == 'invCorpCnName') {
  976. this.$set(this.form, 'invCorpAccountBankUsd', '')
  977. this.$set(this.form, 'invCorpAccountNoUsd', '')
  978. this.$set(this.form, 'invCorpAccountBankCny', '')
  979. this.$set(this.form, 'invCorpAccountNoCny', '')
  980. if (!value) {
  981. this.$set(this.form, 'invCorpId', '')
  982. this.$set(this.form, 'invCorpCnName', '')
  983. return
  984. }
  985. for (let item of this.invCorpData) {
  986. if (item.id == value) {
  987. this.$set(this.form, 'invCorpId', item.id)
  988. this.$set(this.form, 'invCorpCnName', item.invoiceHeader)
  989. this.$set(this.form, 'invCorpTaxNo', item.uscc) // 税号
  990. this.$set(this.form, 'invCorpAccountBankUsd', item.accountBankUsd) // 美元银行
  991. this.$set(this.form, 'invCorpAccountNoUsd', item.accountNoUsd) // 美元账户
  992. this.$set(this.form, 'invCorpAccountBankCny', item.accountBankUsd) // 人民币银行
  993. this.$set(this.form, 'invCorpAccountNoCny', item.accountNoUsd) // 人民币账户
  994. }
  995. }
  996. }
  997. // 结算单位银行账户
  998. else if (name == 'bankReceiptAccountNo') {
  999. for (let item of this.bankReceiptData) {
  1000. if (item.accountNo == value) {
  1001. this.$set(this.form, 'bankReceiptAccountNo', item.accountNo)
  1002. this.$set(this.form, 'bankReceiptBankName', item.accountBank)
  1003. }
  1004. }
  1005. }
  1006. else {
  1007. this.$set(this.form, name, value)
  1008. }
  1009. },
  1010. // 费用明细表格多选
  1011. handleSelectionChange(list) {
  1012. this.amountSubSum = 0
  1013. this.amountSubUsdSum = 0
  1014. if (list.length) {
  1015. list.forEach(e => {
  1016. this.amountSubSum += Number(e.currentAmountCNY ? e.currentAmountCNY : 0)
  1017. this.amountSubUsdSum += Number(e.currentAmountUSD ? e.currentAmountUSD : 0)
  1018. })
  1019. }
  1020. this.handleSelectionData = list
  1021. },
  1022. // 开票明细表格多选
  1023. invoicingCheckboxChange(list) {
  1024. this.amountSubSum = 0
  1025. this.amountSubUsdSum = 0
  1026. if (list.length) {
  1027. list.forEach(e => {
  1028. this.amountSubSum += Number(e.amount ? e.amount : 0)
  1029. })
  1030. }
  1031. this.invoicingCheckboxData = list
  1032. },
  1033. // 编辑事件
  1034. editHandle() {
  1035. this.editSave = false
  1036. },
  1037. newbillFun() {
  1038. if (this.statusType) {
  1039. this.$emit('toAddEdit')
  1040. } else {
  1041. this.$confirm('是否需要保存?', '提示', {
  1042. confirmButtonText: '确定',
  1043. cancelButtonText: '取消',
  1044. type: 'warning'
  1045. }).then(() => {
  1046. this.editCustomer('toAddEdit')
  1047. }).catch(() => {
  1048. this.$emit('toAddEdit')
  1049. });
  1050. }
  1051. },
  1052. submit(type) {
  1053. this.$confirm("确定进行确认开票操作?", {
  1054. confirmButtonText: "确定",
  1055. cancelButtonText: "取消",
  1056. type: "warning"
  1057. }).then(() => {
  1058. this.editCustomer(type)
  1059. }).catch(() => {
  1060. this.saveLoading = false
  1061. });
  1062. },
  1063. // 保存按钮事件
  1064. editCustomer(type) {
  1065. this.$refs.form.validate((valid) => {
  1066. if (!valid) return
  1067. if (!this.form.id) {
  1068. // 是否选择从表数据
  1069. if (this.handleSelectionData.length == 0) {
  1070. this.$message.warning('请选择结算数据');
  1071. return;
  1072. }
  1073. }
  1074. this.form.type = '销项'
  1075. this.form.billNoFormat = 'XXFP'
  1076. this.form.businessTypeCode = 'XXFP'
  1077. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  1078. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1079. //开票日期
  1080. if (this.form.invoiceDate) {
  1081. this.form.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  1082. }
  1083. // 业务日期
  1084. if (this.form.accountDateFrom) {
  1085. this.form.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  1086. }
  1087. if (this.form.accountDateTo) {
  1088. this.form.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  1089. }
  1090. if (this.form.id) {
  1091. this.form.finInvoicesItemsList = this.form.finInvoicesItemsList.map(item => {
  1092. if (item.currentCurCode == 'CNY') {
  1093. item.currentAmount = item.currentAmountCNY
  1094. } else {
  1095. item.currentAmount = item.currentAmountUSD
  1096. }
  1097. return item
  1098. })
  1099. } else {
  1100. this.form.finInvoicesItemsList = this.handleSelectionData.map(item => {
  1101. if (item.currentCurCode == 'CNY') {
  1102. item.currentAmount = item.currentAmountCNY
  1103. } else {
  1104. item.currentAmount = item.currentAmountUSD
  1105. }
  1106. return item
  1107. })
  1108. }
  1109. this.form.finInvoiceItemDetailList = this.InvoicingList
  1110. this.saveLoading = true
  1111. if (type == '开票') {
  1112. fininvoicesSubmit(this.form).then(res => {
  1113. res.data.data.businessTypes = res.data.data.businessTypes ? res.data.data.businessTypes.split(',') : []
  1114. res.data.data.feeCnName = res.data.data.feeCnName ? res.data.data.feeCnName.split(',') : []
  1115. this.form = res.data.data
  1116. this.fininvoicesConfirmFinInvoicesfun()
  1117. }).finally(() => {
  1118. this.saveLoading = false
  1119. });
  1120. } else if (type == 'toAddEdit') {
  1121. fininvoicesSubmit(this.form).then(res => {
  1122. this.$message.success('操作成功');
  1123. this.saveLoading = false // 关闭按钮动画
  1124. this.$emit(type)
  1125. }).catch(() => {
  1126. this.saveLoading = false
  1127. })
  1128. } else {
  1129. this.fininvoicesSubmitfun(this.form)
  1130. }
  1131. })
  1132. },
  1133. retrievePopupsSelect(row) {
  1134. this.$set(this.form, 'corpId', row.id)
  1135. this.$set(this.form, 'corpCnName', row.cnName)
  1136. this.$set(this.form, 'corpEnName', row.enName)
  1137. bcorpsbankList(1, 10, { pid: row.id }).then(res => {
  1138. if (res.data.data.records.length != 0) {
  1139. this.$set(this.form, 'bankReceiptAccountNo', res.data.data.records[0].accountNo)
  1140. this.$set(this.form, 'bankReceiptBankName', res.data.data.records[0].accountBank)
  1141. }
  1142. })
  1143. // 带出开票单位数据
  1144. corpsinvoiceheaderList(1, 20, { pid: row.id }).then(res => {
  1145. if (res.data.data.records.length != 0) {
  1146. this.$set(this.form, 'invCorpId', res.data.data.records[0].id)
  1147. this.$set(this.form, 'invCorpCnName', res.data.data.records[0].invoiceHeader)
  1148. this.$set(this.form, 'invCorpTaxNo', res.data.data.records[0].uscc) // 税号
  1149. this.$set(this.form, 'invCorpAccountBankUsd', res.data.data.records[0].accountBankUsd) // 美元银行
  1150. this.$set(this.form, 'invCorpAccountNoUsd', res.data.data.records[0].accountNoUsd) // 美元账户
  1151. this.$set(this.form, 'invCorpAccountBankCny', res.data.data.records[0].accountBankUsd) // 人民币银行
  1152. this.$set(this.form, 'invCorpAccountNoCny', res.data.data.records[0].accountNoUsd) // 人民币账户
  1153. }
  1154. })
  1155. this.retrievePopupsType = false
  1156. this.finstlbillslistAccBillV1fun(this.appendType)
  1157. },
  1158. finstlbillslistAccBillByCorpfun() {
  1159. let obj = {}
  1160. if (this.form.accountDateFrom) {
  1161. obj.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  1162. }
  1163. if (this.form.accountDateTo) {
  1164. obj.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  1165. }
  1166. obj.type = '3'
  1167. obj.billNo = this.form.businessNo // 业务编号
  1168. obj.businessBillNo = this.form.billNo // 业务编号
  1169. obj.mblno = this.form.mblno // 主单编号
  1170. obj.hblno = this.form.hblno // 分单编号
  1171. obj.bookingNo = this.form.bookingNo // 订舱号(BOOK NO)
  1172. obj.curCode = this.form.curCode // 币种
  1173. obj.businessType = this.form.businessTypes ? this.form.businessTypes.join(',') : '' // 业务类型
  1174. obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1175. finstlbillslistAccBillByCorp(obj).then(res => {
  1176. this.retrievePopupsType = true
  1177. this.retrievePopupsData = res.data.data
  1178. })
  1179. },
  1180. // 检索
  1181. finstlbillslistAccBillV1fun(type) {
  1182. if (this.form.businessNo || this.form.mblno || this.form.checkNo) {
  1183. if (!this.form.corpId) {
  1184. this.finstlbillslistAccBillByCorpfun()
  1185. return
  1186. }
  1187. } else {
  1188. if (!this.form.corpId) {
  1189. this.$message.warning('请选择结算单位');
  1190. return
  1191. }
  1192. }
  1193. let obj = {}
  1194. //开票日期
  1195. if (this.form.invoiceDate) {
  1196. obj.invoiceDate = this.form.invoiceDate.slice(0, 10) + ' 00:00:00'
  1197. }
  1198. // 业务日期
  1199. if (this.form.accountDateFrom) {
  1200. obj.accountDateFrom = this.form.accountDateFrom.slice(0, 10) + ' 00:00:00'
  1201. }
  1202. if (this.form.accountDateTo) {
  1203. obj.accountDateTo = this.form.accountDateTo.slice(0, 10) + ' 00:00:00'
  1204. }
  1205. obj.type = '3'
  1206. obj.billNo = this.form.bookingNo // 账单号
  1207. obj.businessBillNo = this.form.businessNo // 业务编号
  1208. obj.mblno = this.form.mblno // 主单编号
  1209. obj.hblno = this.form.hblno // 分单编号
  1210. obj.bookingNo = this.form.bookingNo // 订舱号(BOOK NO)
  1211. obj.curCode = this.form.curCode // 币种
  1212. obj.businessType = this.form.businessTypes ? this.form.businessTypes.join(',') : '' // 业务类型
  1213. obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1214. obj.dc = this.form.dc
  1215. // 判断是否有对账单号
  1216. if (this.form.checkNo) {
  1217. obj.corpId = this.form.corpId // 结算单位
  1218. obj.checkNo = this.form.checkNo // CHK NO 对账单号
  1219. // obj.dc='D'
  1220. finstlbillsGetByDetail(obj).then(res => {
  1221. let arr = res.data.data.finStlBillsItemsList.map((item, index) => {
  1222. item.lineNo = Number(index) + 1 // 行号
  1223. item.currentCurCode = item.curCode
  1224. item.currentExrate = item.exrate
  1225. if (item.currentCurCode == 'CNY') {
  1226. // 本次发票金额
  1227. item.currentAmountCNY = item.appliedInvoiceCurrentAmount
  1228. } else {
  1229. // 本次发票金额
  1230. item.currentAmountUSD = item.appliedInvoiceCurrentAmount
  1231. }
  1232. delete item.id
  1233. return item
  1234. })
  1235. if (type == '追加') {
  1236. let a = [...this.tableData, ...arr,]
  1237. this.tableData = a.filter((obj, index) => {
  1238. return a.findIndex((elem) => {
  1239. return elem.accBillNo === obj.accBillNo
  1240. }) === index;
  1241. });
  1242. } else {
  1243. // 获取有id 的数据
  1244. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  1245. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  1246. // 有id 的处理
  1247. if (itemsWithId.length != 0) {
  1248. finstlbillsitemsRemove(arrIds.join(',')).then(res => {
  1249. this.$message.success('操作成功')
  1250. })
  1251. }
  1252. if (arr.length == 0) {
  1253. this.$message.warning('当前检索暂无数据!')
  1254. }
  1255. this.tableData· = arr
  1256. }
  1257. })
  1258. } else {
  1259. obj.billNo = this.form.businessNo // 业务编号
  1260. obj.corpCnName = this.form.corpId // 结算单位
  1261. obj.checkBillNo = this.form.checkNo // 对账单号
  1262. // obj.dc='D'
  1263. finstlbillslistAccBillV1(obj).then(res => {
  1264. let arr = res.data.data.map((item, index) => {
  1265. console.log(item)
  1266. item.lineNo = Number(index) + 1 // 行号
  1267. item.accBillId = item.id
  1268. item.accBillNo = item.billNo
  1269. item.billNo = item.businessBillNo
  1270. item.accDate = item.createTime
  1271. item.currentCurCode = item.curCode
  1272. item.currentExrate = item.exrate
  1273. item.dc = item.accountDc
  1274. if (item.currentCurCode == 'CNY') {
  1275. // 本次发票金额
  1276. item.currentAmountCNY = item.appliedInvoiceCurrentAmount
  1277. } else {
  1278. // 本次发票金额
  1279. item.currentAmountUSD = item.appliedInvoiceCurrentAmount
  1280. }
  1281. delete item.id
  1282. return item
  1283. })
  1284. if (type == '追加') {
  1285. let a = [...this.tableData, ...arr,]
  1286. this.tableData = a.filter((obj, index) => {
  1287. return a.findIndex((elem) => {
  1288. return elem.accBillNo === obj.accBillNo
  1289. }) === index;
  1290. });
  1291. } else {
  1292. // 获取有id 的数据
  1293. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  1294. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  1295. // 有id 的处理
  1296. if (itemsWithId.length != 0) {
  1297. fininvoicesitemsRemove(arrIds.join(',')).then(res => {
  1298. this.$message.success('操作成功')
  1299. })
  1300. }
  1301. if (arr.length == 0) {
  1302. this.$message.warning('当前检索暂无数据!')
  1303. }
  1304. this.tableData = arr
  1305. }
  1306. })
  1307. }
  1308. },
  1309. // 保存接口
  1310. fininvoicesSubmitfun(obj) {
  1311. fininvoicesSubmit(obj).then(res => {
  1312. this.$message.success('操作成功');
  1313. this.fininvoicesDetailfun(res.data.data.id)
  1314. })
  1315. },
  1316. // 详情接口
  1317. fininvoicesDetailfun(id) {
  1318. this.pageLoading = true
  1319. fininvoicesDetail(id).then(res => {
  1320. this.form = res.data.data
  1321. if (this.roleName.indexOf('admin') == -1 ? this.roleName.indexOf('允许修改他人业务') == -1 ? this.saberUserInfo.user_id != this.form.createUser : false : false) {
  1322. this.editPower = true
  1323. } else {
  1324. this.editPower = false
  1325. }
  1326. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.split(',') : [] // 业务类型转换成数组显示
  1327. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.split(',') : []
  1328. this.tableData = this.form.finInvoicesItemsList.map(item => {
  1329. if (item.currentCurCode == 'CNY') {
  1330. item.currentAmountCNY = item.currentAmount
  1331. } else {
  1332. item.currentAmountUSD = item.currentAmount
  1333. }
  1334. return item
  1335. })
  1336. this.InvoicingList = this.form.finInvoiceItemDetailList.map(item => {
  1337. item.edit = false
  1338. return item
  1339. })
  1340. }).finally(() => {
  1341. setTimeout(() => {
  1342. this.saveLoading = false
  1343. }, 1000);
  1344. this.pageLoading = false
  1345. })
  1346. },
  1347. // 开票获取数据
  1348. fininvoicesGenerateFinInvoicesfun(billId) {
  1349. this.pageLoading = true
  1350. fininvoicesGenerateFinInvoices({ billId }).then(res => {
  1351. this.form = res.data.data
  1352. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.split(',') : [] // 业务类型转换成数组显示
  1353. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.split(',') : []
  1354. // 判断是否是数组
  1355. if (Array.isArray(this.form.finInvoicesItemsList)) {
  1356. this.tableData = this.form.finInvoicesItemsList.map(item => {
  1357. if (item.currentCurCode == 'CNY') {
  1358. item.currentAmountCNY = item.currentAmount
  1359. } else {
  1360. item.currentAmountUSD = item.currentAmount
  1361. }
  1362. return item
  1363. })
  1364. }
  1365. // 判断是否是数组
  1366. if (Array.isArray(this.form.finInvoiceItemDetailList)) {
  1367. this.InvoicingList = this.form.finInvoiceItemDetailList.map(item => {
  1368. item.edit = false
  1369. return item
  1370. })
  1371. }
  1372. }).finally(() => {
  1373. this.pageLoading = false
  1374. })
  1375. },
  1376. // 确认申请
  1377. fininvoicesConfirmFinInvoicesfun() {
  1378. this.pageLoading = true
  1379. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  1380. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1381. fininvoicesConfirmFinInvoices(this.form).then(res => {
  1382. this.$message.success('操作成功');
  1383. this.fininvoicesDetailfun(res.data.data.id)
  1384. }).finally(() => {
  1385. this.pageLoading = false
  1386. })
  1387. },
  1388. // 撤销申请
  1389. fininvoicesRevokeFinInvoicesfun() {
  1390. this.$confirm("确定进行撤销确认发票操作?", {
  1391. confirmButtonText: "确定",
  1392. cancelButtonText: "取消",
  1393. type: "warning"
  1394. }).then(res => {
  1395. this.pageLoading = true
  1396. this.form.businessTypes = this.form.businessTypes ? this.form.businessTypes.join(',') : ''
  1397. this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(',') : ''
  1398. fininvoicesRevokeFinInvoices(this.form).then(res => {
  1399. this.$message.success('操作成功');
  1400. this.fininvoicesDetailfun(res.data.data.id)
  1401. }).finally(() => {
  1402. this.pageLoading = false
  1403. })
  1404. })
  1405. },
  1406. //返回列表
  1407. backToList() {
  1408. this.$emit('goBack')
  1409. },
  1410. // 获取客户名称数据 往来单位数据
  1411. corpBcorpsListfun(cnName) {
  1412. getBcorpsList(1, 10, { cnName }).then(res => {
  1413. this.corpData = res.data.data.records
  1414. })
  1415. },
  1416. // 根据往来单位选择调用获取银行数据
  1417. bcorpsbankListfun(accountNo) {
  1418. bcorpsbankList(1, 10, {
  1419. // curNo:this.cntyCode,
  1420. pid: this.form.corpId,
  1421. accountNo: accountNo
  1422. }).then(res => {
  1423. this.bankReceiptData = res.data.data.records
  1424. })
  1425. },
  1426. // 根据往来单位选择调用获取发票抬头数据 开票单位数据
  1427. invcorpsinvoiceheaderListfun(cnName) {
  1428. corpsinvoiceheaderList(1, 20, { pid: this.form.corpId, cnName }).then(res => {
  1429. this.invCorpData = res.data.data.records
  1430. })
  1431. },
  1432. // 获取币别数据
  1433. getRateListfun(cnName) {
  1434. getRateList({ current: 1, size: 10, cnName }).then(res => {
  1435. this.curData = res.data.data.records
  1436. })
  1437. },
  1438. // 获取发票币别数据
  1439. invCurCodeRateListfun(cnName) {
  1440. getRateList({ current: 1, size: 20, cnName }).then(res => {
  1441. this.invCurCodeData = res.data.data.records
  1442. })
  1443. },
  1444. // 目的地
  1445. destinationBportsListfun(enName) {
  1446. bportsList(1, 10, { enName }).then(res => {
  1447. this.destinationData = res.data.data.records
  1448. })
  1449. },
  1450. // 卸货港
  1451. podBportsListfun(enName) {
  1452. bportsList(1, 10, { enName }).then(res => {
  1453. this.podData = res.data.data.records
  1454. })
  1455. },
  1456. // 装货港
  1457. polBportsListfun(enName) {
  1458. bportsList(1, 10, { enName }).then(res => {
  1459. this.polData = res.data.data.records
  1460. })
  1461. },
  1462. // 发票类型字典数据
  1463. invTypeWorkDictsfun() {
  1464. getWorkDicts('inv_type_los').then(res => {
  1465. this.invTypeData = res.data.data;
  1466. })
  1467. },
  1468. serverWorkDictsfun() {
  1469. getWorkDicts('Invoice_information_los').then(res => {
  1470. this.serverData = res.data.data;
  1471. })
  1472. },
  1473. },
  1474. }
  1475. </script>
  1476. <style scoped>
  1477. ::v-deep.el-form-item {
  1478. margin-bottom: 0;
  1479. }
  1480. .cardBox {
  1481. background: #fff;
  1482. width: 100%;
  1483. height: 100%;
  1484. padding: 20px;
  1485. box-sizing: border-box;
  1486. border-radius: 4px;
  1487. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  1488. }
  1489. .flexBox {
  1490. display: flex;
  1491. }
  1492. .flexBoxLeft {
  1493. flex: 2;
  1494. margin-right: 10px;
  1495. //padding-bottom: 40px;
  1496. }
  1497. .flexBoxRight {
  1498. flex: 3;
  1499. //padding-bottom: 40px;
  1500. }
  1501. </style>