1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-b39164e8"],{2543:function(e,t,r){"use strict";r.d(t,"f",function(){return s}),r.d(t,"g",function(){return l}),r.d(t,"d",function(){return u}),r.d(t,"h",function(){return c}),r.d(t,"e",function(){return m}),r.d(t,"a",function(){return f}),r.d(t,"b",function(){return p}),r.d(t,"c",function(){return d});var a=r("b775"),o=r("4328"),i=r.n(o),n="/api-web";function s(e){return Object(a["a"])({url:n+"/goods/queryPage",method:"get",params:e})}function l(e){return Object(a["a"])({url:n+"/goods/get/".concat(e),method:"get"})}function u(e){return Object(a["a"])({url:n+"/goods/add",method:"post",data:i.a.stringify(e)})}function c(e){return Object(a["a"])({url:n+"/goods/update",method:"post",data:i.a.stringify(e)})}function m(e){return Object(a["a"])({url:n+"/goods/del/".concat(e),method:"post"})}function f(e){return Object(a["a"])({url:n+"/category/queryPage",method:"get",params:e})}function p(e){return Object(a["a"])({url:n+"/category/upset",method:"post",data:e})}function d(e){return Object(a["a"])({url:n+"/category/del",method:"post",data:i.a.stringify(e)})}},"7b94":function(e,t,r){"use strict";var a=r("8238"),o=r.n(a);o.a},8238:function(e,t,r){},fd78:function(e,t,r){"use strict";r.r(t);var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"m-container"},[r("h2",[r("el-page-header",{attrs:{content:("create"==e.pageType?"添加":"修改")+"商品"},on:{back:e.onCancel}})],1),e._v(" "),r("div",{staticClass:"m-core"},[r("el-form",{ref:"form",staticStyle:{width:"500px"},attrs:{model:e.form,rules:e.rules,"label-width":"120px"}},[r("el-form-item",{attrs:{label:"品牌",prop:"brand"}},[r("el-input",{model:{value:e.form.brand,callback:function(t){e.$set(e.form,"brand","string"===typeof t?t.trim():t)},expression:"form.brand"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品名称",prop:"name"}},[r("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name","string"===typeof t?t.trim():t)},expression:"form.name"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品类型",prop:"type"}},[r("el-select",{model:{value:e.form.type,callback:function(t){e.$set(e.form,"type","string"===typeof t?t.trim():t)},expression:"form.type"}},[r("el-option",{attrs:{label:"乐器",value:"INSTRUMENT"}}),e._v(" "),r("el-option",{attrs:{label:"辅件",value:"ACCESSORIES"}}),e._v(" "),r("el-option",{attrs:{label:"教材",value:"TEACHING"}}),e._v(" "),r("el-option",{attrs:{label:"教谱",value:"STAFF"}}),e._v(" "),r("el-option",{attrs:{label:"其它",value:"OTHER"}})],1)],1),e._v(" "),r("el-form-item",{attrs:{label:"商品分类",prop:"goodsCategoryId"}},[r("el-select",{attrs:{filterable:""},model:{value:e.form.goodsCategoryId,callback:function(t){e.$set(e.form,"goodsCategoryId","string"===typeof t?t.trim():t)},expression:"form.goodsCategoryId"}},e._l(e.categoryList,function(e){return r("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1)],1),e._v(" "),r("el-form-item",{attrs:{label:"商品型号",prop:"specification"}},[r("el-input",{model:{value:e.form.specification,callback:function(t){e.$set(e.form,"specification","string"===typeof t?t.trim():t)},expression:"form.specification"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品价格",prop:"marketPrice"}},[r("el-input",{attrs:{type:"number"},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:e.form.marketPrice,callback:function(t){e.$set(e.form,"marketPrice","string"===typeof t?t.trim():t)},expression:"form.marketPrice"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品团购价",prop:"groupPurchasePrice"}},[r("el-input",{attrs:{type:"number"},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:e.form.groupPurchasePrice,callback:function(t){e.$set(e.form,"groupPurchasePrice","string"===typeof t?t.trim():t)},expression:"form.groupPurchasePrice"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品采购价",prop:"discountPrice"}},[r("el-input",{attrs:{type:"number"},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:e.form.discountPrice,callback:function(t){e.$set(e.form,"discountPrice","string"===typeof t?t.trim():t)},expression:"form.discountPrice"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商品图片",prop:"image"}},[r("el-upload",{staticClass:"avatar-uploader",attrs:{action:"/api-web/uploadFile",accept:".jpg, .jpeg, .png",headers:e.headers,"show-file-list":!1,"on-success":e.handleAvatarSuccess,"before-upload":e.beforeAvatarUpload}},[e.form.image?r("img",{staticClass:"avatar",attrs:{src:e.form.image}}):r("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),r("el-form-item",{attrs:{label:"商品描述",prop:"desc"}},[r("el-input",{attrs:{type:"textarea"},model:{value:e.form.desc,callback:function(t){e.$set(e.form,"desc","string"===typeof t?t.trim():t)},expression:"form.desc"}})],1),e._v(" "),r("el-form-item",[r("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSubmit("form")}}},[e._v("立即"+e._s("create"==e.pageType?"创建":"修改"))]),e._v(" "),r("el-button",{on:{click:function(t){return e.onReSet("form")}}},[e._v("重置")])],1)],1)],1)])},o=[],i=(r("ac6a"),r("7f7f"),r("386d"),r("2543")),n=r("5f87"),s=function(e,t,r){""==t&&"string"==typeof t||null==t?r(new Error("请输入金额")):t<0?r(new Error("输入金额必须大于或等于0")):t>=1e5?r(new Error("输入金额必须小于100000")):r()},l={name:"shopOperation",data:function(){return{categoryList:[],pageType:null,headers:{Authorization:Object(n["a"])()},form:{brand:null,name:null,type:null,goodsCategoryId:null,specification:null,marketPrice:null,groupPurchasePrice:null,discountPrice:null,image:null,desc:null},rules:{brand:[{required:!0,message:"请输入品牌",trigger:"blur"},{min:2,max:30,message:"长度在 2 到 30 个字符",trigger:"blur"}],name:[{required:!0,message:"请输入商品名称",trigger:"blur"},{min:2,max:30,message:"长度在 2 到 30 个字符",trigger:"blur"}],type:[{required:!0,message:"请选择商品分类",trigger:"change"}],goodsCategoryId:[{required:!0,message:"请选择商品类型",trigger:"change"}],specification:[{required:!0,message:"请输入商品型号",trigger:"blur"},{min:2,max:30,message:"长度在 2 到 30 个字符",trigger:"blur"}],marketPrice:[{required:!0,validator:s,trigger:"blur"}],groupPurchasePrice:[{required:!0,validator:s,trigger:"blur"}],discountPrice:[{required:!0,validator:s,trigger:"blur"}],image:[{required:!0,message:"请选择图片",trigger:"blur"}],desc:[{required:!0,message:"请输入商品描述",trigger:"blur"}]},Fsearch:null,Frules:null}},created:function(){this.init()},activated:function(){this.init()},mounted:function(){},methods:{init:function(){var e=this.$route.query;if(e.paramInfo){var t=JSON.parse(e.paramInfo);this.pageType=t.type,this.id=t.id}e.search&&(this.Fsearch=e.search),e.pageInfo&&(this.Frules=e.pageInfo),this.getList(),this.getCatagory()},onSubmit:function(e){var t=this;this.$refs[e].validate(function(e){if(!e)return!1;"create"==t.pageType?(t.form.id&&delete t.form.id,t.form.status="YES",Object(i["d"])(t.form).then(function(e){t.messageTips("添加",e)})):"update"==t.pageType&&Object(i["h"])(t.form).then(function(e){t.messageTips("修改",e)})})},messageTips:function(e,t){200==t.code?(this.$message.success(e+"成功"),this.$router.push({path:"/shopManager/shopManager",query:{pageInfo:this.Frules,searchForm:this.Fsearch}})):this.$message.error(t.msg)},onCancel:function(){this.$router.push({path:"/shopManager/shopManager",query:{pageInfo:this.Frules,searchForm:this.Fsearch}})},onReSet:function(e){this.$refs[e].resetFields()},getList:function(){var e=this;"create"==this.pageType?(this.form={brand:null,name:null,type:null,goodsCategoryId:null,specification:null,marketPrice:null,groupPurchasePrice:null,discountPrice:null,image:null,desc:null},this.$refs["form"]&&this.$refs["form"].resetFields()):Object(i["g"])(this.id).then(function(t){if(200==t.code){var r=t.data;e.form={id:r.id,brand:r.brand,name:r.name,type:r.type,goodsCategoryId:r.goodsCategoryId,specification:r.specification,marketPrice:r.marketPrice,groupPurchasePrice:r.groupPurchasePrice,discountPrice:r.discountPrice,image:r.image,desc:r.desc}}})},getCatagory:function(){var e=this;Object(i["a"])({delFlag:0,rows:9999}).then(function(t){var r=t.data;if(200==t.code){var a=[];r.rows.forEach(function(e){a.push({label:e.name,value:e.id})}),e.categoryList=a}})},handleAvatarSuccess:function(e,t){this.form.image=e.data.url},beforeAvatarUpload:function(e){var t={"image/png":!0,"image/jpeg":!0},r=t[e.type],a=e.size/1024/1024<2;return r||this.$message.error("只能上传图片格式!"),a||this.$message.error("上传头像图片大小不能超过 2MB!"),r&&a}}},u=l,c=(r("7b94"),r("2877")),m=Object(c["a"])(u,a,o,!1,null,"717de9cc",null);t["default"]=m.exports}}]);
|