!function(){function t(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e0?t.reduce((function(t,n){return t+n})):0,e=this.orderAmount-n;this.list.forEach((function(t){Number(t.useLimit)>e&&!t.checked?t.disabled=!0:t.disabled=!1}))}},render:function(){var t=this;return r("div",{class:A},[r("div",{class:_},[r("span",null,[u("优惠券")]),r("i",{class:y,onClick:function(){return t.$emit("close")}},null)]),r("div",{class:C},[this.dataLoading?r(s,{size:48,color:"#2dc7aa",vertical:!0,style:{height:"100%",justifyContent:"center"}},{default:function(){return[u("加载中...")]}}):r(i,null,[this.list.length>0?r(i,null,[this.list.map((function(n){return r(m,{item:n,isSelect:!0,onClick:t.onSelect},null)}))]):r(c,{btnStatus:!1,tips:"暂无优惠券",classImgSize:"SMALL"},null)])]),r("div",{class:[b,"van-hairline--top"]},[r("div",{class:L},[u("已选"),r("span",null,[this.useLength]),u("张")]),r(a,{type:"primary",round:!0,style:{minWidth:"105px",fontSize:"16px"},onClick:this.onSubmit},{default:function(){return[u("确定")]}})])])}}),S={UNIVERSAL:"UNIVERSAL",VIP:"VIP",PIANO_ROOM:"PIANO",GOODS:"MALL",MUSIC:"MUSIC",PRACTICE:"SPARRING",LIVE:"LIVE",VIDEO:"VIDEO",ALBUM:"ALBUM"};n("U",e({name:"use-conpon",props:{disabled:{type:Boolean,default:!1},orderAmount:{type:Number,default:0},orderType:{type:String,default:""},discountPrice:{type:Number,default:0}},emits:["couponSelect"],data:function(){return{popupStatus:!1,popupLoading:!1,useCouponList:[],useCouponLoading:!1,useCouponCount:0,dataLoading:!1,list:[]}},computed:{couponCount:function(){var t=this.useCouponList.map((function(t){return Number(t.discountPrice||0)}));return this.disabled?this.discountPrice:t.length>0?t.reduce((function(t,n){return t+n})):0},couponCategory:function(){return S[this.orderType]||"UNIVERSAL"}},mounted:function(){this.getList()},methods:{getList:function(){var t=this;return o(regeneratorRuntime.mark((function n(){var e,o,r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!t.dataLoading){n.next=2;break}return n.abrupt("return");case 2:return t.dataLoading=!0,n.prev=3,n.next=6,p.post("".concat(l.platformApi,"/couponInfo/page"),{data:{couponCategory:t.couponCategory,couponType:"FULL_DISCOUNT",useState:"USABLE",orderUse:1,page:1,rows:100}});case 6:if(e=n.sent,t.dataLoading=!1,o=e.data||{},!(t.list.length>0&&1===o.pageNo)){n.next=11;break}return n.abrupt("return");case 11:t.list=o.rows||[],t.list.forEach((function(n){n.checked=!1,n.useLimit>t.orderAmount?n.disabled=!0:n.disabled=!1})),r=0,t.list.forEach((function(t){t.disabled||r++})),console.log(t.list,"list"),t.useCouponCount=r,n.next=21;break;case 19:n.prev=19,n.t0=n.catch(3);case 21:case"end":return n.stop()}}),n,null,[[3,19]])})))()},onSubmit:function(t){this.useCouponList=t,this.$emit("couponSelect",t),this.popupStatus=!1,this.popupLoading=!1}},render:function(){var t=this;return r(i,null,[r(f,{title:"优惠券",class:v,style:{borderRadius:"8px"},isLink:!this.disabled,clickable:!1,onClick:function(){t.disabled||(t.popupStatus=!0,t.popupLoading=!0)}},{value:function(){return!t.useCouponLoading&&r(i,null,[t.couponCount>0?r("span",{class:g},[r("i",null,[u("-¥")]),t.couponCount]):r(i,null,[t.useCouponCount>0?"".concat(t.useCouponCount,"张可使用"):"暂无可使用优惠券"])])}}),r(d,{show:this.popupStatus,"onUpdate:show":function(n){return t.popupStatus=n},position:"bottom",round:!0,safeAreaInsetBottom:!0,style:{height:"75%"},onClosed:function(){t.popupLoading=!1}},{default:function(){return[t.popupLoading&&r(z,{couponCategory:t.couponCategory,useCoupon:t.useCouponList,orderAmount:t.orderAmount,couponList:t.list,onClose:function(){return t.popupStatus=!1},onSubmit:function(n){return t.onSubmit(n)}},null)]}})])}}))}}}))}();