java-mall-app/unpackage/dist/build/mp-weixin/activity/coupon/detail.js
2024-11-01 16:35:40 +08:00

1 line
13 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["activity/coupon/detail","components/uni-qrcode/uni-qrcode"],{"0d54":function(e,t,n){"use strict";n.r(t);var o=n("1af7"),r=n.n(o);for(var a in o)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(a);t["default"]=r.a},"1af7":function(e,t,n){"use strict";(function(e,o){var r=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n("7ca3")),i=r(n("be2d")),u=(r(n("42b0")),r(n("25aa"))),f=n("8f59");function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){(0,a.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s={data:function(){return{options:{},CenterCoupon:{activity_rule:{requirement:{buy:{}}}},cid:"",couponItemId:"",bannerShow:!1,isOnLine:!1}},computed:(0,f.mapState)(["Config","StateCode","notice","plantformInfo","shopInfo","userInfo","hasLogin"]),onLoad:function(t){e.setNavigationBarTitle({title:this.__("优惠券详情")}),this.setData({cid:t.cid,couponItemId:t.couponItemId});this.GetCouponInfo()},methods:c(c({},(0,f.mapMutations)(["login","logout","getPlantformInfo","forceUserInfo","getUserInfo"])),{},{GetCouponInfo:function(e){var t={activity_id:this.cid,user_voucher_id:this.couponItemId},n=this;n.$.request({url:this.Config.URL.user.voucher_get,data:t,success:function(e,t,o,r){200==t&&(e.AllowOfflineWriteOff=!1,n.setData({CenterCoupon:e}))}})},onGotUserInfo:function(e){if(null!=e.detail.userInfo){var t={Photo:e.detail.userInfo.avatarUrl,NickName:e.detail.userInfo.nickName,UserName:app.globalData.UserInfo.UserName};i.default.xsr(i.default.makeUrl(userapi.UpdateUserPhotoAndNickName,t),(function(e){})),app.imageUrl=e.detail.userInfo.avatarUrl,app.nickName=e.detail.userInfo.nickName,app.authorize=!0,this.shareQRCode()}},shareQRCode:function(e){var t={vendorId:app.globalData.VendorInfo.Id,userId:app.globalData.UserInfo.Id,couponId:this.cid};i.default.xsr(i.default.makeUrl(userapi.QRCouponCodePoster,t),(function(e){}))},showCodeImg:function(){o.previewImage({current:this.PageQRCodeInfo.Path,urls:[this.PageQRCodeInfo.Path]})},saveImg:function(){var e=this;i.default.loading(),o.downloadFile({url:this.PageQRCodeInfo.Path,success:function(t){i.default.hideloading(),o.saveImageToPhotosAlbum({filePath:t.tempFilePath,success:function(){e.setData({PageQRCodeInfo:{Path:"",IsShare:!1,IsShareBox:!1,IsJT:!1}}),i.default.alert("保存图片成功!")},fail:function(e){i.default.hideloading()}})},fail:function(e){i.default.hideloading()}})},cancelShare:function(){this.setData({PageQRCodeInfo:{Path:"",IsShare:!1,IsShareBox:!1,IsJT:!1}})},usenow:function(e){var t=e.currentTarget.dataset.store_id;this.$.redirectTo({url:"/member/product/coupon?store_id="+t})},receivenow:function(e){this.getCoupon(e.currentTarget.dataset.id)},setHide:function(){this.setData({bannerShow:!1})},Make:function(e){this.setData({bannerShow:!0});var t=e.currentTarget.dataset.writeoff_code;null!=t&&""!=t&&(this.couponItemId=t),u.default.make({canvasId:"qrcode",componentInstance:this,text:this.couponItemId,size:200,margin:10,backgroundColor:"#ffffff",foregroundColor:"#000000",fileType:"jpg",success:function(e){},fail:function(e){console.log(e)}})},getCoupon:function(e){var t=this,n=this,o={activity_id:e,user_is_new:0};this.forceUserInfo((function(e){e&&i.default.request({url:t.Config.URL.user.voucher_add,data:o,success:function(e,t,o,r){200==t?(n.getCouponlist(),n.$.confirm(n.__("领取成功!,去消费"),(function(e){e.confirm&&n.$.navigateTo({url:"/pagesub/index/store?store_id="+n.CenterCoupon.store_id})}))):i.default.alert(o)}})}))},shareBox:function(){this.setData({PageQRCodeInfo:{Path:"",IsShare:!0,IsShareBox:!0,IsJT:!1}})}})};t.default=s}).call(this,n("df3c")["default"],n("3223")["default"])},"2c8a":function(e,t,n){"use strict";var o=n("4f61"),r=n.n(o);r.a},"42b0":function(e,t,n){"use strict";n.r(t);var o=n("42ec"),r=n("46e3");for(var a in r)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(a);var i=n("828b"),u=Object(i["a"])(r["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],void 0);t["default"]=u.exports},"42ec":function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){}));var o=function(){var e=this.$createElement;this._self._c},r=[]},"46e3":function(e,t,n){"use strict";n.r(t);var o=n("9450"),r=n.n(o);for(var a in o)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(a);t["default"]=r.a},"4f61":function(e,t,n){e.exports={theme_bg:"#f30213"}},6667:function(e,t,n){"use strict";(function(e,t){var o=n("47a9");n("90c2");o(n("3240"));var r=o(n("d69c"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(r.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},9450:function(e,t,n){"use strict";(function(e){var o=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=o(n("7eb4")),a=o(n("ee10")),i=o(n("25aa")),u={props:{cid:{type:String,required:!0},text:{type:String,required:!0},size:{type:Number,default:129},margin:{type:Number,default:0},backgroundColor:{type:String,default:"#ffffff"},foregroundColor:{type:String,default:"#000000"},backgroundImage:{type:String},logo:{type:String},makeOnLoad:{type:Boolean,default:!1}},data:function(){return{}},mounted:function(){this.makeOnLoad&&this.make()},methods:{make:function(){var e=this;return(0,a.default)(r.default.mark((function t(){var n,o;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return n={canvasId:e.cid,componentInstance:e,text:e.text,size:e.size,margin:e.margin,backgroundColor:e.backgroundImage?"rgba(255,255,255,0)":e.backgroundColor,foregroundColor:e.foregroundColor},t.next=3,e.makeSync(n);case 3:if(o=t.sent,!e.backgroundImage){t.next=8;break}return t.next=7,e.drawBackgroundImageSync(o);case 7:o=t.sent;case 8:if(!e.logo){t.next=12;break}return t.next=11,e.drawLogoSync(o);case 11:o=t.sent;case 12:e.makeComplete(o);case 13:case"end":return t.stop()}}),t)})))()},makeComplete:function(e){this.$emit("makeComplete",e)},drawBackgroundImage:function(t){var n=this,o=e.createCanvasContext(this.cid,this);o.drawImage(this.backgroundImage,0,0,this.size,this.size),o.drawImage(t.filePath,0,0,this.size,this.size),o.draw(!1,(function(){e.canvasToTempFilePath({canvasId:n.cid,success:function(e){t.success&&t.success(e.tempFilePath)},fail:function(e){t.fail&&t.fail(e)}})}))},drawBackgroundImageSync:function(e){var t=this;return(0,a.default)(r.default.mark((function n(){return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.abrupt("return",new Promise((function(n,o){t.drawBackgroundImage({filePath:e,success:function(e){n(e)},fail:function(e){o(e)}})})));case 1:case"end":return n.stop()}}),n)})))()},fillRoundRect:function(e,t,n,o,r,a){e.save(),e.translate(n,o),e.beginPath(),e.arc(r-t,a-t,t,0,Math.PI/2),e.lineTo(t,a),e.arc(t,a-t,t,Math.PI/2,Math.PI),e.lineTo(0,t),e.arc(t,t,t,Math.PI,3*Math.PI/2),e.lineTo(r-t,0),e.arc(r-t,t,t,3*Math.PI/2,2*Math.PI),e.lineTo(r,a-t),e.closePath(),e.setFillStyle("#ffffff"),e.fill(),e.restore()},drawLogo:function(t){var n=this,o=e.createCanvasContext(this.cid,this);o.drawImage(t.filePath,0,0,this.size,this.size);var r=this.size/4,a=this.size/2-r/2,i=a,u=r+10,f=this.size/2-u/2,l=f;this.fillRoundRect(o,5,f,l,u,u),o.drawImage(this.logo,a,i,r,r),o.draw(!1,(function(){e.canvasToTempFilePath({canvasId:n.cid,success:function(e){t.success&&t.success(e.tempFilePath)},fail:function(e){t.fail&&t.fail(e)}})}))},drawLogoSync:function(e){var t=this;return(0,a.default)(r.default.mark((function n(){return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.abrupt("return",new Promise((function(n,o){t.drawLogo({filePath:e,success:function(e){n(e)},fail:function(e){o(e)}})})));case 1:case"end":return n.stop()}}),n)})))()},makeSync:function(e){return(0,a.default)(r.default.mark((function t(){return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){i.default.make({canvasId:e.canvasId,componentInstance:e.componentInstance,text:e.text,size:e.size,margin:e.margin,backgroundColor:e.backgroundColor,foregroundColor:e.foregroundColor,success:function(e){t(e)},fail:function(e){n(e)}})})));case 1:case"end":return t.stop()}}),t)})))()}}};t.default=u}).call(this,n("df3c")["default"])},c05f:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){}));var o=function(){var e=this,t=e.$createElement,n=(e._self._c,e.__("¥")),o=e.sprintf(e.__("满¥%s可用"),e.CenterCoupon.voucher_subtotal||e.CenterCoupon.activity_rule.requirement.buy.subtotal),r=e.sprintf(e.__("有效日期至:%s"),e.CenterCoupon.voucher_end_date||e.CenterCoupon.activity_endtime),a=e.CenterCoupon.AllowOfflineWriteOff||e.CenterCoupon.activity_state!=e.StateCode.ACTIVITY_STATE_NORMAL||2!=e.CenterCoupon.CouponType?null:e.__("立即领取"),i=e.CenterCoupon.AllowOfflineWriteOff||e.CenterCoupon.activity_state!=e.StateCode.ACTIVITY_STATE_NORMAL?null:e.__("立即领取"),u=e.CenterCoupon.AllowOfflineWriteOff||e.CenterCoupon.activity_state!=e.StateCode.ACTIVITY_STATE_FINISHED&&e.CenterCoupon.activity_state!=e.StateCode.ACTIVITY_STATE_CLOSED||e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_USED?null:e.__("已领完"),f=e.CenterCoupon.AllowOfflineWriteOff||e.CenterCoupon.voucher_state_id!=e.StateCode.VOUCHER_STATE_USED?null:e.__("已使用"),l=e.CenterCoupon.AllowOfflineWriteOff||e.CenterCoupon.voucher_state_id!=e.StateCode.VOUCHER_STATE_TIMEOUT?null:e.__("已过期"),c=!e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_UNUSED&&0==e.CenterCoupon.AllowOfflineWriteOff&&e.isOnLine?e.__("立即使用"):null,s=e.CenterCoupon.AllowOfflineWriteOff||e.CenterCoupon.voucher_state_id!=e.StateCode.VOUCHER_STATE_UNUSED||0!=e.CenterCoupon.AllowOfflineWriteOff||e.isOnLine?null:e.__("立即使用"),d=!e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_UNUSED&&e.CenterCoupon.AllowOfflineWriteOff?e.__("在线使用"):null,C=(e.CenterCoupon.AllowOfflineWriteOff,null),p=e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.activity_state==e.StateCode.ACTIVITY_STATE_NORMAL&&2==e.CenterCoupon.CouponType?e.__("立即领取"):null,_=e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.activity_state==e.StateCode.ACTIVITY_STATE_NORMAL?e.__("立即领取"):null,h=!e.CenterCoupon.AllowOfflineWriteOff||e.CenterCoupon.activity_state!=e.StateCode.ACTIVITY_STATE_FINISHED&&e.CenterCoupon.activity_state!=e.StateCode.ACTIVITY_STATE_CLOSED||e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_USED?null:e.__("已领完"),m=e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_USED?e.__("已使用"):null,O=e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_TIMEOUT?e.__("已过期"):null,I=e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_UNUSED&&0==e.CenterCoupon.AllowOfflineWriteOff?e.__("立即使用"):null,v=e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.voucher_state_id==e.StateCode.VOUCHER_STATE_UNUSED&&e.CenterCoupon.AllowOfflineWriteOff?e.__("在线使用"):null,g=(e.CenterCoupon.AllowOfflineWriteOff,null),w=e.CenterCoupon.AllowOfflineWriteOff&&e.CenterCoupon.AllowOfflineWriteOff?e.__("支持线下使用(在门店购物时,向店员出示此码抵扣)"):null,T=e.CenterCoupon.AllowOfflineWriteOff?null:e.__("使用条件"),S=e.CenterCoupon.AllowOfflineWriteOff?null:e.sprintf(e.__("满¥%s可用"),e.CenterCoupon.voucher_subtotal||e.CenterCoupon.activity_rule.requirement.buy.subtotal),b=e.CenterCoupon.AllowOfflineWriteOff?null:e.__("可用"),A=e.CenterCoupon.AllowOfflineWriteOff||0!==e.CenterCoupon.activity_on_is_off?null:e.__("查看"),y=e.CenterCoupon.AllowOfflineWriteOff?e.__("使用条件"):null,P=e.CenterCoupon.AllowOfflineWriteOff?e.sprintf(e.__("满¥%s可用"),e.CenterCoupon.voucher_subtotal||e.CenterCoupon.activity_rule.requirement.buy.subtotal):null,E=e.CenterCoupon.AllowOfflineWriteOff?e.__("可用"):null,U=e.CenterCoupon.AllowOfflineWriteOff?e.__("查看"):null,k=""!=e.CenterCoupon.Description&&null!=e.CenterCoupon.Description||e.CenterCoupon.AllowOfflineWriteOff?e.__("使用说明"):null,W=(""!=e.CenterCoupon.Description&&null!=e.CenterCoupon.Description||e.CenterCoupon.AllowOfflineWriteOff)&&e.CenterCoupon.AllowOfflineWriteOff?e.__("支持线下使用,领取后向店员展示优惠券详情"):null;e.$mp.data=Object.assign({},{$root:{m0:n,m1:o,m2:r,m3:a,m4:i,m5:u,m6:f,m7:l,m8:c,m9:s,m10:d,m11:C,m12:p,m13:_,m14:h,m15:m,m16:O,m17:I,m18:v,m19:g,m20:w,m21:T,m22:S,m23:b,m24:A,m25:y,m26:P,m27:E,m28:U,m29:k,m30:W}})},r=[]},d69c:function(e,t,n){"use strict";n.r(t);var o=n("c05f"),r=n("0d54");for(var a in r)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(a);n("2c8a");var i=n("828b"),u=Object(i["a"])(r["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],void 0);t["default"]=u.exports}},[["6667","common/runtime","common/vendor"]]]);