(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["DollarActivityForm"],{1276:function(e,t,a){"use strict";var r=a("c65b"),l=a("e330"),o=a("d784"),n=a("825a"),i=a("861d"),s=a("1d80"),c=a("4840"),u=a("8aa5"),d=a("50c4"),m=a("577e"),p=a("dc4a"),f=a("14c3"),b=a("9f7f"),g=a("d039"),v=b.UNSUPPORTED_Y,h=4294967295,y=Math.min,w=l([].push),$=l("".slice),x=!g((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var a="ab".split(e);return 2!==a.length||"a"!==a[0]||"b"!==a[1]})),k="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;o("split",(function(e,t,a){var l="0".split(void 0,0).length?function(e,a){return void 0===e&&0===a?[]:r(t,this,e,a)}:t;return[function(t,a){var o=s(this),n=i(t)?p(t,e):void 0;return n?r(n,t,o,a):r(l,m(o),t,a)},function(e,r){var o=n(this),i=m(e);if(!k){var s=a(l,o,i,r,l!==t);if(s.done)return s.value}var p=c(o,RegExp),b=o.unicode,g=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(v?"g":"y"),x=new p(v?"^(?:"+o.source+")":o,g),C=void 0===r?h:r>>>0;if(0===C)return[];if(0===i.length)return null===f(x,i)?[i]:[];var D=0,A=0,N=[];while(A1&&void 0!==t[1]&&t[1],a.pageLoading=!0,r.next=4,s["a"].webDollarActivitySingle({id:e});case 4:if(o=r.sent,a.pageLoading=!1,o.code==p.StatusOK&&null!=o.data){r.next=10;break}return a.$pigeon.MessageError(o.msg||a.$i18n.t("Msg.SystemError")),a.cancel(),r.abrupt("return");case 10:if(i=o.data,l||(a.editingId=i.id),c=(i.startDate||"").toString().split(" ")[0],u=(i.endDate||"").toString().split(" ")[0],d=(i.displayDate||"").toString().split(" ")[0],m=Array.isArray(i.rulelist)&&i.rulelist.length?i.rulelist.map((function(e){return{depositAmount:null!=e.depositAmount?String(e.depositAmount):"",rewardAmount:null!=e.rewardAmount?String(e.rewardAmount):"",standardVolume:null!=e.standardVolume?String(e.standardVolume):"",ecnVolume:null!=e.ecnVolume?String(e.ecnVolume):"",centVolume:null!=e.centVolume?String(e.centVolume):""}})):[f()],a.form={title:i.title||"",subTitle:i.subTitle||"",coverUrl:i.coverUrl||"",content:i.content||"",dateRange:c&&u?[c,u]:[],startDate:c,endDate:u,displayDate:d,giveNum:null!=i.giveNum?Number(i.giveNum):0,hot:null!=i.hot?Number(i.hot):0,valid:null!=i.valid?Number(i.valid):0,country:i.country||"",state:b(i.state),agentIbNo:i.agentIbNo||"",excludeIbNo:i.excludeIbNo||"",rulelist:m},!a.form.country){r.next=22;break}return r.next=20,a.initStatesForCountry(a.form.country);case 20:r.next=23;break;case 22:a.stateOptions=[];case 23:return a.editorContext=i.content||"",a.editorKey+=1,r.next=27,a.$nextTick();case 27:a.$refs.dollarForm&&a.$refs.dollarForm.clearValidate(),a.prepareEditor();case 29:case"end":return r.stop()}}),r)})))()},addRuleRow:function(){this.form.rulelist.push(f())},removeRuleRow:function(e){this.form.rulelist.length<=1?this.$pigeon.MessageWarning(this.$i18n.t("DollarActivity.Label.rulelistKeepOne")):this.form.rulelist.splice(e,1)},handleCoverUpload:function(e){return Object(m["a"])(e,"/web/activity/dollar/upload")},onCoverSuccess:function(e,t){var a=this;t&&t.raw&&(this.coverPreviewLocal=URL.createObjectURL(t.raw)),this.form.coverUrl=e.data,this.$nextTick((function(){a.$refs.dollarForm&&a.$refs.dollarForm.validateField("coverUrl")}))},onCoverUploadError:function(e){var t=e&&e.message||("string"===typeof e?e:"")||this.$i18n.t("Msg.SystemError");this.$pigeon.MessageError(t)},beforeCoverUpload:function(e){var t=["jpeg","JPEG","png","PNG","jpg","JPG","webp","WEBP"].includes(e.name.split(".").pop()),a=e.size/1024/1024<5;return t||this.$pigeon.MessageError(this.$i18n.t("news_add_field.Des.item1")),a||this.$pigeon.MessageError(this.$i18n.t("news_add_field.Des.item1")),t&&a},normalizeRulelist:function(){return this.form.rulelist.map((function(e){return{depositAmount:""===e.depositAmount?null:Number(e.depositAmount),rewardAmount:""===e.rewardAmount?null:Number(e.rewardAmount),standardVolume:""===e.standardVolume?null:Number(e.standardVolume),ecnVolume:""===e.ecnVolume?null:Number(e.ecnVolume),centVolume:""===e.centVolume?null:Number(e.centVolume)}})).filter((function(e){return null!=e.depositAmount||null!=e.rewardAmount||null!=e.standardVolume||null!=e.ecnVolume||null!=e.centVolume}))},buildPayload:function(){var e=this.form.dateRange||[],t=e[0]||"",a=e[1]||"";return{title:this.form.title,subTitle:this.form.subTitle,coverUrl:this.form.coverUrl,content:this.form.content,startDate:t,endDate:a,displayDate:this.form.displayDate,giveNum:this.form.giveNum,hot:this.form.hot,valid:this.form.valid,country:this.form.country||"",state:b(this.form.state),agentIbNo:this.form.agentIbNo||"",excludeIbNo:this.form.excludeIbNo||"",rulelist:this.normalizeRulelist()}},submitForm:function(){var e=this;this.$refs.dollarForm.validate(function(){var t=Object(i["a"])(Object(n["a"])().mark((function t(a){var r,l;return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(a){t.next=2;break}return t.abrupt("return");case 2:if(e.submitLoading=!0,r=e.buildPayload(),"add"!==e.pageType){t.next=10;break}return t.next=7,s["a"].webDollarActivityAdd(r);case 7:l=t.sent,t.next=13;break;case 10:return t.next=12,s["a"].webDollarActivityUpdate(Object(o["a"])(Object(o["a"])({},r),{},{id:e.editingId}));case 12:l=t.sent;case 13:e.submitLoading=!1,l.code==p.StatusOK?(e.$pigeon.MessageOK("add"===e.pageType?e.$i18n.t("Msg.SaveSuccess"):e.$i18n.t("Msg.ModifySuccess")),e.cancel()):e.$pigeon.MessageError(l.msg);case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},mounted:function(){this.getCountry(),this.initFromRoute()}},h=v,y=(a("9fbf"),a("fbd8"),a("fd638"),a("2877")),w=Object(y["a"])(h,r,l,!1,null,"16796ed0",null);t["default"]=w.exports},"797e":function(e,t,a){},9129:function(e,t,a){"use strict";var r=a("23e7");r({target:"Number",stat:!0},{isNaN:function(e){return e!==e}})},"9fbf":function(e,t,a){"use strict";a("1683")},ed8d:function(e,t,a){},fbd8:function(e,t,a){"use strict";a("797e")},fd638:function(e,t,a){"use strict";a("ed8d")}}]);