billEdit.vue 41 KB

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