chunk-232b94cf.424a3ec2.js 10 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-232b94cf"],{"1e0c":function(t,e,a){"use strict";a.r(e);var i=a("2f62"),r=a("b0e7"),s=a("b7be"),o=a("c4ad"),n=a("d708");function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function c(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var d={name:"create",components:{uploadPictures:r.a,goodsList:o.default},data:function(){return{roterPre:n.a.roterPre,currentTab:"1",modals:!1,gridBtn:{xl:4,lg:8,md:8,sm:8,xs:8},gridPic:{xl:6,lg:8,md:12,sm:12,xs:12},headeNum:[{type:"1",name:"基础设置"},{type:"2",name:"关联商品"}],formValidate:{desc:"",image:"",sort:0,video_url:"",product_id:[]},modalPic:!1,isChoice:"单选",ruleValidate:{desc:[{required:!0,message:"请输入视频简介",trigger:"blur"}],video_url:[{required:!0,message:"请上传视频",validator:function(t,e,a){if(!e)return a(new Error("请上传视频"));a()},trigger:"change"}],image:[{required:!0,validator:function(t,e,a){if(!e)return a(new Error("请上传视频封面图"));a()},trigger:"change"}]},columns:[{type:"selection",width:60,align:"center"},{title:"商品信息",slot:"info",minWidth:180},{title:"商品分类",key:"cate_name",minWidth:180},{title:"售价",key:"price",minWidth:180},{title:"库存",key:"stock",minWidth:180},{title:"操作",slot:"action",fixed:"right",width:100}],tableData:[],id:0,formSelection:[],typeTit:""}},computed:function(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?l(a,!0).forEach((function(e){c(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):l(a).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}({},Object(i.e)("admin/layout",["isMobile","menuCollapse"]),{labelWidth:function(){return this.isMobile?void 0:90},labelPosition:function(){return this.isMobile?"top":"right"}}),created:function(){this.id=this.$route.params.id||0,this.id&&this.getInfo()},methods:{delVideo:function(){this.$set(this.formValidate,"video_url",""),this.$refs.formValidate.validateField("video_url")},del:function(t){var e=this;this.tableData.forEach((function(a,i){if(t.id===a.id)return e.tableData.splice(i,1)}))},batchDel:function(){for(var t=0;t<this.formSelection.length;t++)for(var e=0;e<this.tableData.length;e++)this.tableData[e].id===this.formSelection[t].id&&(this.tableData.splice(e,1),e--)},selectChange:function(t){this.formSelection=t},addGoods:function(){this.modals=!0},cancel:function(){this.modals=!1},unique:function(t){var e=new Map;return t.filter((function(t){return!e.has(t.id)&&e.set(t.id,1)}))},getProductId:function(t){this.modals=!1;var e=this.tableData.concat(t);this.tableData=this.unique(e)},getInfo:function(){var t=this;Object(s.Jb)(this.id).then((function(e){t.formValidate=e.data,t.tableData=e.data.productInfo})).catch((function(e){t.$Message.error(e.msg)}))},upTab:function(){this.currentTab="1"},downTab:function(t){var e=this;this.$refs[t].validate((function(t){t?e.currentTab="2":e.$Message.warning("请完善数据")}))},handleSubmit:function(t){var e=this;this.$refs[t].validate((function(t){if(t){var a=[];e.tableData.forEach((function(t){a.push(t.id)})),e.formValidate.product_id=a,Object(s.Mb)(e.formValidate,e.id).then((function(t){e.$router.push({path:"".concat(e.roterPre,"/marketing/short_video/index")}),e.$Message.success(t.msg)})).catch((function(t){e.$Message.error(t.msg)}))}else e.$Message.warning("请完善数据")}))},modalPicTap:function(t){this.typeTit=t,this.modalPic=!0},getPic:function(t){this.modalPic=!1,"image"==this.typeTit?(this.formValidate.image=t.att_dir,this.$refs.formValidate.validateField("image")):(this.formValidate.video_url=t.att_dir,this.$refs.formValidate.validateField("video_url"))},handleRemove:function(){this.formValidate.image="",this.$refs.formValidate.validateField("image")}}},u=(a("6cb7a"),a("2877")),m=Object(u.a)(d,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("div",{staticClass:"i-layout-page-header"},[a("PageHeader",{staticClass:"product_tabs",attrs:{"hidden-breadcrumb":""}},[a("div",{staticClass:"acea-row row-middle",attrs:{slot:"title"},slot:"title"},[a("router-link",{attrs:{to:{path:t.roterPre+"/marketing/short_video/index"}}},[a("div",{staticClass:"font-sm after-line"},[a("span",{staticClass:"iconfont iconfanhui"}),a("span",{staticClass:"pl10"},[t._v("返回")])])]),a("span",{staticClass:"mr20 ml16",domProps:{textContent:t._s(t.$route.params.id?"编辑短视频":"添加短视频")}})],1)])],1),a("Card",{staticClass:"ivu-mt mb79",attrs:{bordered:!1,"dis-hover":""}},[a("div",{staticClass:"new_tab"},[a("Tabs",{model:{value:t.currentTab,callback:function(e){t.currentTab=e},expression:"currentTab"}},t._l(t.headeNum,(function(t,e){return a("TabPane",{key:e,attrs:{label:t.name,name:t.type}})})),1)],1),"2"===t.currentTab?a("div",{staticClass:"Button"},[a("Button",{staticClass:"bnt mr15",attrs:{type:"primary"},on:{click:t.addGoods}},[t._v("添加商品")]),a("Tooltip",{attrs:{content:"本页至少选中一项",disabled:!!t.formSelection.length}},[a("Button",{staticClass:"bnt mr15",attrs:{disabled:!t.formSelection.length},on:{click:t.batchDel}},[t._v("批量删除")])],1)],1):t._e(),a("Form",{ref:"formValidate",staticClass:"formValidate mt20",attrs:{rules:t.ruleValidate,model:t.formValidate,"label-width":t.labelWidth,"label-position":t.labelPosition},nativeOn:{submit:function(t){t.preventDefault()}}},[a("Row",{directives:[{name:"show",rawName:"v-show",value:"1"===t.currentTab,expression:"currentTab === '1'"}],attrs:{gutter:24,type:"flex"}},[a("Col",{attrs:{span:"24"}},[a("FormItem",{attrs:{label:"视频简介:",prop:"desc"}},[a("Input",{directives:[{name:"width",rawName:"v-width",value:"50%",expression:"'50%'"}],attrs:{type:"textarea",rows:3,placeholder:"请输入视频简介",maxlength:"220","show-word-limit":""},model:{value:t.formValidate.desc,callback:function(e){t.$set(t.formValidate,"desc",e)},expression:"formValidate.desc"}})],1)],1),a("Col",{attrs:{span:"24"}},[a("FormItem",{attrs:{label:"上传视频:",prop:"video_url"}},[a("Button",{on:{click:function(e){return t.modalPicTap("video")}}},[t._v("上传视频")]),a("div",{staticClass:"tips"},[t._v("建议时长:9~30秒,视频宽高比9:16(不建议本地储存)")]),t.formValidate.video_url?a("div",{staticClass:"iview-video-style"},[a("video",{staticClass:"video-style",attrs:{src:t.formValidate.video_url,controls:"controls"}}),a("div",{staticClass:"mark"}),a("Icon",{staticClass:"iconv",attrs:{type:"ios-trash-outline"},on:{click:t.delVideo}})],1):t._e()],1)],1),a("Col",{attrs:{span:"24"}},[a("FormItem",{attrs:{label:"封面图:",prop:"image"}},[a("div",{staticClass:"pictrueBox"},[t.formValidate.image?a("div",{staticClass:"pictrue"},[a("img",{directives:[{name:"lazy",rawName:"v-lazy",value:t.formValidate.image,expression:"formValidate.image"}]}),a("Button",{staticClass:"btndel",attrs:{shape:"circle",icon:"md-close"},nativeOn:{click:function(e){return t.handleRemove(e)}}})],1):a("div",{staticClass:"upLoad acea-row row-center-wrapper",on:{click:function(e){return t.modalPicTap("image")}}},[a("Input",{staticClass:"input-display",model:{value:t.formValidate.image,callback:function(e){t.$set(t.formValidate,"image",e)},expression:"formValidate.image"}}),a("Icon",{attrs:{type:"ios-add",size:"26"}})],1)]),a("div",{staticClass:"tips"},[t._v("建议尺寸:226 * 300px")])])],1),a("Col",{attrs:{span:"24"}},[a("FormItem",{attrs:{label:"排序:"}},[a("InputNumber",{directives:[{name:"width",rawName:"v-width",value:"50%",expression:"'50%'"}],attrs:{min:0,max:99999999},model:{value:t.formValidate.sort,callback:function(e){t.$set(t.formValidate,"sort",e)},expression:"formValidate.sort"}})],1)],1)],1),a("div",{directives:[{name:"show",rawName:"v-show",value:"2"===t.currentTab,expression:"currentTab === '2'"}]},[a("Table",{staticClass:"ivu-mt",attrs:{columns:t.columns,data:t.tableData,"highlight-row":"","no-userFrom-text":"暂无数据","no-filtered-userFrom-text":"暂无筛选结果"},on:{"on-selection-change":t.selectChange},scopedSlots:t._u([{key:"info",fn:function(e){var i=e.row;return[a("div",{staticClass:"imgPic acea-row row-middle"},[a("viewer",[a("div",{staticClass:"pictrue"},[a("img",{directives:[{name:"lazy",rawName:"v-lazy",value:i.image,expression:"row.image"}]})])]),a("div",{staticClass:"info"},[a("Tooltip",{attrs:{"max-width":"200",placement:"bottom",transfer:""}},[a("span",{staticClass:"line2"},[t._v(t._s(i.store_name)+t._s(i.suk))]),a("p",{attrs:{slot:"content"},slot:"content"},[t._v(t._s(i.store_name)+t._s(i.suk))])])],1)],1)]}},{key:"action",fn:function(e){var i=e.row;return e.index,[a("a",{on:{click:function(e){return t.del(i)}}},[t._v("删除")])]}}])})],1)],1)],1),a("Card",{staticClass:"fixed-card",style:{left:t.menuCollapse?t.isMobile?"0":"80px":"200px"},attrs:{bordered:!1,"dis-hover":""}},[a("Form",[a("FormItem",["1"!==t.currentTab?a("Button",{staticStyle:{"margin-right":"10px"},on:{click:t.upTab}},[t._v("上一步")]):t._e(),"2"!==t.currentTab?a("Button",{staticClass:"submission",attrs:{type:"primary"},on:{click:function(e){return t.downTab("formValidate")}}},[t._v("下一步")]):a("Button",{staticClass:"submission",attrs:{type:"primary"},on:{click:function(e){return t.handleSubmit("formValidate")}}},[t._v("保存")])],1)],1)],1),a("Modal",{attrs:{width:"960px",scrollable:"","footer-hide":"",closable:"",title:"上传商品图","mask-closable":!1,"z-index":1},model:{value:t.modalPic,callback:function(e){t.modalPic=e},expression:"modalPic"}},[t.modalPic?a("uploadPictures",{attrs:{isChoice:t.isChoice,gridBtn:t.gridBtn,gridPic:t.gridPic},on:{getPic:t.getPic}}):t._e()],1),a("Modal",{staticClass:"paymentFooter",attrs:{title:"商品列表",footerHide:"",scrollable:"",width:"900"},on:{"on-cancel":t.cancel},model:{value:t.modals,callback:function(e){t.modals=e},expression:"modals"}},[t.modals?a("goods-list",{ref:"goodslist",attrs:{ischeckbox:!0,isdiy:!0},on:{getProductId:t.getProductId}}):t._e()],1)],1)}),[],!1,null,"047db158",null);e.default=m.exports},"6cb7a":function(t,e,a){"use strict";var i=a("d354");a.n(i).a},d354:function(t,e,a){}}]);