erp/public/dist/js/769.8d06d508.js

2 lines
32 KiB
JavaScript
Vendored

"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[769],{5769:function(t,e,o){o.r(e),o.d(e,{default:function(){return T}});var s=function(){var t=this,e=t._self._c;return e("div",[e("div",{staticClass:"cardBox"},[e("div",{staticClass:"searchBox"},[e("div",{staticClass:"row"},[e("span",[t._v("商品名称:")]),e("el-input",{attrs:{placeholder:"商品名称",clearable:""},model:{value:t.form.goods_title,callback:function(e){t.$set(t.form,"goods_title",e)},expression:"form.goods_title"}})],1),e("div",{staticClass:"row"},[e("span",[t._v("商品品种/品类:")]),e("treeselect",{staticStyle:{width:"200px"},attrs:{options:t.treeList,"disable-branch-nodes":!0,"show-count":!0,normalizer:t.normalizer,placeholder:"请选择品种"},scopedSlots:t._u([{key:"value-label",fn:function({node:o}){return e("div",{},[t._v(t._s(t.parseLabel(o)))])}}]),model:{value:t.form.type_id,callback:function(e){t.$set(t.form,"type_id",e)},expression:"form.type_id"}})],1),e("div",{staticClass:"row"},[e("span",[t._v("商品编码:")]),e("el-input",{attrs:{placeholder:"商品编码",clearable:""},model:{value:t.form.external_sku_id,callback:function(e){t.$set(t.form,"external_sku_id",e)},expression:"form.external_sku_id"}})],1),e("div",{staticClass:"row"},[e("span",[t._v("商品状态:")]),e("el-select",{attrs:{placeholder:"商品状态",clearable:""},model:{value:t.form.status,callback:function(e){t.$set(t.form,"status",e)},expression:"form.status"}},t._l(t.options,(function(t){return e("el-option",{key:t.id,attrs:{label:t.label,value:t.id}})})),1)],1),e("div",{staticClass:"row"},[e("span",[t._v("创建时间:")]),e("el-date-picker",{staticStyle:{width:"250px"},attrs:{type:"datetimerange","range-separator":"至","start-placeholder":"开始时间","end-placeholder":"结束时间",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd",clearable:""},model:{value:t.filterTime,callback:function(e){t.filterTime=e},expression:"filterTime"}})],1),e("div",{staticClass:"row"},[e("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:function(e){return t.handleChoose()}}},[t._v("筛选")]),e("el-button",{attrs:{plain:"",icon:"el-icon-refresh"},on:{click:t.handleReChoose}},[t._v("重置筛选")])],1)])]),e("el-card",[e("div",[e("div",[e("span",[t._v("全部商品(共"+t._s(t.total)+"条)")]),e("div",{staticClass:"btn"},[e("el-button",{attrs:{type:"primary",icon:"el-icon-edit",disabled:!t.chooseList.length},on:{click:t.petchEditStock}},[t._v("批量更新在售库存")]),t.is_admin?e("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:t.addNewgoods}},[t._v("新增商品")]):t._e(),t.is_admin?e("el-button",{attrs:{type:"primary",plain:"",icon:"el-icon-upload2"},on:{click:t.handleImport}},[t._v("在售库存导入")]):t._e(),e("el-button",{attrs:{type:"warning",icon:"el-icon-download"},on:{click:t.handleTypeExport}},[t._v("选择类型导出")]),e("el-button",{attrs:{type:"warning",icon:"el-icon-download"},on:{click:t.handleExport}},[t._v("数据导出")])],1)]),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],ref:"multipleTable",staticClass:"table",staticStyle:{width:"100%"},attrs:{border:"",data:t.tableData,"tooltip-effect":"dark"},on:{"selection-change":t.handleSelectionChange,"sort-change":t.sortChange}},[e("el-table-column",{attrs:{type:"selection",align:"center"}}),e("el-table-column",{attrs:{label:"商品信息",width:"300"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("div",{staticClass:"goodBox flex"},[o.row.goods&&o.row.goods.img_url?e("img",{staticClass:"Img",attrs:{src:o.row.goods.img_url}}):t._e(),e("div",[e("div",{staticClass:"tit"},[t._v(t._s(o.row.name))]),e("p",[t._v(t._s(o.row.external_sku_id))]),e("p",[t._v(t._s(o.row.created_at))])])])]}}])}),e("el-table-column",{attrs:{prop:"cost",label:"成本",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("div",{staticClass:"flex",staticStyle:{"justify-content":"center"}},[t.isShow?e("div",[e("el-input",{model:{value:o.row.cost,callback:function(e){t.$set(o.row,"cost",e)},expression:"scope.row.cost"}})],1):e("span",[t._v(t._s(o.row.cost||0))])])]}}])}),e("el-table-column",{attrs:{prop:"order_goods_num",sortable:"custom",label:"销量",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("span",[t._v(t._s(o.row.order_goods_num))]),0!==o.row.order_detail.length?e("el-popover",{attrs:{placement:"right-start",trigger:"hover"}},[e("div",t._l(o.row.order_detail,(function(o,s){return e("span",{key:s},[e("div",[t._v(t._s(o.shop.name)+":"+t._s(o.number))])])})),0),e("i",{staticClass:"el-icon-view",staticStyle:{"padding-left":"5px"},attrs:{slot:"reference"},slot:"reference"})]):t._e()]}}])}),e("el-table-column",{attrs:{prop:"yesterday_num",label:"实际库存",align:"center"}}),e("el-table-column",{attrs:{prop:"sale_stock",label:"可售库存",sortable:"custom"},scopedSlots:t._u([{key:"default",fn:function(o){return[o.row.edit?e("div",{staticClass:"titBox"},[e("el-input",{staticStyle:{width:"100%"},attrs:{placeholder:"可售库存",size:"mini"},model:{value:o.row.sale_stock,callback:function(e){t.$set(o.row,"sale_stock",e)},expression:"scope.row.sale_stock"}}),e("span",{staticStyle:{color:"#666",cursor:"pointer","font-size":"18px","margin-left":"5px"},on:{click:function(e){return t.cancelEdit(o.row,o.$index)}}},[e("i",{staticClass:"el-icon-close"})]),e("span",{staticStyle:{color:"#409eff",cursor:"pointer","font-size":"18px","margin-left":"5px"},on:{click:function(e){return t.confirmEdit(o.row,o.$index)}}},[e("i",{staticClass:"el-icon-check"})])],1):e("div",[t._v(t._s(o.row.sale_stock)+" "),e("span",{staticStyle:{color:"#409eff","margin-left":"5px",cursor:"pointer","font-size":"15px"},on:{click:function(e){return t.openSaleEdit(o.row,o.$index)}}},[e("i",{staticClass:"el-icon-edit"})])])]}}])}),e("el-table-column",{attrs:{label:"剩余库存",sortable:"custom",align:"center",prop:"stock"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("span",{class:1*o.row.stock<0?"red":""},[t._v(t._s(o.row.stock))])]}}])}),e("el-table-column",{attrs:{prop:"status",label:"状态",align:"center"}}),t.is_admin?e("el-table-column",{attrs:{label:"操作",align:"center",width:"120"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.handleEdit(o.row.id)}}},[t._v("编辑")])]}}],null,!1,1564336291)}):t._e()],1)],1),e("div",{directives:[{name:"show",rawName:"v-show",value:t.isShow||t.stock,expression:"isShow || stock"}],staticClass:"footerBtn"},[e("el-button",{staticClass:"confirmbtn",attrs:{type:"primary"},on:{click:function(e){return t.cancel()}}},[t._v("取消")]),e("el-button",{staticClass:"confirmbtn",attrs:{type:"primary"},on:{click:function(e){return t.onSubmit()}}},[t._v("保存")])],1),e("div",{staticClass:"page-pagination"},[e("el-pagination",{attrs:{"current-page":t.current_page,"page-sizes":[10,30,50,100,200],"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.ejectstock1,width:"30%","close-on-click-modal":!1},on:{"update:visible":function(e){t.ejectstock1=e}}},[e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.ommodityInventory,"tooltip-effect":"dark"}},[e("el-table-column",{attrs:{prop:"two_days_ago_num",label:"2天前库存"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("div",[e("el-input",{attrs:{disabled:!0},model:{value:o.row.two_days_ago_num,callback:function(e){t.$set(o.row,"two_days_ago_num",e)},expression:"scope.row.two_days_ago_num"}}),e("el-input",{model:{value:o.row.two_days_ago_num,callback:function(e){t.$set(o.row,"two_days_ago_num",e)},expression:"scope.row.two_days_ago_num"}})],1)]}}])}),e("el-table-column",{attrs:{prop:"yesterday_num",label:"1天前库存"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("div",[e("el-input",{attrs:{disabled:!0},model:{value:o.row.yesterday_num,callback:function(e){t.$set(o.row,"yesterday_num",e)},expression:"scope.row.yesterday_num"}}),e("el-input",{model:{value:o.row.yesterday_num,callback:function(e){t.$set(o.row,"yesterday_num",e)},expression:"scope.row.yesterday_num"}})],1)]}}])}),e("el-table-column",{attrs:{sortable:"",label:"今日到货"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("div",[e("el-input",{attrs:{disabled:!0},model:{value:o.row.daily.arrived_today_num,callback:function(e){t.$set(o.row.daily,"arrived_today_num",e)},expression:"scope.row.daily.arrived_today_num"}}),e("el-input",{model:{value:o.row.daily.arrived_today_num,callback:function(e){t.$set(o.row.daily,"arrived_today_num",e)},expression:"scope.row.daily.arrived_today_num"}})],1)]}}])})],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){return t.cancelStock()}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.oldStock()}}},[t._v("确 定")])],1)],1),e("el-dialog",{attrs:{title:"提示",visible:t.dialogVisible3,width:"20%","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible3=e}}},[e("span",[t._v("确定要修改售价吗?")]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.dialogVisible3=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.referencePriceRequest()}}},[t._v("确 定")])],1)]),e("el-dialog",{attrs:{title:"提示",visible:t.dialogVisible5,width:"20%","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible5=e}}},[e("span",[t._v("确定要修改目标去化率吗?")]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:t.cancelGoal}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.confirmGoal()}}},[t._v("确 定")])],1)]),e("el-dialog",{attrs:{title:"表格导出",visible:t.Tableexport,width:"30%","close-on-click-modal":!1},on:{"update:visible":function(e){t.Tableexport=e}}},[e("div",[e("span",[t._v("选择:")]),[e("el-select",{attrs:{placeholder:"盘点表/成本表/周数据"},model:{value:t.value,callback:function(e){t.value=e},expression:"value"}},t._l(t.options2,(function(t){return e("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1)]],2),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.Tableexport=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.derivation()}}},[t._v("确 定")])],1)]),e("el-dialog",{ref:"drawer",attrs:{title:"在售库存导入",visible:t.docImportDrawer,direction:"rtl","custom-class":"demo-drawer",width:"450px","close-on-click-modal":!1},on:{"update:visible":function(e){t.docImportDrawer=e},close:function(e){t.importForm.imFileList=[]}}},[e("div",{staticClass:"demo-drawer__content"},[e("el-upload",{ref:"aupload",staticClass:"upload-demo",attrs:{action:"",limit:1,drag:"",accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel","file-list":t.importForm.fileList,"auto-upload":!1,"on-change":t.importFileChange}},[e("i",{staticClass:"el-icon-upload"}),e("div",{staticClass:"el-upload__text"},[t._v("将文件拖到此处,或"),e("em",[t._v("点击上传")])])])],1),e("div",{staticClass:"import-right"},[e("el-button",{attrs:{size:"medium",type:"text"}},[e("a",{attrs:{href:"/goods/import/template"}},[t._v("下载模板")])])],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.docImportDrawer=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.saveUpload}},[t._v("上 传")])],1)]),e("el-dialog",{attrs:{title:"可售库存",visible:t.showUpdate,width:"600px"},on:{"update:visible":function(e){t.showUpdate=e}}},[e("div",{},[e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.chooseList,border:""}},[e("el-table-column",{attrs:{label:"商品信息"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("div",{staticClass:"goodBox flex"},[o.row.goods&&o.row.goods.img_url?e("img",{staticClass:"Img",attrs:{src:o.row.goods.img_url}}):t._e(),e("div",[e("div",{staticClass:"tit"},[t._v(t._s(o.row.name))]),e("p",[t._v(t._s(o.row.external_sku_id))])])])]}}])}),e("el-table-column",{attrs:{label:"可售库存",width:"200"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input",{model:{value:o.row.sale_stock,callback:function(e){t.$set(o.row,"sale_stock",e)},expression:"scope.row.sale_stock"}})]}}])})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.showUpdate=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary",loading:t.commitLoading},on:{click:function(e){return t.commitPetchStock()}}},[t._v("更 新")])],1)]),e("add-goods",{attrs:{show:t.showAdd},on:{close:function(e){t.showAdd=!1},complete:t.refreshList}}),e("edit-goods",{attrs:{show:t.showEdit,id:t.curId},on:{close:function(e){t.showEdit=!1},complete:t.refreshList}})],1)},i=[],a=(o(560),o(9669)),l=o.n(a),n=o(2346),r=o(9036),d=o(9998),c=o(4301),u=o.n(c),p=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{visible:t.show,title:"新增商品",width:"900px","close-on-click-modal":!1},on:{"update:visible":function(e){t.show=e},close:t.closeDialog}},[e("el-form",{attrs:{"label-width":"120px",inline:!0}},[e("el-form-item",{attrs:{label:"商品品种/品类:"}},[e("treeselect",{staticStyle:{width:"200px"},attrs:{options:t.treeList,"disable-branch-nodes":!0,"show-count":!0,normalizer:t.normalizer,placeholder:"请选择品种"},scopedSlots:t._u([{key:"value-label",fn:function({node:o}){return e("div",{},[t._v(t._s(t.parseLabel(o)))])}}]),model:{value:t.type_id,callback:function(e){t.type_id=e},expression:"type_id"}})],1),t._l(t.skus,(function(o,s){return e("div",{key:s,staticClass:"skuBox"},[e("div",{staticClass:"tit"},[t._v("规格"+t._s(s+1))]),e("el-form-item",{attrs:{label:"规格名称:"}},[e("el-input",{attrs:{placeholder:"规格名称"},model:{value:o.title,callback:function(e){t.$set(o,"title",e)},expression:"item.title"}})],1),e("el-form-item",{attrs:{label:"颜色/特性:"}},[e("el-input",{attrs:{placeholder:"颜色/特性"},model:{value:o.attribute,callback:function(e){t.$set(o,"attribute",e)},expression:"item.attribute"}})],1),e("el-form-item",{attrs:{label:"商品状态:"}},[e("el-select",{staticStyle:{width:"200px"},attrs:{placeholder:"下架(默认)"},model:{value:o.status,callback:function(e){t.$set(o,"status",e)},expression:"item.status"}},t._l(t.options,(function(t){return e("el-option",{key:t.id,attrs:{label:t.label,value:t.id}})})),1)],1),e("el-form-item",{attrs:{label:"商品成本:"}},[e("el-input",{attrs:{placeholder:"商品成本"},model:{value:o.cost,callback:function(e){t.$set(o,"cost",e)},expression:"item.cost"}})],1),e("div",[e("el-form-item",{attrs:{label:"可售库存:"}},[e("el-input",{attrs:{placeholder:"可售库存"},model:{value:o.sale_stock,callback:function(e){t.$set(o,"sale_stock",e)},expression:"item.sale_stock"}})],1),e("el-form-item",{attrs:{label:"最终编码:"}},[e("el-input",{attrs:{placeholder:"不输入自动生成"},model:{value:o.external_sku_id,callback:function(e){t.$set(o,"external_sku_id",e)},expression:"item.external_sku_id"}})],1),e("el-form-item",{attrs:{label:""}},[e("el-button",{attrs:{type:"danger",size:"mini",icon:"el-icon-delete"},on:{click:function(e){return t.handleDelete(s)}}},[t._v("删除")])],1)],1)],1)})),e("div",[e("el-form-item",[e("el-button",{attrs:{type:"success",icon:"el-icon-plus"},on:{click:function(e){return t.toAddSku()}}},[t._v("增加规格")])],1)],1)],2),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{attrs:{type:"primary",loading:t.loading},on:{click:function(e){return t.handleSave()}}},[t._v("保存")]),e("el-button",{attrs:{plain:""},on:{click:function(e){return t.cancel()}}},[t._v("取消")])],1)],1)},h=[],m={components:{Treeselect:u()},props:{show:{type:Boolean,default:()=>!1}},data(){return{showDialog:!1,treeList:[],skus:[],type_id:null,options:[{id:0,label:"下架"},{id:1,label:"在售"}],loading:!1}},methods:{getGoodsTypes(){let t={parent_id:0};(0,n.Ci)(t).then((t=>{this.treeList=JSON.parse(JSON.stringify(t.data.data).replace(/name/g,"label"))}))},handleSave(){this.loading=!0;let t=this.skus,e={type_id:this.type_id||"",goods_id:"",skus:t};(0,r.Rq)(e).then((t=>{this.$message({message:"商品添加成功!",type:"success"}),this.loading=!1,this.closeDialog(),this.$emit("complete")})).catch((()=>{this.loading=!1}))},toAddSku(){this.type_id?this.handleAdd():this.$message({message:"请选择商品品种/品类",type:"error"})},handleAdd(){let t={title:"",external_sku_id:"",status:0,num:0,cost:0,sale_stock:9999,reserve:0,attribute:""};this.skus.push(t)},handleDelete(t){this.skus.splice(t,1)},cancel(){this.closeDialog()},normalizer(t){return(!t.children||t.children&&0==t.children.length)&&1==t.level&&(t.isDisabled=!0),t},parseLabel(t){let e="";return e+=t.parentNode?t.parentNode.label+" / ":"",e+=t.raw?t.raw.label:"",e},closeDialog(){this.showDialog=!1,this.$emit("close")}},watch:{show:{handler(t,e){t&&(this.skus=[],this.showDialog=!0,this.handleAdd(),this.getGoodsTypes())},deep:!0,immediate:!0}}},_=m,f=o(1001),g=(0,f.Z)(_,p,h,!1,null,"4de310da",null),b=g.exports,y=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{visible:t.show,title:"编辑商品",width:"900px","close-on-click-modal":!1},on:{"update:visible":function(e){t.show=e},close:t.closeDialog}},[e("el-form",{attrs:{"label-width":"120px",inline:!0}},[e("el-form-item",{attrs:{label:"商品品种/品类:"}},[e("treeselect",{staticStyle:{width:"200px"},attrs:{options:t.treeList,"disable-branch-nodes":!0,"show-count":!0,normalizer:t.normalizer,placeholder:"请选择品种"},scopedSlots:t._u([{key:"value-label",fn:function({node:o}){return e("div",{},[t._v(t._s(t.parseLabel(o)))])}}]),model:{value:t.goodsInfo.goods.type_id,callback:function(e){t.$set(t.goodsInfo.goods,"type_id",e)},expression:"goodsInfo.goods.type_id"}})],1),e("el-form-item",{attrs:{label:"规格名称:"}},[e("el-input",{attrs:{placeholder:"规格名称"},model:{value:t.goodsInfo.title,callback:function(e){t.$set(t.goodsInfo,"title",e)},expression:"goodsInfo.title"}})],1),e("el-form-item",{attrs:{label:"最终编码:"}},[e("el-input",{attrs:{placeholder:"不输入自动生成",disabled:""},model:{value:t.goodsInfo.external_sku_id,callback:function(e){t.$set(t.goodsInfo,"external_sku_id",e)},expression:"goodsInfo.external_sku_id"}})],1),e("el-form-item",{attrs:{label:"颜色/特性:"}},[e("el-input",{attrs:{placeholder:"颜色/特性"},model:{value:t.goodsInfo.attribute,callback:function(e){t.$set(t.goodsInfo,"attribute",e)},expression:"goodsInfo.attribute"}})],1),e("el-form-item",{attrs:{label:"商品状态:"}},[e("el-select",{staticStyle:{width:"200px"},attrs:{placeholder:"下架(默认)"},model:{value:t.goodsInfo.status,callback:function(e){t.$set(t.goodsInfo,"status",e)},expression:"goodsInfo.status"}},t._l(t.options,(function(t){return e("el-option",{key:t.id,attrs:{label:t.label,value:t.id}})})),1)],1),e("el-form-item",{attrs:{label:"商品成本:"}},[e("el-input",{attrs:{placeholder:"商品成本"},model:{value:t.goodsInfo.cost,callback:function(e){t.$set(t.goodsInfo,"cost",e)},expression:"goodsInfo.cost"}})],1),e("el-form-item",{attrs:{label:"在售库存:"}},[e("el-input",{attrs:{placeholder:"可售库存"},model:{value:t.goodsInfo.sale_stock,callback:function(e){t.$set(t.goodsInfo,"sale_stock",e)},expression:"goodsInfo.sale_stock"}})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{attrs:{type:"primary",loading:t.loading},on:{click:function(e){return t.handleSave()}}},[t._v("保存")]),e("el-button",{attrs:{plain:""},on:{click:function(e){return t.cancel()}}},[t._v("取消")])],1)],1)},v=[],k={components:{Treeselect:u()},props:{show:{type:Boolean,default:()=>!1},id:{type:Number,default:()=>0}},data(){return{goods_id:0,showDialog:!1,treeList:[],skus:[],type_id:null,options:[{id:"下架",label:"下架"},{id:"在售",label:"在售"}],loading:!1,goodsInfo:{goods:{type_id:null}}}},methods:{getGoodsTypes(){let t={parent_id:0};(0,n.Ci)(t).then((t=>{this.treeList=JSON.parse(JSON.stringify(t.data.data).replace(/name/g,"label"))}))},handleSave(){this.loading=!0;let t={title:this.goodsInfo.goods.title,img_url:this.goodsInfo.goods.img_url,type_id:this.goodsInfo.goods.type_id||"",brand_id:this.goodsInfo.goods.brand_id,goods_code:this.goodsInfo.goods.goods_code},e={title:this.goodsInfo.title,external_sku_id:this.goodsInfo.external_sku_id,status:this.goodsInfo.status,num:this.goodsInfo.num,cost:this.goodsInfo.cost,sale_stock:this.goodsInfo.sale_stock,thumb_url:this.goodsInfo.thumb_url,attribute:this.goodsInfo.attribute};"下架"==e.status?e.status=0:"在售"==e.status&&(e.status=1);let o={goods_id:this.goodsInfo.goods_id,goods:t,sku:e};(0,r.e3)(this.goods_id,o).then((t=>{this.$message({type:"success",message:"编辑成功"}),this.loading=!1,this.closeDialog(),this.$emit("complete")})).catch((()=>{this.loading=!1}))},getGoodsInfo(){(0,r.rQ)(this.goods_id).then((t=>{this.goodsInfo=t.data.data,this.goodsInfo.goods.type_id=this.goodsInfo.goods.type_id||null}))},cancel(){this.closeDialog()},normalizer(t){return(!t.children||t.children&&0==t.children.length)&&1==t.level&&(t.isDisabled=!0),t},parseLabel(t){let e="";return e+=t.parentNode?t.parentNode.label+" / ":"",e+=t.raw?t.raw.label:"",e},closeDialog(){this.showDialog=!1,this.$emit("close")}},watch:{id(t,e){this.goods_id=t},show(t,e){t&&(this.showDialog=!0,this.getGoodsInfo(),this.getGoodsTypes())}}},w=k,x=(0,f.Z)(w,y,v,!1,null,"3dbf163e",null),S=x.exports,I={components:{Treeselect:u(),addGoods:b,editGoods:S},data(){return{editPriceId:"",editGoalId:"",total:0,rose_num:0,other_num:0,radio:"",brand:[],treeList:[],loading:!1,tableData:[],shopsData:[],sku_code:{},options:[{id:1,label:"在售"},{id:2,label:"预警"},{id:0,label:"下架"}],options2:[{value:"inventory",label:"盘点表"},{value:"cost",label:"成本表"},{value:"week_data",label:"周数据"}],value:"",options3:[{value:"stock",label:"库存"},{value:"cost",label:"成本"},{value:"loss_num",label:"损耗"},{value:"reserve",label:"预留"}],form:{external_sku_id:"",goods_title:"",type_id:null,brand_id:"",sku_title:"",status:"",keyword_type:"stock",keyword_value:""},Paginationdata:{},current_page:1,per_page:10,updateType:"",stock:!1,isShow:!1,ejectstock1:!1,Importgoods:!1,Tableexport:!1,isShow1:!1,importForm:{fileList:[]},docImportDrawer:!1,improtRules:{fileList:[{required:!0,message:"请导入Excel文件",trigger:"change"},{validator:(t,e,o)=>{e.length?o():o(new Error("请导入Excel文件"))},trigger:"change"}]},publicPath:"",excelTemplatePath:"",visible:!1,updateField:"",reserveShow:!1,ommodityInventory:[],dialogVisible:!1,dialogVisible2:!1,dialogVisible3:!1,dialogVisible5:!1,publicId:"",lastVal:0,nowVal:0,loadingModule:"",noRow:{},chooseList:[],showUpdate:!1,commitLoading:!1,is_admin:!1,showAdd:!1,showEdit:!1,curId:0,filterTime:[],sort_field:"",sort_value:""}},methods:{getStockInfo(){(0,r.sx)().then((t=>{this.rose_num=t.data.rose_num,this.other_num=t.data.other_num}))},handleEdit(t){this.curId=t,this.showEdit=!0},getList(){this.loading=!0;let t={...this.form,page:this.current_page,per_page:this.per_page,create_time_start:this.filterTime?this.filterTime[0]:"",create_time_end:this.filterTime?this.filterTime[1]:"",sort_field:this.sort_field||"id",sort_value:this.sort_value||"desc"};t.type_id=t.type_id||"",(0,r.lO)(t).then((t=>{this.tableData=t.data.data,this.tableData=this.tableData.map((t=>(t={...t,arrived_today_num11:0},t))),this.total=t.data.meta.total,this.Paginationdata=t.data.meta,this.shopsData=this.tableData.map((t=>(t=t.goods&&t.goods.goods_code+"_"+t.sku_code,t))),this.sku_code={sku_code:this.shopsData},this.is_admin=t.data.manage&&t.data.manage.is_admin,this.loading=!1})).catch((()=>{this.loading=!1}))},handleChoose(){this.current_page=1,this.getList()},handleReChoose(){this.form={external_sku_id:"",goods_title:"",type_id:null,brand_id:"",sku_title:"",status:""},this.filterTime=[]},handleImport(){this.importForm.fileList=[],this.docImportDrawer=!0,this.$nextTick((function(){this.$refs.aupload.clearFiles()}))},handleTypeExport(){this.Tableexport=!0},resetOrderCount(){this.$confirm("确定重置订单计数?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{(0,d.dT)().then((t=>{console.log(t),this.$message({type:"success",message:t.data.message}),this.getList()}))}))},update(){this.isShow=!0,this.stock=!1,this.updateType="newest"},handleSelectionChange(t){this.chooseList=JSON.parse(JSON.stringify(t))},addNewgoods(){this.showAdd=!0},refreshList(){this.handleChoose()},handleSizeChange(t){this.per_page=t,this.getList()},handleCurrentChange(t){this.current_page=t,this.getList()},cancel(){this.current_page=1,this.getList(),this.isShow=!1,this.stock=!1},handleExport(){let t={exportType:"goods_sku",external_sku_id:this.form.external_sku_id,goods_title:this.form.goods_title,type_id:this.form.type_id||"",status:this.form.status,keyword_type:"stock",create_time_start:this.filterTime?this.filterTime[0]:"",create_time_end:this.filterTime?this.filterTime[1]:""};window.open("/goods_skus/export?"+this.objectToQueryString(t))},objectToQueryString(t){return Object.keys(t).map((e=>encodeURIComponent(e)+"="+(t[e]?encodeURIComponent(t[e]):""))).join("&")},sortChange(t){this.sort_field=t.order?t.prop:"",this.sort_value=t.order?"descending"==t.order?"desc":"asc":"",this.current_page=1,this.getList()},onSubmit(){if("newest"===this.updateType){let t=this.tableData.map((t=>[{id:t.id,cost:t.cost,arrived_today_num:t.arrived_today_num11}])),e={updateType:this.updateType,skus:t.flat()};(0,r.Vx)(e).then((t=>{this.$message({message:"上新成功!",type:"success"})}))}if("inventory"===this.updateType){let t=this.tableData.map((t=>[{id:t.id,inventory:t.daily.inventory}])),e={updateType:this.updateType,skus:t.flat()};(0,r.Vx)(e).then((t=>{this.$message({message:"库存盘点成功!",type:"success"})}))}this.isShow=!1,this.stock=!1,this.handleChoose(this.current_page)},onCount(){this.dialogVisible2=!1,this.isShow=!1,this.stock=!0,this.updateType="inventory"},ejectstock(t){this.ommodityInventory=[],this.ejectstock1=!0,this.updateType="stock",this.ommodityInventory.push(t)},cancelStock(){this.handleChoose(this.current_page),this.ejectstock1=!1},oldStock(){if(this.ejectstock1=!1,"stock"===this.updateType){let t=[{id:this.ommodityInventory[0].id,yesterday_num:this.ommodityInventory[0].yesterday_num,two_days_ago_num:this.ommodityInventory[0].two_days_ago_num,arrived_today_num:this.ommodityInventory[0].daily.arrived_today_num}],e={updateType:this.updateType,skus:t};(0,r.Vx)(e).then((t=>{this.handleChoose(this.current_page),this.$message({message:"库存更新成功!",type:"success"})}))}},importFile(){this.docImportDrawer=!0},async importFileChange(t,e){this.importForm.fileList=e},saveUpload(){if(!this.importForm.fileList.length)return void this.$message.error("请先上传文件");this.isLoadingDialog=!0;const t=new FormData;t.append("saleStockFile",this.importForm.fileList[0].raw);let e=localStorage.getItem("token");l().post("/api/goods_skus/saleStockImport",t,{headers:{Authorization:`Bearer ${e}`}}).then((t=>{200===t.status?(this.$message.success("导入成功"),this.current_page=1,this.getList(),this.commitloading=!1,this.docImportDrawer=!1):this.isLoadingDialog=!1})).catch((()=>{this.isLoadingDialog=!1}))},getExcelTemplatePath(){this.$requestInternet.get("/api/xxx").then((t=>{this.excelTemplatePath=t}))},derivation(){window.open("/goods_skus/export?exportType="+this.value)},referencePriceRequest(){let t={updateField:this.updateField,reference_price:this.reference_price};(0,r.K1)(this.publicId,t).then((t=>{this.editPriceId="",this.dialogVisible3=!1,this.$message({message:"参考售价修改成功!",type:"success"})}))},cancelGoal(){this.dialogVisible5=!1,this.updateField="goal_rate",this.editGoalId=this.publicId,this.noRow.goal_rate=this.lastVal},confirmGoal(){let t={updateField:"goal_rate",goal_rate:this.nowVal};(0,r.K1)(this.publicId,t).then((t=>{this.editGoalId="",this.dialogVisible5=!1,this.$message({message:"目标去化率修改成功!",type:"success"})}))},getgoodsType(){let t={per_page:99999};(0,n.Ci)(t).then((t=>{this.treeList=JSON.parse(JSON.stringify(t.data.data).replace(/name/g,"label"))}))},petchEditStock(){this.showUpdate=!0},commitPetchStock(){this.commitLoading=!0;let t=[];this.chooseList.forEach((e=>{t.push({id:e.id,sale_stock:e.sale_stock})}));let e={updateType:"saleStock",skus:t};(0,r.b9)(e).then((t=>{this.commitLoading=!1,this.$refs.multipleTable.clearSelection(),this.$message({message:"更新成功",type:"success"}),this.getList(),this.showUpdate=!1})).catch((()=>{this.commitLoading=!1}))},openSaleEdit(t,e){this.$set(this.tableData[e],"edit",!0),this.$set(this.tableData[e],"sale_stock_old",t.sale_stock)},cancelEdit(t,e){this.$set(this.tableData[e],"sale_stock",t.sale_stock_old),this.$set(this.tableData[e],"edit",!1)},confirmEdit(t,e){let o={updateType:"saleStock",skus:[{id:t.id,sale_stock:t.sale_stock}]};(0,r.b9)(o).then((t=>{this.$message({message:"更新成功",type:"success"}),this.$set(this.tableData[e],"edit",!1)}))},normalizer(t){return(!t.children||t.children&&0==t.children.length)&&1==t.level&&(t.isDisabled=!0),t},parseLabel(t){console.log(t);let e="";return e+=t.parentNode?t.parentNode.label+" / ":"",e+=t.raw?t.raw.label:"",e}},watch:{$route(t,e){window.location.reload()}},mounted(){this.getList(),this.getStockInfo(),this.getgoodsType()}},C=I,$=(0,f.Z)(C,s,i,!1,null,"0b7fe2a3",null),T=$.exports},9036:function(t,e,o){o.d(e,{CD:function(){return b},JS:function(){return y},K1:function(){return c},NR:function(){return m},Rq:function(){return a},Vx:function(){return d},b9:function(){return v},cM:function(){return u},e3:function(){return r},gM:function(){return g},lO:function(){return i},no:function(){return f},od:function(){return p},rQ:function(){return l},sx:function(){return _},t5:function(){return n},zl:function(){return h}});var s=o(8430);function i(t){return(0,s.Z)({url:"/api/goods_skus",method:"get",params:t})}function a(t){return(0,s.Z)({url:"/api/goods",method:"post",data:t})}function l(t){return(0,s.Z)({url:`/api/goods_skus/${t}`,method:"get"})}function n(t){return(0,s.Z)({url:"/api/goods",method:"get",params:t})}function r(t,e){return(0,s.Z)({url:`/api/goods_skus/${t}`,method:"patch",data:e})}function d(t){return(0,s.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}function c(t,e){return(0,s.Z)({url:`/api/single/goods_skus/${t}`,method:"patch",data:e})}function u(t,e){return(0,s.Z)({url:"/api/upload",Headers:e,method:"post",data:t})}function p(t){return(0,s.Z)({url:"/api/goodsList",method:"get",params:t})}function h(t){return(0,s.Z)({url:"/api/goods_sku_location",method:"get",params:t})}function m(t){return(0,s.Z)({url:"/api/goodsSkusList",method:"get",params:{title:t}})}function _(){return(0,s.Z)({url:"/api/stock/goods_skus",method:"get"})}function f(t){return(0,s.Z)({url:"/api/goods/filter/"+t,method:"get"})}function g(t){return(0,s.Z)({url:"/api/goods_combination",method:"post",data:t})}function b(t){return(0,s.Z)({url:"/api/goods_combination",method:"get",params:t})}function y(t){return(0,s.Z)({url:"/api/goods_combination/"+t,method:"get"})}function v(t){return(0,s.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}},9998:function(t,e,o){o.d(e,{$i:function(){return a},OV:function(){return c},Vq:function(){return p},_d:function(){return d},dT:function(){return h},hA:function(){return i},nH:function(){return l},ow:function(){return r},rV:function(){return n},tA:function(){return u}});var s=o(8430);function i(){return(0,s.Z)({url:"/api/shop_platforms",method:"get"})}function a(t){return(0,s.Z)({url:"/api/shops",method:"post",data:t})}function l(t){return(0,s.Z)({url:"/api/shops",method:"get",params:t})}function n(t){return(0,s.Z)({url:`/api/download/${t}/goods`,method:"get"})}function r(t,e){return(0,s.Z)({url:`/api/shops/${t}`,method:"patch",params:e})}function d(t){return(0,s.Z)({url:"/api/sync/shop/stock",method:"put",params:t})}function c(){return(0,s.Z)({url:"/api/shop/ship",method:"get"})}function u(t,e){return(0,s.Z)({url:"/api/shop/ship/senders",method:"get",params:{shop_id:t,shop_ship_id:e}})}function p(t){return(0,s.Z)({url:"/api/shop/ship/senders",method:"post",params:t})}function h(t){return(0,s.Z)({url:"/api/order/reset",method:"get"})}}}]);
//# sourceMappingURL=769.8d06d508.js.map