| 12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-64fcb3c2"],{"108b":function(t,e,a){"use strict";var n=a("390a"),i=a.n(n);i.a},"390a":function(t,e,a){},aa81:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"ns-coupon"},[t.adList.length?a("div",{staticClass:"ns-coupon-info"},[a("div",{staticClass:"ns-coupon-wrap"},[t._m(0),t._m(1),a("el-button",{on:{click:t.myCoupon}},[t._v("我的优惠券")])],1),a("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loadingAd,expression:"loadingAd"}],staticClass:"ns-coupon-img"},[a("el-carousel",{attrs:{height:"406px"}},t._l(t.adList,(function(e){return a("el-carousel-item",{key:e.adv_id},[a("el-image",{staticStyle:{width:"100%",height:"100%"},attrs:{src:t.$img(e.adv_image),fit:"cover"},on:{click:function(a){return t.$router.pushToTab(e.adv_url.url)}}})],1)})),1)],1)]):t._e(),a("el-tabs",[a("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}]},[a("ul",{staticClass:"ns-coupon-list"},t._l(t.couponList,(function(e,n){return a("li",{key:n,staticClass:"ns-bg-color ns-coupon-li",class:e.count==e.lead_count?"no-coupon":""},[a("div",{staticClass:"describe"},[[e.discount&&"0.00"!=e.discount?a("span",[t._v(t._s(e.discount)+"折")]):a("span",[t._v("¥"+t._s(e.money))])],a("span",[t._v(t._s("first"==t.activeName?e.coupon_name:e.platformcoupon_name))]),"first"==t.activeName?a("span",[t._v(t._s(1==e.goods_type?"全部商品可用":"指定商品可用"))]):t._e(),["0.00"==e.at_least?a("span",[t._v("无门槛优惠券")]):a("span",[t._v("满"+t._s(e.at_least)+"可使用")])],[e.validity_type?a("span",{staticClass:"coupon-wrap-time"},[t._v("领取之日起"+t._s(e.fixed_term)+"日内有效")]):a("span",{staticClass:"coupon-wrap-time"},[t._v("有效期至"+t._s(t.$timeStampTurnTime(e.end_time)))])]],2),a("div",{staticClass:"receive"},[e.count==e.lead_count?a("a",{staticClass:"ns-text-color"},[a("span",[t._v("已抢完")])]):a("a",{staticClass:"ns-text-color",on:{click:function(a){return t.couponTap(e,n)}}},[0==e.useState?a("span",[t._v("立即领取")]):a("span",[t._v("去使用")])])])])})),0),t.couponList.length<=0?a("div",{staticClass:"empty-wrap"},[a("div",{staticClass:"ns-text-align"},[t._v("暂无优惠券")])]):t._e(),a("div",{staticClass:"pager"},[a("el-pagination",{attrs:{background:"","pager-count":5,total:t.total,"prev-text":"上一页","next-text":"下一页","current-page":t.currentPage,"page-size":t.pageSize,"hide-on-single-page":""},on:{"update:currentPage":function(e){t.currentPage=e},"update:current-page":function(e){t.currentPage=e},"update:pageSize":function(e){t.pageSize=e},"update:page-size":function(e){t.pageSize=e},"size-change":t.handlePageSizeChange,"current-change":t.handleCurrentPageChange}})],1)])])],1)},i=[function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"coupon-name"},[a("span",{staticClass:"ns-text-color"},[t._v("优惠券中心")]),a("span",{staticClass:"ns-text-color-gray text12"},[t._v("省钱更多,领券更多")])])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("ul",{staticClass:"coupon-type clear-float"},[a("li",[a("i"),a("span",[t._v("限时抢券")])]),a("li",[a("i"),a("span",[t._v("叠加使用")])]),a("li",[a("i"),a("span",[t._v("种类多样")])])])}],o=(a("4160"),a("159b"),a("5530")),s=a("cbfe"),c=a("2f62"),u=a("37cb"),r={name:"coupon",components:{},data:function(){return{couponList:[],total:0,currentPage:1,pageSize:9,couponBtnSwitch:!1,activeName:"first",loading:!0,loadingAd:!0,adList:[]}},created:function(){var t=this;this.addonIsExit&&1!=this.addonIsExit.coupon?this.$message({message:"优惠券插件未安装",type:"warning",duration:2e3,onClose:function(){t.$route.push("/")}}):(this.getAdList(),this.getCanReceiveCouponQuery())},computed:Object(o["a"])({},Object(c["b"])(["addonIsExit"])),watch:{addonIsExit:function(){var t=this;1!=this.addonIsExit.coupon&&this.$message({message:"优惠券插件未安装",type:"warning",duration:2e3,onClose:function(){t.$route.push("/")}})}},methods:{getAdList:function(){var t=this;Object(u["a"])({keyword:"NS_PC_COUPON"}).then((function(e){t.adList=e.data.adv_list;for(var a=0;a<t.adList.length;a++)t.adList[a].adv_url&&(t.adList[a].adv_url=JSON.parse(t.adList[a].adv_url));t.loadingAd=!1})).catch((function(e){t.loadingAd=!1}))},handleClick:function(t,e){this.loading=!0},myCoupon:function(){this.$router.pushToTab("/member/my_coupon")},getCanReceiveCouponQuery:function(){var t=this;Object(s["a"])({page:this.currentPage,page_size:this.pageSize,activeName:this.activeName}).then((function(e){t.couponList=e.data.list,t.total=e.data.count,t.couponList.forEach((function(t){t.useState=0})),t.loading=!1})).catch((function(e){t.loading=!1,t.$message.error(e.message)}))},handlePageSizeChange:function(t){this.pageSize=t,this.loading=!0,this.getCanReceiveCouponQuery()},handleCurrentPageChange:function(t){this.currentPage=t,this.loading=!0,this.getCanReceiveCouponQuery()},couponTap:function(t,e){0==t.useState?this.receiveCoupon(t,e):this.toGoodsList(t)},receiveCoupon:function(t,e){var a=this;if(!this.couponBtnSwitch){this.couponBtnSwitch=!0;var n={site_id:t.site_id,activeName:this.activeName};n.coupon_type_id=t.coupon_type_id,Object(s["d"])(n).then((function(e){e.data;var n=e.message;0==e.code?(n="领取成功",a.$message({message:n,type:"success"})):a.$message({message:n,type:"warning"});var i=a.couponList;if(1==e.data.is_exist)for(var o=0;o<i.length;o++)"first"==a.activeName?i[o].coupon_type_id==t.coupon_type_id&&(i[o].useState=1):i[o].platformcoupon_type_id==t.platformcoupon_type_id&&(i[o].useState=1);else for(var s=0;s<i.length;s++)"first"==a.activeName?i[s].coupon_type_id==t.coupon_type_id&&(i[s].useState=2):i[s].platformcoupon_type_id==t.platformcoupon_type_id&&(i[s].useState=2);a.couponBtnSwitch=!1,a.$forceUpdate()})).catch((function(t){"您尚未登录,请先进行登录"==t.message?a.$router.push("/login"):a.$message.error(t.message),a.couponBtnSwitch=!1}))}},toGoodsList:function(t){"first"==this.activeName?1!=t.goods_type?this.$router.push({path:"/list",query:{coupon:t.coupon_type_id}}):this.$router.push({path:"/list"}):this.$router.push("/list")}}},p=r,d=(a("108b"),a("2877")),l=Object(d["a"])(p,n,i,!1,null,"557b1d94",null);e["default"]=l.exports},cbfe:function(t,e,a){"use strict";a.d(e,"b",(function(){return i})),a.d(e,"a",(function(){return o})),a.d(e,"d",(function(){return s})),a.d(e,"c",(function(){return c}));var n=a("751a");function i(t){return Object(n["a"])({url:"/coupon/api/coupon/receive",data:t,forceLogin:!0})}function o(t){var e="/coupon/api/coupon/typepagelists";return Object(n["a"])({url:e,data:t})}function s(t){var e="/coupon/api/coupon/receive";return Object(n["a"])({url:e,data:t,forceLogin:!0})}function c(t){return Object(n["a"])({url:"/coupon/api/coupon/goodsCoupon",data:t})}}}]);
- //# sourceMappingURL=chunk-64fcb3c2.b3f4bb03.js.map
|