(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:'