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