erp/public/dist/js/415.53fdfe41.js

2 lines
10 KiB
JavaScript
Vendored

"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[415],{1930:function(t,e,a){a.r(e),a.d(e,{default:function(){return u}});var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"pageBox"},[e("div",{staticClass:"cardBox"},[e("div",{staticClass:"searchBox"},[e("div",{staticClass:"row"},[e("span",[t._v("商品名称:")]),e("el-input",{attrs:{clearable:""},model:{value:t.searchForm.sku_title,callback:function(e){t.$set(t.searchForm,"sku_title",e)},expression:"searchForm.sku_title"}})],1),e("div",{staticClass:"row"},[e("span",[t._v("商品编码:")]),e("el-input",{attrs:{clearable:""},model:{value:t.searchForm.external_sku_id,callback:function(e){t.$set(t.searchForm,"external_sku_id",e)},expression:"searchForm.external_sku_id"}})],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(1)}}},[t._v("筛选")])],1)])]),e("el-card",[e("div",{staticClass:"opaBox"},[e("el-upload",{ref:"myUpload",staticStyle:{display:"inline-block",margin:"0 15px 0 0"},attrs:{action:"/api/combination/goods",multiple:!1,name:"combinationGoods","show-file-list":!1,"on-success":t.uploadSuccess,"before-upload":t.beforeUpload,"on-error":t.uploadError}},[e("el-button",{attrs:{type:"primary",plain:"",icon:"el-icon-upload2"}},[t._v("组合商品导入")])],1),t.is_admin?e("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:t.addGoodsCombination}},[t._v("新增组合商品")]):t._e(),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:{data:t.tableData,"tooltip-effect":"dark",border:"","row-key":"id","tree-props":{children:"children"}},on:{"sort-change":t.sortChange}},[e("el-table-column",{attrs:{label:"商品信息",width:"400","class-name":"flex"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("div",{staticClass:"commodityimg"},[e("img",{staticClass:"Img",attrs:{src:a.row.img_url}})]),e("div",[e("p",[t._v(t._s(a.row.title))]),e("p",[t._v(t._s(a.row.external_sku_id))]),e("p",[t._v(t._s(a.row.created_at))])])]}}])}),e("el-table-column",{attrs:{prop:"num",label:"组合数量",align:"center"}}),e("el-table-column",{attrs:{prop:"order_goods_num",label:"销量",align:"center",sortable:"custom"}}),e("el-table-column",{attrs:{label:"剩余库存",align:"center"},scopedSlots:t._u([{key:"default",fn:function(a){return[a.row.children?t._e():e("span",[t._v(t._s(a.row.stock))])]}}])}),e("el-table-column",{attrs:{prop:"sale_stock",label:"可售库存",align:"center",sortable:"custom"}}),e("el-table-column",{attrs:{prop:"status",label:"状态",align:"center"}}),t.is_admin?e("el-table-column",{attrs:{label:"操作",width:"130",align:"center"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.handleEdit(a.row.id)}}},[t._v("编辑")])]}}],null,!1,1564336291)}):t._e()],1),e("div",{staticClass:"page-pagination"},[e("el-pagination",{attrs:{"current-page":t.current_page,"page-sizes":[10,50,100,150,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)],1),e("el-dialog",{attrs:{title:"新增组合商品",visible:t.dialogVisible},on:{"update:visible":function(e){t.dialogVisible=e}}},[e("el-form",{ref:"dynamicValidateForm",staticClass:"demo-dynamic",attrs:{model:t.dynamicValidateForm,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"商品名称",prop:"title",rules:[{required:!0,message:"请输入商品名称",trigger:"blur"}]}},[e("el-input",{model:{value:t.dynamicValidateForm.title,callback:function(e){t.$set(t.dynamicValidateForm,"title",e)},expression:"dynamicValidateForm.title"}})],1),e("el-form-item",{attrs:{label:"商品编码",prop:"external_sku_id"}},[e("el-input",{model:{value:t.dynamicValidateForm.external_sku_id,callback:function(e){t.$set(t.dynamicValidateForm,"external_sku_id",e)},expression:"dynamicValidateForm.external_sku_id"}})],1),t._l(t.dynamicValidateForm.combination_goods,(function(a,i){return e("el-form-item",{key:a.item_id,attrs:{label:"花材"+(i+1),prop:"combination_goods."+i+".item_id",rules:{required:!0,message:"子商品不能为空",trigger:"blur"}}},[e("div",{staticStyle:{display:"flex","align-items":"center"}},[e("el-select",{staticStyle:{width:"240px"},attrs:{filterable:"",remote:"","reserve-keyword":"",placeholder:"请选择子商品","remote-method":t.remoteMethod,loading:t.remoteLoading},model:{value:a.item_id,callback:function(e){t.$set(a,"item_id",e)},expression:"item.item_id"}},t._l(t.skus,(function(t){return e("el-option",{key:t.id,attrs:{label:t.title,value:t.id}})})),1),e("el-input",{staticStyle:{width:"120px",margin:"0 10px"},attrs:{placeholder:"数量"},model:{value:a.item_num,callback:function(e){t.$set(a,"item_num",e)},expression:"item.item_num"}}),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return e.preventDefault(),t.removeItem(i)}}},[t._v("删除")])],1)])})),e("el-form-item",{attrs:{label:" "}},[e("el-button",{attrs:{icon:"el-icon-plus"},on:{click:t.addItem}},[t._v("添加花材")])],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.submitForm("dynamicValidateForm")}}},[t._v("提交")]),e("el-button",{on:{click:function(e){return t.resetForm("dynamicValidateForm")}}},[t._v("重置")])],1)],2)],1)],1)},r=[],o=(a(560),a(9036)),n={data(){return{dialogVisible:!1,loading:!1,tableData:[],searchForm:{external_sku_id:"",sku_title:""},sort_field:"",sort_value:"",Paginationdata:{},current_page:1,per_page:10,dynamicValidateForm:{id:0,title:"",external_sku_id:"",combination_goods:[{item_id:"",item_num:1}]},skus:[],is_admin:!1,remoteLoading:!1,filterTime:[]}},methods:{handleEdit(t){this.dialogVisible=!0,(0,o.JS)(t).then((t=>{this.dynamicValidateForm=t.data.data,this.skus=t.data.data.skus}))},handleDelete(t){},getList(){this.loading=!0;let t={...this.searchForm,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"};(0,o.CD)(t).then((t=>{this.tableData=t.data.data,this.Paginationdata=t.data.meta,this.currentPage=t.data.meta.current_page,this.per_page=parseInt(t.data.meta.per_page),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()},handleSizeChange(t){this.current_page=1,this.per_page=t,this.getList()},handleCurrentChange(t){this.current_page=t,this.getList()},submitForm(t){this.$refs[t].validate((t=>{t&&(0,o.gM)(this.dynamicValidateForm).then((t=>{this.$message({message:t.data.message,type:"success"}),this.dialogVisible=!1,this.handleChoose()}))}))},resetForm(t){this.$refs[t].resetFields()},removeItem(t){this.dynamicValidateForm.combination_goods.splice(t,1)},addItem(){this.dynamicValidateForm.combination_goods.push({item_id:"",item_num:1})},remoteMethod(t){""!==t?(this.remoteLoading=!0,(0,o.no)(t).then((t=>{this.skus=t.data.data,this.remoteLoading=!1}))):this.skus=[]},addGoodsCombination(){this.dialogVisible=!0,this.dynamicValidateForm={id:0,title:"",external_sku_id:"",combination_goods:[{item_id:"",item_num:1}]}},beforeUpload(){this.loadingModule=this.$loading({lock:!0,text:"表格导入中...",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"})},uploadSuccess(t){this.$message({message:t.message,type:"success"}),this.loadingModule.close()},uploadError(t){this.$message({message:t.errorMessage,type:"error"}),this.loadingModule.close()},handleExport(){let t={exportType:"goods_combination",external_sku_id:this.searchForm.external_sku_id,sku_title:this.searchForm.sku_title,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()}},mounted(){this.handleCurrentChange(1)}},s=n,l=a(1001),d=(0,l.Z)(s,i,r,!1,null,"29045bd9",null),u=d.exports},9036:function(t,e,a){a.d(e,{CD:function(){return b},JS:function(){return k},K1:function(){return u},NR:function(){return h},Rq:function(){return o},Vx:function(){return d},b9:function(){return y},cM:function(){return c},e3:function(){return l},gM:function(){return f},lO:function(){return r},no:function(){return _},od:function(){return m},rQ:function(){return n},sx:function(){return g},t5:function(){return s},zl:function(){return p}});var i=a(8430);function r(t){return(0,i.Z)({url:"/api/goods_skus",method:"get",params:t})}function o(t){return(0,i.Z)({url:"/api/goods",method:"post",data:t})}function n(t){return(0,i.Z)({url:`/api/goods_skus/${t}`,method:"get"})}function s(t){return(0,i.Z)({url:"/api/goods",method:"get",params:t})}function l(t,e){return(0,i.Z)({url:`/api/goods_skus/${t}`,method:"patch",data:e})}function d(t){return(0,i.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}function u(t,e){return(0,i.Z)({url:`/api/single/goods_skus/${t}`,method:"patch",data:e})}function c(t,e){return(0,i.Z)({url:"/api/upload",Headers:e,method:"post",data:t})}function m(t){return(0,i.Z)({url:"/api/goodsList",method:"get",params:t})}function p(t){return(0,i.Z)({url:"/api/goods_sku_location",method:"get",params:t})}function h(t){return(0,i.Z)({url:"/api/goodsSkusList",method:"get",params:{title:t}})}function g(){return(0,i.Z)({url:"/api/stock/goods_skus",method:"get"})}function _(t){return(0,i.Z)({url:"/api/goods/filter/"+t,method:"get"})}function f(t){return(0,i.Z)({url:"/api/goods_combination",method:"post",data:t})}function b(t){return(0,i.Z)({url:"/api/goods_combination",method:"get",params:t})}function k(t){return(0,i.Z)({url:"/api/goods_combination/"+t,method:"get"})}function y(t){return(0,i.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}}}]);
//# sourceMappingURL=415.53fdfe41.js.map