billDetail.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <div class="app-container zap-main">
  3. <header-bar :list="headerList"></header-bar>
  4. <el-row class="zap-margin-top">
  5. <el-row class="zap-form">
  6. <el-form ref="form" :model="form" label-width="auto" :disabled="true">
  7. <el-col :span="12">
  8. <div style="width: 420px;">
  9. <el-form-item label="账款类型" prop="wplIsInput" size="large">
  10. <el-radio-group v-model="type" prop="type">
  11. <el-radio-button label="00" v-if="type == '00'">应付账款</el-radio-button>
  12. <el-radio-button label="01" v-if="type == '01'">应收账款</el-radio-button>
  13. </el-radio-group>
  14. </el-form-item>
  15. </div>
  16. </el-col>
  17. <el-col :span="12">
  18. <div style="width: 420px;">
  19. <el-form-item label="账款名称" prop="zbiName" size="large">
  20. <el-input v-model="form.zbiName" maxlength="20" />
  21. </el-form-item>
  22. </div>
  23. </el-col>
  24. <el-col :span="12">
  25. <div style="width: 420px;">
  26. <el-form-item label="应付方" prop="zbiPayerId" size="large">
  27. <el-input v-model="form.payerName" maxlength="20" />
  28. </el-form-item>
  29. </div>
  30. </el-col>
  31. <el-col :span="12">
  32. <div style="width: 420px;">
  33. <el-form-item label="应收方" prop="zbiPayeeId" size="large">
  34. <el-input v-model="form.payeeName" maxlength="20" />
  35. </el-form-item>
  36. </div>
  37. </el-col>
  38. <el-col :span="12">
  39. <div style="width: 420px;">
  40. <el-form-item label="贸易日期" prop="zbiDate" size="large">
  41. <el-date-picker v-model="form.zbiDate" value-format="yyyy-MM-dd" type="date">
  42. </el-date-picker>
  43. </el-form-item>
  44. </div>
  45. </el-col>
  46. <el-col :span="12">
  47. <div style="width: 420px;">
  48. <el-form-item :label="
  49. type == '00'
  50. ? '预计付款日期'
  51. : type == '01'
  52. ? '预计收款日期'
  53. : '预计收/付款日期'
  54. " prop="zbiPayDate" size="large">
  55. <el-date-picker v-model="form.zbiPayDate" value-format="yyyy-MM-dd" type="date">
  56. </el-date-picker>
  57. </el-form-item>
  58. </div>
  59. </el-col>
  60. <el-col :span="12">
  61. <div style="width: 420px;">
  62. <el-form-item label="账款金额" prop="zbiAmount" size="large">
  63. <el-input v-model="form.zbiAmount" maxlength="20">
  64. <template slot="append">元</template>
  65. </el-input>
  66. </el-form-item>
  67. </div>
  68. </el-col>
  69. <el-col :span="12">
  70. <div style="width: 420px;">
  71. <el-form-item label="账款金额大写" size="large">
  72. <el-input :disabled="true" :value="smallToBig(form.zbiAmount)">
  73. </el-input>
  74. </el-form-item>
  75. </div>
  76. </el-col>
  77. <el-col :span="12">
  78. <div style="width: 420px;">
  79. <el-form-item label="贸易合同编号" prop="zbiContractNo" size="large">
  80. <el-input v-model="form.zbiContractNo" maxlength="20" />
  81. </el-form-item>
  82. </div>
  83. </el-col>
  84. <el-col :span="12">
  85. <div style="width: 420px;">
  86. <el-form-item label="贸易商品/服务" size="large">
  87. <el-input v-model="form.zbiService" maxlength="20" />
  88. </el-form-item>
  89. </div>
  90. </el-col>
  91. <el-col :span="12">
  92. <div style="width: 420px;">
  93. <el-form-item label="配送企业" size="large">
  94. <el-input v-model="form.zbiDistributor" maxlength="20" />
  95. </el-form-item>
  96. </div>
  97. </el-col>
  98. <el-col :span="12">
  99. <div style="width: 420px;">
  100. <el-form-item label="配送订单号" size="large">
  101. <el-input v-model="form.zbiOrderNo" maxlength="20" />
  102. </el-form-item>
  103. </div>
  104. </el-col>
  105. <el-col :span="24">
  106. <el-form-item label="备注" size="large">
  107. <el-input v-model="form.zbiRemark" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="100" type="textarea" />
  108. </el-form-item>
  109. </el-col>
  110. </el-form>
  111. </el-row>
  112. </el-row>
  113. <el-row class="zap-margin-top">
  114. <div class="zap-form" style="padding-bottom: 67px;">
  115. <content-title title="发票列表" desc="请填写贸易相关的发票列表"></content-title>
  116. <content-total :amount="handleInput(allAmount())" :words="smallToBig(allAmount())"></content-total>
  117. <el-table :data="fileList" row-key="ziiId" default-expand-all :row-class-name="tableRowClassName" stripe="">
  118. <el-table-column type="index" width="50" align="center" />
  119. <el-table-column label="发票代码" align="center" prop="ziiNo" maxlength="10" />
  120. <el-table-column label="发票号码" align="center" prop="ziiNumber" maxlength="10" />
  121. <el-table-column label="开票日期" align="center" prop="ziiDate" />
  122. <el-table-column label="购方识别号" align="center" prop="ziiPurchaserNo" />
  123. <el-table-column label="销方识别号" align="center" prop="ziiSellerNo" />
  124. <el-table-column label="合计金额" align="center" prop="ziiTotalAmount" />
  125. <el-table-column label="价税合计" align="center" prop="ziiAmount" />
  126. <el-table-column label="校验结果" align="center" prop="ziiCheckStt" :formatter="checkSttFormat" />
  127. <el-table-column label="附件" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
  128. <template slot-scope="scope">
  129. <el-button class="zap-button-plain" size="mini" @click="invoicePictureCardPreview(scope.row)">详情</el-button>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. </div>
  134. </el-row>
  135. <el-row class="zap-margin-top">
  136. <div class="zap-form pt20">
  137. <content-title title="贸易合同">
  138. <el-button class="WIDTH64" type="success">上传</el-button>
  139. </content-title>
  140. <el-upload class="mt20" :disabled="true" :file-list="contractList" :auto-upload="false" action="" ref="contractUpload" list-type="picture-card" :on-preview="invoicePictureCardPreview">
  141. </el-upload>
  142. </div>
  143. </el-row>
  144. <el-row class="zap-margin-top">
  145. <div class="zap-form pt20">
  146. <content-title title="物流附件">
  147. <el-button class="WIDTH64" type="success">上传</el-button>
  148. </content-title>
  149. <el-upload class="mt20" :disabled="true" :file-list="logisticsList" :auto-upload="false" action="" ref="logisticsUpload" list-type="picture-card" :on-preview="invoicePictureCardPreview">
  150. </el-upload>
  151. </div>
  152. </el-row>
  153. <el-row class="zap-margin-top">
  154. <div class="zap-form" style="pt20">
  155. <content-title title="其他附件">
  156. <el-button class="WIDTH64" type="success">上传</el-button>
  157. </content-title>
  158. <el-upload class="mt20" :disabled="true" :file-list="otherList" :auto-upload="false" action="" ref="otherUpload" list-type="picture-card" :on-preview="invoicePictureCardPreview">
  159. </el-upload>
  160. </div>
  161. </el-row>
  162. <!-- 查看图片 -->
  163. <el-dialog :visible.sync="invoiceVisible">
  164. <img width="100%" :src="invoiceImageUrl" alt="" />
  165. </el-dialog>
  166. <el-row type="flex" justify="center" align="middle" style="height: 82px;">
  167. <el-button plain @click="submit()">取消</el-button>
  168. </el-row>
  169. </div>
  170. </template>
  171. <script>
  172. import {
  173. getBill,
  174. getInvoice,
  175. getFile,
  176. commitBill,
  177. } from "@/api/service/bill/bill";
  178. import {
  179. getOwnCompany,
  180. companyRelList
  181. } from "@/api/common/company";
  182. import {
  183. amtformat
  184. } from "@/utils/amtCommon";
  185. import {
  186. getToken
  187. } from "@/utils/auth";
  188. import HeaderBar from "@/components/HeaderBar/index.vue"
  189. import ContentTitle from "@/components/ContentTitle/index.vue"
  190. import ContentTotal from "@/components/ContentTotal/index.vue"
  191. export default {
  192. name: "billDetail",
  193. components: {
  194. HeaderBar,
  195. ContentTitle,
  196. ContentTotal
  197. },
  198. data() {
  199. return {
  200. // 查询参数
  201. queryParams: {},
  202. // 表单参数
  203. form: {},
  204. //进度
  205. active: 0,
  206. //类型
  207. type: "00",
  208. //贸易合同
  209. contractList: [],
  210. //物流附件
  211. logisticsList: [],
  212. //其他附件
  213. otherList: [],
  214. //发票列表
  215. fileList: [],
  216. //合计金额
  217. totalPrice: 0,
  218. //验证结果
  219. checkSttOptions: [],
  220. //图片路径
  221. invoiceImageUrl: null,
  222. //图片显示
  223. invoiceVisible: false,
  224. //等待框
  225. fullscreenLoading: false,
  226. //链属企业
  227. companyRelList: [],
  228. //链属企业
  229. company: {},
  230. };
  231. },
  232. computed: {
  233. headerList() {
  234. return [{
  235. icon: require('../../../assets/images/components/headerBar/icon_creater.png'),
  236. label: '创建人:',
  237. value: this.form.createUser
  238. },
  239. {
  240. icon: require('../../../assets/images/components/headerBar/icon_calendar.png'),
  241. label: '创建日期:',
  242. value: this.parseTime(new Date(this.form.createTime))
  243. },
  244. {
  245. icon: require('../../../assets/images/components/headerBar/icon_list.png'),
  246. label: '编号:',
  247. value: this.form.zbiNumber
  248. },
  249. ]
  250. }
  251. },
  252. created() {
  253. //进度
  254. this.active = 0;
  255. const zbiId = this.$route.params && this.$route.params.zbiId;
  256. this.fullscreenLoading = true;
  257. getOwnCompany().then((response) => {
  258. this.company = response.data;
  259. });
  260. this.getCompanyRel();
  261. this.getDetail(zbiId);
  262. getInvoice(zbiId).then((response) => {
  263. response.data.forEach((element) => {
  264. element.url = element.url + "/" + getToken();
  265. });
  266. this.fileList = response.data;
  267. this.invoice = this.fileList[0] ? this.fileList[0] : {};
  268. this.ids = [];
  269. });
  270. getFile("0", zbiId).then((response) => {
  271. response.data.forEach((element) => {
  272. element.url = element.url + "/" + getToken();
  273. });
  274. this.contractList = response.data;
  275. });
  276. //查询物流
  277. getFile("1", zbiId).then((response) => {
  278. response.data.forEach((element) => {
  279. element.url = element.url + "/" + getToken();
  280. });
  281. this.logisticsList = response.data;
  282. });
  283. //查询其他附件
  284. getFile("2", zbiId).then((response) => {
  285. response.data.forEach((element) => {
  286. element.url = element.url + "/" + getToken();
  287. });
  288. this.otherList = response.data;
  289. });
  290. this.getDicts("zc_invoice_checkStt").then((response) => {
  291. this.checkSttOptions = response.data;
  292. });
  293. },
  294. activated() {},
  295. methods: {
  296. //查询往来账款详情
  297. getDetail(zbiId) {
  298. const loading = this.$loading({
  299. lock: true,
  300. text: 'Loading',
  301. spinner: 'el-icon-loading',
  302. background: 'rgba(0, 0, 0, 0.7)'
  303. });
  304. getBill(zbiId).then((response) => {
  305. this.form = response.data;
  306. if (this.form.zbiPayerId == this.company.scyId) {
  307. this.type = "00";
  308. } else {
  309. this.type = "01";
  310. }
  311. loading.close();
  312. })
  313. .catch(() => {
  314. loading.close();
  315. });
  316. },
  317. //查询链属企业
  318. getCompanyRel(val) {
  319. this.queryParams.companyName = val;
  320. companyRelList(this.queryParams).then((response) => {
  321. this.companyRelList = response.data;
  322. });
  323. },
  324. //表格置灰
  325. tableRowClassName({
  326. row,
  327. rowIndex
  328. }) {
  329. if (row.ziiCheckStt != "1") {
  330. return "warning-row";
  331. }
  332. return "";
  333. },
  334. //查看图片
  335. invoicePictureCardPreview(file) {
  336. this.invoiceImageUrl = file.url;
  337. this.invoiceVisible = true;
  338. },
  339. //发票合计
  340. allAmount() {
  341. var strarr = [0.00];
  342. for (let i in this.fileList) {
  343. if (this.fileList[i]["ziiCheckStt"] == "1") {
  344. strarr.push(this.fileList[i]["ziiAmount"]);
  345. }
  346. }
  347. return (Math.round(eval(strarr.join("+")) * 100) / 100); //结果
  348. // return this.handleInput(eval(strarr.join("+"))); //结果
  349. },
  350. // 结束
  351. submit() {
  352. this.$store.dispatch("tagsView/delView", this.$route);
  353. this.$router.go(-1);
  354. },
  355. //校验结果字典
  356. checkSttFormat(row, column) {
  357. return this.selectDictLabel(this.checkSttOptions, row.ziiCheckStt);
  358. },
  359. /* 金额展示 */
  360. handleInput(str) {
  361. return amtformat(str, 2, ".", ",");
  362. },
  363. /* // 将数字金额转换为大写金额 */
  364. smallToBig(money) {
  365. // 将数字金额转换为大写金额
  366. var cnNums = new Array(
  367. "零",
  368. "壹",
  369. "贰",
  370. "叁",
  371. "肆",
  372. "伍",
  373. "陆",
  374. "柒",
  375. "捌",
  376. "玖"
  377. ); //汉字的数字
  378. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  379. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  380. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  381. var cnInteger = "整"; //整数金额时后面跟的字符
  382. var cnIntLast = "元"; //整数完以后的单位
  383. //最大处理的数字
  384. var maxNum = 999999999999999.9999;
  385. var integerNum; //金额整数部分
  386. var decimalNum; //金额小数部分
  387. //输出的中文金额字符串
  388. var chineseStr = "";
  389. var parts; //分离金额后用的数组,预定义
  390. if (money == "" || money == null || money == undefined) {
  391. return "零元零角零分";
  392. }
  393. money = parseFloat(money);
  394. if (money >= maxNum) {
  395. //超出最大处理数字
  396. return "超出最大处理数字";
  397. }
  398. if (money == 0) {
  399. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  400. return chineseStr;
  401. }
  402. //四舍五入保留两位小数,转换为字符串
  403. money = Math.round(money * 100).toString();
  404. integerNum = money.substr(0, money.length - 2);
  405. decimalNum = money.substr(money.length - 2);
  406. //获取整型部分转换
  407. if (parseInt(integerNum, 10) > 0) {
  408. var zeroCount = 0;
  409. var IntLen = integerNum.length;
  410. for (var i = 0; i < IntLen; i++) {
  411. var n = integerNum.substr(i, 1);
  412. var p = IntLen - i - 1;
  413. var q = p / 4;
  414. var m = p % 4;
  415. if (n == "0") {
  416. zeroCount++;
  417. } else {
  418. if (zeroCount > 0) {
  419. chineseStr += cnNums[0];
  420. }
  421. //归零
  422. zeroCount = 0;
  423. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  424. }
  425. if (m == 0 && zeroCount < 4) {
  426. chineseStr += cnIntUnits[q];
  427. }
  428. }
  429. chineseStr += cnIntLast;
  430. }
  431. //小数部分
  432. if (decimalNum != "") {
  433. var decLen = decimalNum.length;
  434. for (var i = 0; i < decLen; i++) {
  435. var n = decimalNum.substr(i, 1);
  436. if (n != "0") {
  437. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  438. }
  439. }
  440. }
  441. if (chineseStr == "") {
  442. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  443. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  444. chineseStr += cnInteger;
  445. }
  446. return chineseStr;
  447. },
  448. },
  449. };
  450. </script>
  451. <style>
  452. .el-table .warning-row {
  453. background: rgb(223, 223, 223);
  454. }
  455. </style><style lang="scss" scoped>
  456. ::v-deep .el-radio-button__inner {
  457. display: flex;
  458. align-items: center;
  459. justify-content: center;
  460. width: 100px;
  461. height: 35px;
  462. padding: 0;
  463. border: 1px solid #e0e0e0;
  464. }
  465. ::v-deep .el-radio-button:first-child .el-radio-button__inner {
  466. margin-right: 20px;
  467. border-radius: 17px;
  468. }
  469. ::v-deep .el-radio-button:last-child .el-radio-button__inner {
  470. border-radius: 17px;
  471. }
  472. ::v-deep .el-radio-button__orig-radio:checked+.el-radio-button__inner {
  473. color: #4280f2;
  474. background: #ecf2fe;
  475. border-color: #b3ccfa;
  476. box-shadow: none;
  477. }
  478. .zap-form {
  479. padding: 20px;
  480. background-color: #ffffff;
  481. }
  482. .zap-table ::v-deep .el-form-item__content {
  483. width: 100%;
  484. }
  485. .zap-contract-add__upload {
  486. display: flex;
  487. flex-direction: column;
  488. justify-content: center;
  489. align-items: center;
  490. width: 148px;
  491. height: 148px;
  492. border: dashed 1px #e0e0e0;
  493. background-color: #f4f5f6;
  494. }
  495. ::v-deep .el-upload--picture-card {
  496. border: none;
  497. }
  498. ::v-deep .el-icon-upload {
  499. font-size: 32px;
  500. color: #02c464;
  501. }
  502. .zap-upload__text {
  503. line-height: 1;
  504. margin-top: 12px;
  505. font-size: 12px;
  506. color: #333333;
  507. }
  508. .zap-contract-add__tip {
  509. width: 140px;
  510. margin-top: 15px;
  511. line-height: 19px;
  512. font-size: 12px;
  513. color: #999999;
  514. }
  515. // 设置缩略图模版。
  516. .zap-contract-add__thumbnail {
  517. position: relative;
  518. width: 140px;
  519. height: 140px;
  520. cursor: pointer;
  521. }
  522. .zap-contract-add__thumbnail {
  523. display: flex;
  524. flex-direction: column;
  525. align-items: center;
  526. justify-content: center;
  527. }
  528. .zap-contract-add__fileimg {
  529. width: 56px;
  530. }
  531. .zap-contractadd__filename {
  532. margin-top: 12px;
  533. line-height: 19px;
  534. font-size: 14px;
  535. color: #333333;
  536. overflow: hidden; // 超出的文本隐藏
  537. text-overflow: ellipsis; // 溢出用省略号显示
  538. display: -webkit-box; // 将对象作为弹性伸缩盒子模型显示。
  539. -webkit-line-clamp: 2; // 这个属性不是css的规范属性,需要组合上面两个属性,表示显示的行数。
  540. -webkit-box-orient: vertical; // 从上到下垂直排列子元素(设置伸缩盒子的子元素排列方式)
  541. }
  542. .zap-contract-add__delete {
  543. position: absolute;
  544. top: 0;
  545. right: 10px;
  546. }
  547. ::v-deep .el-icon-error {
  548. font-size: 26px;
  549. color: #f41d27;
  550. }
  551. .zap-contract-add__buttons {
  552. padding: 30px;
  553. text-align: center;
  554. }
  555. .el-date-editor.el-input,
  556. .el-date-editor.el-input__inner {
  557. width: 100%;
  558. }
  559. ::v-deep .el-textarea.is-disabled .el-textarea__inner {
  560. height: 80px !important;
  561. border-color: transparent;
  562. background-color: #F4F5F6;
  563. }
  564. </style>