invoice.blade.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <style>
  2. .dialog-box {
  3. position: fixed;
  4. top: 0;
  5. left: 0;
  6. width: 100vw;
  7. height: 100vh;
  8. display: flex;
  9. align-items: center;
  10. justify-content: center;
  11. z-index: 2001;
  12. background-color: rgba(0, 0, 0, .1);
  13. }
  14. </style>
  15. <template id="printme">
  16. <div v-show="show" class="dialog-box" @click="clone">
  17. <div style="border-radius:10px;background-color: #fff;width:900px;max-height: 90vh;overflow-y: auto;" @click.stop="dialogVisible = true" v-loading="loading">
  18. <div ref="edit">
  19. <div style="color:#101010;padding: 10px 20px;">
  20. <div style="margin:10px 0;font-size: 18px;">发票明细</div>
  21. <div style="margin:10px;display:flex;flex-wrap:wrap;font-size: 14px;">
  22. <div style="font-weight:700;width:100%;">购货单位</div>
  23. <div style="padding: 0 10px;width: 100%;display:flex;flex-wrap:wrap;">
  24. <item l="名称" :c="purchase.name"></item>
  25. <item l="纳税人识别号" :c="purchase.tax_number"></item>
  26. <item l="地址/电话" :c="(purchase.register_address || '') + (purchase.register_address&&purchase.register_mobile?' / ':'') + (purchase.register_mobile || '')"></item>
  27. <item l="开户行/账号" :c="(purchase.bank || '') +' ' + (purchase.bank_admin || '')"></item>
  28. <item l="手机" :c="purchase.mobile"></item>
  29. <item l="邮箱" :c="purchase.email"></item>
  30. </div>
  31. </div>
  32. <div style="padding:10px;display:flex;flex-wrap:wrap;">
  33. <div style="font-weight:600;width:100%;">销货单位</div>
  34. <div style="padding: 0 10px;width: 100%;display:flex;flex-wrap:wrap;">
  35. <item l="名称" :c="sale.enterprise_name"></item>
  36. <item l="纳税人识别号" :c="sale.taxpayer_number"></item>
  37. <item l="地址/电话" :c="sale.sale_address" t="1" :c1="sale.sale_mobile"></item>
  38. <item l="开户行/账号" :c="(sale.sale_bank || '') + ' ' + (sale.sale_bank_admin || '')"></item>
  39. <div style="width:33.3%;margin: 10px 0;">收款人:[[sale.billing_payee]]</div>
  40. <div style="width:33.3%;margin: 10px 0;">复核人:[[sale.invoice_reviewer]]</div>
  41. <div style="width:33.4%;margin: 10px 0;">开票人:[[sale.invoice_drawer]]</div>
  42. </div>
  43. </div>
  44. <div style="padding-left:10px;margin:20px 10px;">
  45. <div style="display:flex;flex-wrap:wrap;">
  46. <div style="width:25%;">价税合计:[[total_tax_price]]</div>
  47. <div style="width:25%;">金额:[[total_amount]]</div>
  48. <div style="flex:1;">税额:[[total_tax_amount]]</div>
  49. </div>
  50. </div>
  51. <div style="text-align:center;margin-bottom:40px;">
  52. <div style="height:40px;line-height:40px;display:flex;background:#f0f0f0 !important;border-radius:4px;-webkit-print-color-adjust: exact;print-color-adjust: exact;color-adjust: exact;">
  53. <div style="flex:1.2;">商品</div>
  54. <div style="flex:1;">规格</div>
  55. <div style="flex:1;">数量</div>
  56. <div style="flex:1;">单价(含税)</div>
  57. <div style="flex:1;">金额(含税)</div>
  58. <div style="flex:1;">税率</div>
  59. <div style="flex:1;">税额</div>
  60. </div>
  61. <div style="height: 80px;display:flex;border-radius:4px;border-bottom: 1px solid #ECECEC;align-items: center;text-align: center;padding: 0 4px;" v-for="(item,i) in goods" :key="i">
  62. <div style="flex:1.2;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;">
  63. <span>[[item.title]]</span><br>
  64. <span v-if="item.is_refund&&item.order_goods&&item.order_goods.belongs_to_refund_goods_log&&item.order_goods.belongs_to_refund_goods_log.belongs_to_order_fund" style="color: #ff1717">
  65. [[ item.order_goods.belongs_to_refund_goods_log.belongs_to_order_fund.refund_type_name ]]
  66. </span>
  67. </div>
  68. <div style="flex:1;">[[item.spec]]</div>
  69. <div style="flex:1;">[[item.total]]</div>
  70. <div style="flex:1;">[[item.unit_price]]</div>
  71. <div style="flex:1;">[[item.money]]</div>
  72. <div style="flex:1;">[[item.tax_rate]]</div>
  73. <div style="flex:1;">[[item.tax_amount]]</div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <div style="text-align:center;margin:10px 0;">
  79. <el-button @click.stop="clone">取消</el-button>
  80. <el-button type="primary" @click.stop="invoicing">确认开票</el-button>
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. Vue.component("invoice", {
  87. template: "#printme",
  88. model: {
  89. prop: 'checked',
  90. event: 'click'
  91. },
  92. props: {
  93. value: {
  94. type: Boolean,
  95. default: false
  96. },
  97. show:{
  98. type: Boolean,
  99. default: false
  100. },
  101. url:{
  102. type: String
  103. },
  104. order_id:{
  105. default:""
  106. },
  107. type:{
  108. type: String,
  109. default:""
  110. },
  111. form:{
  112. type: Object
  113. }
  114. },
  115. delimiters: ["[[", ']]'],
  116. data() {
  117. return {
  118. dialogVisible: false,
  119. purchase: {},
  120. sale: {},
  121. goods: [],
  122. total_amount: "",
  123. total_tax_amount: "",
  124. total_tax_price: "",
  125. loading:false,
  126. invoice_type:""
  127. }
  128. },
  129. watch:{
  130. show(nVal){
  131. if(nVal) this.getdata();
  132. }
  133. },
  134. methods: {
  135. clone(){
  136. this.$emit("click",false)
  137. },
  138. open(){
  139. this.$emit("click",true)
  140. },
  141. getdata() {
  142. let json = {id: this.order_id};
  143. if (this.form) json.data = this.form;
  144. this.loading = true;
  145. this.$http.post("{!! yzWebFullUrl('plugin.invoice.admin.invoicing_order.preview') !!}", json).then(({data:{data, result,msg} }) => {
  146. this.loading = false;
  147. if (result == 1) {
  148. this.purchase = data.purchase;
  149. this.sale = data.sale;
  150. this.goods = data.goods || [];
  151. this.total_amount = data.total_amount;
  152. this.total_tax_amount = data.total_tax_amount;
  153. this.total_tax_price = data.total_tax_price;
  154. this.invoice_type = data.invoice_type;
  155. }else this.$message.error(msg)
  156. })
  157. },
  158. printme() {
  159. global_Html = document.body.innerHTML;
  160. document.body.innerHTML = this.$refs.edit.innerHTML;
  161. document.body.style.overflow = "hidden";
  162. window.print();
  163. window.location.href = this.url;
  164. },
  165. electronicsInvoice(){
  166. this.clone();
  167. this.$message.success("提交开票成功");
  168. },
  169. getInitJson(){
  170. let json ={order_id:this.order_id};
  171. return json;
  172. },
  173. invoicing() {
  174. this.loading = true;
  175. // let json = this.getInitJson();
  176. let json = this.form?{data:this.form}:{id: this.order_id};
  177. this.$http.post("{!! yzWebFullUrl('plugin.invoice.admin.invoicing_order.confirm-invoicing') !!}",json).then(({data:{result,msg,data}})=>{
  178. this.loading = false;
  179. if(result==1){
  180. if(this.invoice_type == 0){
  181. this.electronicsInvoice();
  182. }
  183. else this.printme();
  184. }else{
  185. this.$message.error(msg);
  186. if (msg=="请前往税收商品配置") {
  187. setTimeout(()=>{
  188. window.location.href = "{!! yzWebFullUrl('plugin.invoice.admin.invoicing-goods.edit') !!}"
  189. },500)
  190. }
  191. }
  192. })
  193. }
  194. },
  195. components: {
  196. item: {
  197. delimiters: ['[[', ']]'],
  198. template: `
  199. <div style="width:50%;display:flex;line-height:1;margin:10px 0;" v-if="t==1">
  200. <div>[[l]]:</div>
  201. <div>
  202. <div>[[c]]</div>
  203. <div style="margin-top:10px;" v-if="c1">[[c1]]</div>
  204. </div>
  205. </div>
  206. <div style="width:50%;margin:10px 0;" v-else>[[l]]:[[c]]</div>`,
  207. props: ["l", "c", "c1", "t"]
  208. }
  209. },
  210. })
  211. </script>