(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[491],{491:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return m}});var i=function(){var e=this,t=e._self._c;return t("div",{staticClass:"pageBox"},[t("div",{staticClass:"cardBox"},[t("div",{staticClass:"searchBox"},[t("div",{staticClass:"row"},[t("span",[e._v("sku标题:")]),t("el-input",{attrs:{clearable:""},model:{value:e.filter.title,callback:function(t){e.$set(e.filter,"title",t)},expression:"filter.title"}})],1),t("div",{staticClass:"row"},[t("span",[e._v("规格编码:")]),t("el-input",{attrs:{clearable:""},model:{value:e.filter.external_sku_id,callback:function(t){e.$set(e.filter,"external_sku_id",t)},expression:"filter.external_sku_id"}})],1),t("div",{staticClass:"row"},[t("span",[e._v("创建时间:")]),t("el-date-picker",{staticStyle:{width:"340px"},attrs:{type:"datetimerange","range-separator":"-","start-placeholder":"开始时间","end-placeholder":"结束时间","value-format":"yyyy-MM-dd HH:mm:ss"},model:{value:e.addTime,callback:function(t){e.addTime=t},expression:"addTime"}})],1),t("div",{staticClass:"row"},[t("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.handleSearch}},[e._v("筛选")])],1)])]),t("el-card",[t("div",{staticClass:"opaBox"},[t("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.handleAdd}},[e._v("新增")]),t("el-button",{attrs:{type:"warning",icon:"el-icon-upload2"},on:{click:e.handleImport}},[e._v("导入")])],1),t("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:e.procureList,border:""}},[t("el-table-column",{attrs:{prop:"sku_id",label:"商品id",width:"80",align:"center"}}),t("el-table-column",{attrs:{prop:"goods_sku.name",label:"商品标题"}}),t("el-table-column",{attrs:{prop:"external_sku_id",label:"规格编码"}}),t("el-table-column",{attrs:{prop:"num",label:"采购数量"}}),t("el-table-column",{attrs:{prop:"cost",label:"采购成本"}}),t("el-table-column",{attrs:{prop:"buyer_name",label:"采购人名称"}}),t("el-table-column",{attrs:{prop:"expire_time",label:"保质期时间"}}),t("el-table-column",{attrs:{prop:"supplier_name",label:"供应商"},scopedSlots:e._u([{key:"default",fn:function(r){return[r.row.supplier_name?t("span",[e._v(e._s(r.row.supplier_name)+"("+e._s(r.row.supplier_id)+")")]):e._e()]}}])}),t("el-table-column",{attrs:{prop:"created_at",label:"创建时间",align:"center"}}),t("el-table-column",{attrs:{label:"操作",width:"120",align:"center"},scopedSlots:e._u([{key:"default",fn:function(r){return[t("el-button",{attrs:{type:"primary",icon:"el-icon-edit",size:"mini"},on:{click:function(t){return e.handleEdit(r.row)}}},[e._v("编辑")])]}}])})],1),t("div",{staticClass:"page-pagination"},[t("el-pagination",{attrs:{"current-page":e.page,"page-sizes":[15,30,50,100],"page-size":e.pageSize,layout:"prev, pager, next, jumper, sizes, total",total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],1),t("el-dialog",{attrs:{title:e.curInfo.id?"编辑":"新增",visible:e.dialogVisible,width:"500px"},on:{"update:visible":function(t){e.dialogVisible=t}}},[t("el-form",{attrs:{"label-width":"90px"}},[t("el-form-item",{attrs:{label:"规格编码"}},[t("el-input",{attrs:{clearable:""},model:{value:e.curInfo.external_sku_id,callback:function(t){e.$set(e.curInfo,"external_sku_id",t)},expression:"curInfo.external_sku_id"}})],1),t("el-form-item",{attrs:{label:"数量"}},[t("el-input",{attrs:{clearable:""},model:{value:e.curInfo.num,callback:function(t){e.$set(e.curInfo,"num",t)},expression:"curInfo.num"}})],1),t("el-form-item",{attrs:{label:"成本"}},[t("el-input",{attrs:{clearable:""},model:{value:e.curInfo.cost,callback:function(t){e.$set(e.curInfo,"cost",t)},expression:"curInfo.cost"}})],1),t("el-form-item",{attrs:{label:"采购人"}},[t("el-select",{ref:"userRef",attrs:{clearable:"",filterable:""},model:{value:e.curInfo.buyer_user_id,callback:function(t){e.$set(e.curInfo,"buyer_user_id",t)},expression:"curInfo.buyer_user_id"}},e._l(e.usersList,(function(e){return t("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1),t("el-form-item",{attrs:{label:"供应商"}},[t("el-select",{ref:"supplierRef",attrs:{clearable:"",filterable:""},model:{value:e.curInfo.supplier_id,callback:function(t){e.$set(e.curInfo,"supplier_id",t)},expression:"curInfo.supplier_id"}},e._l(e.supplierList,(function(e){return t("el-option",{key:e.id,attrs:{label:e.supplier_name,value:e.id}})})),1)],1),t("el-form-item",{attrs:{label:"过期时间"}},[t("el-date-picker",{attrs:{type:"date",placeholder:"选择日期",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd"},model:{value:e.curInfo.expire_time,callback:function(t){e.$set(e.curInfo,"expire_time",t)},expression:"curInfo.expire_time"}})],1)],1),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary",loading:e.commitloading},on:{click:e.commitSupplier}},[e._v("确 定")])],1)],1),t("el-dialog",{attrs:{title:"导入",visible:e.showImport,width:"500px"},on:{"update:visible":function(t){e.showImport=t}}},[t("div",{staticStyle:{"text-align":"center"}},[t("el-upload",{staticClass:"upload-demo",attrs:{drag:"",action:"",limit:1,multiple:!1,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel","file-list":e.fileList,"auto-upload":!1,"on-change":e.importFileChange,"on-remove":e.fileRemove}},[t("i",{staticClass:"el-icon-upload"}),t("div",{staticClass:"el-upload__text"},[e._v("将文件拖到此处,或"),t("em",[e._v("点击上传")])])])],1),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.showImport=!1}}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary",loading:e.commitloading},on:{click:e.commitUpload}},[e._v("上 传")])],1)])],1)},n=[],s=r(3550),a=r(9669),o=r.n(a),l=r(2900),u={data(){return{loading:!1,page:1,pageSize:15,total:0,procureList:[],filter:{title:"",external_sku_id:""},addTime:[],commitloading:!1,dialogVisible:!1,curInfo:{},showImport:!1,fileList:[],usersList:[],supplierList:[]}},methods:{fetchList(){this.loading=!0;let e={page:this.page,per_page:this.pageSize,...this.filter,start_time:this.addTime?this.addTime[0]:"",end_time:this.addTime?this.addTime[1]:""};(0,s.Js)(e).then((e=>{this.procureList=e.data.data,this.total=e.data.meta.total,this.loading=!1})).catch((()=>{this.loading=!1}))},handleSizeChange(e){this.page=1,this.pageSize=e,this.fetchList()},handleCurrentChange(e){this.page=e,this.fetchList()},handleSearch(){this.page=1,this.fetchList()},handleAdd(){this.curInfo={},this.dialogVisible=!0},handleEdit(e){this.curInfo=JSON.parse(JSON.stringify(e)),this.dialogVisible=!0},commitSupplier(){this.commitloading=!0;let e={...this.curInfo};e.buyer_name="",e.supplier_name="",e.buyer_user_id&&(e.buyer_name=this.$refs.userRef.selectedLabel),e.supplier_id&&(e.supplier_name=this.$refs.supplierRef.selectedLabel),this.curInfo.id?(0,s.JI)(this.curInfo.id,e).then((e=>{this.fetchList(),this.$message({type:"success",message:"更新成功!"}),this.dialogVisible=!1,this.commitloading=!1})).catch((()=>{this.commitloading=!1})):(0,s.xr)(e).then((e=>{this.page=1,this.fetchList(),this.$message({type:"success",message:"新增成功!"}),this.dialogVisible=!1,this.commitloading=!1})).catch((()=>{this.commitloading=!1}))},handleImport(){this.fileList=[],this.showImport=!0},importFileChange(e,t){console.log(t),this.fileList=t},fileRemove(){this.fileList=[]},commitUpload(){if(this.fileList.length){this.commitloading=!0;const e=new FormData;e.append("purchaseFile",this.fileList[0].raw);let t=localStorage.getItem("token");o().post("/api/purchase_record/purchase_import",e,{headers:{Authorization:`Bearer ${t}`}}).then((e=>{200===e.status?(this.$message.success("导入成功"),this.page=1,this.fetchList(),this.commitloading=!1,this.showImport=!1):this.commitloading=!1})).catch((()=>{this.commitloading=!1}))}else this.$message.error("请先上传文件")},getUserList(){let e={page:1,per_page:9999};(0,l.Lh)(e).then((e=>{this.usersList=e.data.data}))},getSupplierList(){let e={page:1,per_page:9999};(0,s.Fb)(e).then((e=>{this.supplierList=e.data.data}))}},mounted(){this.fetchList(),this.getSupplierList(),this.getUserList()}},c=u,p=r(1001),d=(0,p.Z)(c,i,n,!1,null,"6bb4a360",null),m=d.exports},4865:function(e,t,r){var i,n; /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress * @license MIT */(function(s,a){i=a,n="function"===typeof i?i.call(t,r,t,e):i,void 0===n||(e.exports=n)})(0,(function(){var e={version:"0.2.0"},t=e.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'