4 lines
15 KiB
JavaScript
Vendored
4 lines
15 KiB
JavaScript
Vendored
(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:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function r(e,t,r){return e<t?t:e>r?r:e}function i(e){return 100*(-1+e)}function n(e,r,n){var s;return s="translate3d"===t.positionUsing?{transform:"translate3d("+i(e)+"%,0,0)"}:"translate"===t.positionUsing?{transform:"translate("+i(e)+"%,0)"}:{"margin-left":i(e)+"%"},s.transition="all "+r+"ms "+n,s}e.configure=function(e){var r,i;for(r in e)i=e[r],void 0!==i&&e.hasOwnProperty(r)&&(t[r]=i);return this},e.status=null,e.set=function(i){var o=e.isStarted();i=r(i,t.minimum,1),e.status=1===i?null:i;var l=e.render(!o),u=l.querySelector(t.barSelector),c=t.speed,p=t.easing;return l.offsetWidth,s((function(r){""===t.positionUsing&&(t.positionUsing=e.getPositioningCSS()),a(u,n(i,c,p)),1===i?(a(l,{transition:"none",opacity:1}),l.offsetWidth,setTimeout((function(){a(l,{transition:"all "+c+"ms linear",opacity:0}),setTimeout((function(){e.remove(),r()}),c)}),c)):setTimeout(r,c)})),this},e.isStarted=function(){return"number"===typeof e.status},e.start=function(){e.status||e.set(0);var r=function(){setTimeout((function(){e.status&&(e.trickle(),r())}),t.trickleSpeed)};return t.trickle&&r(),this},e.done=function(t){return t||e.status?e.inc(.3+.5*Math.random()).set(1):this},e.inc=function(t){var i=e.status;return i?("number"!==typeof t&&(t=(1-i)*r(Math.random()*i,.1,.95)),i=r(i+t,0,.994),e.set(i)):e.start()},e.trickle=function(){return e.inc(Math.random()*t.trickleRate)},function(){var t=0,r=0;e.promise=function(i){return i&&"resolved"!==i.state()?(0===r&&e.start(),t++,r++,i.always((function(){r--,0===r?(t=0,e.done()):e.set((t-r)/t)})),this):this}}(),e.render=function(r){if(e.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var n=document.createElement("div");n.id="nprogress",n.innerHTML=t.template;var s,o=n.querySelector(t.barSelector),u=r?"-100":i(e.status||0),c=document.querySelector(t.parent);return a(o,{transition:"all 0 linear",transform:"translate3d("+u+"%,0,0)"}),t.showSpinner||(s=n.querySelector(t.spinnerSelector),s&&p(s)),c!=document.body&&l(c,"nprogress-custom-parent"),c.appendChild(n),n},e.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(t.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},e.isRendered=function(){return!!document.getElementById("nprogress")},e.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var s=function(){var e=[];function t(){var r=e.shift();r&&r(t)}return function(r){e.push(r),1==e.length&&t()}}(),a=function(){var e=["Webkit","O","Moz","ms"],t={};function r(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function i(t){var r=document.body.style;if(t in r)return t;var i,n=e.length,s=t.charAt(0).toUpperCase()+t.slice(1);while(n--)if(i=e[n]+s,i in r)return i;return t}function n(e){return e=r(e),t[e]||(t[e]=i(e))}function s(e,t,r){t=n(t),e.style[t]=r}return function(e,t){var r,i,n=arguments;if(2==n.length)for(r in t)i=t[r],void 0!==i&&t.hasOwnProperty(r)&&s(e,r,i);else s(e,n[1],n[2])}}();function o(e,t){var r="string"==typeof e?e:c(e);return r.indexOf(" "+t+" ")>=0}function l(e,t){var r=c(e),i=r+t;o(r,t)||(e.className=i.substring(1))}function u(e,t){var r,i=c(e);o(e,t)&&(r=i.replace(" "+t+" "," "),e.className=r.substring(1,r.length-1))}function c(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return e}))},3550:function(e,t,r){"use strict";r.d(t,{EY:function(){return m},Fb:function(){return n},GI:function(){return a},JI:function(){return c},Js:function(){return l},Mo:function(){return p},S6:function(){return o},X2:function(){return s},YA:function(){return d},q8:function(){return h},xr:function(){return u},zB:function(){return f}});var i=r(8430);function n(e){return(0,i.Z)({url:"/api/supplier",method:"get",params:e})}function s(e){return(0,i.Z)({url:`/api/supplier/${e}`,method:"delete"})}function a(e){return(0,i.Z)({url:"/api/supplier",method:"post",data:e})}function o(e,t){return(0,i.Z)({url:`/api/supplier/${e}`,method:"patch",data:t})}function l(e){return(0,i.Z)({url:"/api/supplier/purchase_record",method:"get",params:e})}function u(e){return(0,i.Z)({url:"/api/supplier/purchase_record",method:"post",data:e})}function c(e,t){return(0,i.Z)({url:`/api/supplier/purchase_record/${e}`,method:"patch",data:t})}function p(e){return(0,i.Z)({url:"/api/supplier/loss_record",method:"get",params:e})}function d(e){return(0,i.Z)({url:"/api/supplier/loss_record",method:"post",data:e})}function m(e,t){return(0,i.Z)({url:`/api/supplier/loss_record/${e}`,method:"patch",data:t})}function f(e){return(0,i.Z)({url:"/api/supplier/daily_stock_record",method:"get",params:e})}function h(e){return(0,i.Z)({url:"/api/supplier/daily_stock_record",method:"post",data:e})}},2900:function(e,t,r){"use strict";r.d(t,{A0:function(){return c},AX:function(){return l},Lh:function(){return s},RF:function(){return a},Uy:function(){return n},f7:function(){return o},nO:function(){return u}});var i=r(8430);function n(){return(0,i.Z)({url:"/api/roles",method:"get"})}function s(e){return(0,i.Z)({url:"/api/users",method:"get",params:e})}function a(e){return(0,i.Z)({url:"/api/users",method:"post",data:e})}function o(e){return(0,i.Z)({url:`/api/users/${e}`,method:"get"})}function l(e,t){return(0,i.Z)({url:`/api/users/${e}`,method:"patch",data:t})}function u(e){return(0,i.Z)({url:"/api/website_message",method:"get",params:e})}function c(e,t){return(0,i.Z)({url:`/api/website_message/${e}`,method:"patch",data:t})}},3695:function(e,t,r){"use strict";r.d(t,{LP:function(){return n},gy:function(){return s}});const i="admin_token";function n(){return localStorage.getItem("token")}function s(){return localStorage.removeItem(i)}},8430:function(e,t,r){"use strict";var i=r(9669),n=r.n(i),s=r(3695),a=r(4865),o=r.n(a),l=r(4720),u=n().create({timeout:36e4});u.interceptors.request.use((e=>(e.headers.Authorization="Bearer "+(0,s.LP)(),o().start(),e)),(e=>Promise.reject(e))),u.interceptors.response.use((e=>{o().done();const t=e.status;if(200===t||201===t)return e}),(e=>(o().done(),400===e.response.status&&(0,l.Message)({message:e.response.data.errorMessage,type:"error"}),500===e.response.status&&(0,l.Message)({message:e.response.data.message,type:"error"}),Promise.reject(e)))),t.Z=u}}]);
|
||
//# sourceMappingURL=491.4d520d7a.js.map
|