Files
PropertyDeployment/resources/Web/MicroCommunityMallWeb/html/js/chunk-6ef570e3.66780a6c.js
Anfioo adfd019d2d 江门
1
2026-02-01 15:37:55 +08:00

2 lines
6.2 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6ef570e3"],{"1f7b":function(t,r,e){"use strict";e("3a4c")},2151:function(t,r,e){"use strict";e("8e6f")},"27ca":function(t,r,e){"use strict";e.r(r);var i=function(){var t=this,r=t._self._c;return r("div",[r("start-print"),r("div",{staticClass:"print_container"},[r("div",{staticStyle:{color:"#000",width:"150px",display:"inline-block","text-align":"center"}},[t._v(" "+t._s(t.printSmallOrderInfo.shopName)+" ")]),r("div",{staticStyle:{"font-size":"12px","margin-top":"10px"}},[t._v("单号:"+t._s(t.printSmallOrderInfo.orderId))]),r("div",{staticStyle:{"font-size":"12px"}},[t._v("时间:"+t._s(t.printSmallOrderInfo.createTime))]),r("span",[t._v("**************************")]),t._m(0),r("span",[t._v("**************************")]),r("div",{staticClass:"section2",staticStyle:{"font-size":"12px"}},t._l(t.printSmallOrderInfo.orderCart,(function(e,i){return r("div",{key:i},[r("span",{staticStyle:{width:"60px",display:"inline-block"}},[t._v(t._s(e.prodName))]),r("span",{staticStyle:{width:"30px",display:"inline-block","text-align":"center"}},[t._v(t._s(e.cartNum))]),r("span",{staticStyle:{width:"30px",display:"inline-block","text-align":"center"}},[t._v(t._s(e.price))]),r("span",{staticStyle:{width:"40px",display:"inline-block","text-align":"center"}},[t._v(t._s(e.payPrice))])])})),0),r("span",[t._v("**************************")]),r("div",{staticClass:"section5",staticStyle:{"font-size":"12px"}},[r("div",[r("span",{staticStyle:{width:"65px",display:"inline-block"}},[t._v("总数量:"+t._s(t.printSmallOrderInfo.cartNumCount))]),r("span",{staticStyle:{width:"85px",display:"inline-block"}},[t._v("支付金额:"+t._s(t.printSmallOrderInfo.orderPayPrice))])]),r("div",[r("span",{staticStyle:{width:"75px",display:"inline-block"}},[t._v("优惠金额:"+t._s(t.printSmallOrderInfo.discountPayPrice))])])]),t.printSmallOrderInfo.content?r("div",{staticClass:"section5",staticStyle:{"font-size":"12px","margin-left":"5px"}},[r("div",{staticStyle:{"white-space":"pre-wrap"},domProps:{innerHTML:t._s(t.printSmallOrderInfo.content)}}),r("div",[r("img",{attrs:{src:t.printSmallOrderInfo.qrImg,width:"100px",height:"100px"}})])]):t._e()]),r("end-print"),r("div",{attrs:{id:"print-btn"}},[r("el-button",{staticClass:"float-right",attrs:{type:"primary"},on:{click:t._printPurchaseApplyDiv}},[r("i",{staticClass:"el-icon-check"}),t._v(" 打印 ")]),r("el-button",{staticClass:"float-right margin-right",attrs:{type:"primary"},on:{click:t._printCloudPurchaseApplyDiv}},[r("i",{staticClass:"el-icon-check"}),t._v(" 云打印 ")]),r("el-button",{staticClass:"float-right",staticStyle:{"margin-right":"20px"},attrs:{type:"warning"},on:{click:t._closePage}},[r("i",{staticClass:"el-icon-close"}),t._v(" 取消 ")])],1)],1)},n=[function(){var t=this,r=t._self._c;return r("div",[r("span",[t._v("品名")]),r("span",[t._v("数量")]),r("span",[t._v("单价")]),r("span",[t._v("金额")])])}],a=e("b775");function s(t){return new Promise((r,e)=>{Object(a["a"])({url:"/storeOrder.queryStoreOrderCart",method:"get",params:t}).then(t=>{const e=t.data;r(e)}).catch(t=>{e(t)})})}function o(t){return new Promise((r,e)=>{Object(a["a"])({url:"/printer.orderPrinter",method:"post",data:t,headers:{"Content-Type":"application/json"}}).then(t=>{const e=t.data;r(e)}).catch(t=>{e(t)})})}function l(t){return new Promise((r,e)=>{Object(a["a"])({url:"/feePrintSpec.queryFeePrintSpec",method:"get",params:t}).then(t=>{const e=t.data;r(e)}).catch(t=>{e(t)})})}var c=e("7323"),d=function(){var t=this,r=t._self._c;return r("div",{staticStyle:{display:"none"}},[t._t("default")],2)},p=[],h={name:"StartPrint"},u=h,m=(e("515d"),e("2877")),f=Object(m["a"])(u,d,p,!1,null,"f2f38a72",null),y=f.exports,_=function(){var t=this,r=t._self._c;return r("div",{staticStyle:{display:"none"}},[t._t("default")],2)},v=[],S={name:"EndPrint"},P=S,I=(e("1f7b"),Object(m["a"])(P,_,v,!1,null,"08e6f4ce",null)),w=I.exports,g={name:"PrintSmallOrder",components:{StartPrint:y,EndPrint:w},data(){return{printSmallOrderInfo:{shopName:"",amount:0,orderCart:[],createTime:"",orderId:"",cartNumCount:0,totalPayPrice:0,totalPrice:0,orderPayPrice:0,content:"",qrImg:"",autoPrint:"N",discountPayPrice:0},printFlag:"0",shopId:""}},created(){this.shopId=Object(c["f"])(),this.printSmallOrderInfo.orderId=this.$route.query.orderId,this.printSmallOrderInfo.autoPrint=this.$route.query.autoPrint||"N",this._loadReceipt(),this._loadPrintSpec(),console.log(this.printFlag)},methods:{async _loadReceipt(){try{const t={page:1,row:100,orderId:this.printSmallOrderInfo.orderId,shopId:this.shopId},r=await s(t),e=r.data;this.printSmallOrderInfo.orderCart=e;let i=0;e.forEach(t=>{i+=parseFloat(t.cartNum)}),this.printSmallOrderInfo.cartNumCount=i,this.printSmallOrderInfo.discountPayPrice=(parseFloat(e[0].totalPrice)-parseFloat(e[0].orderPayPrice)).toFixed(2),this.printSmallOrderInfo.orderPayPrice=e[0].orderPayPrice,this.printSmallOrderInfo.createTime=e[0].createTime,"Y"===this.printSmallOrderInfo.autoPrint&&setTimeout(()=>{this._printPurchaseApplyDiv()},1e3)}catch(t){console.error("加载收据失败:",t)}},_printPurchaseApplyDiv(){let t=window.document.body.innerHTML,r="<start-print></start-print>",e="<end-print></end-print>",i=t.substr(t.indexOf(r)+r.length);i=i.substring(0,i.indexOf(e)),window.document.body.innerHTML=i,console.log(window.document.body.innerHTML),window.print(),window.opener=null,window.close()},async _printCloudPurchaseApplyDiv(){try{const t={shopId:this.shopId,orderId:this.printSmallOrderInfo.orderId},r=await o(t);if(0===r.code)return this.$message.success(r.msg),void this.$router.go(-1);this.$message.error(r.msg)}catch(t){console.error("云打印失败:",t),this.$message.error("云打印失败")}},async _loadPrintSpec(){try{const t={page:1,row:1,specCd:2020,shopId:this.shopId},r=await l(t),e=r.data;e.length>0&&(this.printSmallOrderInfo.content=e[0].content,this.printSmallOrderInfo.qrImg=e[0].qrImg,this.printSmallOrderInfo.shopName=e[0].printName)}catch(t){console.error("加载打印规格失败:",t)}},_closePage(){window.opener=null,window.close()}}},O=g,b=(e("2151"),Object(m["a"])(O,i,n,!1,null,"32a3c1c1",null));r["default"]=b.exports},"3a4c":function(t,r,e){},"515d":function(t,r,e){"use strict";e("655c")},"655c":function(t,r,e){},"8e6f":function(t,r,e){}}]);
//# sourceMappingURL=chunk-6ef570e3.66780a6c.js.map