| 12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-32c76a16"],{6063:function(t,e,n){"use strict";var a=n("8686"),o=n.n(a);o.a},8686:function(t,e,n){},aa81:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"ns-coupon"},[t.adList.length?n("div",{staticClass:"ns-coupon-info"},[n("div",{staticClass:"ns-coupon-wrap"},[t._m(0),t._m(1),n("el-button",{on:{click:t.myCoupon}},[t._v("我的优惠券")])],1),n("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loadingAd,expression:"loadingAd"}],staticClass:"ns-coupon-img"},[n("el-carousel",{attrs:{height:"406px"}},t._l(t.adList,(function(e){return n("el-carousel-item",{key:e.adv_id},[n("el-image",{attrs:{src:t.$img(e.adv_image),fit:"cover"},on:{click:function(n){return t.$router.pushToTab(e.adv_url.url)}}})],1)})),1)],1)]):t._e(),n("el-tabs",[n("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}]},[n("ul",{staticClass:"ns-coupon-list"},t._l(t.couponList,(function(e,a){return n("li",{key:a,staticClass:"ns-bg-color ns-coupon-li",class:e.count==e.lead_count?"no-coupon":""},[n("div",{staticClass:"describe"},[[e.discount&&"0.00"!=e.discount?n("span",[t._v(t._s(e.discount)+"折")]):n("span",[t._v("¥"+t._s(e.money))])],n("span",[t._v(t._s("first"==t.activeName?e.coupon_name:e.platformcoupon_name))]),"first"==t.activeName?n("span",[t._v(t._s(1==e.goods_type?"全部商品可用":"指定商品可用"))]):t._e(),["0.00"==e.at_least?n("span",[t._v("无门槛优惠券")]):n("span",[t._v("满"+t._s(e.at_least)+"可使用")])],[e.validity_type?n("span",{staticClass:"coupon-wrap-time"},[t._v("领取之日起"+t._s(e.fixed_term)+"日内有效")]):n("span",{staticClass:"coupon-wrap-time"},[t._v("有效期至"+t._s(t.$timeStampTurnTime(e.end_time)))])]],2),n("div",{staticClass:"receive"},[e.count==e.lead_count?n("a",{staticClass:"ns-text-color"},[n("span",[t._v("已抢完")])]):n("a",{staticClass:"ns-text-color",on:{click:function(n){return t.couponTap(e,a)}}},[0==e.useState?n("span",[t._v("立即领取")]):n("span",[t._v("去使用")])])])])})),0),t.couponList.length<=0?n("div",{staticClass:"empty-wrap"},[n("div",{staticClass:"ns-text-align"},[t._v("暂无优惠券")])]):t._e(),n("div",{staticClass:"pager"},[n("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)},o=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"coupon-name"},[n("span",{staticClass:"ns-text-color"},[t._v("优惠券中心")]),n("span",{staticClass:"ns-text-color-gray text12"},[t._v("省钱更多,领券更多")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ul",{staticClass:"coupon-type clear-float"},[n("li",[n("i"),n("span",[t._v("限时抢券")])]),n("li",[n("i"),n("span",[t._v("叠加使用")])]),n("li",[n("i"),n("span",[t._v("种类多样")])])])}],i=(n("4160"),n("159b"),n("5530")),s=n("cbfe"),c=n("2f62"),u=n("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(i["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 n=0;n<t.adList.length;n++)t.adList[n].adv_url&&(t.adList[n].adv_url=JSON.parse(t.adList[n].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,console.log(t.couponList),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 n=this;if(!this.couponBtnSwitch){this.couponBtnSwitch=!0;var a={site_id:t.site_id,activeName:this.activeName};a.coupon_type_id=t.coupon_type_id,Object(s["d"])(a).then((function(e){e.data;var a=e.message;0==e.code?(a="领取成功",n.$message({message:a,type:"success"})):n.$message({message:a,type:"warning"});var o=n.couponList;if(1==e.data.is_exist)for(var i=0;i<o.length;i++)"first"==n.activeName?o[i].coupon_type_id==t.coupon_type_id&&(o[i].useState=1):o[i].platformcoupon_type_id==t.platformcoupon_type_id&&(o[i].useState=1);else for(var s=0;s<o.length;s++)"first"==n.activeName?o[s].coupon_type_id==t.coupon_type_id&&(o[s].useState=2):o[s].platformcoupon_type_id==t.platformcoupon_type_id&&(o[s].useState=2);n.couponBtnSwitch=!1,n.$forceUpdate()})).catch((function(t){"您尚未登录,请先进行登录"==t.message?n.$router.push("/login"):n.$message.error(t.message),n.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=(n("6063"),n("2877")),l=Object(d["a"])(p,a,o,!1,null,"7d7efcf7",null);e["default"]=l.exports},cbfe:function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return i})),n.d(e,"d",(function(){return s})),n.d(e,"c",(function(){return c}));var a=n("751a");function o(t){return Object(a["a"])({url:"/coupon/api/coupon/receive",data:t,forceLogin:!0})}function i(t){var e="/coupon/api/coupon/typepagelists";return Object(a["a"])({url:e,data:t})}function s(t){var e="/coupon/api/coupon/receive";return Object(a["a"])({url:e,data:t,forceLogin:!0})}function c(t){return Object(a["a"])({url:"/coupon/api/coupon/goodsCoupon",data:t})}}}]);
- //# sourceMappingURL=chunk-32c76a16.d6256348.js.map
|