2 lines
6.9 KiB
JavaScript
Vendored
2 lines
6.9 KiB
JavaScript
Vendored
"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[43],{8630:function(t,e,a){a.r(e),a.d(e,{default:function(){return d}});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(a){return[e("el-input",{attrs:{placeholder:"成本变动"},on:{change:function(e){return t.handleCellChange(a.row)}},model:{value:a.row.ratio,callback:function(e){t.$set(a.row,"ratio",e)},expression:"scope.row.ratio"}})]}}])}),e("el-table-column",{attrs:{label:"操作",width:"280"},scopedSlots:t._u([{key:"default",fn:function(a){return["未授权"===a.row.status?e("el-button",{attrs:{type:"danger",size:"mini"}},[e("a",{attrs:{href:a.row.authUrl,target:"_blank",rel:"noopener noreferrer"}},[t._v("授权")])]):t._e(),"已授权"===a.row.status?e("div",[e("el-button",{attrs:{type:"success",disabled:!0,size:"mini"}},[t._v(t._s(a.row.status))]),e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t.download(a.row)}}},[t._v("下载商品")]),"已授权"===a.row.status?e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.syncShopStock(a.row.id)}}},[t._v("同步库存")]):t._e()],1):t._e(),"重新授权"===a.row.status?e("div",[e("el-button",{attrs:{type:"danger",target:"_blank",size:"mini"}},[e("a",{attrs:{href:a.row.authUrl,rel:"noopener noreferrer"}},[t._v("重新授权")])]),e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t.download(a.row)}}},[t._v("下载商品")])],1):t._e(),"无需授权"===a.row.status?e("div",[e("el-button",{attrs:{type:"success",disabled:!0,size:"mini"}},[t._v(t._s(a.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,a){return e("el-option",{key:a,attrs:{label:t,value:a}})})),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=[],n=a(9998),i={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,n.$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,n.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,n.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,n.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,n.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,n._d)({shop_id:t}).then((t=>{e.close(),this.$message({type:"info",message:t.data.message})}))}}},s=i,l=a(1001),u=(0,l.Z)(s,r,o,!1,null,"bec75ba2",null),d=u.exports},9998:function(t,e,a){a.d(e,{$i:function(){return n},OV:function(){return d},Vq:function(){return p},_d:function(){return u},dT:function(){return h},hA:function(){return o},nH:function(){return i},ow:function(){return l},rV:function(){return s},tA:function(){return c}});var r=a(8430);function o(){return(0,r.Z)({url:"/api/shop_platforms",method:"get"})}function n(t){return(0,r.Z)({url:"/api/shops",method:"post",data:t})}function i(t){return(0,r.Z)({url:"/api/shops",method:"get",params:t})}function s(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 d(){return(0,r.Z)({url:"/api/shop/ship",method:"get"})}function c(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 h(t){return(0,r.Z)({url:"/api/order/reset",method:"get"})}}}]);
|
|
//# sourceMappingURL=43.a6a8b65f.js.map
|