1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6ac1ca3f"],{"0b46":function(t,e,i){},2434:function(t,e,i){"use strict";i("ea4e")},"46af":function(t,e,i){"use strict";i("0b46")},"4e62":function(t,e,i){"use strict";i("6ea8")},"4e82":function(t,e,i){"use strict";var n=i("23e7"),s=i("1c0b"),a=i("7b0b"),o=i("d039"),r=i("a640"),c=[],l=c.sort,u=o((function(){c.sort(void 0)})),d=o((function(){c.sort(null)})),p=r("sort"),h=u||!d||!p;n({target:"Array",proto:!0,forced:h},{sort:function(t){return void 0===t?l.call(a(this)):l.call(a(this),s(t))}})},"6ea8":function(t,e,i){},8093:function(t,e,i){"use strict";i("81d5")},"81d5":function(t,e,i){},8256:function(t,e,i){"use strict";var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"tinymce-container",class:{fullscreen:t.fullscreen},style:{width:t.containerWidth}},[i("textarea",{staticClass:"tinymce-textarea",attrs:{id:t.tinymceId}})])},s=[],a=(i("b680"),i("a9e3"),i("ac1f"),i("00b4"),i("d3b7"),i("159b"),i("b85c")),o=[];function r(){return window.tinymce}var c=function(t,e){var i=document.getElementById(t),n=e||function(){};if(!i){var s=document.createElement("script");s.src=t,s.id=t,document.body.appendChild(s),o.push(n);var c="onload"in s?l:u;c(s)}function l(e){e.onload=function(){this.onerror=this.onload=null;var t,i=Object(a["a"])(o);try{for(i.s();!(t=i.n()).done;){var n=t.value;n(null,e)}}catch(s){i.e(s)}finally{i.f()}o=null},e.onerror=function(){this.onerror=this.onload=null,n(new Error("Failed to load "+t),e)}}function u(t){t.onreadystatechange=function(){if("complete"===this.readyState||"loaded"===this.readyState){this.onreadystatechange=null;var e,i=Object(a["a"])(o);try{for(i.s();!(e=i.n()).done;){var n=e.value;n(null,t)}}catch(s){i.e(s)}finally{i.f()}o=null}}}i&&n&&(r()?n(null,i):o.push(n))},l=c,u=i("c40e"),d="https://cdn.jsdelivr.net/npm/tinymce@5.9.1/tinymce.min.js",p={name:"Tinymce",props:{id:{type:String,default:function(){return"vue-tinymce-"+ +new Date+(1e3*Math.random()).toFixed(0)}},value:{type:String,default:""},toolbar:{type:Array,required:!1,default:function(){return[]}},menubar:{type:String,default:"file edit insert view format table"},height:{type:[Number,String],required:!1,default:360},width:{type:[Number,String],required:!1,default:"auto"}},data:function(){return{hasChange:!1,hasInit:!1,tinymceId:this.id,fullscreen:!1,languageTypeList:{en:"en",zh:"zh_CN",es:"es_MX",ja:"ja"}}},computed:{language:function(){return this.languageTypeList[this.$store.getters.language]},containerWidth:function(){var t=this.width;return/^[\d]+(\.[\d]+)?$/.test(t)?"".concat(t,"px"):t}},watch:{value:function(t){var e=this;!this.hasChange&&this.hasInit&&this.$nextTick((function(){return window.tinymce.get(e.tinymceId).setContent(t||"")}))},language:function(){var t=this;this.destroyTinymce(),this.$nextTick((function(){return t.initTinymce()}))}},mounted:function(){this.init()},activated:function(){window.tinymce&&this.initTinymce()},deactivated:function(){this.destroyTinymce()},destroyed:function(){this.destroyTinymce()},methods:{init:function(){var t=this;l(d,(function(e){e?t.$message.error(e.message):t.initTinymce()}))},initTinymce:function(){var t=this,e=this;window.tinymce.init({language:this.language,selector:"#".concat(this.tinymceId),height:this.height,body_class:"panel-body ",branding:!1,object_resizing:!1,toolbar:["formatselect | bold italic | alignleft aligncenter alignright alignjustify |bullist numlist outdent indent | lists image media table | removeformat link | code preview|fullscreen"],menubar:!1,plugins:["image","preview"],paste_data_images:!0,convert_urls:!1,init_instance_callback:function(i){e.value&&i.setContent(e.value),e.hasInit=!0,i.on("NodeChange Change KeyUp SetContent",(function(){t.hasChange=!0,t.$emit("input",i.getContent())}))},setup:function(t){t.on("FullscreenStateChanged",(function(t){e.fullscreen=t.state}))},images_upload_handler:function(e,i,n){var s=e.blob(),a=["image/png","image/jpg","image/jpeg"];if(-1===a.indexOf(s.type))return t.$message.warning("上传图片格式必须为: png或jpg格式"),!1;var o=new FormData;o.append("img",s),Object(u["i"])(o).then((function(e){try{var n=e.code,s=e.data;200===n?i(s):t.$message.error(message)}catch(a){console.log("上传图片失败: ".concat(a))}})).catch((function(){t.thumbLoad=!1}))}})},destroyTinymce:function(){var t=window.tinymce.get(this.tinymceId);this.fullscreen&&t.execCommand("mceFullScreen"),t&&t.destroy()},setContent:function(t){window.tinymce.get(this.tinymceId).setContent(t)},getContent:function(){window.tinymce.get(this.tinymceId).getContent()},imageSuccessCBK:function(t){var e=this;t.forEach((function(t){window.tinymce.get(e.tinymceId).insertContent('<img class="wscnph" src="'.concat(t.url,'" >'))}))}}},h=p,g=(i("46af"),i("2877")),m=Object(g["a"])(h,n,s,!1,null,"baa81742",null);e["a"]=m.exports},"8f2f":function(t,e,i){"use strict";i.r(e);var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"app-container",attrs:{"element-loading-text":"加载中"}},[i("el-form",{ref:"addGoods",attrs:{model:t.goods,rules:t.goodRules,"label-width":"120px"}},[[i("div",{staticClass:"step-title"},[t._v("第一步: 填写商品基本信息")]),i("div",[i("el-form-item",{staticStyle:{width:"50%"},attrs:{label:"商品名称:",prop:"name"}},[i("el-input",{attrs:{type:"text",maxlength:"32","show-word-limit":"",size:"small"},model:{value:t.goods.name,callback:function(e){t.$set(t.goods,"name",e)},expression:"goods.name"}})],1),i("el-form-item",{staticStyle:{width:"50%"},attrs:{label:"商品简称:",prop:"name"}},[i("el-input",{attrs:{type:"text",maxlength:"5","show-word-limit":"",size:"small"},model:{value:t.goods.main_attr,callback:function(e){t.$set(t.goods,"main_attr",e)},expression:"goods.main_attr"}})],1)],1),i("el-form-item",{attrs:{label:"上传主图:",required:""}},[i("el-upload",{attrs:{action:"http://api.app.cliu.cc/api/store_goods/upload_img","show-file-list":!1,name:"img","on-success":t.handleAvatarSuccess}},[i("el-button",{attrs:{size:"mini"}},[t._v("点击上传")]),i("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[t._v(" (建议尺寸画布600*480,大小50K,只能上传1张,如需修改请重新上传主图) ")])],1),t.goods.img?i("div",[i("img",{staticClass:"thumbUrl",attrs:{src:t.goods.img}})]):t._e()],1),i("el-form-item",{attrs:{label:"上传轮播图",required:""}},[i("el-upload",{ref:"bannerUpload",attrs:{multiple:"",limit:15,action:"","show-file-list":!1,"http-request":t.bannerPictureUpload}},[i("el-button",{attrs:{size:"mini"}},[t._v("点击上传")]),i("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[t._v(" (建议尺寸画布600*480,大小50K) ")])],1),t.goods.banner.length>0?i("ul",{staticClass:"banner_list"},t._l(t.goods.banner,(function(e,n){return i("li",{key:n,staticClass:"banner_item"},[i("img",{attrs:{src:e}}),i("div",{staticClass:"remove",on:{click:function(e){return t.deleteBanner(n)}}},[t._v("删除")])])})),0):t._e()],1),i("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{label:"商品详情",prop:"content"}},[i("Tinymce",{ref:"editor",attrs:{height:400,width:700},model:{value:t.goods.content,callback:function(e){t.$set(t.goods,"content",e)},expression:"goods.content"}})],1)],[i("div",{staticClass:"step-title"},[t._v("第二步: 填写商品规格")]),i("el-form-item",{attrs:{label:"规格设置:",required:""}},[i("div",[i("div",{staticClass:"spec"},[i("span",{staticClass:"intr"},[t._v("款式")]),t._l(t.typeList,(function(e,n){return i("el-tag",{key:n,staticClass:"tag_box",attrs:{"disable-transitions":!1,type:e.color},on:{click:function(e){return t.checkType(n)}}},[t._v(" "+t._s(e.type)+" ")])})),t.typeShow?i("el-input",{ref:"saveTagInput",staticClass:"input-new-tag",attrs:{size:"small"},on:{blur:t.addType},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.addType(e)}},model:{value:t.newType,callback:function(e){t.newType=e},expression:"newType"}}):i("el-button",{staticClass:"button-new-tag",attrs:{size:"small"},on:{click:function(e){return t.showInp(0)}}},[t._v("+ 添加")])],2),i("div",{staticClass:"spec"},[i("span",{staticClass:"intr"},[t._v("尺码")]),t._l(t.sizeList,(function(e,n){return i("el-tag",{key:e.id,staticClass:"tag_box",attrs:{type:e.color,"disable-transitions":!1},on:{click:function(e){return t.checkSize(n)}}},[t._v(" "+t._s(e.size)+" ")])})),t.sizeShow?i("el-input",{ref:"saveTagInput",staticClass:"input-new-tag",attrs:{size:"small"},on:{blur:t.addSize},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.addSize(e)}},model:{value:t.newSize,callback:function(e){t.newSize=e},expression:"newSize"}}):i("el-button",{staticClass:"button-new-tag",attrs:{size:"small"},on:{click:function(e){return t.showInp(1)}}},[t._v("+ 添加")])],2),i("div",{staticClass:"spec"},[i("span",{staticClass:"intr"},[t._v("已选")]),t._l(t.checkList,(function(e,n){return i("el-tag",{key:n,attrs:{closable:"","disable-transitions":!1},on:{close:function(e){return t.delTag(2,n)}}},[t._v(" "+t._s(e.type)+"-"+t._s(e.size)+" ")])}))],2)])]),i("el-form-item",{attrs:{label:"价格设置",required:""}},[i("el-input",{staticStyle:{width:"350px"},attrs:{placeholder:"请输入价格",type:"number",size:"small"},model:{value:t.goods.price,callback:function(e){t.$set(t.goods,"price",e)},expression:"goods.price"}})],1),i("el-form-item",{attrs:{label:"vip价格设置",required:""}},[i("el-input",{staticStyle:{width:"350px"},attrs:{placeholder:"请输入vip价格",type:"number",size:"small"},model:{value:t.goods.vip_price,callback:function(e){t.$set(t.goods,"vip_price",e)},expression:"goods.vip_price"}})],1)],[i("el-button",{attrs:{size:"small"},on:{click:t.cancel}},[t._v("取消")]),i("el-button",{attrs:{type:"primary",size:"small"},on:{click:t.handleSubmit}},[t._v("添加")])]],2),i("el-dialog",{attrs:{top:"50px",visible:t.dialogBannerVisable,size:"tiny"},on:{"update:visible":function(e){t.dialogBannerVisable=e}}},t._l(t.goods.bannerUrl,(function(t,e){return i("img",{key:e,attrs:{width:"100%",src:t}})})),0),t.thumbLoad?i("div",{directives:[{name:"loading",rawName:"v-loading",value:t.thumbLoad,expression:"thumbLoad"}],staticClass:"loadingShade"}):t._e()],1)},s=[],a=i("c7eb"),o=i("1da1"),r=(i("d81d"),i("c740"),i("4e82"),i("a434"),i("ac1f"),i("00b4"),i("b0c0"),i("c40e")),c=i("8256"),l=(i("8975"),{name:"GoodsAdd",components:{Tinymce:c["a"]},data:function(){return{goodRules:{name:[{required:!0,message:"请输入商品名称",trigger:"blur"}],main_attr:[{required:!0,message:"请输入商品简称",trigger:"blur"}]},goods:{name:"",main_attr:"",img:"",banner:[],price:"",content:"",sku:[],vip_price:"",size_img:[]},typeList:[{type:"男款",color:"info",typeVal:10},{type:"女款",color:"info",typeVal:20}],sizeList:[{size:"M",color:"info",sizeVal:1},{size:"L",color:"info",sizeVal:2},{size:"XL",color:"info",sizeVal:3},{size:"2XL",color:"info",sizeVal:4},{size:"3XL",color:"info",sizeVal:5},{size:"4XL",color:"info",sizeVal:6},{size:"5XL",color:"info",sizeVal:7}],checkedType:"",checkList:[{type:"男款",size:"M",sort:11},{type:"男款",size:"L",sort:12},{type:"男款",size:"XL",sort:13},{type:"男款",size:"2XL",sort:14},{type:"男款",size:"3XL",sort:15},{type:"男款",size:"4XL",sort:16},{type:"男款",size:"5XL",sort:17},{type:"女款",size:"M",sort:21},{type:"女款",size:"L",sort:22},{type:"女款",size:"XL",sort:23},{type:"女款",size:"2XL",sort:24},{type:"女款",size:"3XL",sort:25},{type:"女款",size:"4XL",sort:26},{type:"女款",size:"5XL",sort:27}],typeInp:"",typeShow:!1,newType:"",sizeInp:"",sizeShow:!1,newSize:"",thumbLoad:!1,dialogBannerVisable:!1,maleList:[],spaceTable:[],setSkuFlag:!0,defaultTotal:"1"}},methods:{cancel:function(){this.$router.push({name:"goods_list"})},handleAvatarSuccess:function(t,e){this.goods.img=t.data},checkType:function(t){var e=this.typeList;e.map((function(i){i.type==e[t].type?i.color="success":i.color="info"}));var i=this.sizeList;i.map((function(t){t.color="info"})),this.checkedType=this.typeList[t].type,this.typeVal=this.typeList[t].typeVal},compareFunc:function(t){return function(e,i){var n,s;return n=e[t],s=i[t],n<s?-1:n>s?1:0}},checkSize:function(t){if(!this.checkedType)return this.$message({message:"请先选择款式",type:"warning"}),!1;var e=this.sizeList[t].color;if("info"===e){var i={type:this.checkedType,size:this.sizeList[t].size,sort:this.typeVal+this.sizeList[t].sizeVal},n=this.checkList.findIndex((function(t){return t.type===i.type&&t.size===i.size}));if(-1===n){this.sizeList[t].color="success",this.checkList.push(i);var s=this.checkList.sort(this.compareFunc("sort"));return this.checkList=s,console.log(s),!1}this.$message({message:"已存在相同规格",type:"warning"})}else this.sizeList[t].color="info",this.checkList.splice(this.checkList.indexOf(this.sizeList[t]),1)},showInp:function(t){var e=this;0==t?this.typeShow=!0:this.sizeShow=!0,this.$nextTick((function(t){e.$refs.saveTagInput.$refs.input.focus()}))},addType:function(){this.newType&&this.typeList.push({type:this.newType,color:"info"}),this.typeShow=!1,this.newType=""},addSize:function(){var t=this,e=this.sizeList.findIndex((function(e){return e.size===t.newSize}));if(-1===e){var i=/^[0-9A-Z]+$/;if(!i.test(this.newSize))return this.$message.warning("尺码只能包含数字和大写字母"),this.sizeShow=!1,this.newSize="",!1;this.sizeList.push({size:this.newSize,color:"info"}),this.checkList.push({size:this.newSize,type:"男款"},{size:this.newSize,type:"女款"}),this.sizeShow=!1,this.newSize=""}else this.$message.warning("已存在相同尺码")},delTag:function(t,e){var i="";switch(t){case 0:i=this.typeList;break;case 1:i=this.sizeList;break;case 2:i=this.checkList;default:break}i.splice(i.indexOf(i[e]),1)},thumbPictureUpload:function(t){var e=this;this.thumbLoad=!0;var i=t.file,n=["image/png","image/jpg","image/jpeg"];if(-1===n.indexOf(i.type))return this.$message.warning("上传图片格式必须为: png或jpg格式"),!1;var s=new FormData;s.append("img",i),Object(r["i"])(s).then((function(t){e.thumbLoad=!1;try{var i=t.message,n=t.code,s=t.data;200===n?(console.log(s,"上传图片"),e.goods.img=s):(e.goods.img="",e.$message.error(i))}catch(a){console.log("上传商品主图失败: ".concat(a))}})).catch((function(){e.thumbLoad=!1}))},bannerPictureUpload:function(t){var e=this;this.thumbLoad=!0;var i=t.file,n=["image/png","image/jpg","image/jpeg"];if(-1===n.indexOf(i.type))return this.$message.warning("上传图片格式必须为: png或jpg格式"),!1;var s=new FormData;s.append("img",i),Object(r["i"])(s).then((function(t){e.thumbLoad=!1;try{var i=t.message,n=t.code,s=t.data;200===n?e.goods.banner.push(s):e.$message.error(i)}catch(a){console.log("上传轮播图失败: ".concat(a))}})).catch((function(){e.thumbLoad=!1}))},sizePictureUpload:function(t){var e=this;this.thumbLoad=!0;var i=t.file,n=["image/png","image/jpg","image/jpeg"];if(-1===n.indexOf(i.type))return this.$message.warning("上传图片格式必须为: png或jpg格式"),!1;var s=new FormData;s.append("img",i),Object(r["i"])(s).then((function(t){e.thumbLoad=!1;try{var i=t.message,n=t.code,s=t.data;200===n?e.goods.size_img.push(s):e.$message.error(i)}catch(a){console.log("上传尺码图失败: ".concat(a))}})).catch((function(){e.thumbLoad=!1}))},deleteBanner:function(t){this.goods.banner.splice(t,1)},deleteSize:function(t){this.goods.size_img.splice(t,1)},handleSubmit:function(){var t=this;this.goods.sku=this.checkList;var e=this.goods,i=e.name,n=e.main_attr,s=e.banner,a=(e.size_img,e.price),o=e.img,r=e.content,c=e.vip_price,l=e.sku;console.log(this.goods,"goods"),this.$refs.addGoods.validate((function(e){if(!e)return t.$message.warning("商品属性还未填写完整哦!!!"),!1;i?n?s.length<1?t.$message.warning("请上传商品轮播图"):r?0==l.length?t.$message.warning("请选择商品尺码"):a?c&&c?t.addGoods({name:i,main_attr:n,banner:s,img:o,price:a,content:r,sku:l,vip_price:c}):t.$message.warning("请设置商品vip价格哦!!!"):t.$message.warning("请设置商品价格哦!!!"):t.$message.warning("请输入商品简介"):t.$message.warning("请先填写商品简称"):t.$message.warning("请先填写商品名称")}))},addGoods:function(t){var e=this;return Object(o["a"])(Object(a["a"])().mark((function i(){var n,s;return Object(a["a"])().wrap((function(i){while(1)switch(i.prev=i.next){case 0:return i.next=2,Object(r["a"])(t);case 2:n=i.sent;try{s=n.code,e.$message({message:"添加成功",type:200===s?"success":"error"}),200===s&&e.$router.push({name:"goods_list"})}catch(a){e.$message.error("添加失败")}case 4:case"end":return i.stop()}}),i)})))()}}}),u=l,d=(i("8093"),i("4e62"),i("2434"),i("2877")),p=Object(d["a"])(u,n,s,!1,null,"34c8abbe",null);e["default"]=p.exports},c40e:function(t,e,i){"use strict";i.d(e,"g",(function(){return s})),i.d(e,"h",(function(){return a})),i.d(e,"a",(function(){return o})),i.d(e,"i",(function(){return r})),i.d(e,"c",(function(){return c})),i.d(e,"e",(function(){return l})),i.d(e,"f",(function(){return u}));var n=i("b775"),s=function(t){return Object(n["a"])({url:"/goods/list",method:"get",params:t})},a=function(t){return Object(n["a"])({url:"/goods/shelves",method:"post",data:t})},o=function(t){return Object(n["a"])({url:"/goods/add_goods",method:"post",data:t})},r=function(t){return Object(n["a"])({url:"/goods/upload_img",method:"post",data:t})},c=function(t){return Object(n["a"])({url:"/goods/destroy",method:"post",data:t})},l=function(t){return Object(n["a"])({url:"/goods/edit_goods",method:"post",data:t})},u=function(t){return Object(n["a"])({url:"/goods/edit_size_desc",method:"post",data:t})}},ea4e:function(t,e,i){}}]);
|