billEdit.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136
  1. <template>
  2. <div class="app-container">
  3. <el-container>
  4. <el-container>
  5. <el-aside
  6. style="
  7. background-color: white;
  8. line-height: 0px;
  9. width: 300px;
  10. height: 400px;
  11. "
  12. >
  13. <el-steps
  14. :active="active"
  15. direction="vertical"
  16. process-status="finish"
  17. finish-status="success"
  18. >
  19. <el-step title="基本信息"></el-step>
  20. <el-step title="发票列表"></el-step>
  21. <el-step title="合同附件"></el-step>
  22. <el-step title="物流附件"></el-step>
  23. <el-step title="其他附件"></el-step>
  24. </el-steps>
  25. </el-aside>
  26. <el-main>
  27. <el-form ref="bill" label-width="auto" :inline="true" style="margin-bottom:50px">
  28. <el-form-item label="创建人:" style="float: right">{{ form.createUser }}</el-form-item>
  29. <el-form-item label="创建时间:" style="float: right">{{ parseTime(new Date(form.createTime)) }}</el-form-item>
  30. <el-form-item label="编号:" style="float: right">{{ form.zbiNumber }}</el-form-item>
  31. </el-form>
  32. <!-- 基本信息 -->
  33. <div v-if="active == 0">
  34. <el-divider content-position="left">基本信息</el-divider>
  35. <el-form
  36. ref="form"
  37. :model="form"
  38. :rules="rules"
  39. label-width="auto"
  40. label-position="top"
  41. :inline="true"
  42. >
  43. <el-form-item
  44. label="账款类型"
  45. prop="wplIsInput"
  46. style="width: 300px"
  47. >
  48. <el-radio-group v-model="type" prop="type" :disabled="true">
  49. <el-radio-button label="00"
  50. v-if="type == '00'"
  51. >应付账款</el-radio-button
  52. >
  53. <el-radio-button label="01"
  54. v-if="type == '01'"
  55. >应收账款</el-radio-button
  56. >
  57. </el-radio-group>
  58. </el-form-item>
  59. <el-form-item label="账款名称" prop="zbiName">
  60. <el-input
  61. v-model="form.zbiName"
  62. placeholder="请输入账款名称"
  63. maxlength="20"
  64. style="width: 300px"
  65. />
  66. </el-form-item>
  67. <el-form-item label="应付方" prop="zbiPayerId">
  68. <el-select style="width: 300px" v-model="form.zbiPayerId" :disabled="true" filterable remote
  69. v-if="type == '00'">
  70. <el-option :label="company.scyName" :value="company.scyId">
  71. </el-option>
  72. </el-select>
  73. <el-select style="width: 300px" v-model="form.zbiPayerId" filterable clearable remote
  74. v-if="type == '01'">
  75. <el-option v-for="(item,index) in companyRelList" :key="index" :label="item.launchScyId == company.scyId ? item.receiveScyName : item.launchScyName" :value="item.launchScyId == company.scyId ? item.receiveScyId : item.launchScyId">
  76. </el-option>
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item label="贸易日期" prop="zbiDate">
  80. <el-date-picker
  81. style="width: 300px"
  82. v-model="form.zbiDate"
  83. value-format="yyyy-MM-dd"
  84. type="date"
  85. placeholder="选择日期"
  86. >
  87. </el-date-picker>
  88. </el-form-item>
  89. <el-form-item
  90. :label="
  91. type == '00'
  92. ? '预计付款日期'
  93. : type == '01'
  94. ? '预计收款日期'
  95. : '预计收/付款日期'
  96. "
  97. prop="zbiPayDate"
  98. >
  99. <el-date-picker
  100. style="width: 300px"
  101. v-model="form.zbiPayDate"
  102. value-format="yyyy-MM-dd"
  103. type="date"
  104. placeholder="选择日期"
  105. >
  106. </el-date-picker>
  107. </el-form-item>
  108. <el-form-item label="应收方" prop="zbiPayeeId">
  109. <el-select style="width: 300px" v-model="form.zbiPayeeId" :disabled="true" filterable remote
  110. v-if="type == '01'">
  111. <el-option :label="company.scyName" :value="company.scyId">
  112. </el-option>
  113. </el-select>
  114. <el-select style="width: 300px" v-model="form.zbiPayeeId" filterable clearable remote
  115. v-if="type == '00'">
  116. <el-option v-for="(item,index) in companyRelList" :key="index" :label="item.launchScyId == company.scyId ? item.receiveScyName : item.launchScyName" :value="item.launchScyId == company.scyId ? item.receiveScyId : item.launchScyId">
  117. </el-option>
  118. </el-select>
  119. </el-form-item>
  120. <el-form-item label="金额" prop="zbiAmount">
  121. <el-input
  122. v-model="form.zbiAmount"
  123. placeholder="请输入金额"
  124. maxlength="20"
  125. style="width: 300px"
  126. >
  127. <template slot="append">元</template>
  128. </el-input>
  129. </el-form-item>
  130. <el-form-item label="合同编号" prop="zbiContractNo">
  131. <el-input
  132. v-model="form.zbiContractNo"
  133. placeholder="请输入合同编号"
  134. maxlength="20"
  135. style="width: 300px"
  136. />
  137. </el-form-item>
  138. <el-form-item label="账款服务">
  139. <el-input
  140. v-model="form.zbiService"
  141. placeholder="请输入账款服务"
  142. maxlength="20"
  143. style="width: 300px"
  144. />
  145. </el-form-item>
  146. <el-form-item label="配送订单">
  147. <el-input
  148. v-model="form.zbiOrderNo"
  149. placeholder="请输入配送订单"
  150. maxlength="20"
  151. style="width: 300px"
  152. />
  153. </el-form-item>
  154. <el-form-item label="配送企业">
  155. <el-input
  156. v-model="form.zbiDistributor"
  157. placeholder="请输入配送企业"
  158. maxlength="20"
  159. style="width: 300px"
  160. />
  161. </el-form-item>
  162. <el-form-item label="备注">
  163. <el-input
  164. v-model="form.zbiRemark"
  165. placeholder="请输入备注"
  166. :autosize="{ minRows: 2, maxRows: 4 }"
  167. maxlength="100"
  168. type="textarea"
  169. style="width: 615px"
  170. />
  171. </el-form-item>
  172. </el-form>
  173. </div>
  174. <!-- 发票列表 -->
  175. <div v-if="active == 1">
  176. <el-divider content-position="left">发票列表</el-divider>
  177. <el-form ref="invoice" label-width="auto" :inline="true">
  178. <el-form-item label="合计:">{{ allAmount() }}</el-form-item>
  179. <el-form-item label="大写:">{{ smallToBig(allAmount()) }}</el-form-item>
  180. <el-form-item style="float: right"
  181. ><el-button type="primary" @click="delInvoice"
  182. >删除</el-button
  183. ></el-form-item
  184. >
  185. <el-form-item style="float: right"
  186. ><el-button type="primary" @click="openUpload()"
  187. >上传</el-button
  188. ></el-form-item
  189. >
  190. </el-form>
  191. <el-table
  192. stripe
  193. :data="fileList"
  194. @selection-change="handleInvoiceSelectionChange"
  195. row-key="ziiId"
  196. default-expand-all
  197. border
  198. >
  199. <el-table-column
  200. type="selection"
  201. width="50"
  202. align="center"
  203. />
  204. <el-table-column
  205. label="发票代码"
  206. align="center"
  207. prop="ziiNo"
  208. maxlength="10"
  209. />
  210. <el-table-column
  211. label="发票号码"
  212. align="center"
  213. prop="ziiNumber"
  214. maxlength="10"
  215. />
  216. <el-table-column label="开票日期" align="center" prop="ziiDate" />
  217. <el-table-column
  218. label="购方识别号"
  219. align="center"
  220. prop="ziiPurchaserNo"
  221. />
  222. <el-table-column
  223. label="销方识别号"
  224. align="center"
  225. prop="ziiSellerNo"
  226. />
  227. <el-table-column
  228. label="合计金额"
  229. align="center"
  230. prop="ziiTotalAmount"
  231. />
  232. <el-table-column
  233. label="价税合计"
  234. align="center"
  235. prop="ziiAmount"
  236. />
  237. <el-table-column
  238. label="校验结果"
  239. align="center"
  240. prop="ziiCheckStt"
  241. :formatter="checkSttFormat"
  242. />
  243. <el-table-column
  244. label="附件"
  245. align="center"
  246. class-name="small-padding fixed-width"
  247. fixed="right"
  248. width="200"
  249. >
  250. <template slot-scope="scope">
  251. <el-button
  252. size="mini"
  253. type="text"
  254. @click="invoicePictureCardPreview(scope.row)"
  255. >详情</el-button
  256. >
  257. </template>
  258. </el-table-column>
  259. </el-table>
  260. <!-- 上传附件 -->
  261. <el-dialog
  262. title="上传发票"
  263. :visible.sync="uploadOpen"
  264. width="500px"
  265. append-to-body
  266. >
  267. <el-upload
  268. class="upload-demo"
  269. drag
  270. ref="upload"
  271. :file-list="fileList"
  272. :auto-upload="false"
  273. :http-request="httpRequest"
  274. :before-remove="beforeRemove"
  275. :on-remove="invoiceRemove"
  276. action=""
  277. multiple
  278. >
  279. <i class="el-icon-upload"></i>
  280. <div class="el-upload__text">
  281. 将文件拖到此处,或<em>点击选择文件</em>
  282. </div>
  283. <div class="el-upload__tip">
  284. 按住Ctrl可同时多选,单个文件不能超过4mb
  285. </div>
  286. <div class="el-upload__tip">
  287. 严禁上传包含色情、暴力、反动等相关违法信息的文件。
  288. </div>
  289. </el-upload>
  290. <el-button type="primary" @click="submitUpload()"
  291. >点击上传</el-button
  292. >
  293. <el-button type="primary" @click="toCheck()"
  294. >完成去验真</el-button
  295. >
  296. </el-dialog>
  297. <!-- 发票验真 -->
  298. <el-dialog
  299. title="发票验真"
  300. :visible.sync="open"
  301. width="1050px"
  302. append-to-body
  303. >
  304. <el-container>
  305. <el-aside width="300px" style="background-color: white">
  306. <el-header
  307. style="background-color: #dfe2e8; text-align: center"
  308. >
  309. <el-checkbox
  310. :indeterminate="isIndeterminate"
  311. v-model="checkAll"
  312. @change="handleCheckAllChange"
  313. >全选</el-checkbox
  314. >
  315. <label>已上传发票列表</label>
  316. </el-header>
  317. <el-main style="height: 550px; border: groove">
  318. <el-checkbox-group
  319. v-model="checkedInvoice"
  320. @change="handleCheckedInvoiceChange"
  321. >
  322. <el-checkbox
  323. v-for="(item, index) in fileList"
  324. :label="item"
  325. :key="index"
  326. style="width: 100%"
  327. ><label @click="changeInvoice(item)"
  328. ><el-link :underline="false">{{
  329. item.name
  330. }}</el-link></label
  331. ><i
  332. class="el-icon-success"
  333. style="color: green"
  334. v-if="item.ziiCheckStt == '1'"
  335. ></i>
  336. <i
  337. class="el-icon-error"
  338. style="color: red"
  339. v-if="item.ziiCheckStt == '2' || item.ziiCheckStt == '3'"
  340. ></i
  341. ></el-checkbox>
  342. </el-checkbox-group>
  343. </el-main>
  344. <el-button
  345. type="primary"
  346. @click="toCheckAgian()"
  347. style="float: right"
  348. >重新验真</el-button
  349. >
  350. </el-aside>
  351. <el-container>
  352. <el-header height="270px">
  353. <el-image
  354. style="width: 650px; height: 267px"
  355. :src="invoice.url"
  356. fit="scale-down"
  357. @click="invoicePictureCardPreview(invoice)"
  358. ></el-image>
  359. </el-header>
  360. <el-main>
  361. <el-form
  362. ref="invoice"
  363. label-width="auto"
  364. :inline="true"
  365. label-position="top"
  366. >
  367. <el-form-item label="发票代码:">
  368. <el-input
  369. v-model="invoice.ziiNo"
  370. maxlength="20"
  371. />
  372. </el-form-item>
  373. <el-form-item label="发票号码:">
  374. <el-input
  375. v-model="invoice.ziiNumber"
  376. maxlength="20"
  377. />
  378. </el-form-item>
  379. <el-form-item label="开票日期:">
  380. <el-date-picker
  381. v-model="invoice.ziiDate"
  382. value-format="yyyy-MM-dd"
  383. type="date"
  384. placeholder="选择日期"
  385. >
  386. </el-date-picker>
  387. </el-form-item>
  388. <el-form-item label="购货纳税人编号:">
  389. <el-input
  390. v-model="invoice.ziiPurchaserNo"
  391. maxlength="20"
  392. />
  393. </el-form-item>
  394. <el-form-item label="销货纳税人编号:">
  395. <el-input
  396. v-model="invoice.ziiSellerNo"
  397. maxlength="20"
  398. />
  399. </el-form-item>
  400. <el-form-item label="发票金额:">
  401. <el-input
  402. v-model="invoice.ziiTotalAmount"
  403. maxlength="16"
  404. />
  405. </el-form-item>
  406. <el-form-item label="税价金额:">
  407. <el-input
  408. v-model="invoice.ziiAmount"
  409. maxlength="16"
  410. />
  411. </el-form-item>
  412. </el-form>
  413. </el-main>
  414. <el-footer>
  415. <el-button
  416. type="primary"
  417. @click="submitCheck()"
  418. style="float: right"
  419. >确定</el-button
  420. >
  421. </el-footer>
  422. </el-container>
  423. </el-container>
  424. </el-dialog>
  425. </div>
  426. <!-- 合同附件 -->
  427. <div v-if="active == 2">
  428. <el-divider content-position="left">合同附件</el-divider>
  429. <el-form ref="contract" label-width="auto" :inline="true">
  430. <el-form-item style="float: right"
  431. ><el-button type="primary" @click="submitUploadContract()"
  432. >上传</el-button
  433. ></el-form-item
  434. >
  435. </el-form>
  436. <el-upload
  437. :file-list="contractList"
  438. :auto-upload="false"
  439. :http-request="httpRequestContract"
  440. action=""
  441. ref="contractUpload"
  442. list-type="picture-card"
  443. :on-preview="invoicePictureCardPreview"
  444. :before-remove="beforeRemove"
  445. :on-remove="handleRemove">
  446. <i class="el-icon-plus"></i>
  447. </el-upload>
  448. </div>
  449. <!-- 物流附件 -->
  450. <div v-if="active == 3">
  451. <el-divider content-position="left">物流附件</el-divider>
  452. <el-form ref="logistics" label-width="auto" :inline="true">
  453. <el-form-item style="float: right"
  454. ><el-button type="primary" @click="submitUploadLogistics()"
  455. >上传</el-button
  456. ></el-form-item
  457. >
  458. </el-form>
  459. <el-upload
  460. :file-list="logisticsList"
  461. :auto-upload="false"
  462. :http-request="httpRequestLogistics"
  463. action=""
  464. ref="logisticsUpload"
  465. list-type="picture-card"
  466. :on-preview="invoicePictureCardPreview"
  467. :before-remove="beforeRemove"
  468. :on-remove="handleRemove">
  469. <i class="el-icon-plus"></i>
  470. </el-upload>
  471. </div>
  472. <!-- 其他附件 -->
  473. <div v-if="active == 4">
  474. <el-divider content-position="left">其他附件</el-divider>
  475. <el-form ref="other" label-width="auto" :inline="true">
  476. <el-form-item style="float: right"
  477. ><el-button type="primary" @click="submitUploadOther()"
  478. >上传</el-button
  479. ></el-form-item
  480. >
  481. </el-form>
  482. <el-upload
  483. :file-list="otherList"
  484. :auto-upload="false"
  485. :http-request="httpRequestOther"
  486. action=""
  487. ref="otherUpload"
  488. list-type="picture-card"
  489. :on-preview="invoicePictureCardPreview"
  490. :before-remove="beforeRemove"
  491. :on-remove="handleRemove">
  492. <i class="el-icon-plus"></i>
  493. </el-upload>
  494. </div>
  495. </el-main>
  496. </el-container>
  497. </el-container>
  498. <!-- 查看图片 -->
  499. <el-dialog :visible.sync="invoiceVisible">
  500. <img width="100%" :src="invoiceImageUrl" alt="" />
  501. </el-dialog>
  502. <div style="text-align: center">
  503. <el-button type="primary" @click="back()" v-if="active != 0"
  504. >上一步</el-button
  505. >
  506. <el-button type="primary" @click="next()" v-if="active != 4"
  507. v-loading.fullscreen.lock="fullscreenLoading"
  508. >下一步</el-button
  509. >
  510. <el-button type="primary" @click="submit()" v-if="active == 4"
  511. >提交</el-button
  512. >
  513. </div>
  514. </div>
  515. </template>
  516. <script>
  517. import {
  518. getBill,
  519. getInvoice,
  520. addBill,
  521. getInvoiceText,
  522. invoiceVerification,
  523. delInvoice,
  524. uploadBillFile,
  525. getFile,
  526. delFile,
  527. commitBill
  528. } from "@/api/service/bill/bill";
  529. import {
  530. getOwnCompany,
  531. companyRelList
  532. } from "@/api/common/company";
  533. import { amtformat } from "@/utils/amtCommon"
  534. import { getToken } from "@/utils/auth";
  535. export default {
  536. name: "BillEdit",
  537. components: {},
  538. data() {
  539. return {
  540. // 选中数组
  541. ids: [],
  542. // 非单个禁用
  543. single: true,
  544. // 非多个禁用
  545. multiple: true,
  546. // 是否显示弹出层
  547. open: false,
  548. uploadOpen: false,
  549. // 查询参数
  550. queryParams: {},
  551. // 表单参数
  552. form: {
  553. },
  554. // 表单校验
  555. rules: {
  556. zbiName: [
  557. {
  558. required: true,
  559. message: "账款名称不能为空",
  560. trigger: ["blur", "change"],
  561. },
  562. ],
  563. zbiPayerId: [
  564. {
  565. required: true,
  566. message: "应付方不能为空",
  567. trigger: ["blur", "change"],
  568. },
  569. ],
  570. zbiDate: [
  571. {
  572. required: true,
  573. message: "贸易日期不能为空",
  574. trigger: ["blur", "change"],
  575. },
  576. ],
  577. zbiPayDate: [
  578. {
  579. required: true,
  580. message: "预计收/付款日期不能为空",
  581. trigger: ["blur", "change"],
  582. },
  583. ],
  584. zbiPayeeId: [
  585. {
  586. required: true,
  587. message: "应收方不能为空",
  588. trigger: ["blur", "change"],
  589. },
  590. ],
  591. zbiAmount: [
  592. {
  593. required: true,
  594. message: "贸易金额不能为空",
  595. trigger: ["blur", "change"],
  596. },
  597. {
  598. pattern: /^(?:0|[1-9]\d{0,13})(?:\.\d{1,2})?$/,
  599. message: "请输入正确的金额",
  600. trigger: ["blur", "change"],
  601. },
  602. ],
  603. zbiContractNo: [
  604. {
  605. required: true,
  606. message: "合同编号不能为空",
  607. trigger: ["blur", "change"],
  608. },
  609. ],
  610. },
  611. //进度
  612. active: 0,
  613. //类型
  614. type: "00",
  615. //合同附件
  616. contractList: [],
  617. //物流附件
  618. logisticsList: [],
  619. //其他附件
  620. otherList: [],
  621. //发票列表
  622. fileList: [],
  623. //全选状态
  624. checkAll: false,
  625. //全选状态
  626. isIndeterminate: false,
  627. //选中值
  628. checkedInvoice: [],
  629. //发票对象
  630. invoice: {},
  631. //合计金额
  632. totalPrice: 0,
  633. //验证结果
  634. checkSttOptions: [],
  635. //图片路径
  636. invoiceImageUrl: null,
  637. //图片显示
  638. invoiceVisible: false,
  639. //等待框
  640. fullscreenLoading: false,
  641. //链属企业
  642. companyRelList:[],
  643. //链属企业
  644. company:{},
  645. };
  646. },
  647. created() {
  648. //进度
  649. this.active = 0;
  650. const zbiId = this.$route.params && this.$route.params.zbiId;
  651. this.fullscreenLoading = true
  652. getOwnCompany().then((response) => {
  653. console.log(response);
  654. this.company = response.data;
  655. });
  656. this.getCompanyRel()
  657. this.getDetail(zbiId)
  658. this.getDicts("zc_invoice_checkStt").then((response) => {
  659. this.checkSttOptions = response.data;
  660. });
  661. },
  662. activated() {},
  663. methods: {
  664. //查询往来账款详情
  665. getDetail(zbiId){
  666. getBill(zbiId).then((response) => {
  667. console.log(response);
  668. this.form = response.data;
  669. if(this.form.zbiPayerId == this.company.scyId){
  670. this.type = "00"
  671. }else{
  672. this.type = "01"
  673. }
  674. this.fullscreenLoading = false
  675. });
  676. },
  677. //切换账款类型
  678. changePayer(val){
  679. console.log(val);
  680. if(val == '00'){
  681. this.form.zbiPayerId = this.company.scyId
  682. this.form.zbiPayeeId = null
  683. }else if(val == '01'){
  684. this.form.zbiPayerId = null
  685. this.form.zbiPayeeId = this.company.scyId
  686. }
  687. },
  688. //查询链属企业
  689. getCompanyRel(val){
  690. this.queryParams.companyName = val
  691. companyRelList(this.queryParams).then((response) => {
  692. console.log(response);
  693. this.companyRelList = response.data;
  694. });
  695. },
  696. //全选
  697. handleCheckAllChange(val) {
  698. this.checkedInvoice = val ? this.fileList : [];
  699. this.isIndeterminate = false;
  700. },
  701. //全选状态
  702. handleCheckedInvoiceChange(value) {
  703. let checkedCount = value.length;
  704. this.checkAll = checkedCount === this.fileList.length;
  705. this.isIndeterminate =
  706. checkedCount > 0 && checkedCount < this.fileList.length;
  707. },
  708. // 多选框选中数据
  709. handleInvoiceSelectionChange(selection) {
  710. this.ids = selection.map((item) => item.ziiId);
  711. this.single = selection.length !== 1;
  712. this.multiple = !selection.length;
  713. },
  714. //发票上传窗口
  715. openUpload() {
  716. this.uploadOpen = true;
  717. },
  718. //上传
  719. submitUpload() {
  720. this.$refs.upload.submit();
  721. },
  722. //去验真
  723. toCheck() {
  724. this.uploadOpen = false;
  725. this.open = true;
  726. this.fullscreenLoading = true
  727. let fd = new FormData(); // FormData 对象
  728. fd.append("fileList", JSON.stringify(this.fileList)); // 文件对象
  729. invoiceVerification(fd).then((response) => {
  730. response.forEach((element) => {
  731. this.fileList.forEach((file) => {
  732. if (element.ziiId == file.ziiId) {
  733. file.ziiCheckStt = element.ziiCheckStt;
  734. }
  735. });
  736. });
  737. this.invoice = response[0] ? response[0] : {};
  738. this.fullscreenLoading = false
  739. }).catch(() => {
  740. this.fullscreenLoading = false
  741. });
  742. },
  743. //重新验真
  744. toCheckAgian() {
  745. this.fullscreenLoading = true
  746. let fd = new FormData(); // FormData 对象
  747. fd.append("fileList", JSON.stringify(this.checkedInvoice)); // 文件对象
  748. invoiceVerification(fd).then((response) => {
  749. response.forEach((element) => {
  750. this.fileList.forEach((file) => {
  751. if (element.ziiId == file.ziiId) {
  752. file.ziiCheckStt = element.ziiCheckStt;
  753. }
  754. });
  755. });
  756. this.fullscreenLoading = false
  757. }).catch(() => {
  758. this.fullscreenLoading = false
  759. });
  760. },
  761. //切换发票
  762. changeInvoice(item) {
  763. this.invoice = item;
  764. },
  765. //手动上传发票触发
  766. httpRequest(param) {
  767. this.fullscreenLoading = true
  768. let fileObj = param.file; // 相当于input里取得的files
  769. console.log(param);
  770. let fd = new FormData(); // FormData 对象
  771. fd.append("file", fileObj); // 文件对象
  772. fd.append("zbiId", this.form.zbiId); //文件类型
  773. getInvoiceText(fd).then((response) => {
  774. response.url = response.url + "/" + getToken()
  775. this.fileList.push(response.data);
  776. this.fullscreenLoading = false
  777. }).catch(() => {
  778. this.fullscreenLoading = false
  779. });
  780. },
  781. //上传合同
  782. submitUploadContract() {
  783. this.$refs.contractUpload.submit();
  784. },
  785. //上传物流
  786. submitUploadLogistics() {
  787. this.$refs.logisticsUpload.submit();
  788. },
  789. //上传其他
  790. submitUploadOther() {
  791. this.$refs.otherUpload.submit();
  792. },
  793. //手动上传合同触发
  794. httpRequestContract(param) {
  795. this.fullscreenLoading = true
  796. let fileObj = param.file; // 相当于input里取得的files
  797. console.log(param);
  798. let fd = new FormData(); // FormData 对象
  799. fd.append("file", fileObj); // 文件对象
  800. fd.append("zbiId", this.form.zbiId); //文件类型
  801. fd.append("type", "0"); //文件类型
  802. uploadBillFile(fd).then((response) => {
  803. response.url = response.url + "/" + getToken()
  804. this.contractList.push(response.data);
  805. this.fullscreenLoading = false
  806. }).catch(() => {
  807. this.fullscreenLoading = false
  808. });
  809. },
  810. //手动上传物流触发
  811. httpRequestLogistics(param) {
  812. this.fullscreenLoading = true
  813. let fileObj = param.file; // 相当于input里取得的files
  814. console.log(param);
  815. let fd = new FormData(); // FormData 对象
  816. fd.append("file", fileObj); // 文件对象
  817. fd.append("zbiId", this.form.zbiId); //文件类型
  818. fd.append("type", "1"); //文件类型
  819. uploadBillFile(fd).then((response) => {
  820. response.url = response.url + "/" + getToken()
  821. this.logisticsList.push(response.data);
  822. this.fullscreenLoading = false
  823. }).catch(() => {
  824. this.fullscreenLoading = false
  825. });
  826. },
  827. //手动上传其他触发
  828. httpRequestOther(param) {
  829. this.fullscreenLoading = true
  830. let fileObj = param.file; // 相当于input里取得的files
  831. console.log(param);
  832. let fd = new FormData(); // FormData 对象
  833. fd.append("file", fileObj); // 文件对象
  834. fd.append("zbiId", this.form.zbiId); //文件类型
  835. fd.append("type", "2"); //文件类型
  836. uploadBillFile(fd).then((response) => {
  837. response.url = response.url + "/" + getToken()
  838. this.otherList.push(response.data);
  839. this.fullscreenLoading = false
  840. }).catch(() => {
  841. this.fullscreenLoading = false
  842. });
  843. },
  844. //删除图片
  845. beforeRemove(file, fileList) {
  846. console.log(file)
  847. let a = true;
  848. if (file && file.status==="success") {
  849. a = this.$confirm(`确定移除 ${ file.name }?`);
  850. }
  851. return a;
  852. },
  853. //删除合同附件
  854. handleRemove(file, fileList) {
  855. console.log(fileList);
  856. if(this.active == 2){
  857. if (this.contractList) {
  858. this.contractList = this.contractList.filter((item) =>{
  859. if(item.uid !== file.uid){
  860. return item
  861. }else{
  862. this.delFile(item)
  863. }
  864. });
  865. }
  866. // console.log(this.contractList);
  867. } else if(this.active == 3) {
  868. if (this.logisticsList) {
  869. this.logisticsList = this.logisticsList.filter((item) =>{
  870. if(item.uid !== file.uid){
  871. return item
  872. }else{
  873. this.delFile(item)
  874. }
  875. });
  876. }
  877. } else if(this.active == 4) {
  878. if (this.otherList) {
  879. this.otherList = this.otherList.filter((item) =>{
  880. if(item.uid !== file.uid){
  881. return item
  882. }else{
  883. this.delFile(item)
  884. }
  885. });
  886. }
  887. }
  888. },
  889. //删除附件
  890. delFile(row){
  891. var self = this;
  892. const ids = row.id || this.ids;
  893. self.fullscreenLoading = true;
  894. delFile(ids).then(function() {
  895. self.fullscreenLoading = false;
  896. })
  897. },
  898. //查看图片
  899. invoicePictureCardPreview(file) {
  900. console.log(file)
  901. this.invoiceImageUrl = file.url;
  902. this.invoiceVisible = true;
  903. },
  904. //删除发票
  905. invoiceRemove(file, fileList) {
  906. var self = this;
  907. if (file && file.status==="success") {
  908. this.fileList = this.fileList.filter((item) =>{
  909. if(item.uid !== file.uid){
  910. return item
  911. }else{
  912. self.fullscreenLoading = true;
  913. delInvoice(item.ziiId).then(function() {
  914. self.fullscreenLoading = false;
  915. this.msgSuccess("删除成功");
  916. }).catch(() => {
  917. self.fullscreenLoading = false
  918. });
  919. }
  920. });
  921. }
  922. console.log(this.fileList);
  923. },
  924. //删除发票
  925. delInvoice(row){
  926. var self = this
  927. console.log(this.ids)
  928. const ziiIds = row.ziiId || this.ids;
  929. this.$confirm("是否确认删除此数据项?", "警告", {
  930. confirmButtonText: "确定",
  931. cancelButtonText: "取消",
  932. type: "warning"
  933. })
  934. .then(function() {
  935. self.fullscreenLoading = true;
  936. return delInvoice(ziiIds);
  937. })
  938. .then(() => {
  939. this.getInvoiceList();
  940. this.msgSuccess("删除成功");
  941. });
  942. },
  943. //确认发票
  944. submitCheck() {
  945. this.open = false;
  946. },
  947. //发票合计
  948. allAmount() {
  949. var strarr = [0.00];
  950. for (let i in this.fileList) {
  951. strarr.push(this.fileList[i]["ziiAmount"]);
  952. }
  953. return Math.floor(eval(strarr.join("+")) * 100) / 100; //结果
  954. // return this.handleInput(eval(strarr.join("+"))); //结果
  955. },
  956. // 取消按钮
  957. cancel() {},
  958. // 下一步
  959. next() {
  960. this.fullscreenLoading = true
  961. if (this.active == 0) {
  962. this.$refs["form"].validate((valid) => {
  963. if (valid) {
  964. addBill(this.form)
  965. .then((response) => {
  966. this.form.zbiId = response.data.zbiId;
  967. this.getInvoiceList();
  968. this.active++;
  969. })
  970. .catch((res) => {
  971. this.fullscreenLoading = false
  972. return false;
  973. });
  974. } else {
  975. this.fullscreenLoading = false
  976. return false;
  977. }
  978. });
  979. } else if(this.active == 1) {
  980. //查询合同
  981. getFile("0",this.form.zbiId).then((response) => {
  982. response.data.forEach(element => {
  983. element.url = element.url + "/" + getToken()
  984. });
  985. this.contractList = response.data;
  986. this.fullscreenLoading = false
  987. }).catch(() => {
  988. this.fullscreenLoading = false
  989. })
  990. this.active++;
  991. } else if(this.active == 2) {
  992. //查询物流
  993. getFile("1",this.form.zbiId).then((response) => {
  994. response.data.forEach(element => {
  995. element.url = element.url + "/" + getToken()
  996. });
  997. this.logisticsList = response.data;
  998. this.fullscreenLoading = false
  999. }).catch(() => {
  1000. this.fullscreenLoading = false
  1001. })
  1002. this.active++;
  1003. } else if(this.active == 3) {
  1004. //查询其他附件
  1005. getFile("2",this.form.zbiId).then((response) => {
  1006. response.data.forEach(element => {
  1007. element.url = element.url + "/" + getToken()
  1008. });
  1009. this.otherList = response.data;
  1010. this.fullscreenLoading = false
  1011. }).catch(() => {
  1012. this.fullscreenLoading = false
  1013. })
  1014. this.active++;
  1015. } else {
  1016. this.fullscreenLoading = false
  1017. this.active++;
  1018. }
  1019. },
  1020. //查询合同
  1021. getInvoiceList(){
  1022. getInvoice(this.form.zbiId).then((response) => {
  1023. response.data.forEach(element => {
  1024. element.url = element.url + "/" + getToken()
  1025. });
  1026. this.fileList = response.data;
  1027. this.fullscreenLoading = false
  1028. }).catch(() => {
  1029. this.fullscreenLoading = false
  1030. });
  1031. },
  1032. // 上一步
  1033. back() {
  1034. this.active--;
  1035. },
  1036. // 结束
  1037. submit() {
  1038. commitBill(this.form.zbiId).then((response) => {
  1039. this.msgSuccess("保存成功");
  1040. this.$store.dispatch("tagsView/delView", this.$route);
  1041. this.$router.go(-1);
  1042. });
  1043. },
  1044. //校验结果字典
  1045. checkSttFormat(row, column) {
  1046. return this.selectDictLabel(this.checkSttOptions, row.ziiCheckStt);
  1047. },
  1048. /* 金额展示 */
  1049. handleInput(str) {
  1050. return amtformat(str,2, ".", ",");
  1051. },
  1052. /* // 将数字金额转换为大写金额 */
  1053. smallToBig(money) {
  1054. // 将数字金额转换为大写金额
  1055. var cnNums = new Array(
  1056. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" ); //汉字的数字
  1057. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  1058. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  1059. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  1060. var cnInteger = "整"; //整数金额时后面跟的字符
  1061. var cnIntLast = "元"; //整数完以后的单位
  1062. //最大处理的数字
  1063. var maxNum = 999999999999999.9999;
  1064. var integerNum; //金额整数部分
  1065. var decimalNum; //金额小数部分
  1066. //输出的中文金额字符串
  1067. var chineseStr = "";
  1068. var parts; //分离金额后用的数组,预定义
  1069. if (money == "" || money == null || money == undefined) {
  1070. return "零元零角零分";
  1071. }
  1072. money = parseFloat(money);
  1073. if (money >= maxNum) {
  1074. //超出最大处理数字
  1075. return "超出最大处理数字";
  1076. }
  1077. if (money == 0) {
  1078. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  1079. return chineseStr;
  1080. }
  1081. //四舍五入保留两位小数,转换为字符串
  1082. money = Math.round(money * 100).toString();
  1083. integerNum = money.substr(0, money.length - 2);
  1084. decimalNum = money.substr(money.length - 2);
  1085. //获取整型部分转换
  1086. if (parseInt(integerNum, 10) > 0) {
  1087. var zeroCount = 0;
  1088. var IntLen = integerNum.length;
  1089. for (var i = 0; i < IntLen; i++) {
  1090. var n = integerNum.substr(i, 1);
  1091. var p = IntLen - i - 1;
  1092. var q = p / 4;
  1093. var m = p % 4;
  1094. if (n == "0") {
  1095. zeroCount++;
  1096. } else {
  1097. if (zeroCount > 0) {
  1098. chineseStr += cnNums[0];
  1099. }
  1100. //归零
  1101. zeroCount = 0;
  1102. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  1103. }
  1104. if (m == 0 && zeroCount < 4) {
  1105. chineseStr += cnIntUnits[q];
  1106. }
  1107. }
  1108. chineseStr += cnIntLast;
  1109. }
  1110. //小数部分
  1111. if (decimalNum != "") {
  1112. var decLen = decimalNum.length;
  1113. for (var i = 0; i < decLen; i++) {
  1114. var n = decimalNum.substr(i, 1);
  1115. if (n != "0") {
  1116. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  1117. }
  1118. }
  1119. }
  1120. if (chineseStr == "") {
  1121. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  1122. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  1123. chineseStr += cnInteger;
  1124. }
  1125. return chineseStr;
  1126. },
  1127. },
  1128. };
  1129. </script>