2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5018344a"],{"0f29c":function(e,t,c){"use strict";c("2393")},2393:function(e,t,c){},2811:function(e,t,c){"use strict";c("4386")},"3a62":function(e,t,c){"use strict";c("8939")},4386:function(e,t,c){},8939:function(e,t,c){},a1a9:function(e,t,c){"use strict";c("f815")},f480:function(e,t,c){"use strict";c.r(t);var a=function(){var e=this,t=e._self._c;return t("div",[t("el-card",{staticClass:"ibox"},[t("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[t("span",[e._v("查询条件")])]),t("div",{},[t("el-form",{staticClass:"flex justify-start",attrs:{inline:!0,model:e.productSpecManageInfo.conditions}},[t("el-form-item",[t("el-form-item",{attrs:{label:"规格名称"}},[t("el-input",{attrs:{placeholder:"请输入规格名称",clearable:""},model:{value:e.productSpecManageInfo.conditions.specName,callback:function(t){e.$set(e.productSpecManageInfo.conditions,"specName",t)},expression:"productSpecManageInfo.conditions.specName"}})],1)],1),t("el-form-item",[t("el-form-item",{attrs:{label:"规格编号"}},[t("el-input",{attrs:{placeholder:"请输入规格编号",clearable:""},model:{value:e.productSpecManageInfo.conditions.specId,callback:function(t){e.$set(e.productSpecManageInfo.conditions,"specId",t)},expression:"productSpecManageInfo.conditions.specId"}})],1)],1),t("el-form-item",[t("el-button",{attrs:{type:"primary"},on:{click:e._queryProductSpecMethod}},[t("i",{staticClass:"el-icon-search"}),e._v("查询 ")]),t("el-button",{on:{click:e._resetProductSpecMethod}},[t("i",{staticClass:"el-icon-refresh"}),e._v("重置 ")])],1)],1)],1)]),t("el-card",{staticClass:"margin-top-sm"},[t("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[t("span",[e._v("商品规格")]),t("el-button",{staticStyle:{float:"right"},attrs:{type:"primary",size:"small"},on:{click:e._openAddProductSpecModal}},[t("i",{staticClass:"el-icon-plus"}),e._v("添加 ")])],1),t("div",{},[t("el-table",{staticStyle:{width:"100%"},attrs:{data:e.productSpecManageInfo.productSpecs,border:""}},[t("el-table-column",{attrs:{prop:"specId",label:"规格编号",align:"center"}}),t("el-table-column",{attrs:{prop:"specName",label:"规格名称",align:"center"}}),t("el-table-column",{attrs:{label:"规格值",align:"center"},scopedSlots:e._u([{key:"default",fn:function(c){return[t("span",{domProps:{innerHTML:e._s(c.row.specValue)}})]}}])}),t("el-table-column",{attrs:{prop:"createTime",label:"创建时间",align:"center"}}),t("el-table-column",{attrs:{label:"操作",align:"center",width:"200"},scopedSlots:e._u([{key:"default",fn:function(c){return[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e._openEditProductSpecModel(c.row)}}},[e._v("修改")]),t("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(t){return e._openDeleteProductSpecModel(c.row)}}},[e._v("删除")])]}}])})],1),t("el-pagination",{staticStyle:{"margin-top":"20px"},attrs:{"current-page":e.productSpecManageInfo.conditions.page,"page-size":e.productSpecManageInfo.conditions.row,layout:"total, prev, pager, next",total:e.productSpecManageInfo.total},on:{"current-change":e.handleCurrentChange}})],1)]),t("add-product-spec",{ref:"addProductSpec",on:{refresh:e._listProductSpecs}}),t("edit-product-spec",{ref:"editProductSpec",on:{refresh:e._listProductSpecs}}),t("delete-product-spec",{ref:"deleteProductSpec",on:{refresh:e._listProductSpecs}})],1)},o=[],s=c("b775"),i=c("7323");function l(e){return new Promise((t,c)=>{Object(s["a"])({url:"/product/queryProductSpec",method:"get",params:{...e,shopId:Object(i["f"])()}}).then(e=>{const c=e.data;t(c)}).catch(e=>{c(e)})})}function r(e){return new Promise((t,c)=>{Object(s["a"])({url:"/product/saveProductSpec",method:"post",data:{...e,shopId:Object(i["f"])()}}).then(e=>{const c=e.data;t(c)}).catch(e=>{c(e)})})}function d(e){return new Promise((t,c)=>{Object(s["a"])({url:"/product/updateProductSpec",method:"post",data:{...e,shopId:Object(i["f"])()}}).then(e=>{const c=e.data;t(c)}).catch(e=>{c(e)})})}function n(e){return new Promise((t,c)=>{Object(s["a"])({url:"/product/deleteProductSpec",method:"post",data:{...e,shopId:Object(i["f"])()}}).then(e=>{const c=e.data;t(c)}).catch(e=>{c(e)})})}var p=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"添加规格",visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("el-form",{ref:"form",attrs:{model:e.addProductSpecInfo,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"名称",prop:"specName",rules:[{required:!0,message:"规格名称不能为空",trigger:"blur"}]}},[t("el-input",{attrs:{placeholder:"必填,请填写规格名称"},model:{value:e.addProductSpecInfo.specName,callback:function(t){e.$set(e.addProductSpecInfo,"specName",t)},expression:"addProductSpecInfo.specName"}})],1),t("div",{staticClass:"form-tips"},[t("span",[e._v("如:颜色,大小,容量,尺寸,重量")]),t("span",{staticStyle:{float:"right"}},[e._v("如:红色,小,500ML,5.5寸,1kg")])]),e._l(e.addProductSpecInfo.specDetails,(function(c,a){return t("div",{key:c.id,staticClass:"spec-item"},[t("el-form-item",{attrs:{label:"规格",prop:`specDetails[${a}].detailName`,rules:[{required:!0,message:"规格不能为空",trigger:"blur"}]}},[t("el-input",{attrs:{placeholder:"必填,请填写规格"},model:{value:c.detailName,callback:function(t){e.$set(c,"detailName",t)},expression:"item.detailName"}})],1),t("el-form-item",{attrs:{label:"值",prop:`specDetails[${a}].detailValue`,rules:[{required:!0,message:"规格值不能为空",trigger:"blur"}]}},[t("el-input",{attrs:{placeholder:"必填,请填写规格值"},model:{value:c.detailValue,callback:function(t){e.$set(c,"detailValue",t)},expression:"item.detailValue"}})],1),t("div",{staticClass:"spec-action"},[a!==e.addProductSpecInfo.specDetails.length-1?t("i",{staticClass:"el-icon-remove",on:{click:function(t){return e._deleteSpecDetail(c)}}}):e._e(),a===e.addProductSpecInfo.specDetails.length-1?t("i",{staticClass:"el-icon-circle-plus",on:{click:e._addSpecDetail}}):e._e()])],1)})),t("div",{staticClass:"dialog-footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.saveProductSpecInfo}},[e._v("保存")])],1)],2)],1)},u=[],f=c("d547"),m={name:"AddProductSpec",data(){return{dialogVisible:!1,addProductSpecInfo:{specName:"",specDetails:[]}}},methods:{open(){this.clearAddProductSpecInfo(),this._addSpecDetail(),this.dialogVisible=!0},clearAddProductSpecInfo(){this.addProductSpecInfo={specName:"",specDetails:[]}},async saveProductSpecInfo(){try{const e=await this.$refs.form.validate();if(!e)return;this.addProductSpecInfo.shopId=Object(i["f"])();const t=await r(this.addProductSpecInfo);0===t.code?(this.$message.success("添加成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(t.msg)}catch(e){console.error("保存规格失败:",e)}},_addSpecDetail(){this.addProductSpecInfo.specDetails.push({id:Object(f["a"])(),detailName:"",detailValue:""})},_deleteSpecDetail(e){const t=this.addProductSpecInfo.specDetails.findIndex(t=>t.id===e.id);t>-1&&this.addProductSpecInfo.specDetails.splice(t,1)},handleClose(){this.$refs.form.resetFields()}}},h=m,S=(c("a1a9"),c("2877")),g=Object(S["a"])(h,p,u,!1,null,"45d10a1d",null),b=g.exports,P=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"修改规格",visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("el-form",{ref:"form",attrs:{model:e.editProductSpecInfo,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"名称",prop:"specName",rules:[{required:!0,message:"规格名称不能为空",trigger:"blur"}]}},[t("el-input",{attrs:{placeholder:"必填,请填写规格名称"},model:{value:e.editProductSpecInfo.specName,callback:function(t){e.$set(e.editProductSpecInfo,"specName",t)},expression:"editProductSpecInfo.specName"}})],1),t("div",{staticClass:"form-tips"},[t("span",[e._v("如:颜色,大小,容量,尺寸,重量")]),t("span",{staticStyle:{float:"right"}},[e._v("如:红色,小,500ML,5.5寸,1kg")])]),e._l(e.editProductSpecInfo.specDetails,(function(c,a){return t("div",{key:a,staticClass:"spec-item"},[t("el-form-item",{attrs:{label:"规格",prop:`specDetails[${a}].detailName`,rules:[{required:!0,message:"规格不能为空",trigger:"blur"}]}},[t("input",{directives:[{name:"model",rawName:"v-model",value:c.detailName,expression:"item.detailName"}],attrs:{placeholder:"必填,请填写规格"},domProps:{value:c.detailName},on:{input:function(t){t.target.composing||e.$set(c,"detailName",t.target.value)}}})]),t("el-form-item",{attrs:{label:"值",prop:`specDetails[${a}].detailValue`,rules:[{required:!0,message:"规格值不能为空",trigger:"blur"}]}},[t("input",{directives:[{name:"model",rawName:"v-model",value:c.detailValue,expression:"item.detailValue"}],attrs:{placeholder:"必填,请填写规格值"},domProps:{value:c.detailValue},on:{input:function(t){t.target.composing||e.$set(c,"detailValue",t.target.value)}}})]),t("div",{staticClass:"spec-action"},[a!==e.editProductSpecInfo.specDetails.length-1?t("i",{staticClass:"el-icon-remove",on:{click:function(t){return e._deleteEditSpecDetail(c)}}}):e._e(),a===e.editProductSpecInfo.specDetails.length-1?t("i",{staticClass:"el-icon-circle-plus",on:{click:e._addEditSpecDetail}}):e._e()])],1)})),t("div",{staticClass:"dialog-footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.editProductSpec}},[e._v("保存")])],1)],2)],1)},I=[],v={name:"EditProductSpec",data(){return{dialogVisible:!1,editProductSpecInfo:{specId:"",specName:"",specDetails:[]}}},methods:{open(e){this.refreshEditProductSpecInfo(),this.editProductSpecInfo=JSON.parse(JSON.stringify(e)),e.productSpecDetails&&(this.editProductSpecInfo.specDetails=e.productSpecDetails.map(e=>({...e,id:Object(f["a"])()}))),this.dialogVisible=!0},refreshEditProductSpecInfo(){this.editProductSpecInfo={specId:"",specName:"",specDetails:[]}},async editProductSpec(){try{const e=await this.$refs.form.validate();if(!e)return;this.editProductSpecInfo.shopId=Object(i["f"])();const t=await d(this.editProductSpecInfo);0===t.code?(this.$message.success("修改成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(t.msg)}catch(e){console.error("修改规格失败:",e)}},_addEditSpecDetail(){this.editProductSpecInfo.specDetails.push({id:Object(f["a"])(),detailName:"",detailValue:"",detailId:"-1"}),this.$forceUpdate()},_deleteEditSpecDetail(e){const t=this.editProductSpecInfo.specDetails.findIndex(t=>t.id===e.id);t>-1&&this.editProductSpecInfo.specDetails.splice(t,1)},handleClose(){this.$refs.form.resetFields()}}},_=v,D=(c("3a62"),Object(S["a"])(_,P,I,!1,null,"6b0b4915",null)),y=D.exports,N=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"请确认您的操作!",visible:e.dialogVisible,width:"30%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("div",{staticClass:"confirm-content"},[t("p",[e._v("确定删除商品规格")])]),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("点错了")]),t("el-button",{attrs:{type:"primary"},on:{click:e.deleteProductSpec}},[e._v("确认删除")])],1)])},w=[],M={name:"DeleteProductSpec",data(){return{dialogVisible:!1,deleteProductSpecInfo:{}}},methods:{open(e){this.deleteProductSpecInfo={...e},this.dialogVisible=!0},async deleteProductSpec(){try{const e=await n(this.deleteProductSpecInfo);0===e.code?(this.$message.success("删除成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(e.msg)}catch(e){console.error("删除规格失败:",e)}},handleClose(){this.deleteProductSpecInfo={}}}},C=M,V=(c("2811"),Object(S["a"])(C,N,w,!1,null,"93aae8f4",null)),$=V.exports,k={name:"ProductSpecManage",components:{AddProductSpec:b,EditProductSpec:y,DeleteProductSpec:$},data(){return{productSpecManageInfo:{productSpecs:[],total:0,conditions:{page:1,row:10,specName:"",specId:"",shopId:""}}}},created(){this.productSpecManageInfo.conditions.shopId=Object(i["f"])(),this._listProductSpecs()},methods:{handleCurrentChange(e){this.productSpecManageInfo.conditions.page=e,this._listProductSpecs()},async _listProductSpecs(){try{const e=await l(this.productSpecManageInfo.conditions);this.productSpecManageInfo.productSpecs=e.data.map(e=>(e.productSpecDetails&&(e.specValue=e.productSpecDetails.map(e=>`${e.detailName}:${e.detailValue}`).join("<br/>")),e)),this.productSpecManageInfo.total=e.total}catch(e){console.error("获取规格列表失败:",e)}},_openAddProductSpecModal(){this.$refs.addProductSpec.open()},_openEditProductSpecModel(e){this.$refs.editProductSpec.open(e)},_openDeleteProductSpecModel(e){this.$refs.deleteProductSpec.open(e)},_queryProductSpecMethod(){this.productSpecManageInfo.conditions.page=1,this._listProductSpecs()},_resetProductSpecMethod(){this.productSpecManageInfo.conditions={page:1,row:10,specName:"",specId:"",shopId:Object(i["f"])()},this._listProductSpecs()}}},j=k,x=(c("0f29c"),Object(S["a"])(j,a,o,!1,null,"21b8efda",null));t["default"]=x.exports},f815:function(e,t,c){}}]);
|
||
//# sourceMappingURL=chunk-5018344a.52f4cfa6.js.map
|