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