webpackJsonp([6],{DlMc:function(e,t,i){var s=i("gApy"),r=i("DtRx"),o=r;o.v1=s,o.v4=r,e.exports=o},DtRx:function(e,t,i){var s=i("i4uy"),r=i("MAlW");e.exports=function(e,t,i){var o=t&&i||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||s)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var n=0;n<16;++n)t[o+n]=a[n];return t||r(a)}},MAlW:function(e,t){for(var i=[],s=0;s<256;++s)i[s]=(s+256).toString(16).substr(1);e.exports=function(e,t){var s=t||0,r=i;return[r[e[s++]],r[e[s++]],r[e[s++]],r[e[s++]],"-",r[e[s++]],r[e[s++]],"-",r[e[s++]],r[e[s++]],"-",r[e[s++]],r[e[s++]],"-",r[e[s++]],r[e[s++]],r[e[s++]],r[e[s++]],r[e[s++]],r[e[s++]]].join("")}},c7fx:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=i("Dd8w"),r=i.n(s),o=i("Gu7T"),a=i.n(o),n=i("mvHQ"),c=i.n(n),l=i("Xxa5"),m=i.n(l),p=i("exGp"),u=i.n(p),d=i("DlMc"),h=i.n(d),g=i("NYxO"),f={data:function(){return{parimarForm:[],parimarOptions:[],distribution:{},tips:{cash_1:",请谨慎选择",cash_2:",请谨慎输入此金额",user:{1:"用户消费, 其上线所得提成,无上线时无提成。提成为百分比,取值1%到100%",2:"用户消费, 其上线所得提成,无上线时无提成。提成为固定金额,最多保留两位小数,若输入的金额大于所购买规格的商品,也是按照输入的金额来进行提成"},staff:{1:"用户消费, 其对应员工所得提成。当消费的用户的上线与消费所属"+this.$t("menu.BusinessCard")+"为同一个人时, 只计算员工提成, 如果没有设置员工提成则计算分销提成, 都没有设置则不计算。提成为百分比,取值1%到100%",2:"用户消费, 其对应员工所得提成。当消费的用户的上线与消费所属"+this.$t("menu.BusinessCard")+"为同一个人时, 只计算员工提成, 如果没有设置员工提成则计算分销提成, 都没有设置则不计算。提成为固定金额,最多保留两位小数,若输入的金额大于所购买规格的商品,也是按照输入的金额来进行提成"}},link_options:[{label:"其他小程序",value:2},{label:"跳转网页",value:3}],jumpType:{2:"请输入小程序appid",3:"请输入网页链接"},testprice:1,testContent:"测试",dialogSwitch:!1,dialogTitle:"添加规格",dialogType:"add",dialogIndex:"",specsName:"",batchValue:"0",dialogPriceTitle:"",dialogPriceVisible:!1,id:"",navTitle:"",copySpecsItem:[],defaultParams:{checkStrictly:!0,multiple:!0,label:"name",value:"id",isDisabled:!0},parForm:{},specIsImg:!1,imgForm:{name:"",carte:[],cover:[],images:[],image_url:"",jump_type:"",video_url:"",desc:"",price:"",phone:"",sort:0},imgFormRules:{name:{required:!0,validator:this.$reg.isNotNull,text:"商品名称",reg_type:2,trigger:"blur"},price:{required:!0,validator:this.$reg.isMoney,text:"商品价格",trigger:"blur"},carte:{required:!0,type:"array",message:"请选择商品分类",trigger:["blur","change"]},cover:{required:!0,type:"array",message:"请上传图片",trigger:["blur","change"]},images:{required:!0,type:"array",message:"请上传图片",trigger:["blur","change"]},desc:{required:!0,validator:this.$reg.isNotNull,text:"商品详情",reg_type:2,trigger:"blur"},phone:{required:!0,validator:this.$reg.isTel,text:"电话号码",trigger:"blur"}},sendForm:{checkList:[]},options:{},companyResult:[],isMemberAuth:!1,levelList:[],memberForm:{is_member:0,is_discount:0,discount_data:[]}}},created:function(){var e=this;return u()(m.a.mark(function t(){var i;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=e.$route.query.id,e.id=i,e.navTitle=e.$t(i?"menu.MallGoodEdit":"menu.MallGoodAdd"),t.next=5,e.getSelectOptions();case 5:if(!i){t.next=8;break}return t.next=8,e.getGoodsInfo();case 8:case"end":return t.stop()}},t,e)}))()},methods:{changeParmar:function(e){var t=this;this.$api.getTemplateInfo({template_id:e}).then(function(e){t.parimarForm=e.data.info})},getGoodsInfo:function(){var e=this;return u()(m.a.mark(function t(){return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.$api.mall.editGoods({id:e.id}).then(function(t){if(200===t.code){var i=t.data;for(var s in e.imgForm)"cover"===s?e.imgForm[s]=[{url:i.cover}]:"images"===s?e.imgForm[s]=i.images.map(function(e){return{url:e}}):"carte"===s?function(){var t=[];i[s].forEach(function(e){t.push([e])}),e.imgForm[s]=t}():e.imgForm[s]=i[s]}});case 1:case"end":return t.stop()}},t,e)}))()},createTableData:function(){var e=this.specsForm.specsItem;if(0===e.length)this.specsForm.specsTable=[];else{var t=e.map(function(e){return e.cate}),i=this.handleSpecsData(t);this.copySpecsItem.forEach(function(e){i.forEach(function(t){e.id==t.id&&(t.price=e.price,t.original_price=e.original_price,t.cost_price=e.cost_price,t.stock=e.stock)})}),this.specsForm.specsTable=i}},handleSpecsData:function(e){if(e.length>1){for(var t=e[0].length,i=e[1].length,s=e.slice(0),r=[],o=0;o1&&void 0!==arguments[1]?arguments[1]:[],i=0,s=e.length;i50?this.$message.error("规格值最多只能输入50个字!"):(this.specsForm.specsItem[e].cate.push({title:i,id:h()(),price:"0.00",original_price:"0.00",cost_price:"0.00",stock:0,image:""}),this.createTableData())),this.specsForm.specsItem[e].inputVisible=!1,this.specsForm.specsItem[e].inputValue=""):this.$message.error("请输入规格值")},showInput:function(e){var t=this;this.specsForm.specsItem[e].inputVisible=!0,this.$nextTick(function(i){t.$refs["saveTagInput"+e][0].$refs.input.focus()})},changeCheckBox:function(e){var t=this;this.authList.map(function(i){t.setForm[i.key]=e.includes(i.title)?1:0})},goBack:function(){this.$route.meta.refresh=!0,this.$router.back(-1)},addSpecsName:function(e){var t=JSON.parse(c()(this.specsName)).replace(/^\s+|\s+$/g,"");if(2!==e||t){if(2===e&&t)-1===this.specsForm.specsItem.map(function(e){return e.title}).indexOf(t)?"add"===this.dialogType?this.specsForm.specsItem.push({inputVisible:!1,inputValue:"",title:t,pid:h()(),cate:[],is_img:0}):this.specsForm.specsItem[this.dialogIndex].title=t:this.$message.error("请勿添加相同的规格名!");this.specsName="",this.dialogIndex="",this.dialogSwitch=!1}else this.$message.error("请添加规格名!")},addOrEditSpecsTitle:function(e,t){"add"===e?this.dialogTitle="添加规格":"edit"===e&&(this.dialogTitle="编辑规格"),this.dialogSwitch=!0,this.dialogType=e,this.specsName=this.specsForm.specsItem[t].title||"",t>=0&&(this.dialogIndex=t)},getGoodsCover:function(e){this.imgForm.cover=e},getSpecImg:function(e,t,i){this.specsForm.specsItem[t].cate[i].image=e.length>0?e:""},setSpecImg:function(e){var t=this;this.specIsImg?1===this.specsForm.specsItem[e].is_img?(this.specsForm.specsItem[e].is_img=0,this.specIsImg=!1):this.$confirm(this.$t("tips.confirmDeleteSpecImage"),this.$t("tips.reminder"),{confirmButtonText:this.$t("action.comfirm"),cancelButtonText:this.$t("action.cancel"),type:"warning"}).then(function(){t.specsForm.specsItem[e].cate.length<1&&t.$confirm("请先添加规格值",t.$t("tips.reminder"),{confirmButtonText:t.$t("action.comfirm"),cancelButtonText:t.$t("action.cancel"),type:"warning"}).then(function(){t.showInput(e)});var i=t.specsForm.specsItem;i.map(function(t,i){t.is_img=e===i?1:0,e===i&&t.cate.map(function(e){e.image&&(e.image="string"==typeof e.image?[{url:e.image}]:e.image)})}),t.specsForm.specsItem=i}).catch(function(){}):(this.specIsImg=!0,this.specsForm.specsItem[e].is_img=1,this.specsForm.specsItem[e].cate.length<1&&this.$confirm("请先添加规格值",this.$t("tips.reminder"),{confirmButtonText:this.$t("action.comfirm"),cancelButtonText:this.$t("action.cancel"),type:"warning"}).then(function(){t.showInput(e)}))},selectedFiles:function(e,t){var i;(i=this.imgForm[t]).push.apply(i,a()(e))},moveFiles:function(e,t){this.imgForm[t]=e},getFile:function(e,t){var i=e.length-1;this.imgForm[t]=e[i].url},submitGoodsInfo:function(){var e=this,t=this.imgForm,i=!1;if(this.$refs.imgForm.validate(function(e){e&&(i=!0)}),i){var s=JSON.parse(c()({imgForm:t}));s.imgForm.cover=s.imgForm.cover.map(function(e){return e.url})[0],s.imgForm.images=s.imgForm.images.map(function(e){return e.url});var r=[];s.imgForm.carte.forEach(function(e){r.push(e[0])}),s.imgForm.carte=r,this.id?(s.imgForm.id=this.id,this.$api.mall.editGoodsPost(s.imgForm).then(function(t){200===t.code&&(e.$message.success(e.$t("tips.successSub")),e.goBack())})):this.$api.mall.addGoods(s.imgForm).then(function(t){200===t.code&&(e.$message.success(e.$t("tips.successSub")),e.goBack())})}},checkSpecsItems:function(e){return e.some(function(e){return void 0===e.price||""===e.price||void 0===e.stock||""===e.stock})}},filters:{handleFileName:function(e){var t="请上传视频";return e&&(t=e.substring(e.lastIndexOf("/")+1)),t}},computed:r()({},Object(g.b)(["adSwitch"])),watch:{"imgForm.desc":function(e,t){e&&!t&&this.$refs.imgForm.clearValidate("desc")}}},v={render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"lb-goods-edit"},[i("top-nav",{attrs:{title:e.navTitle,isBack:!0}}),e._v(" "),i("div",{staticClass:"page-main"},[i("lb-classify-title",{attrs:{title:"基本信息"}}),e._v(" "),i("div",{staticStyle:{height:"20px"}}),e._v(" "),i("el-form",{ref:"imgForm",staticClass:"img-form",attrs:{model:e.imgForm,rules:e.imgFormRules,"label-width":"180px"},nativeOn:{submit:function(e){e.preventDefault()}}},[i("el-form-item",{attrs:{label:"商品名称",prop:"name"}},[i("el-input",{attrs:{type:"text",placeholder:"请输入商品名称",maxlength:"38","show-word-limit":""},model:{value:e.imgForm.name,callback:function(t){e.$set(e.imgForm,"name",t)},expression:"imgForm.name"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"选择商品分类",prop:"carte"}},[i("el-cascader",{attrs:{options:e.options,props:e.defaultParams,clearable:""},model:{value:e.imgForm.carte,callback:function(t){e.$set(e.imgForm,"carte",t)},expression:"imgForm.carte"}})],1),e._v(" "),i("lb-classify-title",{attrs:{title:"商品信息"}}),e._v(" "),i("el-form-item",{attrs:{label:"封面图",prop:"cover"}},[i("lb-cover",{attrs:{fileList:e.imgForm.cover},on:{selectedFiles:e.getGoodsCover}}),e._v(" "),i("lb-tool-tips",[e._v("图片建议尺寸: 345 * 350")])],1),e._v(" "),i("el-form-item",{attrs:{label:"轮播图",prop:"images"}},[i("lb-cover",{attrs:{type:"more",fileList:e.imgForm.images},on:{selectedFiles:function(t){return e.selectedFiles(t,"images")},moveFiles:function(t){return e.moveFiles(t,"images")}}}),e._v(" "),i("lb-tool-tips",[e._v("图片建议尺寸: 750 * 564")])],1),e._v(" "),i("el-form-item",{attrs:{label:"轮播图跳转链接",prop:"image_url"}},[i("el-input",{attrs:{type:"text",placeholder:"请输入网页链接","show-word-limit":""},model:{value:e.imgForm.image_url,callback:function(t){e.$set(e.imgForm,"image_url",t)},expression:"imgForm.image_url"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"视频",prop:"video_url"}},[i("div",{staticClass:"lb-file-input flex-between"},[i("div",{class:[{"c-title":e.imgForm.video_url}]},[e._v("\n "+e._s(e._f("handleFileName")(e.imgForm.video_url))+"\n ")]),e._v(" "),i("lb-cover",{attrs:{type:"button",fileType:"video",fileSize:1},on:{selectedFiles:function(t){return e.getFile(t,"video_url")}}})],1)]),e._v(" "),i("el-form-item",{attrs:{label:"商品价格",prop:"price"}},[i("el-input",{attrs:{type:"text",placeholder:"请输入金额","show-word-limit":""},model:{value:e.imgForm.price,callback:function(t){e.$set(e.imgForm,"price",t)},expression:"imgForm.price"}},[i("template",{slot:"append"},[e._v("元")])],2)],1),e._v(" "),i("el-form-item",{attrs:{label:"商品详情",prop:"desc"}},[i("lb-ueditor",{attrs:{destroy:!0},model:{value:e.imgForm.desc,callback:function(t){e.$set(e.imgForm,"desc",t)},expression:"imgForm.desc"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"联系平台",prop:"phone"}},[i("el-input",{attrs:{type:"text",placeholder:"请输入电话号码","show-word-limit":""},model:{value:e.imgForm.phone,callback:function(t){e.$set(e.imgForm,"phone",t)},expression:"imgForm.phone"}})],1),e._v(" "),i("el-form-item",{attrs:{label:"排序值",prop:"sort"}},[i("el-input",{attrs:{type:"text",placeholder:"","show-word-limit":""},model:{value:e.imgForm.sort,callback:function(t){e.$set(e.imgForm,"sort",t)},expression:"imgForm.sort"}}),e._v(" "),i("lb-tool-tips",[e._v("值越大, 排序越靠前")])],1)],1)],1),e._v(" "),i("el-dialog",{attrs:{title:e.dialogTitle,visible:e.dialogSwitch,width:"400px",center:""},on:{"update:visible":function(t){e.dialogSwitch=t}},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.addSpecsName(2)}}},[i("div",{staticClass:"dialog-inner"},[i("el-input",{attrs:{type:"textarea",rows:4,resize:"none",maxlength:"50","show-word-limit":"",placeholder:"请输入规格名"},model:{value:e.specsName,callback:function(t){e.specsName=t},expression:"specsName"}})],1),e._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){return e.addSpecsName(1)}}},[e._v(e._s(e.$t("action.cancel")))]),e._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.addSpecsName(2)}}},[e._v(e._s(e.$t("action.comfirm")))])],1)]),e._v(" "),i("el-dialog",{attrs:{title:"批量设置"+e.dialogPriceTitle,visible:e.dialogPriceVisible,width:"300px",center:""},on:{"update:visible":function(t){e.dialogPriceVisible=t}},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.setBatchPrice(2)}}},[i("div",{staticClass:"dialog-inner"},["库存"===e.dialogPriceTitle?i("el-input-number",{attrs:{controls:!1,precision:0,min:0},model:{value:e.batchValue,callback:function(t){e.batchValue=t},expression:"batchValue"}}):i("el-input-number",{attrs:{controls:!1,precision:2,min:0,max:999999999.99},model:{value:e.batchValue,callback:function(t){e.batchValue=t},expression:"batchValue"}})],1),e._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){return e.setBatchPrice(1)}}},[e._v(e._s(e.$t("action.cancel")))]),e._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.setBatchPrice(2)}}},[e._v(e._s(e.$t("action.comfirm")))])],1)]),e._v(" "),i("div",{staticClass:"fiexd",staticStyle:{bottom:"0px"},style:{right:e.adSwitch?"242px":"22px"}},[i("el-button",{attrs:{type:"primary"},on:{click:e.submitGoodsInfo}},[e._v(e._s(e.$t("action.submit")))]),e._v(" "),i("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"default"},on:{click:e.goBack}},[e._v(e._s(e.$t("action.back")))])],1)],1)},staticRenderFns:[]};var b=i("VU/8")(f,v,!1,function(e){i("wg6n")},"data-v-c4193456",null);t.default=b.exports},gApy:function(e,t,i){var s,r,o=i("i4uy"),a=i("MAlW"),n=0,c=0;e.exports=function(e,t,i){var l=t&&i||0,m=t||[],p=(e=e||{}).node||s,u=void 0!==e.clockseq?e.clockseq:r;if(null==p||null==u){var d=o();null==p&&(p=s=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==u&&(u=r=16383&(d[6]<<8|d[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),g=void 0!==e.nsecs?e.nsecs:c+1,f=h-n+(g-c)/1e4;if(f<0&&void 0===e.clockseq&&(u=u+1&16383),(f<0||h>n)&&void 0===e.nsecs&&(g=0),g>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");n=h,c=g,r=u;var v=(1e4*(268435455&(h+=122192928e5))+g)%4294967296;m[l++]=v>>>24&255,m[l++]=v>>>16&255,m[l++]=v>>>8&255,m[l++]=255&v;var b=h/4294967296*1e4&268435455;m[l++]=b>>>8&255,m[l++]=255&b,m[l++]=b>>>24&15|16,m[l++]=b>>>16&255,m[l++]=u>>>8|128,m[l++]=255&u;for(var F=0;F<6;++F)m[l+F]=p[F];return t||a(m)}},i4uy:function(e,t){var i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(i){var s=new Uint8Array(16);e.exports=function(){return i(s),s}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},wg6n:function(e,t){}});