(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[401],{1401:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return c}});var n=function(){var t=this,e=t._self._c;return e("div",{staticClass:"conent"},[e("el-button",{attrs:{type:"success"},on:{click:t.handAdd}},[t._v("新增")]),e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.syncShopStock("all")}}},[t._v("同步所有店铺库存")]),e("div",{staticClass:"table",staticStyle:{"margin-top":"10px"}},[e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{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(r){return[e("el-input",{attrs:{placeholder:"成本变动"},on:{change:function(e){return t.handleCellChange(r.row)}},model:{value:r.row.ratio,callback:function(e){t.$set(r.row,"ratio",e)},expression:"scope.row.ratio"}})]}}])}),e("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(r){return["未授权"===r.row.status?e("el-button",{attrs:{type:"danger",size:"small"}},[e("a",{attrs:{href:r.row.authUrl,target:"_blank",rel:"noopener noreferrer"}},[t._v("授权")])]):t._e(),"已授权"===r.row.status?e("div",[e("el-button",{attrs:{type:"success",disabled:!0,size:"small"}},[t._v(t._s(r.row.status))]),e("el-button",{attrs:{size:"small"},on:{click:function(e){return t.download(r.row)}}},[t._v("下载商品")]),"已授权"===r.row.status?e("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(e){return t.syncShopStock(r.row.id)}}},[t._v("同步库存")]):t._e()],1):t._e(),"重新授权"===r.row.status?e("div",[e("el-button",{attrs:{type:"danger",target:"_blank",size:"small"}},[e("a",{attrs:{href:r.row.authUrl,rel:"noopener noreferrer"}},[t._v("重新授权")])]),e("el-button",{attrs:{size:"small"},on:{click:function(e){return t.download(r.row)}}},[t._v("下载商品")])],1):t._e(),"无需授权"===r.row.status?e("div",[e("el-button",{attrs:{type:"success",disabled:!0,size:"small"}},[t._v(t._s(r.row.status))])],1):t._e()]}}])})],1)],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),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,r){return e("el-option",{key:r,attrs:{label:t,value:r}})})),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)},s=[],a=r(2978),o={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.UB)(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.CZ)(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.G)().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.v7)(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.fF)(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.TS)({shop_id:t}).then((t=>{e.close(),this.$message({type:"info",message:t.data.message})}))}}},i=o,l=r(1656),u=(0,l.A)(i,n,s,!1,null,"61aedda5",null),c=u.exports},2978:function(t,e,r){"use strict";r.d(e,{CZ:function(){return o},G:function(){return s},TL:function(){return m},TS:function(){return u},UB:function(){return a},Zt:function(){return c},fF:function(){return l},uY:function(){return d},v7:function(){return i},wI:function(){return p}});var n=r(802);function s(){return(0,n.A)({url:"/api/shop_platforms",method:"get"})}function a(t){return(0,n.A)({url:"/api/shops",method:"post",data:t})}function o(t){return(0,n.A)({url:"/api/shops",method:"get",params:t})}function i(t){return(0,n.A)({url:`/api/download/${t}/goods`,method:"get"})}function l(t,e){return(0,n.A)({url:`/api/shops/${t}`,method:"patch",params:e})}function u(t){return(0,n.A)({url:"/api/sync/shop/stock",method:"put",params:t})}function c(){return(0,n.A)({url:"/api/shop/ship",method:"get"})}function d(t,e){return(0,n.A)({url:"/api/shop/ship/senders",method:"get",params:{shop_id:t,shop_ship_id:e}})}function p(t){return(0,n.A)({url:"/api/shop/ship/senders",method:"post",params:t})}function m(t){return(0,n.A)({url:"/api/order/reset",method:"get"})}},5272:function(t,e,r){"use strict";r.d(e,{eF:function(){return a},gf:function(){return s}});const n="admin_token";function s(){return localStorage.getItem("token")}function a(){return localStorage.removeItem(n)}},802:function(t,e,r){"use strict";var n=r(2505),s=r.n(n),a=r(5272),o=r(5947),i=r.n(o),l=r(1052),u=s().create({timeout:36e4});u.interceptors.request.use((t=>(t.headers.Authorization="Bearer "+(0,a.gf)(),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.A=u},5947:function(t,e,r){var n,s; /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress * @license MIT */(function(a,o){n=o,s="function"===typeof n?n.call(e,r,e,t):n,void 0===s||(t.exports=s)})(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 r(t,e,r){return tr?r:t}function n(t){return 100*(-1+t)}function s(t,r,s){var a;return a="translate3d"===e.positionUsing?{transform:"translate3d("+n(t)+"%,0,0)"}:"translate"===e.positionUsing?{transform:"translate("+n(t)+"%,0)"}:{"margin-left":n(t)+"%"},a.transition="all "+r+"ms "+s,a}t.configure=function(t){var r,n;for(r in t)n=t[r],void 0!==n&&t.hasOwnProperty(r)&&(e[r]=n);return this},t.status=null,t.set=function(n){var i=t.isStarted();n=r(n,e.minimum,1),t.status=1===n?null:n;var l=t.render(!i),u=l.querySelector(e.barSelector),c=e.speed,d=e.easing;return l.offsetWidth,a((function(r){""===e.positionUsing&&(e.positionUsing=t.getPositioningCSS()),o(u,s(n,c,d)),1===n?(o(l,{transition:"none",opacity:1}),l.offsetWidth,setTimeout((function(){o(l,{transition:"all "+c+"ms linear",opacity:0}),setTimeout((function(){t.remove(),r()}),c)}),c)):setTimeout(r,c)})),this},t.isStarted=function(){return"number"===typeof t.status},t.start=function(){t.status||t.set(0);var r=function(){setTimeout((function(){t.status&&(t.trickle(),r())}),e.trickleSpeed)};return e.trickle&&r(),this},t.done=function(e){return e||t.status?t.inc(.3+.5*Math.random()).set(1):this},t.inc=function(e){var n=t.status;return n?("number"!==typeof e&&(e=(1-n)*r(Math.random()*n,.1,.95)),n=r(n+e,0,.994),t.set(n)):t.start()},t.trickle=function(){return t.inc(Math.random()*e.trickleRate)},function(){var e=0,r=0;t.promise=function(n){return n&&"resolved"!==n.state()?(0===r&&t.start(),e++,r++,n.always((function(){r--,0===r?(e=0,t.done()):t.set((e-r)/e)})),this):this}}(),t.render=function(r){if(t.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var s=document.createElement("div");s.id="nprogress",s.innerHTML=e.template;var a,i=s.querySelector(e.barSelector),u=r?"-100":n(t.status||0),c=document.querySelector(e.parent);return o(i,{transition:"all 0 linear",transform:"translate3d("+u+"%,0,0)"}),e.showSpinner||(a=s.querySelector(e.spinnerSelector),a&&d(a)),c!=document.body&&l(c,"nprogress-custom-parent"),c.appendChild(s),s},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 r=t.shift();r&&r(e)}return function(r){t.push(r),1==t.length&&e()}}(),o=function(){var t=["Webkit","O","Moz","ms"],e={};function r(t){return t.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(t,e){return e.toUpperCase()}))}function n(e){var r=document.body.style;if(e in r)return e;var n,s=t.length,a=e.charAt(0).toUpperCase()+e.slice(1);while(s--)if(n=t[s]+a,n in r)return n;return e}function s(t){return t=r(t),e[t]||(e[t]=n(t))}function a(t,e,r){e=s(e),t.style[e]=r}return function(t,e){var r,n,s=arguments;if(2==s.length)for(r in e)n=e[r],void 0!==n&&e.hasOwnProperty(r)&&a(t,r,n);else a(t,s[1],s[2])}}();function i(t,e){var r="string"==typeof t?t:c(t);return r.indexOf(" "+e+" ")>=0}function l(t,e){var r=c(t),n=r+e;i(r,e)||(t.className=n.substring(1))}function u(t,e){var r,n=c(t);i(t,e)&&(r=n.replace(" "+e+" "," "),t.className=r.substring(1,r.length-1))}function c(t){return(" "+(t.className||"")+" ").replace(/\s+/gi," ")}function d(t){t&&t.parentNode&&t.parentNode.removeChild(t)}return t}))}}]); //# sourceMappingURL=401.bc9b9fe1.js.map