fininvoicesDetails.vue 81 KB

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