index-legacy.5c9f7133.js 10 KB

1
  1. !function(){function e(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(e,t)}(e)||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(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,o=new Array(n);t<n;t++)o[t]=e[t];return o}function t(e,n,t,o,r,u,i){try{var c=e[u](i),s=c.value}catch(a){return void t(a)}c.done?n(s):Promise.resolve(s).then(o,r)}function o(e){return function(){var n=this,o=arguments;return new Promise((function(r,u){var i=e.apply(n,o);function c(e){t(i,r,u,c,s,"next",e)}function s(e){t(i,r,u,c,s,"throw",e)}c(void 0)}))}}var r=document.createElement("style");r.innerHTML="._useCoupon_ne7c2_1{border-radius:.26667rem}._useCoupon_ne7c2_1 ._couponCount_ne7c2_4{color:#ff3535;font-size:.37333rem;font-weight:500}._useCoupon_ne7c2_1 ._couponCount_ne7c2_4 i{font-style:normal;font-size:.37333rem}._choiceCoupon_ne7c2_13{display:flex;flex-direction:column;overflow:hidden;height:100%}._couponTitle_ne7c2_19{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;padding:0 .45333rem;height:1.6rem;line-height:1.6rem;font-size:.48rem;font-weight:600;color:#1a1a1a}._couponTitle_ne7c2_19 ._iconClose_ne7c2_31{display:inline-block;width:.64rem;height:.64rem;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IArs4c6QAAAG9QTFRFAAAAzMzM8fHx8/Pz6+vr8fHx6urq7Ozs6urq6+vr7Ozs6+vr6+vr6+vr6+vr7Ozs6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr7OzsZmZma2trbGxsgYGBj4+PysrKy8vLzMzMz8/P39/f6+vrszxq/gAAABp0Uk5TAAUSFhkkJVBXZmt1jY+2yM7b6/Hz9Pj8/v60zef/AAABRUlEQVRIx61W2baCMAyMIIvsm6ChgGD+/xvvA4gta+O580TITE+bpEkBljDdMEqzsszSKHRNOIHhxQ+S8Ig944B+De60wj247tAvfkGbKPzLFt9KaBeJteY7OR0gd5b8W0WHqG4L/pNO8FQUTkWnqKRd2TlpILfneCakheQTXZ804U/5LXQFxZjzgLQRAAAYcv28W9EMX3NoRPuW68oAAE9eokXEuvtYXY2Irez3ACCWfwhERPEajddoyf4YwFTqv8GvYuRjo9wPE1zlVEM9KyZ+PSgEF0I1Dt1IE30/fXSqP4RoEblpYSFQPs6MCFLaVmzzKYWM9hVrPmVQrvM5bR9Fv/aVfAF7S+xDs8PKThy7NNjFxy5v/gViX1F2E+C3GXYj47dK3WZs/d7u+QOFP7L4QxHAPhq79n8Mdv7T4YfHic7z5w+yIe8epvSUygAAAABJRU5ErkJggg==) no-repeat center;background-size:contain}._couponContent_ne7c2_38{flex:1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:.32rem .37333rem;--coupon-point: #fff}._couponFooter_ne7c2_45{display:flex;align-items:center;justify-content:space-between;line-height:1.49333rem;padding:0 .42667rem}._couponFooter_ne7c2_45 ._couponSelectText_ne7c2_52{font-size:.42667rem;color:#1a1a1a}._couponFooter_ne7c2_45 ._couponSelectText_ne7c2_52 span{padding:0 .24rem;font-weight:600;color:#fc1a19}._couponFooter_ne7c2_45 ._btnTenant_ne7c2_61{background-color:#fe2451;border:none;font-size:.42667rem}\n",document.head.appendChild(r),System.register(["./ResizeObserver.es-legacy.8d60aee1.js","./index-legacy.610f0a70.js","./hooks-legacy.f81762aa.js","./item-legacy.5685cd99.js"],(function(n){"use strict";var t,r,u,i,c,s,a,p,l,d,f,h,g;return{setters:[function(e){t=e.d,r=e.j,u=e.A,i=e.F,c=e.C,s=e.aT,a=e.B,p=e.g,l=e.y,d=e.aS},function(e){f=e.C},function(e){h=e.u},function(e){g=e.I}],execute:function(){var m="_useCoupon_ne7c2_1",A="_couponCount_ne7c2_4",y="_choiceCoupon_ne7c2_13",C="_couponTitle_ne7c2_19",_="_iconClose_ne7c2_31",L="_couponContent_ne7c2_38",v="_couponFooter_ne7c2_45",S="_couponSelectText_ne7c2_52",I="_btnTenant_ne7c2_61",b=t({name:"choice-coupon",props:{orderAmount:{type:Number,default:0},orderGoodsType:{type:Array,default:function(){return[]}},useCoupon:{type:Array,default:function(){return[]}},couponCategory:{type:String,default:"UNIVERSAL"},couponList:{type:Array,default:function(){return[]}},usedLength:{type:String,default:"MULTIPLE"}},emits:["close","submit"],data:function(){return{list:[],dataLoading:!1}},computed:{useLength:function(){return this.list.filter((function(e){return e.checked})).length||0}},mounted:function(){var n=this;return o(regeneratorRuntime.mark((function t(){var o,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.couponList.forEach((function(e){n.useCoupon.forEach((function(n){e.couponIssueId===n.couponIssueId&&(e.checked=!0)}))})),o=n.couponList.filter((function(e){return!e.disabled})),r=n.couponList.filter((function(e){return e.disabled})),n.list=[].concat(e(o),e(r)),n.calcCoupon(),h("优惠券");case 6:case"end":return t.stop()}}),t)})))()},methods:{onSubmit:function(){this.$emit("submit",this.list.filter((function(e){return e.checked}))),this.list.forEach((function(e){e.checked=!1}))},onSelect:function(e){e.checked=!e.checked,this.calcCoupon()},calcCoupon:function(){var e=this,n=this.list.filter((function(e){return e.checked}));if("SINGLE"===this.usedLength){var t={};n.forEach((function(e){var n=t[e.couponCategory];t[e.couponCategory]=(n||0)+e.useLimit})),this.list.forEach((function(o){var r=!0;if("UNIVERSAL"===o.couponCategory){var u=0;e.orderGoodsType.forEach((function(e){u+=e.price}));var i=0;for(var c in t)i+=t[c];r=o.useLimit>u-i}else{var s=e.orderGoodsType.find((function(e){return E[e.orderType]===o.couponCategory})),a=s?s.price-(t[o.couponCategory]||0):0;r=Number(o.useLimit)>a}!o.checked&&(n.length>0||r)?o.disabled=!0:o.disabled=!1})),t=null}else{var o=n.map((function(e){return Number(e.useLimit||0)})),r=o.length>0?o.reduce((function(e,n){return e+n})):0,u=this.orderAmount-r;this.list.forEach((function(e){Number(e.useLimit)>u&&!e.checked?e.disabled=!0:e.disabled=!1}))}}},render:function(){var e=this;return r("div",{class:y},[r("div",{class:C},[r("span",null,[u("优惠券")]),r("i",{class:_,onClick:function(){return e.$emit("close")}},null)]),r("div",{class:L},[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(g,{item:n,isSelect:!0,onClick:e.onSelect},null)}))]):r(c,{btnStatus:!1,tips:"暂无优惠券",classImgSize:"SMALL"},null)])]),r("div",{class:[v,"van-hairline--top"]},[r("div",{class:S},[u("已选"),r("span",null,[this.useLength]),u("张")]),r(a,{type:"primary",round:!0,class:"tenant"===p.projectType&&I,style:{minWidth:"105px",fontSize:"16px"},onClick:this.onSubmit},{default:function(){return[u("确定")]}})])])}}),E={UNIVERSAL:"UNIVERSAL",VIP:"VIP",SVIP:"SVIP",PIANO_ROOM:"PIANO",GOODS:"MALL",MUSIC:"MUSIC",VIP_COURSE:"VIP_COURSE",DISCOUNT:"DISCOUNT",PRACTICE:"SPARRING",LIVE:"LIVE",VIDEO:"VIDEO",ALBUM:"ALBUM"};n("c",{UNIVERSAL:"UNIVERSAL",VIP:"VIP",SVIP:"SVIP",PIANO:"PIANO_ROOM",MALL:"GOODS",MUSIC:"MUSIC",VIP_COURSE:"VIP_COURSE",DISCOUNT:"DISCOUNT",SPARRING:"PRACTICE",LIVE:"LIVE",VIDEO:"VIDEO",ALBUM:"ALBUM"}),n("U",t({name:"use-conpon",props:{disabled:{type:Boolean,default:!1},orderAmount:{type:Number,default:0},orderType:{type:String,default:""},orderGoodsType:{type:Array,default:function(){return[]}},discountPrice:{type:Number,default:0},couponId:{type:String,default:""},usedLength:{type:String,default:"SINGLE"}},emits:["couponSelect"],data:function(){return{popupStatus:!1,popupLoading:!1,useCouponList:[],useCouponLoading:!1,useCouponCount:0,dataLoading:!1,list:[]}},computed:{couponCount:function(){var e=this.useCouponList.map((function(e){return Number(e.discountPrice||0)}));return this.disabled?this.discountPrice:e.length>0?e.reduce((function(e,n){return e+n})):0},couponCategory:function(){var e=[];return this.orderGoodsType.forEach((function(n){E[n.orderType]&&e.push(E[n.orderType])})),e.join(",")+(e.length?",UNIVERSAL":"UNIVERSAL")}},watch:{couponId:function(e){var n=e?e.split(",").map((function(e){return Number(e)})):[],t=[];this.useCouponList.forEach((function(e){n.includes(e.couponIssueId)&&t.push(e)})),this.useCouponList=t}},mounted:function(){this.getList()},methods:{resetCouponList:function(){this.list=[],this.getList()},getList:function(){var e=this;return o(regeneratorRuntime.mark((function n(){var t,o,r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!e.dataLoading){n.next=2;break}return n.abrupt("return");case 2:return e.dataLoading=!0,n.prev=3,n.next=6,l.post("".concat(p.platformApi,"/couponInfo/page"),{data:{couponCategory:e.couponCategory,couponType:"FULL_DISCOUNT",useState:"USABLE",orderUse:1,page:1,rows:100}});case 6:if(t=n.sent,e.dataLoading=!1,o=t.data||{},!(e.list.length>0&&1===o.pageNo)){n.next=11;break}return n.abrupt("return");case 11:e.list=o.rows||[],e.list.forEach((function(n){if(n.checked=!1,"UNIVERSAL"===n.couponCategory){var t=0;e.orderGoodsType.forEach((function(e){t+=Number(e.price)})),console.log(t,"1212"),n.disabled=!(n.useLimit<=t)}else{var o=e.orderGoodsType.find((function(e){return E[e.orderType]===n.couponCategory})).price||0;n.useLimit>o?n.disabled=!0:n.disabled=!1}})),r=0,e.list.forEach((function(e){e.disabled||r++})),e.useCouponCount=r,n.next=20;break;case 18:n.prev=18,n.t0=n.catch(3);case 20:case"end":return n.stop()}}),n,null,[[3,18]])})))()},onSubmit:function(e){this.useCouponList=e,this.$emit("couponSelect",e),this.popupStatus=!1,this.popupLoading=!1}},render:function(){var e=this;return r(i,null,[r(f,{title:"优惠券",class:m,isLink:!this.disabled,clickable:!1,onClick:function(){e.disabled||(e.popupStatus=!0,e.popupLoading=!0)}},{value:function(){return!e.useCouponLoading&&r(i,null,[e.couponCount>0?r("span",{class:A},[r("i",null,[u("-¥")]),e.couponCount]):r(i,null,[e.useCouponCount>0?"".concat(e.useCouponCount,"张可使用"):"暂无可使用优惠券"])])}}),r(d,{show:this.popupStatus,"onUpdate:show":function(n){return e.popupStatus=n},position:"bottom",round:!0,safeAreaInsetBottom:!0,style:{height:"75%"},onClosed:function(){e.popupLoading=!1}},{default:function(){return[e.popupLoading&&r(b,{usedLength:e.usedLength,couponCategory:e.couponCategory,useCoupon:e.useCouponList,orderAmount:e.orderAmount,orderGoodsType:e.orderGoodsType,couponList:e.list,onClose:function(){return e.popupStatus=!1},onSubmit:function(n){return e.onSubmit(n)}},null)]}})])}}))}}}))}();