"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[382],{6961:function(t,e,r){r.r(e),r.d(e,{default:function(){return d}});var o=function(){var t=this,e=t._self._c;return e("div",{staticClass:"conent"},[e("el-card",[e("el-form",{ref:"form",attrs:{inline:!0,model:t.form}},[e("el-form-item",{attrs:{label:"所属店铺:"}},[e("el-select",{attrs:{placeholder:"店铺"},model:{value:t.form.shop_id,callback:function(e){t.$set(t.form,"shop_id",e)},expression:"form.shop_id"}},t._l(t.shops,(function(t){return e("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1),e("el-form-item",{attrs:{label:"发货状态:"}},[e("el-select",{attrs:{placeholder:"发货状态"},model:{value:t.form.shipping_status,callback:function(e){t.$set(t.form,"shipping_status",e)},expression:"form.shipping_status"}},[e("el-option",{attrs:{value:"",label:"全部"}}),e("el-option",{attrs:{value:"0",label:"未发货"}}),e("el-option",{attrs:{value:"2",label:"部分发货"}}),e("el-option",{attrs:{value:"1",label:"已发货"}})],1)],1),e("el-form-item",{attrs:{label:"订单类型:"}},[e("el-select",{attrs:{placeholder:"订单类型"},model:{value:t.form.is_supplier,callback:function(e){t.$set(t.form,"is_supplier",e)},expression:"form.is_supplier"}},[e("el-option",{attrs:{value:"",label:"全部订单"}}),e("el-option",{attrs:{value:"1",label:"自卖团订单"}}),e("el-option",{attrs:{value:"0",label:"帮卖团订单"}})],1)],1),e("el-form-item",{attrs:{label:"订单状态:"}},[e("el-select",{attrs:{placeholder:"订单状态"},model:{value:t.form.cancel_status,callback:function(e){t.$set(t.form,"cancel_status",e)},expression:"form.cancel_status"}},[e("el-option",{attrs:{value:"",label:"全部"}}),e("el-option",{attrs:{value:"0",label:"未取消"}}),e("el-option",{attrs:{value:"1",label:"已取消"}})],1)],1),e("el-form-item",{attrs:{label:"售后状态:"}},[e("el-select",{attrs:{placeholder:"售后状态"},model:{value:t.form.after_sales_status,callback:function(e){t.$set(t.form,"after_sales_status",e)},expression:"form.after_sales_status"}},[e("el-option",{attrs:{value:"",label:"全部"}}),e("el-option",{attrs:{value:"0",label:"未售后"}}),e("el-option",{attrs:{value:"1",label:"有售后"}})],1)],1),e("el-form-item",{attrs:{label:"商品数量:"}},[e("el-select",{attrs:{placeholder:"商品数量"},model:{value:t.form.goods_sku_num,callback:function(e){t.$set(t.form,"goods_sku_num",e)},expression:"form.goods_sku_num"}},[e("el-option",{attrs:{value:"",label:"全部"}}),e("el-option",{attrs:{value:"1",label:"1个商品"}}),e("el-option",{attrs:{value:"2",label:"2-5个商品"}}),e("el-option",{attrs:{value:"6",label:"6个以上商品"}})],1)],1),e("el-form-item",{attrs:{label:"订单商品:"}},[e("el-select",{attrs:{multiple:"",filterable:"",remote:"","reserve-keyword":"",placeholder:"订单商品","remote-method":t.remoteMethod,loading:t.searchLoading},model:{value:t.form.external_sku_ids,callback:function(e){t.$set(t.form,"external_sku_ids",e)},expression:"form.external_sku_ids"}},t._l(t.options,(function(t){return e("el-option",{key:t.external_sku_id,attrs:{label:t.title,value:t.external_sku_id}})})),1)],1),e("el-form-item",{attrs:{label:"下单时间:"}},[e("el-date-picker",{attrs:{type:"datetimerange","range-separator":"-","start-placeholder":"起","end-placeholder":"止",format:"yyyy-MM-dd HH:mm:ss","value-format":"yyyy-MM-dd HH:mm:ss"},model:{value:t.form.confirm_at,callback:function(e){t.$set(t.form,"confirm_at",e)},expression:"form.confirm_at"}})],1),e("el-form-item",{attrs:{label:"跟团号:"}},[e("el-input",{attrs:{placeholder:"跟团号"},model:{value:t.form.pno,callback:function(e){t.$set(t.form,"pno",e)},expression:"form.pno"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.handleChoose}},[t._v("筛选")]),e("el-button",{attrs:{plain:""},on:{click:t.handleReChoose}},[t._v("重置筛选")])],1),e("el-button",{attrs:{type:"primary"},on:{click:t.print}},[t._v("打印")]),2===t.form.goods_sku_num?e("el-button",{attrs:{type:"primary"}},[t._v("配货单导出")]):t._e()],1)],1),e("el-card",{staticStyle:{"margin-top":"10px"}},[e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],ref:"multipleTable",staticStyle:{width:"100%"},attrs:{data:t.tableData},on:{"selection-change":t.handleSelectionChange}},[e("el-table-column",{attrs:{type:"selection",width:"55"}}),e("el-table-column",{attrs:{label:"店铺名称"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(e.row.shop.name)+" ")]}}])}),e("el-table-column",{attrs:{label:"跟团号"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(e.row.is_supplier?"自卖团: ":"帮卖团: ")+" "+t._s(e.row.is_supplier?e.row.participate_no:e.row.supply_participate_no)+" ")]}}])}),e("el-table-column",{attrs:{label:"收件人信息",width:"160"},scopedSlots:t._u([{key:"default",fn:function(r){return[e("p",[t._v(t._s(r.row.receiver_name))]),e("p",[t._v(t._s(r.row.receiver_address_province)+" "+t._s(r.row.receiver_address_city)+" "+t._s(r.row.receiver_address_district))]),e("p",[t._v(t._s(r.row.receiver_address_detail))])]}}])}),e("el-table-column",{attrs:{prop:"shipping_status",label:"发货状态"}}),e("el-table-column",{attrs:{prop:"cancel_status",label:"订单状态"}}),e("el-table-column",{attrs:{prop:"after_sales_status",label:"售后状态"}}),e("el-table-column",{attrs:{label:"商品信息",width:"420"},scopedSlots:t._u([{key:"default",fn:function(r){return t._l(r.row.items,(function(r){return e("div",{key:r.id},[t._v(" "+t._s(r.goods_name)+" "),e("br"),e("span",{staticStyle:{color:"red"}},[t._v("+"+t._s(r.goods_number))])])}))}}])}),e("el-table-column",{attrs:{prop:"confirm_at",label:"下单时间",width:"100"}}),e("el-table-column",{attrs:{prop:"print_status",label:"打印次数"}})],1),e("div",{staticClass:"block"},[e("el-pagination",{attrs:{"current-page":t.current_page,"page-sizes":[15,50,100],"page-size":t.per_page,layout:"total, sizes, prev, pager, next, jumper",total:t.Paginationdata.total},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}})],1)],1)],1)},s=[],n=(r(560),r(5522)),a=r(9998),i=r(9036),l={data(){return{form:{shop_id:"",shipping_status:"",cancel_status:"0",after_sales_status:"0",goods_sku_num:"",print_status:"0",external_sku_ids:[],confirm_at:[],ids:[],pno:""},dialogVisible:!1,loading:!0,searchLoading:!1,options:[],tableData:[],Paginationdata:{},current_page:1,per_page:10,shops:[],groupActivity:[],exportForm:{shop_id:"",start_no:"",end_no:"",is_supplier:1},exportFormRules:{shop_id:[{required:!0,trigger:"blur"}],start_no:[{required:!0,trigger:"blur"}],end_no:[{required:!0,trigger:"blur"}]},confirmAt:[],print_order_ids:"",print_documents:[],socket:null,lockReconnect:!1,timeout:58e3,timeoutObj:null,serverTimeoutObj:null,timeoutnum:null,defaultPrinter:null,taskIDArray:[],requestIDGetGlobalConfig:""}},created(){this.initConfirmAt(),this.getPlatOrderList({confirm_at_start:this.form.confirm_at[0],confirm_at_end:this.form.confirm_at[1]})},mounted(){this.getShopsList()},beforeDestroy(){},destroyed(){},methods:{initConfirmAt(){const t=new Date;t.setHours(0,0,0,0),this.form.confirm_at[0]=t.toLocaleString("zh",{hour12:!1}).replaceAll("/","-"),t.setHours(23,59,59,999),this.form.confirm_at[1]=t.toLocaleString("zh",{hour12:!1}).replaceAll("/","-"),this.confirmAt=this.form.confirm_at},getPlatOrderList(t={}){t.page=this.current_page,t.per_page=this.per_page,(0,n.lU)(t).then((t=>{this.tableData=t.data.data,this.Paginationdata=t.data.meta}))},getShopsList(){let t={page:0,per_page:99};(0,a.nH)(t).then((t=>{this.shops=t.data.data})),this.loading=!1},handleSizeChange(t){this.current_page=1,this.per_page=t,this.getPlatOrderList()},handleCurrentChange(t){this.current_page=t,this.getPlatOrderList()},handleChoose(){this.form.confirm_at_start=this.form.confirm_at[0]?this.form.confirm_at[0]:"",this.form.confirm_at_end=this.form.confirm_at[1]?this.form.confirm_at[1]:"",this.form={...this.form,page:1,per_page:this.per_page},this.getPlatOrderList(this.form)},handleReChoose(){this.form={shop_id:"",shipping_status:"",cancel_status:"0",after_sales_status:"0",goods_sku_num:"",print_status:0,external_sku_ids:[],confirm_at:this.confirmAt,ids:[],pno:""},this.getPlatOrderList()},derivation(t){this.$refs[t].validate((t=>{if(!t)return!1;window.open("/plat_orders/export?shop_id="+this.exportForm.shop_id+"&start_no="+this.exportForm.start_no+"&end_no="+this.exportForm.end_no+"&is_supplier="+this.exportForm.is_supplier)}))},remoteMethod(t){""!==t?(this.searchLoading=!0,setTimeout((()=>{this.searchLoading=!1,(0,i.NR)(t).then((e=>{this.options=e.data.filter((e=>e.title.toLowerCase().indexOf(t.toLowerCase())>-1))}))}),200)):this.options=[]},print(){const t=this.$loading({lock:!0,text:"Loading",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});(0,n.kT)(this.form).then((e=>{this.print_documents=e.data.documents,this.print_order_ids=e.data.order_ids,t.close(),this.doPrint()}))},handleSelectionChange(t){let e=[];t.forEach((t=>{e.push(t.id)})),this.form.ids=e},initWebSocket(){const t="ws://127.0.0.1:5000";this.socket=new WebSocket(t),this.socket.onmessage=this.websocketonmessage,this.socket.onopen=this.websocketonopen,this.socket.onerror=this.websocketonerror,this.socket.onclose=this.websocketclose},websocketonopen(){this.start(),1===this.socket.readyState&&this.getPrinters()},start(){console.log("开启心跳");var t=this;t.timeoutObj&&clearTimeout(t.timeoutObj),t.serverTimeoutObj&&clearTimeout(t.serverTimeoutObj),t.timeoutObj=setTimeout((function(){1==t.socket.readyState||t.reconnect(),t.serverTimeoutObj=setTimeout((function(){t.socket.close()}),t.timeout)}),t.timeout)},reconnect(){var t=this;t.lockReconnect||(t.lockReconnect=!0,t.timeoutnum&&clearTimeout(t.timeoutnum),t.timeoutnum=setTimeout((function(){t.initWebSocket(),t.lockReconnect=!1}),5e3))},websocketonerror(){console.log("出现错误"),this.reconnect()},websocketonmessage(t){console.log(t),void 0!==JSON.parse(t.data).printers&&(this.defaultPrinter=JSON.parse(t.data).defaultPrinter),console.log("默认打印机"+this.defaultPrinter),"success"===JSON.parse(t.data).status&&console.log("打印就绪.."),"failed"===JSON.parse(t.data).status&&console.log("打印未就绪.."),"printed"===JSON.parse(t.data).taskStatus&&(console.log("出纸成功--打印成功"),(0,n.EB)({order_ids:this.print_order_ids}).then((t=>{console.log(t)}))),"failed"===JSON.parse(t.data).taskStatus&&console.log("打印失败!"),"canceled"===JSON.parse(t.data).taskStatus&&console.log("打印取消!"),this.reset()},reset(){var t=this;clearTimeout(t.timeoutObj),clearTimeout(t.serverTimeoutObj),t.start()},websocketsend(t){this.socket.send(t)},websocketclose(t){console.log("断开连接",t),this.reconnect()},getPrinters(){var t=this.getRequestObject("getPrinters");this.websocketsend(JSON.stringify(t))},doPrint(){var t=this.getRequestObject("print");t.task=new Object,t.task.taskID=this.getUUID(8,10),this.taskIDArray.push(t.task.taskID),this.requestIDGetGlobalConfig=t.task.taskID,t.task.preview=!1,t.task.printer=this.defaultPrinter,t.task.documents=this.print_documents,console.log(t.task.documents),this.websocketsend(JSON.stringify(t))},getRequestObject(t){var e=new Object;return e.requestID=this.getUUID(8,16),e.version="1.0",e.cmd=t,e},getUUID(t,e){var r,o,s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];if(e=e||s.length,t)for(r=0;r