|
|
webpackJsonp([1],{100:function(t,e,a){"use strict";var r=a(101),i=a.n(r),n=a(14),o=a.n(n),s=a(15),l=a.n(s),d=a(9),u=a(10),c=(a.n(u),a(62)),p=a.n(c),f=a(252),m=new d.a;e.a=i()({components:{},name:"ModalCreateCoupon",data:function(){return{brandList:[],readonly:!1,productReadonly:!1,visiable:!1,loading:!1,posting:!0,uploadTxt:"",isShowBrand:!0,bucket:"yhb-img01",productLimitType:"",formData:{includeBrandId:"",rangeType:1,productLimitValue:"",imageUrl:"",isExcludeis:!1}}},filters:{removeImageParams:function(t){return t?t.split("?")[0]:""}},methods:{show:function(t,e){var a=this;return l()(o.a.mark(function r(){var i,n,s,l,d,u,c,p;return o.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a.fetchBrandData(),a.readonly=e,a.posting=!0,a.visiable=!0,a.$refs.formProductSize.resetFields(),i="",n=!0,s={id:0,includeBrandId:"",productLimitType:"",productLimitValue:"",imageUrl:"",isExcludeis:!1},!t){r.next=15;break}return a.loading=!0,r.next=12,m._get("/ufoPlatform/sizePool/getSizePoolDetail",{id:t});case 12:l=r.sent,a.loading=!1,200===l.code?(d=l.data,u="",c="",1===d.rangeType&&(u=d.includeBrandId),p=parseInt(d.rangeType||1),1===p?(i="brand",n=!0):(i="product",n=!1),s={id:t,includeBrandId:u,imageUrl:d.imageUrl,rangeType:parseInt(d.rangeType||1),productLimitValue:d.notIncludeProductIds||d.includeProductIds,isExcludeis:!!d.notIncludeProductIds}):l.message&&a.$Message.warning(l.message);case 15:a.productLimitType=i,a.isShowBrand=n,a.formData=s;case 18:case"end":return r.stop()}},r,a)}))()},fetchBrandData:function(){var t=this;return l()(o.a.mark(function e(){var a;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m._get("/ufoPlatform/brand/getBrandSelector",{});case 2:a=e.sent,200===a.code?t.brandList=a.data:(a.message&&t.$Message.warning(a.message),t.$Loading.error());case 4:case"end":return e.stop()}},e,t)}))()},onOk:function(){var t=this;return this.formData.productLimitType?1!==this.formData.productLimitType||this.formData.includeBrandId?(2!==this.formData.productLimitType||this.formData.productLimitValue&&""!==this.formData.productLimitValue)&&(1!==this.formData.productLimitType||!this.formData.isExcludeis||this.formData.productLimitValue&&""!==this.formData.productLimitValue)?this.formData.imageUrl?void this.saveData(this.formData):(this.posting=!1,this.$Message.error("请上传图片!"),void this.$nextTick(function(){t.posting=!0})):(this.posting=!1,this.$Message.error("请填写商品编码!"),void this.$nextTick(function(){t.posting=!0})):(this.posting=!1,this.$Message.error("请选择品牌!"),void this.$nextTick(function(){t.posting=!0})):(this.posting=!1,this.$Message.error("请选择商品范围!"),void this.$nextTick(function(){t.posting=!0}))},getChangeChecked:function(t){this.formData.productLimitType=t,"brand"===t?(this.isShowBrand=!0,this.formData.productLimitType=1,this.formData.isExcludeis?this.productReadonly=!1:this.productReadonly=!0):(this.productReadonly=!1,this.isShowBrand=!1,this.formData.productLimitType=2)},getChecked:function(t){this.formData.isExcludeis=t,this.productReadonly=!t},saveData:function(t){var e=this;return l()(o.a.mark(function a(){var r,i,n,s;return o.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!e.readonly){a.next=3;break}return e.visiable=!1,a.abrupt("return");case 3:return r="",i="",n="",1===t.productLimitType?(i=t.productLimitValue,n=t.includeBrandId):(r=t.productLimitValue,n=""),a.next=9,m._post("/ufoPlatform/sizePool/addSizePool",{rangeType:t.productLimitType,includeBrandId:n,notIncludeProductIds:i,includeProductIds:r,imageUrl:t.imageUrl,imageHeight:t.imageHeight,imageWidth:t.imageWidth});case 9:s=a.sent,200===s.code?(e.$Message.success("保存成功"),e.visiable=!1,e.$emit("on-created")):(e.posting=!1,s.message&&e.$Message.warning(s.message),e.$nextTick(function(){e.posting=!0}));case 11:case"end":return a.stop()}},a,e)}))()},onBeforeUpload:function(t){var e=this;if("xlsx"!==t.name.split(".").pop().toLocaleLowerCase())return this.$Message.warning("文件格式错误"),!1;if(t.size>1048576)return this.$Message.warning("文件大小超过1M"),!1;var a=new FileReader;return a.readAsArrayBuffer(t),a.onloadstart=function(){e.uploadTxt="开始读取"},a.onprogress=function(t){e.uploadTxt="进度:"+Math.round(t.loaded/t.total*100)+"..."},a.onerror=function(){e.uploadTxt="文件读取出错"},a.onload=function(t){e.uploadTxt="";try{var a=t.target.result,r=p.a.read(a,{type:"array"}),i=r.SheetNames[0],n=r.Sheets[i],o=p.a.utils.sheet_to_json(n);e.formData.productLimitValue=o.map(function(t){return t["商品编码"]}).filter(function(t){return t}).join(",")}catch(t){e.uploadTxt="文件解析失败,请按照格式上传"}},!1},onExample:function(){var t=p.a.utils.book_new(),e=p.a.utils.json_to_sheet([{"商品编码":"123456"}]);p.a.utils.book_append_sheet(t,e,"尺码表适用范围示例"),p.a.writeFile(t,"尺码表适用范围示例.xlsx")},onUploadSuccess:function(t,e){e.url;this.formData.imageUrl=e.url,this.formData.imageWidth=e.width,this.formData.imageHeight=e.height},onUploadRemove:function(){this.formData.imageUrl="",this.formData.imageWidth=0,this.formData.imageHeight=0}}},"components",{fileUpload:f.a})},102:function(t,e,a){"use strict";var r=a(103);e.a={name:"drag-file-upload",props:{id:{type:Number},defaultFile:{type:String},disabled:{type:Boolean,default:!1},bucket:{type:String,default:function(){return"yhb-img01"}}},data:function(){var t=this;return{imgUrl:"",show:!0,visible:!1,uploadList:[],defaultList:t.defaultFile?[{url:t.defaultFile}]:[]}},methods:{handleView:function(t){this.imgUrl=t,this.visible=!0},handleRemove:function(){var t=this.uploadList[0],e=this.$refs.upload.fileList;this.$refs.upload.fileList.splice(e.indexOf(t),1),this.uploadList=this.$refs.upload.fileList,this.$emit("remove",this.id)},handleSuccess:function(t,e,a){if(t.data){var r=(t.data,t.data.width||0),i=t.data.height||0,n=t.data.imgUrl+"?imageView2/{2}/w/"+r+"/h/"+i;t.data.url=n,e.url=t.data.imgUrl,e.width=r,e.height=i}this.uploadList=a,this.$emit("success",this.id,e)},handleError:function(){this.$Notice.error("上传失败"),this.$emit("error",this.id)},handleFormatError:function(t){this.$Notice.warning({title:"文件格式不正确",desc:"文件 "+t.name+" 格式不正确,请上传 jpg 或 png 格式的图片。"})},handleMaxSize:function(t){this.$Notice.warning({title:"超出文件大小限制",desc:"文件 "+t.name+" 太大,不能超过 2M。"})}},mounted:function(){this.uploadList=this.$refs.upload.fileList},watch:{defaultFile:function(t){t?this.defaultList=[{url:t}]:this.handleRemove()}},components:{imagePurview:r.a}}},11:function(t,e){t.exports=Vue},2:function(t,e){t.exports=iview},247:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=a(248),i=a(16);Object(i.a)(r.a)},248:function(t,e,a){"use strict";function r(t){o||a(249)}var i=a(99),n=a(259),o=!1,s=a(0),l=r,d=s(i.a,n.a,!1,l,"data-v-da7229f0",null);d.options.__file="src/views/product/index.vue",e.a=d.exports},249:function(t,e){},250:function(t,e,a){"use strict";function r(t){o||a(251)}var i=a(100),n=a(258),o=!1,s=a(0),l=r,d=s(i.a,n.a,!1,l,"data-v-58270013",null);d.options.__file="src/views/product/components/modal-create-size.vue",e.a=d.exports},251:function(t,e){},252:function(t,e,a){"use strict";function r(t){o||a(253)}var i=a(102),n=a(257),o=!1,s=a(0),l=r,d=s(i.a,n.a,!1,l,null,null);d.options.__file="src/components/drag-file-uploadEx.vue",e.a=d.exports},253:function(t,e){},257:function(t,e,a){"use strict";var r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return t.show?a("div",[t.uploadList[0]?a("image-purview",{attrs:{status:t.uploadList[0].status,url:t.uploadList[0].url,progress:t.uploadList[0].showProgress,percentage:t.uploadList[0].percentage,remove:!0,disabled:t.disabled},on:{"remove-image":t.handleRemove}}):t._e(),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:!t.uploadList[0],expression:"!uploadList[0]"}],staticClass:"upload-box"},[a("Upload",{ref:"upload",attrs:{"show-upload-list":!1,data:{bucket:t.bucket},"on-success":t.handleSuccess,"on-error":t.handleError,"default-file-list":t.defaultList,format:["jpg","jpeg","png"],"max-size":2048,disabled:t.disabled,"on-format-error":t.handleFormatError,"on-exceeded-size":t.handleMaxSize,action:"/ufoPlatform/fileupload/uploadEx?debug=XYZ"}},[a("Icon",{attrs:{type:"ios-cloud-upload-outline",title:"上传图片"}})],1)],1)],1):t._e()},i=[];r._withStripped=!0;var n={render:r,staticRenderFns:i};e.a=n},258:function(t,e,a){"use strict";var r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("Modal",{attrs:{loading:t.posting,title:"尺码表设置",width:"600"},on:{"on-ok":t.onOk},model:{value:t.visiable,callback:function(e){t.visiable=e},expression:"visiable"}},[t.loading?a("Spin"):a("Form",{ref:"formProductSize",attrs:{model:t.formData,"label-width":80}},[a("FormItem",{staticClass:"form-group",attrs:{label:"商品范围"}}),t._v(" "),a("FormItem",{attrs:{prop:"productLimitType"}},[a("RadioGroup",{attrs:{disabled:t.readonly},on:{"on-change":t.getChangeChecked},model:{value:t.productLimitType,callback:function(e){t.productLimitType=e},expression:"productLimitType"}},[a("Radio",{attrs:{value:1,label:"brand",disabled:t.readonly}},[a("span",[t._v("指定品牌")])]),t._v(" "),a("Radio",{attrs:{value:2,label:"product",disabled:t.readonly}},[a("span",[t._v("指定商品")])])],1)],1),t._v(" "),a("FormItem",[a("Select",{directives:[{name:"show",rawName:"v-show",value:t.isShowBrand,expression:"isShowBrand"}],attrs:{clearable:"true",disabled:t.readonly},model:{value:t.formData.includeBrandId,callback:function(e){t.$set(t.formData,"includeBrandId",e)},expression:"formData.includeBrandId"}},t._l(t.brandList,function(e){return a("Option",{attrs:{value:e.id}},[t._v(t._s(e.text))])}),1)],1),t._v(" "),a("FormItem",{directives:[{name:"show",rawName:"v-show",value:t.isShowBrand,expression:"isShowBrand"}],attrs:{prop:"isExcludeis"}},[a("checkbox",{attrs:{disabled:t.readonly,checked:t.formData.isExcludeis},on:{"update:checked":function(e){return t.$set(t.formData,"isExcludeis",e)},"on-change":t.getChecked}},[t._v("排除商品")])],1),t._v(" "),a("FormItem",[a("Input",{attrs:{type:"textarea",disabled:t.productReadonly||t.readonly,placeholder:"填写商品编码,多个商品编码用英文逗号分隔"},model:{value:t.formData.productLimitValue,callback:function(e){t.$set(t.formData,"productLimitValue",e)},expression:"formData.productLimitValue"}}),t._v(" "),a("Poptip",{attrs:{trigger:"hover"}},[a("div",{attrs:{slot:"content"},slot:"content"},[a("p",[t._v("1.上传文件必须是xlsx文件")]),t._v(" "),a("p",[t._v("2.第一行标题栏:商品编码")]),t._v(" "),a("p",[t._v("\n 3.\n "),a("a",{attrs:{href:"javascript:;"},on:{click:t.onExample}},[t._v("下载样例")])])]),t._v(" "),a("Upload",{attrs:{action:"",format:["xlsx"],"max-size":1024,"before-upload":t.onBeforeUpload}},[a("Button",{attrs:{type:"success",size:"small",disabled:t.productReadonly||t.readonly}},[t._v("导入")]),t._v(" "),a("p",[t._v(t._s(t.uploadTxt))])],1)],1)],1),t._v(" "),a("FormItem",{staticClass:"form-group",attrs:{label:"尺码表上传"}}),t._v(" "),a("FormItem",[a("file-upload",{attrs:{disabled:t.readonly,"default-file":t._f("removeImageParams")(t.formData.imageUrl),id:0},on:{success:t.onUploadSuccess,remove:t.onUploadRemove}})],1)],1)],1)},i=[];r._withStripped=!0;var n={render:r,staticRenderFns:i};e.a=n},259:function(t,e,a){"use strict";var r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("LayoutContent",{attrs:{breads:[{title:"商品详情Banner"}]}},[a("LayoutTools",[a("Button",{attrs:{type:"primary"},on:{click:t.onCreateSize}},[t._v("新增尺码表")])],1),t._v(" "),a("LayoutTools",[a("div",{staticClass:"filter-root"},[a("Form",{ref:"filterForm",attrs:{inline:"",model:t.filter}},[a("FormItem",{attrs:{prop:"brandId"}},[a("Select",{staticStyle:{width:"100px"},attrs:{placeholder:"选择品牌",clearable:"true"},model:{value:t.filter.brandId,callback:function(e){t.$set(t.filter,"brandId",e)},expression:"filter.brandId"}},t._l(t.brandList,function(e){return a("Option",{attrs:{value:e.id}},[t._v(t._s(e.text))])}),1)],1),t._v(" "),a("FormItem",{attrs:{prop:"skn"}},[a("Input",{attrs:{placeholder:"商品编码"},model:{value:t.filter.name,callback:function(e){t.$set(t.filter,"name",e)},expression:"filter.name"}})],1),t._v(" "),a("FormItem",{attrs:{prop:"status"}},[a("Select",{staticStyle:{width:"100px"},attrs:{placeholder:"状态"},model:{value:t.filter.status,callback:function(e){t.$set(t.filter,"status",e)},expression:"filter.status"}},[a("Option",{attrs:{value:2}},[t._v("全部")]),t._v(" "),a("Option",{attrs:{value:1}},[t._v("已启用")]),t._v(" "),a("Option",{attrs:{value:0}},[t._v("关闭")])],1)],1)],1),t._v(" "),a("Button",{staticStyle:{width:"60px",height:"30px"},attrs:{type:"primary"},on:{click:t.onFilter}},[t._v("筛选")]),t._v(" "),a("Button",{staticStyle:{width:"60px",height:"30px"},attrs:{type:"primary"},on:{click:t.onAll}},[t._v("全部")])],1)]),t._v(" "),a("div",[a("p",{staticClass:"table-title"},[t._v("尺码表对应商品集")])]),t._v(" "),a("LayoutTable",{attrs:{page:t.page,total:t.total,columns:t.columns,data:t.data},on:{"on-page-change":t.onPageChange}}),t._v(" "),a("ModalCreateSize",{ref:"modalCreateSize",on:{"on-created":t.onFilter}}),t._v(" "),a("ModalPurview",{attrs:{url:t.imageUrl},model:{value:t.showModal,callback:function(e){t.showModal=e},expression:"showModal"}})],1)},i=[];r._withStripped=!0;var n={render:r,staticRenderFns:i};e.a=n},62:function(t,e){t.exports=XLSX},99:function(t,e,a){"use strict";var r=a(12),i=a.n(r),n=a(14),o=a.n(n),s=a(15),l=a.n(s),d=a(2),u=(a.n(d),a(9)),c=a(10),p=a.n(c),f=a(34),m=a(23),h=a.n(m),g=a(250),v=a(105),w=new u.a;e.a={name:"CouponPage",data:function(){var t=this;this.$createElement;return{filter:{brandId:"",productId:"",status:""},showModal:!1,imageUrl:"",page:1,total:0,brandList:[],data:[],columns:[{title:"状态",key:"statusStr",width:80},{title:"商品范围",key:"rangeTypeStr",width:180},{title:"包含",key:"includeItems",align:"center",width:180},{title:"不包含",key:"notIncludeItems",align:"center",width:90},{title:"尺码表",align:"center",key:"imageUrl",width:90,render:function(e,a){var r=a.row;return e("div",[e(d.Poptip,{attrs:{trigger:"hover",content:"点击查看大图",placement:"left"}},[e("img",{attrs:{src:r.imageUrl,width:"100%"},on:{click:function(){return t.preview(r.imageUrl)}}})])])}},{title:"操作",align:"center",width:300,render:function(e,a){var r=a.row;return e("div",[0===r.status?e(d.Button,{style:"margin-right:10px;",attrs:{type:"primary",size:"small"},on:{click:function(){return t.onOpenAndClose(r)}}},["启用"]):e(d.Button,{style:"margin-right:10px;",attrs:{type:"error",size:"small"},on:{click:function(){return t.onOpenAndClose(r)}}},["关闭"]),e(d.Button,{style:"margin-right:10px;",attrs:{type:"error",size:"small"},on:{click:function(){return t.onDelete(r)}}},["删除"]),e(d.Button,{style:"margin-right:10px;",attrs:{type:"primary",size:"small"},on:{click:function(){return t.onToDetailSize(r)}}},["详情"])])}}]}},created:function(){var t=this;this.$nextTick(function(){var e=h.a.parse(location.search?location.search.slice(1):""),a=e.page,r=e.brandId,i=e.productId,n=e.status;t.filter.brandId=r||t.filter.brandId,t.filter.productId=i||t.filter.productId,t.filter.status=n||t.filter.status,t.page=a?parseInt(a):1,t.fetchData(t.filter,t.page),t.fetchBrandData()})},methods:{onOpenAndClose:function(t){var e=this,a=t.id,r=t.status;return l()(o.a.mark(function t(){var i,n;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.$Loading.start(),i=1===r?0:1,t.next=4,w._get("/ufoPlatform/sizePool/updateSizePoolStatus",{id:a,status:i});case 4:n=t.sent,200===n.code?(e.$Loading.finish(),e.fetchData(e.filter)):(n.message&&e.$Message.warning(n.message),e.$Loading.error());case 6:case"end":return t.stop()}},t,e)}))()},onDelete:function(t){var e=this,a=t.id;return l()(o.a.mark(function t(){var r;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.$Loading.start(),t.next=3,w._get("/ufoPlatform/sizePool/deleteSizePool",{id:a});case 3:r=t.sent,200===r.code?(e.$Loading.finish(),e.fetchData(e.filter)):(r.message&&e.$Message.warning(r.message),e.$Loading.error());case 5:case"end":return t.stop()}},t,e)}))()},fetchBrandData:function(){var t=this;return l()(o.a.mark(function e(){var a,r;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w._get("/ufoPlatform/brand/getBrandSelector",{});case 2:a=e.sent,200===a.code&&(r=[{id:"",text:"全部"}],t.brandList=a.data);case 4:case"end":return e.stop()}},e,t)}))()},preview:function(t){console.log("=====:"+t),this.showModal=!0,this.imageUrl=t,this.$emit("purview",this.url)},onFilter:function(){this.fetchData(this.filter)},onAll:function(){this.$refs.filterForm.resetFields(),this.fetchData(this.filter)},onPageChange:function(t){this.fetchData(this.filter,t)},onCreateSize:function(t){this.$refs.modalCreateSize.show(t.id,!1)},onToDetailSize:function(t){this.$refs.modalCreateSize.show(t.id,!0)},onExport:function(){var t=this;return l()(o.a.mark(function e(){var a;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.$Loading.start(),e.next=3,w._get("/ufoPlatform/coupon/export",{param:{method:"coupon",param:w._2params(t.getParams(t.filter))}},{responseType:"blob"});case 3:a=e.sent,a instanceof Blob?(f.a.downloadBlob(a,"优惠券导出_"+p()().format("YYYY-MM-DD")+".xlsx"),t.$Loading.finish()):a&&(a.message&&t.$Message.warning(a.message),t.$Loading.error());case 5:case"end":return e.stop()}},e,t)}))()},fetchData:function(t){var e=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return l()(o.a.mark(function r(){var n;return o.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return e.page=a,e.$Loading.start(),r.next=4,w._get("/ufoPlatform/sizePool/querySizePoolList",i()({page:a},e.getParams(t)));case 4:n=r.sent,200===n.code?(e.total=n.data.total,e.data=n.data.list,e.$Loading.finish()):(n.message&&e.$Message.warning(n.message),e.$Loading.error());case 6:case"end":return r.stop()}},r,e)}))()},getParams:function(t){var e=t.status>=2?"":t.status;return{brandId:t.brandId||"",productId:t.productId||"",status:e}}},components:{ModalCreateSize:g.a,ModalPurview:v.a}}}},[247]); |