invoice-show.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <script setup lang="ts">
  2. import { reactive, ref } from "vue";
  3. import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
  4. interface Buyer {
  5. title?: string;
  6. apis?: string;
  7. columns?: any;
  8. notReuqiredInit?: boolean;
  9. notPagination?: boolean;
  10. statusProp?: string;
  11. deleteProp?: string;
  12. isTree?: boolean;
  13. }
  14. interface Seller {
  15. title?: string;
  16. apis?: string;
  17. columns?: any;
  18. notReuqiredInit?: boolean;
  19. notPagination?: boolean;
  20. statusProp?: string;
  21. deleteProp?: string;
  22. isTree?: boolean;
  23. }
  24. interface invoiceConfig {
  25. title?: string;
  26. apis?: string;
  27. columns?: any;
  28. notReuqiredInit?: boolean;
  29. notPagination?: boolean;
  30. statusProp?: string;
  31. deleteProp?: string;
  32. isTree?: boolean;
  33. }
  34. const BuyerItem = reactive<Record<string, any>>({
  35. title: ""
  36. });
  37. const SellerItem = reactive<Record<string, any>>({
  38. title: ""
  39. });
  40. const configItem = reactive<Record<string, any>>({
  41. title: ""
  42. });
  43. const orderList = ref([]);
  44. const showHeader = ref(false);
  45. function show(
  46. Buyer: Buyer,
  47. Seller: Seller,
  48. order: object[],
  49. invoiceConfig: invoiceConfig
  50. ) {
  51. Object.keys(BuyerItem.value).forEach(key => {
  52. BuyerItem.value[key] = Buyer[key] ?? "";
  53. });
  54. Object.keys(SellerItem.value).forEach(key => {
  55. SellerItem.value[key] = Seller[key] ?? "";
  56. });
  57. Object.keys(configItem.value).forEach(key => {
  58. configItem.value[key] = invoiceConfig[key] ?? "";
  59. });
  60. orderList.value = [];
  61. orderList.value.push(...order);
  62. }
  63. function money(n) {
  64. if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) {
  65. return "";
  66. }
  67. let unit = "仟佰拾亿仟佰拾万仟佰拾圆角分",
  68. str = "";
  69. n += "00";
  70. let p = n.indexOf(".");
  71. if (p >= 0) n = n.substring(0, p) + n.substr(p + 1, 2);
  72. unit = unit.substr(unit.length - n.length);
  73. for (let i = 0; i < n.length; i++)
  74. str += "零壹贰叁肆伍陆柒捌玖".charAt(n.charAt(i)) + unit.charAt(i);
  75. return str
  76. .replace(/零(仟|佰|拾|角)/g, "零")
  77. .replace(/(零)+/g, "零")
  78. .replace(/零(万|亿|圆)/g, "$1")
  79. .replace(/(亿)万|壹(拾)/g, "$1$2")
  80. .replace(/^圆零?|零分/g, "")
  81. .replace(/圆$/g, "圆整");
  82. }
  83. function editItem() {}
  84. defineExpose({
  85. show
  86. });
  87. </script>
  88. <template>
  89. <div class="InvoiceTmpDiv">
  90. <el-row v-if="showHeader">
  91. <el-col :span="12" :offset="6" class="title no-border"
  92. >XX市增值税XX票XX发票</el-col
  93. >
  94. <el-col :span="6" class="extra no-border">
  95. <div>
  96. <span class="label title-label">发票代码</span>:<span class="content"
  97. >xxxxxxxxxxxxxxxx</span
  98. >
  99. </div>
  100. <div>
  101. <span class="label title-label">发票号码</span>:<span class="content"
  102. >xxxxxxxxxxxxxxxx</span
  103. >
  104. </div>
  105. <div>
  106. <span class="label title-label">开票日期</span>:<span class="content"
  107. >xxxxxxxxxxxxxxxx</span
  108. >
  109. </div>
  110. <div>
  111. <span class="label title-label">校验码</span>:<span class="content"
  112. >xxxxxxxxxxxxxxxx</span
  113. >
  114. </div>
  115. </el-col>
  116. </el-row>
  117. <el-row class="row height84">
  118. <el-col :span="1" class="no-border">
  119. <ul class="tc">
  120. <li>购</li>
  121. <li>买</li>
  122. <li>方</li>
  123. </ul>
  124. </el-col>
  125. <el-col :span="15">
  126. <div>
  127. <span class="label">名称</span>:<span class="content"
  128. >xxxxxxxxxxxxxxxx</span
  129. >
  130. </div>
  131. <div>
  132. <span class="label">纳税人识别号</span>:<span class="content"
  133. >xxxxxxxxxxxxxxxx</span
  134. >
  135. </div>
  136. <div>
  137. <span class="label">地址、电话</span>:<span class="content"
  138. >xxxxxxxxxxxxxxxx</span
  139. >
  140. </div>
  141. <div>
  142. <span class="label">开户行及账号</span>:<span class="content"
  143. >xxxxxxxxxxxxxxxx</span
  144. >
  145. </div>
  146. </el-col>
  147. <el-col :span="1">
  148. <ul class="tc">
  149. <li>密</li>
  150. <li>码</li>
  151. <li>区</li>
  152. </ul></el-col
  153. >
  154. <el-col :span="7">
  155. <el-button
  156. class="fr"
  157. type="primary"
  158. :icon="useRenderIcon('eye-view')"
  159. @click="editItem()"
  160. >
  161. 查看销售订单详情
  162. </el-button>
  163. </el-col>
  164. </el-row>
  165. <div class="row-div">
  166. <el-row>
  167. <el-col :span="8" class="no-border">
  168. <div class="tc">货物或应税劳务、服务名称</div>
  169. </el-col>
  170. <el-col :span="3">
  171. <div class="tc">规格型号</div>
  172. </el-col>
  173. <el-col :span="1">
  174. <div class="tc">单位</div>
  175. </el-col>
  176. <el-col :span="2">
  177. <div class="tc">数量</div>
  178. </el-col>
  179. <el-col :span="3">
  180. <div class="tc">单价</div>
  181. </el-col>
  182. <el-col :span="3">
  183. <div class="tc">金额</div>
  184. </el-col>
  185. <el-col :span="1">
  186. <div class="tc">税率</div>
  187. </el-col>
  188. <el-col :span="3">
  189. <div class="tc">税额</div>
  190. </el-col>
  191. </el-row>
  192. <el-row v-for="(si, sii) in orderList" :key="sii + si">
  193. <el-col :span="8" class="no-border">
  194. <div class="tc">{{ si[1] }}</div>
  195. </el-col>
  196. <el-col :span="3">
  197. <div class="tc">{{ si[2] }}</div>
  198. </el-col>
  199. <el-col :span="1">
  200. <div class="tc">{{ si[3] }}</div>
  201. </el-col>
  202. <el-col :span="2">
  203. <div class="tc">{{ si[4] }}</div>
  204. </el-col>
  205. <el-col :span="3">
  206. <div class="tc">{{ si[5] }}</div>
  207. </el-col>
  208. <el-col :span="3">
  209. <div class="tc">{{ si[6] }}</div>
  210. </el-col>
  211. <el-col :span="1">
  212. <div class="tc">{{ si[7] }}</div>
  213. </el-col>
  214. <el-col :span="3">
  215. <div class="tc">{{ si[8] }}</div>
  216. </el-col>
  217. </el-row>
  218. <el-row>
  219. <el-col :span="8" class="no-border">
  220. <div class="tc">合计</div>
  221. </el-col>
  222. <el-col :span="3">
  223. <div class="tc">&nbsp;</div>
  224. </el-col>
  225. <el-col :span="1">
  226. <div class="tc">&nbsp;</div>
  227. </el-col>
  228. <el-col :span="2">
  229. <div class="tc">&nbsp;</div>
  230. </el-col>
  231. <el-col :span="3">
  232. <div class="tc">&nbsp;</div>
  233. </el-col>
  234. <el-col :span="3">
  235. <div class="tc">&nbsp;</div>
  236. </el-col>
  237. <el-col :span="1">
  238. <div class="tc">&nbsp;</div>
  239. </el-col>
  240. <el-col :span="3">
  241. <div class="tc">&nbsp;</div>
  242. </el-col>
  243. </el-row>
  244. </div>
  245. <el-row class="row con">
  246. <el-col :span="8" class="no-border tc">价税合计(大写)</el-col>
  247. <el-col :span="9" class="no-border tl">{{ money(num) }}</el-col>
  248. <el-col :span="7" class="no-border tc"
  249. >(小写)<span>¥ 111</span></el-col
  250. >
  251. </el-row>
  252. <el-row class="row height84">
  253. <el-col :span="1" class="no-border">
  254. <ul class="tc">
  255. <li>销</li>
  256. <li>售</li>
  257. <li>方</li>
  258. </ul>
  259. </el-col>
  260. <el-col :span="15">
  261. <div>
  262. <span class="label">名称</span>:<span class="content"
  263. >xxxxxxxxxxxxxxxx</span
  264. >
  265. </div>
  266. <div>
  267. <span class="label">纳税人识别号</span>:<span class="content"
  268. >xxxxxxxxxxxxxxxx</span
  269. >
  270. </div>
  271. <div>
  272. <span class="label">地址、电话</span>:<span class="content"
  273. >xxxxxxxxxxxxxxxx</span
  274. >
  275. </div>
  276. <div>
  277. <span class="label">开户行及账号</span>:<span class="content">{{
  278. configItem.title
  279. }}</span>
  280. </div>
  281. </el-col>
  282. <el-col :span="1">
  283. <ul class="tc">
  284. <li>备</li>
  285. <li>&nbsp;</li>
  286. <li>注</li>
  287. </ul>
  288. </el-col>
  289. <el-col :span="7"> {{}} </el-col>
  290. </el-row>
  291. <el-row class="last-row">
  292. <el-col :span="6" class="no-border">
  293. <span>收款人:</span>
  294. <span class="content">{{ configItem.title }}</span>
  295. </el-col>
  296. <el-col :span="6" class="no-border">
  297. <span>复核:</span>
  298. <span class="content">{{ configItem.title }}</span>
  299. </el-col>
  300. <el-col :span="6" class="no-border">
  301. <span>开票人:</span>
  302. <span class="content">{{ configItem.title }}</span>
  303. </el-col>
  304. <el-col :span="5" class="no-border">
  305. <span>销售方:(章)</span>
  306. </el-col>
  307. </el-row>
  308. </div>
  309. </template>
  310. <style lang="scss" scoped>
  311. .InvoiceTmpDiv {
  312. font-size: 12px;
  313. width: 100%;
  314. .title {
  315. font-size: 26px;
  316. color: #b16363;
  317. text-align: center;
  318. line-height: 56px;
  319. }
  320. .extra {
  321. color: #b15b16;
  322. padding: 0 0 6px 0;
  323. div {
  324. line-height: 18px;
  325. }
  326. .content {
  327. color: #181818;
  328. }
  329. }
  330. .height84 {
  331. [class*="el-col-"] {
  332. border-right: 1px solid #b16363;
  333. &:last-child {
  334. border-right: 0px;
  335. }
  336. }
  337. ul {
  338. padding: 15px 0;
  339. // border-right: 1px solid #b16363;
  340. li {
  341. height: 20px;
  342. line-height: 20px;
  343. }
  344. }
  345. .el-col-15 {
  346. padding: 5px 10px;
  347. div {
  348. line-height: 20px;
  349. }
  350. }
  351. .el-col-7 {
  352. padding: 5px 10px;
  353. line-height: 20px;
  354. }
  355. }
  356. .row {
  357. border: 1px solid #b16363;
  358. border-bottom: none;
  359. color: #b15b16;
  360. &.con {
  361. padding: 5px 0;
  362. line-height: 22px;
  363. }
  364. .content {
  365. color: #181818;
  366. }
  367. .col_1 {
  368. width: 4.16%;
  369. }
  370. .col_2 {
  371. width: 8.33%;
  372. }
  373. .col_3 {
  374. width: 12.5%;
  375. }
  376. .col_5 {
  377. width: 20.83%;
  378. }
  379. .col_6 {
  380. width: 25%;
  381. }
  382. .col_7 {
  383. width: 29.16%;
  384. }
  385. .col_8 {
  386. width: 33.33%;
  387. }
  388. .col_14 {
  389. width: 58.33%;
  390. }
  391. .col_15 {
  392. width: 62.5%;
  393. }
  394. .col_17 {
  395. width: 70.83%;
  396. }
  397. .col_18 {
  398. width: 75%;
  399. }
  400. .col_24 {
  401. width: 100%;
  402. }
  403. .col_1,
  404. .col_2,
  405. .col_3,
  406. .col_4,
  407. .col_5,
  408. .col_6,
  409. .col_7,
  410. .col_8,
  411. .col_14,
  412. .col_15,
  413. .col_17,
  414. .col_18,
  415. .col_24 {
  416. display: inline-block;
  417. padding: 8px;
  418. box-sizing: border-box;
  419. vertical-align: middle;
  420. border-left: 1px solid #b16363;
  421. height: 100%;
  422. &.no-border {
  423. border-left: none;
  424. }
  425. }
  426. }
  427. .row-div {
  428. border: 1px solid #b16363;
  429. // padding:7px 0;
  430. border-bottom: 0px;
  431. [class*="el-col-"] {
  432. padding: 4px 0;
  433. line-height: 22px;
  434. border-right: 1px solid #b16363;
  435. &:last-child {
  436. border-right: 0px;
  437. }
  438. }
  439. .el-row {
  440. &:first-child {
  441. [class*="el-col-"] {
  442. padding-top: 8px;
  443. }
  444. }
  445. &:last-child {
  446. [class*="el-col-"] {
  447. padding-bottom: 10px;
  448. }
  449. }
  450. }
  451. }
  452. .last-row {
  453. padding: 6px 0 0 0;
  454. .content {
  455. color: #181818;
  456. }
  457. color: #b15b16;
  458. border-top: 1px solid #b16363;
  459. }
  460. .label {
  461. width: 78px;
  462. display: inline-block;
  463. text-align-last: justify;
  464. text-align: justify;
  465. }
  466. .title-label {
  467. width: 52px;
  468. }
  469. }
  470. </style>