require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_promotion/fenxiao/promote_code"],{"2a64":function(e,t,n){"use strict";var o=n("e3e9"),i=n.n(o);i.a},3394:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;n("cc1e");var o={data:function(){return{poster:[],fenxiaoInfo:{},posterIndex:0,templateId:["default"],mpShareData:null}},components:{uniPopup:function(){n.e("components/uni-popup/uni-popup").then(function(){return resolve(n("1843"))}.bind(null,n)).catch(n.oe)}},methods:{getPoster:function(e){var t=this;return new Promise((function(n,o){t.$api.sendRequest({url:"/fenxiao/api/fenxiao/poster",data:{page:"/pages/index/index",qrcode_param:JSON.stringify({}),template_id:e},success:function(e){t.$refs.loadingCover&&t.$refs.loadingCover.hide(),e.code>=0&&n(e.data.path)},fail:function(e){t.$refs.loadingCover&&t.$refs.loadingCover.hide(),o()}})}))},getIndex:function(e){this.posterIndex=e.detail.current},save:function(){var t=this;e.downloadFile({url:this.$util.img(this.poster[this.posterIndex]),success:function(n){200===n.statusCode?e.saveImageToPhotosAlbum({filePath:n.tempFilePath,success:function(){t.$util.showToast({title:"保存成功"})},fail:function(e){"saveImageToPhotosAlbum:fail auth deny"==e.errMsg||"saveImageToPhotosAlbum:fail:auth denied"==e.errMsg?t.$refs.popupDialog.open():t.$util.showToast({title:"保存失败，请稍后重试"})}}):t.$util.showToast({title:"下载失败"})},fail:function(e){t.$util.showToast({title:"下载失败"})}})},getFenxiaoDetail:function(){var e=this;this.poster=[];try{this.templateId.forEach((function(t,n){e.getPoster(t).then((function(t){e.poster.push(t),e.$refs.loadingCover&&e.$refs.loadingCover.hide()})).catch((function(e){throw e}))}))}catch(t){this.$util.showToast({title:"海报生成失败"})}},closeDialog:function(){this.$refs.popupDialog.close()}},onLoad:function(e){var t=this;setTimeout((function(){t.addonIsExist.fenxiao||(t.$util.showToast({title:"商家未开启分销",mask:!0,duration:2e3}),setTimeout((function(){t.$util.redirectTo("/pages/index/index")}),2e3))}),1e3),e.templateId&&(this.templateId=e.templateId.split(",")),this.storeToken?e.poster?(this.poster=decodeURIComponent(e.poster).split(","),setTimeout((function(){t.$refs.loadingCover&&t.$refs.loadingCover.hide()}),500)):this.getFenxiaoDetail():this.$nextTick((function(){t.$refs.login.open("/pages_promotion/fenxiao/promote_code")}))},onShow:function(){var e=this;this.$util.getMpShare().then((function(t){e.mpShareData=t}))},onShareAppMessage:function(){return this.mpShareData.appMessage},onShareTimeline:function(){return this.mpShareData.timeLine},watch:{storeToken:function(e,t){e&&this.getFenxiaoDetail()}}};t.default=o}).call(this,n("df3c")["default"])},"512a":function(e,t,n){"use strict";n.r(t);var o=n("db7e"),i=n("f7e7");for(var a in i)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(a);n("2a64");var s=n("828b"),r=Object(s["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],void 0);t["default"]=r.exports},"5d76":function(e,t,n){"use strict";(function(e,t){var o=n("47a9");n("1dee");o(n("3240"));var i=o(n("512a"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(i.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},db7e:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"a",(function(){return o}));var o={uniPopup:function(){return n.e("components/uni-popup/uni-popup").then(n.bind(null,"1843"))},nsLogin:function(){return Promise.all([n.e("common/vendor"),n.e("components/ns-login/ns-login")]).then(n.bind(null,"17d0"))},loadingCover:function(){return n.e("components/loading-cover/loading-cover").then(n.bind(null,"0773"))}},i=function(){var e=this,t=e.$createElement,n=(e._self._c,e.__map(e.poster,(function(t,n){var o=e.__get_orig(t),i=e.$util.img(t);return{$orig:o,g0:i}})));e.$mp.data=Object.assign({},{$root:{l0:n}})},a=[]},e3e9:function(e,t,n){},f7e7:function(e,t,n){"use strict";n.r(t);var o=n("3394"),i=n.n(o);for(var a in o)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(a);t["default"]=i.a}},[["5d76","common/runtime","common/vendor"]]]);