Files
2026-04-05 10:48:38 +08:00

11 lines
9.8 KiB
JavaScript
Executable File

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/diy-components/diy-coupon"],{"063b":function(t,n,e){"use strict";e.r(n);var o=e("bc1f"),u=e.n(o);for(var i in o)["default"].indexOf(i)<0&&function(t){e.d(n,t,(function(){return o[t]}))}(i);n["default"]=u.a},"218e":function(t,n,e){"use strict";e.r(n);var o=e("d800"),u=e("063b");for(var i in u)["default"].indexOf(i)<0&&function(t){e.d(n,t,(function(){return u[t]}))}(i);e("4c05"),e("289f");var c=e("828b"),l=Object(c["a"])(u["default"],o["b"],o["c"],!1,null,"6ce39406",null,!1,o["a"],void 0);n["default"]=l.exports},"289f":function(t,n,e){"use strict";var o=e("ccf0"),u=e.n(o);u.a},"4c05":function(t,n,e){"use strict";var o=e("bea4"),u=e.n(o);u.a},bc1f:function(t,n,e){"use strict";(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e={name:"diy-coupon",props:{value:{type:Object,default:function(){return{}}}},data:function(){return{couponList:[],isHave:!0,couponBtnSwitch:!1,isSuccess:!1,loading:!0,skeletonConfig:{gridRows:2,gridRowsGap:"20rpx",headHeight:"160rpx"}}},created:function(){this.getCanReceiveCouponQuery()},watch:{componentRefresh:function(t){this.getCanReceiveCouponQuery()}},computed:{computedCouponList:function(){var t=[];return this.couponList.filter((function(n){n.count!=n.lead_count&&t.push(n)})),t},couponItemHeight:function(){var n="",e=t.getSystemInfoSync().windowWidth;return"1"==this.value.style||"2"==this.value.style?n=[e-3*this.rpxUpPx(210)-2*this.rpxUpPx(2*this.value.margin.both)]/6:"3"==this.value.style?n=[e-2*this.rpxUpPx(24)-3*this.rpxUpPx(194)-2*this.rpxUpPx(2*this.value.margin.both)]/6:"4"==this.value.style?n=[e-3*this.rpxUpPx(206)-2*this.rpxUpPx(2*this.value.margin.both)]/6:"6"==this.value.style&&(n=[e-3*this.rpxUpPx(208)-2*this.rpxUpPx(2*this.value.margin.both)]/6),n},couponBtnStyle:function(){var t="";return t+="color:"+this.value.btnStyle.textColor+";",t+="background-color:"+this.value.btnStyle.bgColor+";",t+="border-radius:"+2*this.value.btnStyle.aroundRadius+"rpx;",t}},methods:{rpxUpPx:function(n){var e=t.getSystemInfoSync().windowWidth,o=e*parseInt(n)/750;return Math.floor(o)},getCanReceiveCouponQuery:function(){var t=this,n={num:this.value.count,can_receive:1};"diy"==this.value.sources&&(n.coupon_type_id_arr=this.value.couponIds.toString()),this.$api.sendRequest({url:"/coupon/api/coupon/typelists",data:n,success:function(n){var e=n.data;null!=e&&(t.couponList=e,t.couponList.forEach((function(t){t.count==t.lead_count?t.useState=2:0==t.max_fetch||0!=t.max_fetch&&!t.member_coupon_num||0!=t.max_fetch&&t.member_coupon_num&&t.max_fetch>t.member_coupon_num?t.useState=0:t.wait_coupon_num?t.useState=1:t.lose_coupon_num?t.useState=3:t.use_coupon_num&&(t.useState=4)}))),t.loading=!1}})},couponAction:function(t,n){0==t.useState?this.receiveCoupon(t,n):this.couponTap(t,n)},couponTap:function(t,n){2!=t.useState?0==t.useState?this.receiveCoupon(t,n):3==t.useState||4==t.useState?this.$util.redirectTo("/pages_tool/member/coupon",{state:4==t.useState?2:t.useState}):this.toGoodsList(t):this.$util.showToast({title:"该优惠券已抢光"})},receiveCoupon:function(t,n){var e=this,o=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(n){n.data;var u=n.message;if(0==n.code)if(u="领取成功",1==n.data.is_exist)for(var i=0;i<o.couponList.length;i++)o.couponList[i].coupon_type_id==t.coupon_type_id&&o.$set(o.couponList[i],"useState",1);else for(var c=0;c<o.couponList.length;c++)o.couponList[c].coupon_type_id==t.coupon_type_id&&o.$set(o.couponList[c],"useState",2);e.$util.showToast({title:u}),e.$forceUpdate(),e.couponBtnSwitch=!1},fail:function(t){e.couponBtnSwitch=!1}}):(this.$refs.login.open("/pages/index/index"),this.couponBtnSwitch=!1))},toGoodsList:function(t){1!=t.goods_type?this.$util.redirectTo("/pages/goods/list",{coupon:t.coupon_type_id}):this.$util.redirectTo("/pages/goods/list",{})}},filters:{moneyConduct:function(t){var n=t.split("."),e=parseInt(n[1].split("").reverse().join(""))+"";return e=e.split("").reverse().join(""),0==e?n[0]:n[0]+"."+e}}};n.default=e}).call(this,e("df3c")["default"])},bea4:function(t,n,e){},ccf0:function(t,n,e){},d800:function(t,n,e){"use strict";e.d(n,"b",(function(){return u})),e.d(n,"c",(function(){return i})),e.d(n,"a",(function(){return o}));var o={xSkeleton:function(){return Promise.all([e.e("common/vendor"),e.e("uni_modules/x-skeleton/components/x-skeleton/x-skeleton")]).then(e.bind(null,"3268"))},nsLogin:function(){return Promise.all([e.e("common/vendor"),e.e("components/ns-login/ns-login")]).then(e.bind(null,"2910"))}},u=function(){var t=this,n=t.$createElement,e=(t._self._c,t.loading||t.computedCouponList&&t.computedCouponList.length),o=e?t.__get_style(["img"==t.value.couponType&&{backgroundImage:"url("+t.$util.img(t.value.couponBgUrl)+")"},"color"==t.value.couponType&&{backgroundColor:t.value.couponBgColor}]):null,u=e&&"1"==t.value.style?t.__map(Math.ceil(t.computedCouponList.length/3),(function(n,e){var o=t.__get_orig(n),u=t.__map(t.computedCouponList,(function(n,o){var u=t.__get_orig(n),i=o>=[3*e]&&o<[3*(e+1)]?t.$util.img("public/uniapp/coupon/style1-bg.png"):null,c=o>=[3*e]&&o<[3*(e+1)]?parseInt(n.discount):null,l=o>=[3*e]&&o<[3*(e+1)]&&!c?t._f("moneyConduct")(n.money):null,a=o>=[3*e]&&o<[3*(e+1)]&&c?t._f("moneyConduct")(n.discount):null,r=o>=[3*e]&&o<[3*(e+1)]&&n.at_least>0?Number(n.at_least):null;return{$orig:u,g1:i,m0:c,f0:l,f1:a,m1:r}}));return{$orig:o,l0:u}})):null,i=e&&"2"==t.value.style?t.__map(Math.ceil(t.computedCouponList.length/3),(function(n,e){var o=t.__get_orig(n),u=t.__map(t.computedCouponList,(function(n,o){var u=t.__get_orig(n),i=o>=[3*e]&&o<[3*(e+1)]?t.$util.img("public/uniapp/coupon/coupon_bg1.png"):null,c=o>=[3*e]&&o<[3*(e+1)]?parseInt(n.discount):null,l=o>=[3*e]&&o<[3*(e+1)]&&!c?t._f("moneyConduct")(n.money):null,a=o>=[3*e]&&o<[3*(e+1)]&&c?t._f("moneyConduct")(n.discount):null,r=o>=[3*e]&&o<[3*(e+1)]&&n.at_least>0?Number(n.at_least):null;return{$orig:u,g2:i,m2:c,f2:l,f3:a,m3:r}}));return{$orig:o,l2:u}})):null,c=e&&"3"==t.value.style?t.__map(Math.ceil(t.computedCouponList.length/3),(function(n,e){var o=t.__get_orig(n),u=t.__map(t.computedCouponList,(function(n,o){var u=t.__get_orig(n),i=o>=[3*e]&&o<[3*(e+1)]?t.$util.img("public/uniapp/coupon/coupon_shu.png"):null,c=o>=[3*e]&&o<[3*(e+1)]?parseInt(n.discount):null,l=o>=[3*e]&&o<[3*(e+1)]&&!c?t._f("moneyConduct")(n.money):null,a=o>=[3*e]&&o<[3*(e+1)]&&c?t._f("moneyConduct")(n.discount):null,r=o>=[3*e]&&o<[3*(e+1)]&&n.at_least>0?Number(n.at_least):null;return{$orig:u,g3:i,m4:c,f4:l,f5:a,m5:r}}));return{$orig:o,l4:u}})):null,l=e&&"4"==t.value.style?t.__map(Math.ceil(t.computedCouponList.length/3),(function(n,e){var o=t.__get_orig(n),u=t.__map(t.computedCouponList,(function(n,o){var u=t.__get_orig(n),i=o>=[3*e]&&o<[3*(e+1)]?t.$util.img("public/uniapp/coupon/style4_bg.png"):null,c=o>=[3*e]&&o<[3*(e+1)]?parseInt(n.discount):null,l=o>=[3*e]&&o<[3*(e+1)]&&!c?t._f("moneyConduct")(n.money):null,a=o>=[3*e]&&o<[3*(e+1)]&&c?t._f("moneyConduct")(n.discount):null,r=o>=[3*e]&&o<[3*(e+1)]&&n.at_least>0?Number(n.at_least):null;return{$orig:u,g4:i,m6:c,f6:l,f7:a,m7:r}}));return{$orig:o,l6:u}})):null,a=e&&"5"==t.value.style?t.__map(t.computedCouponList,(function(n,e){var o=t.__get_orig(n),u=t.$util.img("public/uniapp/coupon/style5_bg.png"),i="0.00"==n.discount?t._f("moneyConduct")(n.money):null,c="0.00"!=n.discount?t._f("moneyConduct")(n.discount):null,l=n.at_least>0?Number(n.at_least):null;return{$orig:o,g5:u,f8:i,f9:c,m8:l}})):null,r=e&&"6"==t.value.style?t.__map(Math.ceil(t.computedCouponList.length/3),(function(n,e){var o=t.__get_orig(n),u=t.__map(t.computedCouponList,(function(n,o){var u=t.__get_orig(n),i=o>=[3*e]&&o<[3*(e+1)]?t.$util.img("public/uniapp/coupon/style6-bg-1.png"):null,c=o>=[3*e]&&o<[3*(e+1)]?t._f("moneyConduct")("0.00"==n.discount?n.money:n.discount):null,l=o>=[3*e]&&o<[3*(e+1)]?parseFloat(n.at_least):null,a=o>=[3*e]&&o<[3*(e+1)]&&l>0?t._f("moneyConduct")(n.at_least):null;return{$orig:u,g6:i,f10:c,m9:l,f11:a}})),i=t.computedCouponList.length,c=i<=2?t.$util.img("public/uniapp/coupon/style6-bg-2.png"):null;return{$orig:o,l9:u,g7:i,g8:c}})):null,s=e&&"7"==t.value.style?t.__map(t.computedCouponList,(function(n,e){var o=t.__get_orig(n),u=t.$util.img("public/uniapp/coupon/style7_bg.png"),i="0.00"==n.discount?t._f("moneyConduct")(n.money):null,c="0.00"!=n.discount?t._f("moneyConduct")(n.discount):null,l=n.at_least>0?Number(n.at_least):null,a=0==n.validity_type?t.$util.timeStampTurnTime(n.end_time,"Y-m-d"):null;return{$orig:o,g9:u,f12:i,f13:c,m10:l,g10:a}})):null;t._isMounted||(t.e0=function(n,e,o){var u=arguments[arguments.length-1].currentTarget.dataset,i=u.eventParams||u["event-params"];e=i.item,o=i.index;return t.couponAction(e,o)},t.e1=function(n,e,o){var u=arguments[arguments.length-1].currentTarget.dataset,i=u.eventParams||u["event-params"];e=i.item,o=i.index;return t.couponAction(e,o)},t.e2=function(n,e,o){var u=arguments[arguments.length-1].currentTarget.dataset,i=u.eventParams||u["event-params"];e=i.item,o=i.index;return t.couponAction(e,o)},t.e3=function(n,e,o){var u=arguments[arguments.length-1].currentTarget.dataset,i=u.eventParams||u["event-params"];e=i.item,o=i.index;return t.couponAction(e,o)},t.e4=function(n,e,o){var u=arguments[arguments.length-1].currentTarget.dataset,i=u.eventParams||u["event-params"];e=i.item,o=i.index;return t.couponAction(e,o)},t.e5=function(n){return t.$util.redirectTo("/pages/goods/category")}),t.$mp.data=Object.assign({},{$root:{g0:e,s0:o,l1:u,l3:i,l5:c,l7:l,l8:a,l10:r,l11:s}})},i=[]}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
'components/diy-components/diy-coupon-create-component',
{
'components/diy-components/diy-coupon-create-component':(function(module, exports, __webpack_require__){
__webpack_require__('df3c')['createComponent'](__webpack_require__("218e"))
})
},
[['components/diy-components/diy-coupon-create-component']]
]);