1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-dcbb8af8"],{"0a96":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vipmangeadd"},[a("div",{staticClass:"outmain ba_f heighthv pad_20 bor_rad5"},[e._m(0),a("el-form",{ref:"form",attrs:{model:e.form,"label-width":"180px"}},[a("div",{staticClass:"mar_t20 flex-bet flex-y-top"},[a("div",{staticClass:"flex-g-1"},[a("el-form-item",{attrs:{label:"等级名称",required:!0,prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入等级名称"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),a("el-form-item",{attrs:{label:"等级背景"}},[a("el-radio-group",{model:{value:e.form.bgType,callback:function(t){e.$set(e.form,"bgType",t)},expression:"form.bgType"}},[a("el-radio",{attrs:{label:"1"}},[e._v("背景色")]),a("el-radio",{attrs:{label:"2"}},[e._v("背景图")])],1)],1),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:"1"==e.form.bgType,expression:"form.bgType=='1'"}],attrs:{label:"背景色"}},[a("el-color-picker",{model:{value:e.form.color,callback:function(t){e.$set(e.form,"color",t)},expression:"form.color"}})],1),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:"2"==e.form.bgType,expression:"form.bgType=='2'"}],attrs:{label:"背景图"}},[e.form.bgImg?a("div",{staticClass:"uploadSource bor_de rel flex"},[a("label",{staticClass:"statusLabel curs",on:{mouseenter:function(t){return e.enter(1)},mouseleave:function(t){return e.leave(1)}}},[a("i",{ref:"imgicon1",staticClass:"el-icon-check"}),a("i",{staticClass:"el-icon-close",on:{click:function(t){return e.deleteMultiImage(e.form.bgImg,1)}}})]),a("img",{staticClass:"wid",attrs:{src:e.form.bgImg},on:{click:function(t){return e.test(1)}}})]):a("div",{staticClass:"uploadSource flex-center curs",on:{click:function(t){return e.test(1)}}},[a("i",{staticClass:"el-icon-plus fon_40 color_d9"})]),a("div",{staticClass:"yb_margin"},[e._v("建议尺寸:1000*600像素")])]),"1"!=this.form.level?a("el-form-item",{attrs:{label:"获得条件",required:!0}},[a("el-input",{attrs:{placeholder:"请输入成长值"},model:{value:e.form.condition,callback:function(t){e.$set(e.form,"condition",t)},expression:"form.condition"}}),a("span",{staticClass:"mar_l10"},[e._v("成长值")]),a("div",{staticClass:"yb_margin lh16"},[e._v("修改等级所需成长值后,部分客户会因无法达到该成长值要求而发生会员等级的变化")])],1):e._e()],1),a("div",{staticClass:"flex-g-0 pad_lr_20"},[a("div",{staticClass:"cardshow",style:{background:1==e.form.bgType?e.form.color:e.form.bgImg&&"url("+e.form.bgImg+") center center / cover no-repeat"}},[a("div",{staticClass:"cardbg"}),a("div",{staticClass:"fon_18 lh22 wei"},[e._v(e._s(e.form.name))]),"1"!=this.form.level?a("div",{staticClass:"mar_t20"},[a("span",{staticClass:"mar_r10 fon_26"},[e._v(e._s(e.form.condition))]),a("span",[e._v("成长值")])]):e._e(),a("div",{staticClass:"line"},[a("div",{staticClass:"lineright"})]),a("div",{staticClass:"mar_t20 fon_12"},[e._v(e._s(e.form.name))])]),a("div",{staticClass:"yb_margin lh16 t_c"},[e._v("仅为预览,实际以用户查看时为准")])])]),a("div",{staticClass:"shuju_title mar_b20"},[a("div",{staticClass:"shuju_title_text"},[a("span",[e._v("权益礼包")])])]),a("el-form-item",{attrs:{label:"会员权益"}},[a("div",{},[a("div",{staticClass:"mar_lr10"},[a("el-checkbox-group",{model:{value:e.form.rights,callback:function(t){e.$set(e.form,"rights",t)},expression:"form.rights"}},e._l(e.rightsList,(function(t){return a("el-checkbox",{key:t.id,attrs:{label:t.id}},[e._v(e._s(t.name))])})),1)],1)])]),a("el-form-item",{attrs:{label:"当面付折扣"}},[a("div",{staticClass:"t_l numberInput"},[a("div",{staticClass:"mar_lr10"},[a("el-checkbox-group",{model:{value:e.form.isCashier,callback:function(t){e.$set(e.form,"isCashier",t)},expression:"form.isCashier"}},[a("el-checkbox",{attrs:{"true-label":"1","false-label":"2"}},[e._v("会员折扣")])],1)],1),a("div",{directives:[{name:"show",rawName:"v-show",value:"1"==e.form.isCashier,expression:"form.isCashier=='1'"}]},[a("el-input-number",{attrs:{"controls-position":"right",min:.01,max:99999999},model:{value:e.form.cashierDiscount,callback:function(t){e.$set(e.form,"cashierDiscount",t)},expression:"form.cashierDiscount"}}),a("span",{staticClass:"mar_l10"},[e._v("折")])],1)])]),a("el-form-item",{attrs:{label:"升级礼包"}},[a("div",{},[a("div",{staticClass:"mar_lr10"},[a("el-checkbox-group",{model:{value:e.form.isCoupon,callback:function(t){e.$set(e.form,"isCoupon",t)},expression:"form.isCoupon"}},[a("el-checkbox",{attrs:{"true-label":"1","false-label":"2"}},[e._v("赠送优惠券")])],1)],1),a("div",{directives:[{name:"show",rawName:"v-show",value:"1"==e.form.isCoupon,expression:"form.isCoupon=='1'"}],staticClass:"flex"},[a("el-select",{attrs:{multiple:"",filterable:"",placeholder:"请选择优惠券"},model:{value:e.form.coupon,callback:function(t){e.$set(e.form,"coupon",t)},expression:"form.coupon"}},e._l(e.comgrouping,(function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1)]),a("div",{staticClass:"t_l numberInput"},[a("div",{staticClass:"mar_lr10"},[a("el-checkbox-group",{model:{value:e.form.isBalance,callback:function(t){e.$set(e.form,"isBalance",t)},expression:"form.isBalance"}},[a("el-checkbox",{attrs:{"true-label":"1","false-label":"2"}},[e._v("赠送余额")])],1)],1),a("div",{directives:[{name:"show",rawName:"v-show",value:"1"==e.form.isBalance,expression:"form.isBalance=='1'"}]},[a("el-input-number",{attrs:{"controls-position":"right",min:.01,max:99999999},model:{value:e.form.balance,callback:function(t){e.$set(e.form,"balance",t)},expression:"form.balance"}}),a("span",{staticClass:"mar_l10"},[e._v("元")])],1)]),a("div",{staticClass:"t_l numberInput"},[a("div",{staticClass:"mar_lr10"},[a("el-checkbox-group",{model:{value:e.form.isIntegral,callback:function(t){e.$set(e.form,"isIntegral",t)},expression:"form.isIntegral"}},[a("el-checkbox",{attrs:{"true-label":"1","false-label":"2"}},[e._v("赠送积分")])],1)],1),a("div",{directives:[{name:"show",rawName:"v-show",value:"1"==e.form.isIntegral,expression:"form.isIntegral=='1'"}]},[a("el-input-number",{attrs:{"controls-position":"right",min:1,max:99999999},model:{value:e.form.integral,callback:function(t){e.$set(e.form,"integral",t)},expression:"form.integral"}}),a("span",{staticClass:"mar_l10"},[e._v("积分")])],1)]),a("div",{staticClass:"t_l numberInput"},[a("div",{staticClass:"mar_lr10"},[a("el-checkbox-group",{model:{value:e.form.isGrowth,callback:function(t){e.$set(e.form,"isGrowth",t)},expression:"form.isGrowth"}},[a("el-checkbox",{attrs:{"true-label":"1","false-label":"2"}},[e._v("赠送成长值")])],1)],1),a("div",{directives:[{name:"show",rawName:"v-show",value:"1"==e.form.isGrowth,expression:"form.isGrowth=='1'"}]},[a("el-input-number",{attrs:{"controls-position":"right",min:1,max:99999999},model:{value:e.form.growth,callback:function(t){e.$set(e.form,"growth",t)},expression:"form.growth"}}),a("span",{staticClass:"mar_l10"},[e._v("成长值")])],1)])])],1)],1),a("div",{staticClass:"mar_t20 ba_f pad_20 t_c"},[a("el-button",{attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("立即创建")])],1),a("attachment-img",{ref:"img1",attrs:{type:"img"},on:{attachment:e.imgadd1}})],1)},r=[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"shuju_title mar_b20"},[a("div",{staticClass:"shuju_title_text"},[a("span",[e._v("基本信息")])])])}],i=(a("c975"),a("d81d"),a("a434"),a("96cf"),a("1da1")),s=a("c24f"),o=a("fc6e"),l={created:function(){this.$route.query.level&&(this.form.level=this.$route.query.level),this.getSaveLevel(),this.getSelectCoupon()},components:{attachmentImg:o["a"]},data:function(){return{form:{level:"",name:"",color:"#E2A850",bgImg:"",bgType:"1",condition:"0",rights:[],isBalance:"2",isIntegral:"2",isGrowth:"2",isCoupon:"2",balance:"",integral:"",growth:"",coupon:[],cashierDiscount:"",isCashier:""},checkedCities:[],rightsList:[],comgrouping:[]}},methods:{getSelectCoupon:function(){var e=this;return Object(i["a"])(regeneratorRuntime.mark((function t(){var a,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(s["n"])();case 2:a=t.sent,n=a.data,e.comgrouping=n||[];case 5:case"end":return t.stop()}}),t)})))()},getSaveLevel:function(){var e=this;return Object(i["a"])(regeneratorRuntime.mark((function t(){var a,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(s["m"])({level:e.form.level?e.form.level:""});case 2:a=t.sent,n=a.data,n.id&&(e.form=Object.assign({},n)),e.rightsList=n.rightsList;case 6:case"end":return t.stop()}}),t)})))()},submitForm:function(){var e=this;return Object(i["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.$refs["form"].validate(function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(a){var n,r,i;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!a){t.next=11;break}return n=e.rightsList&&e.rightsList.map((function(e){return e.id})),e.form.rights=e.getArrEqual(n,e.form.rights),t.next=5,Object(s["y"])(e.form);case 5:r=t.sent,i=r.msg,e.$baseMessage(i,"success"),e.$router.push({path:"vipmange"}),t.next=12;break;case 11:return t.abrupt("return",!1);case 12:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 1:case"end":return t.stop()}}),t)})))()},getArrEqual:function(e,t){for(var a=[],n=0;n<t.length;n++)for(var r=0;r<e.length;r++)e[r]===t[n]&&a.push(e[r]);return a},enter:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.$refs["imgicon"+e].style.display="none"},leave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.$refs["imgicon"+e].style.display="inline-block"},test:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.$refs["img"+e].dialogVisible=!0},imgadd1:function(e){this.form.bgImg=e.str},deleteMultiImage:function(e,t,a){if(Array.prototype.remove=function(e){var t=this.indexOf(e);t>-1&&this.splice(t,1)},"multigraph"==a)switch(t){case 2:this.form2.environment.remove(e);break}else switch(t){case 1:this.form.bgImg="";break}}}},c=l,u=(a("5711"),a("2877")),m=Object(u["a"])(c,n,r,!1,null,null,null);t["default"]=m.exports},5711:function(e,t,a){"use strict";var n=a("efe1"),r=a.n(n);r.a},a434:function(e,t,a){"use strict";var n=a("23e7"),r=a("23cb"),i=a("a691"),s=a("50c4"),o=a("7b0b"),l=a("65f0"),c=a("8418"),u=a("1dde"),m=a("ae40"),d=u("splice"),f=m("splice",{ACCESSORS:!0,0:0,1:2}),p=Math.max,g=Math.min,h=9007199254740991,v="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!d||!f},{splice:function(e,t){var a,n,u,m,d,f,b=o(this),_=s(b.length),y=r(e,_),x=arguments.length;if(0===x?a=n=0:1===x?(a=0,n=_-y):(a=x-2,n=g(p(i(t),0),_-y)),_+a-n>h)throw TypeError(v);for(u=l(b,n),m=0;m<n;m++)d=y+m,d in b&&c(u,m,b[d]);if(u.length=n,a<n){for(m=y;m<_-n;m++)d=m+n,f=m+a,d in b?b[f]=b[d]:delete b[f];for(m=_;m>_-n+a;m--)delete b[m-1]}else if(a>n)for(m=_-n;m>y;m--)d=m+n-1,f=m+a-1,d in b?b[f]=b[d]:delete b[f];for(m=0;m<a;m++)b[m+y]=arguments[m+2];return b.length=_-n+a,u}})},c24f:function(e,t,a){"use strict";a.d(t,"k",(function(){return r})),a.d(t,"E",(function(){return i})),a.d(t,"C",(function(){return s})),a.d(t,"d",(function(){return o})),a.d(t,"b",(function(){return l})),a.d(t,"s",(function(){return c})),a.d(t,"c",(function(){return u})),a.d(t,"j",(function(){return m})),a.d(t,"q",(function(){return d})),a.d(t,"i",(function(){return f})),a.d(t,"r",(function(){return p})),a.d(t,"f",(function(){return g})),a.d(t,"x",(function(){return h})),a.d(t,"h",(function(){return v})),a.d(t,"n",(function(){return b})),a.d(t,"u",(function(){return _})),a.d(t,"g",(function(){return y})),a.d(t,"l",(function(){return x})),a.d(t,"t",(function(){return C})),a.d(t,"A",(function(){return w})),a.d(t,"z",(function(){return k})),a.d(t,"w",(function(){return j})),a.d(t,"p",(function(){return O})),a.d(t,"m",(function(){return $})),a.d(t,"y",(function(){return L})),a.d(t,"a",(function(){return I})),a.d(t,"o",(function(){return S})),a.d(t,"B",(function(){return A})),a.d(t,"e",(function(){return z})),a.d(t,"F",(function(){return E})),a.d(t,"D",(function(){return T})),a.d(t,"v",(function(){return N}));var n=a("b775");function r(e){return Object(n["a"])({url:"channel/member/get-member-list",method:"get",params:e})}function i(e){return Object(n["a"])({url:"channel/member/get-member-list",method:"post",data:e})}function s(e){return Object(n["a"])({url:"channel/activity/select-user",method:"post",data:e})}function o(e){return Object(n["a"])({url:"channel/member/change-status",method:"post",data:e})}function l(e){return Object(n["a"])({url:"channel/member/change-info",method:"post",data:e})}function c(e){return Object(n["a"])({url:"channel/member/member-label-save",method:"post",data:e})}function u(e){return Object(n["a"])({url:"channel/member/change-member-label",method:"post",data:e})}function m(e){return Object(n["a"])({url:"channel/member/get-member-label",method:"get",params:e})}function d(e){return Object(n["a"])({url:"channel/member/member-excel-list",method:"get",params:e})}function f(e){return Object(n["a"])({url:"channel/member/get-member-info",method:"post",data:e})}function p(e){return Object(n["a"])({url:"channel/member/member-info-save",method:"post",data:e})}function g(e){return Object(n["a"])({url:"channel/member/get-deposit-list",method:"get",params:e})}function h(e){return Object(n["a"])({url:"channel/member/deposit-save",method:"post",data:e})}function v(e){return Object(n["a"])({url:"channel/member/deposit-save",method:"get",params:e})}function b(e){return Object(n["a"])({url:"channel/activity/select-coupon",method:"get",params:e})}function _(e){return Object(n["a"])({url:"channel/member/modify-deposit",method:"post",data:e})}function y(e){return Object(n["a"])({url:"channel/member/get-deposit-order",method:"get",params:e})}function x(e){return Object(n["a"])({url:"channel/member/get-member-set-info",method:"get",params:e})}function C(e){return Object(n["a"])({url:"channel/member/member-set",method:"post",data:e})}function w(e){return Object(n["a"])({url:"channel/vip-card/rights-list",method:"get",params:e})}function k(e){return Object(n["a"])({url:"channel/vip-card/save-rights",method:"post",data:e})}function j(e){return Object(n["a"])({url:"channel/vip-card/modify-rights",method:"post",data:e})}function O(e){return Object(n["a"])({url:"channel/vip-card/level-list",method:"get",params:e})}function $(e){return Object(n["a"])({url:"channel/vip-card/save-level",method:"get",params:e})}function L(e){return Object(n["a"])({url:"channel/vip-card/save-level",method:"post",data:e})}function I(e){return Object(n["a"])({url:"channel/vip-card/card-record",method:"get",params:e})}function S(e){return Object(n["a"])({url:"channel/good/goods-vip",method:"get",params:e})}function A(e){return Object(n["a"])({url:"channel/good/save-goods-vip",method:"post",data:e})}function z(e){return Object(n["a"])({url:"channel/member/get-coupon-list",method:"get",params:e})}function E(e){return Object(n["a"])({url:"channel/member/store-coupon-list",method:"get",params:e})}function T(e){return Object(n["a"])({url:"channel/member/send-coupon",method:"post",data:e})}function N(e){return Object(n["a"])({url:"channel/vip-card/modify-level",method:"post",data:e})}},c8f1:function(e,t,a){},dad0:function(e,t,a){"use strict";var n=a("c8f1"),r=a.n(n);r.a},efe1:function(e,t,a){},fc6e:function(e,t,a){"use strict";var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-dialog",{staticClass:"attachmentImg",attrs:{title:"选择图片",visible:e.dialogVisible,"close-on-click-modal":!1,width:"55%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.modalClose,opened:e.dialogOpened}},[a("div",{staticClass:"attachment_img_box",attrs:{flex:"box:first"}},[a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.groupListLoading,expression:"groupListLoading"}],staticClass:"attachment_img_left"},[a("el-menu",{staticClass:"group-menu",attrs:{mode:"vertical"}},[a("el-scrollbar",{staticStyle:{height:"523px",width:"100%"}},[a("div",{staticClass:"goods-menu"},[a("el-menu-item",{class:{"is-active":"all"==e.allindex},staticStyle:{"text-align":"center"},attrs:{index:"all"},on:{click:function(t){return e.selected(0)}}},[a("span",[e._v("全部")])]),e._l(e.groupItem,(function(t){return[a("el-menu-item",{key:t.id,attrs:{index:t.id},on:{click:function(a){return e.selected(t.id)}}},[a("div",{staticClass:"fenlei",attrs:{flex:"dir:left box:last"}},[a("i",{staticClass:"el-icon-circle-close gbfenlei",staticStyle:{display:"none"},on:{click:function(a){return e.deleteType(t.id)}}}),a("div",{staticStyle:{overflow:"hidden","text-overflow":"ellipsis",width:"100%"}},[a("span",[e._v(e._s(t.name))])])])])]}))],2)]),a("el-popover",{attrs:{placement:"top",width:"160"},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[a("el-input",{attrs:{placeholder:"请输入分组名称",size:"mini"},model:{value:e.new_type_name,callback:function(t){e.new_type_name=t},expression:"new_type_name"}}),a("div",{staticStyle:{"text-align":"right",margin:"0","margin-top":"10px"}},[a("el-button",{attrs:{size:"mini",type:"text"},on:{click:function(t){e.visible=!1}}},[e._v("取消")]),a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:e.addNewAttType}},[e._v("确定")])],1),a("el-button",{staticStyle:{"margin-left":"22%","margin-top":"13px"},attrs:{slot:"reference",size:"small"},slot:"reference"},[a("i",{staticClass:"el-icon-circle-plus-outline"}),e._v(" 新建分组 ")])],1)],1)],1),a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.rightLoading,expression:"rightLoading"}],staticClass:"attachment_img_right",attrs:{flex:"dir:top"}},[a("div",{staticClass:"selectBox"},[a("el-input",{staticStyle:{width:"30%","padding-left":"12px"},attrs:{placeholder:"请输入图片名称","suffix-icon":"el-icon-search",size:"small"},on:{input:function(t){return e.search(e.atta_name)}},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.search(e.atta_name)}},model:{value:e.atta_name,callback:function(t){e.atta_name=t},expression:"atta_name"}}),a("div",{staticStyle:{float:"right",padding:"0 10px 0 0"}},[a("el-upload",{staticClass:"upload-demo",attrs:{action:e.UploadUrl(),multiple:!0,limit:50,"on-exceed":e.handleExceed,"file-list":e.fileList,"on-success":e.handleSuccess,"on-error":e.handleError,"before-upload":e.beforeUpload,data:e.uploadData,"on-progress":e.handProgress}},[a("el-button",{attrs:{size:"small",type:"primary"}},[a("i",{staticClass:"el-icon-plus avatar-uploader-icon"}),e._v(" 上传图片 ")])],1)],1)],1),a("el-scrollbar",{staticClass:"scrollbar",staticStyle:{height:"460px"}},[a("div",{staticClass:"app-attachment-list"},[e._l(e.attachments,(function(t,n){return[a("el-tooltip",{key:t.id,staticClass:"item",attrs:{effect:"dark",content:t.name,placement:"top","open-delay":1}},[a("div",{staticClass:"app-attachment-item",on:{click:function(a){return e.selectedItem(n,t.url)}}},[a("div",{staticClass:"app-attachment-item-bj"},[a("div",{staticClass:"imgStyle"},[a("el-image",{staticStyle:{width:"100%",height:"143px","border-radius":"5px"},attrs:{src:t.url,fit:"cover"}}),a("div",{staticClass:"mask",style:e.getStyle2(n)},[a("i",{staticClass:"el-icon-check center-icon pos-center"}),a("p",{staticClass:"triangle"},[a("i",{staticClass:"el-icon-check"})])])],1),a("div",{staticClass:"app-attachment-name"},[e._v(e._s(t.name))]),a("i",{staticClass:"el-icon-error delete",on:{click:function(a){return e.deleteItem(t.id)}}})])])])]}))],2)]),a("div",{staticStyle:{padding:"5px","text-align":"right","margin-top":"auto"}},[a("el-pagination",{attrs:{background:"",layout:"prev, pager, next",total:e.total,"page-size":e.pagesize},on:{"current-change":e.current_change}})],1)],1)]),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"small"},on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(t){return e.selectedItems()}}},[e._v("确 定")])],1)])},r=[],i=(a("99af"),a("365c")),s={name:"attachment-img",props:{type:{type:String,default:"img"},type2:{type:String,default:""},op:{type:String}},data:function(){return{visible:!1,atta_name:"",uploadParams:{type_id:0,type:1},category:0,keywords:"",total:0,pagesize:30,currentPage:1,dialogVisible:!1,groupItem:[],attachments:[],groupListLoading:!1,rightLoading:!1,new_type_name:"",fileList:[],selectedArr:{},attachmentList:"12",uploadData:{key:"",token:""},file:{Url:"",path:"",name:"",size:0},att_type:"",allindex:"all"}},created:function(){},methods:{getStyle2:function(e){var t=this,a=t.currentPage,n=t.selectedArr["img"==t.type?"danxuan":"item"+e+a];return n&&n.page==a&&n.index==e?"display:block":""},modalClose:function(){var e=this;e.selectedArr={}},dialogOpened:function(){this.getgroupItem(),this.getAttachment_List()},handProgress:function(){var e=this;e.rightLoading=!0},getgroupItem:function(){var e=this;this.$api.get("common/file/get-category",{storeId:this.type2},(function(t){1==t.code?(e.groupItem=t.data,e.groupListLoading=!1,e.visible=!1):e.groupListLoading=!1}))},getAttachment_List:function(){var e=this;e.rightLoading=!0,this.$api.get("common/file/get-picture",{page:e.currentPage,category:e.category,keywords:e.keywords,storeId:this.type2},(function(t){1==t.code?(e.attachments=t.data,e.total=t.count,e.rightLoading=!1):e.rightLoading=!1}))},addNewAttType:function(){var e=this;e.groupListLoading=!0,this.$api.post("common/file/save-category",{storeId:this.type2,name:e.new_type_name},(function(t){1==t.code?(e.visible=!1,e.$message({message:t.msg,type:"success",duration:500,onClose:function(){e.new_type_name="",e.getgroupItem()}})):(e.visible=!1,e.$message.error(t.msg))}))},deleteType:function(e){var t=this;t.groupListLoading=!0,this.$api.post("common/file/del-picture-category",{id:e},(function(e){1==e.code?(t.visible=!1,t.$message({message:e.msg,type:"success",duration:500,onClose:function(){t.getgroupItem()}})):(t.$message.error(e.msg),t.groupListLoading=!1)}))},search:function(e){var t=this;console.log(e),this.keywords=e,t.getAttachment_List()},current_change:function(e){var t=this;t.currentPage=e,t.getAttachment_List()},deleteItem:function(e){var t=this;t.rightLoading=!0,this.$api.post("common/file/del-picture",{id:e},(function(e){1==e.code?(t.visible=!1,t.$message({message:e.msg,type:"success",duration:500,onClose:function(){t.getAttachment_List()}})):(t.$message.error(e.msg),t.groupListLoading=!1)}))},UploadUrl:function(){var e=i["a"].backendPath;return e+"common/file/get-category"},beforeUpload:function(e){console.log("上传前判断",e);var t="image/jpg"===e.type||"image/jpeg"===e.type||"image/png"===e.type||"image/gif"===e.type,a=e.size/1024/1024<2;return t?a?void 0:(this.$message.error("文件大小不能超过 2MB!"),!1):(this.$message.error("上传图片只支持jpg、jpeg、png格式!"),!1)},handleError:function(e){this.$message({message:"上传失败",duration:2e3,type:"warning"})},handleSuccess:function(e,t,a){console.log("345",a),this.file=t,this.addAttachment()},handleExceed:function(e,t){this.$message.warning("当前限制选择 50 个文件,本次选择了 ".concat(e.length," 个文件,共选择了 ").concat(e.length+t.length," 个文件"))},addAttachment:function(){var e=this,t=new FormData;t.append("file",this.file.raw),t.append("category",this.category),t.append("storeId",this.type2),this.$api.post("common/file/upload",t,(function(t){1==t.code?(e.getAttachment_List(),e.$message.success("上传成功")):(e.$message.error(t.msg),console.log(t.msg))}))},selected:function(e){var t=this;t.rightLoading=!0,t.currentPage=1,t.category=e,t.allindex="otherList",t.getAttachment_List()},selectedItem:function(e,t){var a=this,n="img"==a.type,r=n?"danxuan":"item"+e+a.currentPage,i=a.selectedArr[r];i&&i.index==e?a.$delete(a.selectedArr,r):(n&&a.$delete(a.selectedArr,r),a.$set(a.selectedArr,r,{page:a.currentPage,index:e,url:t}))},selectedItems:function(){var e=this;e=this;var t=e.selectedArr,a="",n=[];for(var r in t)a+=a?","+t[r].url:t[r].url,n.push(t[r].url);e.$emit("attachment",{str:a,arr:n}),e.dialogVisible=!1}}},o=s,l=(a("dad0"),a("2877")),c=Object(l["a"])(o,n,r,!1,null,null,null);t["a"]=c.exports}}]); |