(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[630],{8630:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return c}});var r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"pageBox"},[e("el-card",[e("div",{staticClass:"opaBox"},[e("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:t.handAdd}},[t._v("新增")]),e("el-button",{attrs:{type:"primary",icon:"el-icon-refresh"},on:{click:function(e){return t.syncShopStock("all")}}},[t._v("同步所有店铺库存")])],1),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{border:"",data:t.tableData}},[e("el-table-column",{attrs:{prop:"name",label:"店铺名称"}}),e("el-table-column",{attrs:{prop:"plat_id",label:"所属平台"}}),e("el-table-column",{attrs:{prop:"owner_id",label:"商家店铺id"}}),e("el-table-column",{attrs:{prop:"refresh_token_expires_at",label:"授权过期时间点"}}),e("el-table-column",{attrs:{label:"成本变动"},scopedSlots:t._u([{key:"default",fn:function(n){return[e("el-input",{attrs:{placeholder:"成本变动"},on:{change:function(e){return t.handleCellChange(n.row)}},model:{value:n.row.ratio,callback:function(e){t.$set(n.row,"ratio",e)},expression:"scope.row.ratio"}})]}}])}),e("el-table-column",{attrs:{label:"操作",width:"280"},scopedSlots:t._u([{key:"default",fn:function(n){return["未授权"===n.row.status?e("el-button",{attrs:{type:"danger",size:"mini"}},[e("a",{attrs:{href:n.row.authUrl,target:"_blank",rel:"noopener noreferrer"}},[t._v("授权")])]):t._e(),"已授权"===n.row.status?e("div",[e("el-button",{attrs:{type:"success",disabled:!0,size:"mini"}},[t._v(t._s(n.row.status))]),e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t.download(n.row)}}},[t._v("下载商品")]),"已授权"===n.row.status?e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.syncShopStock(n.row.id)}}},[t._v("同步库存")]):t._e()],1):t._e(),"重新授权"===n.row.status?e("div",[e("el-button",{attrs:{type:"danger",target:"_blank",size:"mini"}},[e("a",{attrs:{href:n.row.authUrl,rel:"noopener noreferrer"}},[t._v("重新授权")])]),e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t.download(n.row)}}},[t._v("下载商品")])],1):t._e(),"无需授权"===n.row.status?e("div",[e("el-button",{attrs:{type:"success",disabled:!0,size:"mini"}},[t._v(t._s(n.row.status))])],1):t._e()]}}])})],1),e("div",{staticClass:"page-pagination"},[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),e("el-dialog",{attrs:{title:"新增店铺",visible:t.dialogFormVisible,"close-on-click-modal":!1,width:"20%"},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[e("el-form",{ref:"form",attrs:{rules:t.rules,model:t.form,"lable-width":"80px"}},[e("el-form-item",{attrs:{label:"店铺名称"}},[e("el-input",{staticStyle:{width:"400px"},attrs:{placeholder:"输入店铺名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),e("el-form-item",{attrs:{label:"店铺平台"}},[e("el-select",{staticStyle:{width:"400px"},attrs:{placeholder:"输入店铺平台"},model:{value:t.form.plat_id,callback:function(e){t.$set(t.form,"plat_id",e)},expression:"form.plat_id"}},t._l(t.storeId,(function(t,n){return e("el-option",{key:n,attrs:{label:t,value:n}})})),1)],1),e("el-form-item",{attrs:{label:"成本变动"}},[e("el-input",{staticStyle:{width:"400px"},attrs:{placeholder:"成本变动"},model:{value:t.form.ratio,callback:function(e){t.$set(t.form,"ratio",e)},expression:"form.ratio"}})],1)],1),e("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.addSubmit}},[t._v("确 定")])],1)],1)],1)},o=[],a=n(9998),s={data(){return{dialogFormVisible:!1,form:{name:"",plat_id:"",ratio:"*1"},rules:{name:[{required:!0,message:"请输入店铺名称",trigger:"blur"}],plat_id:[{required:!0,message:"请选择店铺平台",trigger:"blur"}],ratio:[{required:!0,message:"请输入成本变动",trigger:"blur"}]},storeId:[],loading:!0,tableData:[],Paginationdata:{},current_page:1,per_page:15}},mounted(){this.getStoreList()},methods:{handAdd(){this.form.name="",this.form.plat_id="",this.dialogFormVisible=!0,this.getshop()},addSubmit(){const t=this.form;(0,a.$i)(t).then((t=>{200==t.status&&this.$message({type:"success",message:"添加成功"}),this.getStoreList()})),this.dialogFormVisible=!1},getStoreList(){let t={page:this.current_page,per_page:this.per_page};(0,a.nH)(t).then((t=>{this.tableData=t.data.data,this.Paginationdata=t.data.meta})),this.loading=!1},handleSizeChange(t){this.per_page=t,this.getStoreList()},handleCurrentChange(t){this.current_page=t,this.getStoreList()},getshop(){(0,a.hA)().then((t=>{this.storeId=t.data.data}))},download(t){const e=this.$loading({lock:!0,text:t.name+" 店铺商品下载中...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});(0,a.rV)(t.id).then((t=>{e.close(),this.$message({type:"success",message:t.data.message})}))},handleCellChange(t){this.$confirm("确认修改成本变动吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{(0,a.ow)(t.id,{ratio:t.ratio}).then((t=>{this.$message({type:"info",message:t.data.message})}))}))},syncShopStock(t){let e=this.$loading({lock:!0,text:"店铺商品库存同步中...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});(0,a._d)({shop_id:t}).then((t=>{e.close(),this.$message({type:"info",message:t.data.message})}))}}},i=s,l=n(1001),u=(0,l.Z)(i,r,o,!1,null,"bec75ba2",null),c=u.exports},4865:function(t,e,n){var r,o; /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress * @license MIT */(function(a,s){r=s,o="function"===typeof r?r.call(e,n,e,t):r,void 0===o||(t.exports=o)})(0,(function(){var t={version:"0.2.0"},e=t.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:'
'};function n(t,e,n){return tn?n:t}function r(t){return 100*(-1+t)}function o(t,n,o){var a;return a="translate3d"===e.positionUsing?{transform:"translate3d("+r(t)+"%,0,0)"}:"translate"===e.positionUsing?{transform:"translate("+r(t)+"%,0)"}:{"margin-left":r(t)+"%"},a.transition="all "+n+"ms "+o,a}t.configure=function(t){var n,r;for(n in t)r=t[n],void 0!==r&&t.hasOwnProperty(n)&&(e[n]=r);return this},t.status=null,t.set=function(r){var i=t.isStarted();r=n(r,e.minimum,1),t.status=1===r?null:r;var l=t.render(!i),u=l.querySelector(e.barSelector),c=e.speed,d=e.easing;return l.offsetWidth,a((function(n){""===e.positionUsing&&(e.positionUsing=t.getPositioningCSS()),s(u,o(r,c,d)),1===r?(s(l,{transition:"none",opacity:1}),l.offsetWidth,setTimeout((function(){s(l,{transition:"all "+c+"ms linear",opacity:0}),setTimeout((function(){t.remove(),n()}),c)}),c)):setTimeout(n,c)})),this},t.isStarted=function(){return"number"===typeof t.status},t.start=function(){t.status||t.set(0);var n=function(){setTimeout((function(){t.status&&(t.trickle(),n())}),e.trickleSpeed)};return e.trickle&&n(),this},t.done=function(e){return e||t.status?t.inc(.3+.5*Math.random()).set(1):this},t.inc=function(e){var r=t.status;return r?("number"!==typeof e&&(e=(1-r)*n(Math.random()*r,.1,.95)),r=n(r+e,0,.994),t.set(r)):t.start()},t.trickle=function(){return t.inc(Math.random()*e.trickleRate)},function(){var e=0,n=0;t.promise=function(r){return r&&"resolved"!==r.state()?(0===n&&t.start(),e++,n++,r.always((function(){n--,0===n?(e=0,t.done()):t.set((e-n)/e)})),this):this}}(),t.render=function(n){if(t.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var o=document.createElement("div");o.id="nprogress",o.innerHTML=e.template;var a,i=o.querySelector(e.barSelector),u=n?"-100":r(t.status||0),c=document.querySelector(e.parent);return s(i,{transition:"all 0 linear",transform:"translate3d("+u+"%,0,0)"}),e.showSpinner||(a=o.querySelector(e.spinnerSelector),a&&d(a)),c!=document.body&&l(c,"nprogress-custom-parent"),c.appendChild(o),o},t.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(e.parent),"nprogress-custom-parent");var t=document.getElementById("nprogress");t&&d(t)},t.isRendered=function(){return!!document.getElementById("nprogress")},t.getPositioningCSS=function(){var t=document.body.style,e="WebkitTransform"in t?"Webkit":"MozTransform"in t?"Moz":"msTransform"in t?"ms":"OTransform"in t?"O":"";return e+"Perspective"in t?"translate3d":e+"Transform"in t?"translate":"margin"};var a=function(){var t=[];function e(){var n=t.shift();n&&n(e)}return function(n){t.push(n),1==t.length&&e()}}(),s=function(){var t=["Webkit","O","Moz","ms"],e={};function n(t){return t.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(t,e){return e.toUpperCase()}))}function r(e){var n=document.body.style;if(e in n)return e;var r,o=t.length,a=e.charAt(0).toUpperCase()+e.slice(1);while(o--)if(r=t[o]+a,r in n)return r;return e}function o(t){return t=n(t),e[t]||(e[t]=r(t))}function a(t,e,n){e=o(e),t.style[e]=n}return function(t,e){var n,r,o=arguments;if(2==o.length)for(n in e)r=e[n],void 0!==r&&e.hasOwnProperty(n)&&a(t,n,r);else a(t,o[1],o[2])}}();function i(t,e){var n="string"==typeof t?t:c(t);return n.indexOf(" "+e+" ")>=0}function l(t,e){var n=c(t),r=n+e;i(n,e)||(t.className=r.substring(1))}function u(t,e){var n,r=c(t);i(t,e)&&(n=r.replace(" "+e+" "," "),t.className=n.substring(1,n.length-1))}function c(t){return(" "+(t.className||"")+" ").replace(/\s+/gi," ")}function d(t){t&&t.parentNode&&t.parentNode.removeChild(t)}return t}))},9998:function(t,e,n){"use strict";n.d(e,{$i:function(){return a},OV:function(){return c},Vq:function(){return p},_d:function(){return u},dT:function(){return m},hA:function(){return o},nH:function(){return s},ow:function(){return l},rV:function(){return i},tA:function(){return d}});var r=n(8430);function o(){return(0,r.Z)({url:"/api/shop_platforms",method:"get"})}function a(t){return(0,r.Z)({url:"/api/shops",method:"post",data:t})}function s(t){return(0,r.Z)({url:"/api/shops",method:"get",params:t})}function i(t){return(0,r.Z)({url:`/api/download/${t}/goods`,method:"get"})}function l(t,e){return(0,r.Z)({url:`/api/shops/${t}`,method:"patch",params:e})}function u(t){return(0,r.Z)({url:"/api/sync/shop/stock",method:"put",params:t})}function c(){return(0,r.Z)({url:"/api/shop/ship",method:"get"})}function d(t,e){return(0,r.Z)({url:"/api/shop/ship/senders",method:"get",params:{shop_id:t,shop_ship_id:e}})}function p(t){return(0,r.Z)({url:"/api/shop/ship/senders",method:"post",params:t})}function m(t){return(0,r.Z)({url:"/api/order/reset",method:"get"})}},3695:function(t,e,n){"use strict";n.d(e,{LP:function(){return o},gy:function(){return a}});const r="admin_token";function o(){return localStorage.getItem("token")}function a(){return localStorage.removeItem(r)}},8430:function(t,e,n){"use strict";var r=n(9669),o=n.n(r),a=n(3695),s=n(4865),i=n.n(s),l=n(4720),u=o().create({timeout:36e4});u.interceptors.request.use((t=>(t.headers.Authorization="Bearer "+(0,a.LP)(),i().start(),t)),(t=>Promise.reject(t))),u.interceptors.response.use((t=>{i().done();const e=t.status;if(200===e||201===e)return t}),(t=>(i().done(),400===t.response.status&&(0,l.Message)({message:t.response.data.errorMessage,type:"error"}),500===t.response.status&&(0,l.Message)({message:t.response.data.message,type:"error"}),Promise.reject(t)))),e.Z=u}}]); //# sourceMappingURL=630.206e68e1.js.map