require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_tool/goods/coupon"],{"19ce":function(t,e,n){"use strict";(function(t,e){var o=n("47a9");n("1dee");o(n("3240"));var i=o(n("6785"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(i.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"53d3":function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return s})),n.d(e,"a",(function(){return o}));var o={nsEmpty:function(){return n.e("components/ns-empty/ns-empty").then(n.bind(null,"a84f"))},loadingCover:function(){return n.e("components/loading-cover/loading-cover").then(n.bind(null,"0773"))},nsLogin:function(){return Promise.all([n.e("common/vendor"),n.e("components/ns-login/ns-login")]).then(n.bind(null,"17d0"))}},i=function(){var t=this,e=t.$createElement,n=(t._self._c,t.$util.img("public/uniapp/coupon/coupon_line.png")),o=t.__map(t.list,(function(e,n){var o=t.__get_orig(e),i="reward"==e.type?parseFloat(e.money):null,s="reward"!=e.type&&"discount"==e.type?parseFloat(e.discount):null,u=0==e.validity_type?t.$util.timeStampTurnTime(e.end_time):null;return{$orig:o,m0:i,m1:s,g1:u}})),i=t.list.length;t.$mp.data=Object.assign({},{$root:{g0:n,l0:o,g2:i}})},s=[]},6785:function(t,e,n){"use strict";n.r(e);var o=n("53d3"),i=n("7235");for(var s in i)["default"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(s);n("97a2");var u=n("828b"),r=Object(u["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],void 0);e["default"]=r.exports},7235:function(t,e,n){"use strict";n.r(e);var o=n("fac0"),i=n.n(o);for(var s in o)["default"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(s);e["default"]=i.a},"845d":function(t,e,n){},"97a2":function(t,e,n){"use strict";var o=n("845d"),i=n.n(o);i.a},fac0:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={data:function(){return{list:[],sort:1,types:"",couponBtnSwitch:!1,mpShareData:null}},onLoad:function(e){var n=this;if(setTimeout((function(){n.addonIsExist.coupon||(n.$util.showToast({title:"商家未开启优惠券",mask:!0,duration:2e3}),setTimeout((function(){n.$util.redirectTo("/pages/index/index")}),2e3))}),1e3),e.source_member&&t.setStorageSync("source_member",e.source_member),e.scene){var o=decodeURIComponent(e.scene);o=o.split("&"),o.length&&o.forEach((function(e){-1!=e.indexOf("sku_id")&&(n.skuId=e.split("-")[1]),-1!=e.indexOf("m")&&t.setStorageSync("source_member",e.split("-")[1]),-1!=e.indexOf("is_test")&&t.setStorageSync("is_test",1)}))}},onShow:function(){var e=this;this.storeToken&&t.getStorageSync("source_member")&&this.$util.onSourceMember(t.getStorageSync("source_member")),this.$util.getMpShare().then((function(t){e.mpShareData=t}))},onShareAppMessage:function(){return this.mpShareData.appMessage},onShareTimeline:function(){return this.mpShareData.timeLine},methods:{changeSort:function(t,e){this.list=[],this.sort=t,this.types=e,this.$refs.mescroll.refresh(!1)},liClick:function(t,e){if(["limit","expire","out"].includes(t.receivedType))return!1;0==t.useState?this.receiveCoupon(t,e):this.toGoodsList(t,e)},receiveCoupon:function(t,e){var n=this;this.couponBtnSwitch||(this.couponBtnSwitch=!0,this.storeToken?this.$api.sendRequest({url:"/coupon/api/coupon/receive",data:{coupon_type_id:t.coupon_type_id,get_type:2},success:function(e){n.couponBtnSwitch=!1;var o="领取成功，快去使用吧",i=n.list;if(e.code<0&&(o=e.message),1==e.data.is_exist)for(var s=0;s<i.length;s++)i[s].coupon_type_id==t.coupon_type_id&&(i[s].useState=1);else for(var u=0;u<i.length;u++)i[u].coupon_type_id==t.coupon_type_id&&(i[u].receivedType=e.data.type,i[u].useState=2);n.$util.showToast({title:o})},fail:function(t){n.couponBtnSwitch=!1}}):(this.couponBtnSwitch=!1,this.$refs.login.open("/pages_tool/goods/coupon")))},getMemberCouponList:function(t){var e=this;this.$api.sendRequest({url:"/coupon/api/coupon/typepagelists",data:{page:t.num,page_size:t.size,sort:this.sort,type:this.types},success:function(n){var o=[],i=n.message;0==n.code&&n.data?o=n.data.list:e.$util.showToast({title:i}),t.endSuccess(o.length),o.length&&o.forEach((function(t){t.count==t.lead_count?t.useState=2:0!=t.max_fetch&&t.member_coupon_num&&t.member_coupon_num>=t.max_fetch?t.useState=1:t.useState=0})),1==t.num&&(e.list=[]),e.list=e.list.concat(o),e.$refs.loadingCover&&e.$refs.loadingCover.hide()},fail:function(){t.endErr(),this.$refs.loadingCover&&this.$refs.loadingCover.hide()}})},imageError:function(t){this.list[t].logo=this.$util.getDefaultImage().goods,this.$forceUpdate()},couponImageError:function(t){this.list[t].image=this.$util.img("public/uniapp/goods/coupon.png"),this.$forceUpdate()},toGoodsList:function(t){1!=t.goods_type?this.$util.redirectTo("/pages/goods/list",{coupon:t.coupon_type_id}):this.$util.redirectTo("/pages/goods/list",{})}}};e.default=n}).call(this,n("df3c")["default"])}},[["19ce","common/runtime","common/vendor"]]]);