"use strict";var o=require("../common/vendor.js"),i=require("../api/coupon.js");require("../common/request.js");const a={name:"getCoupon",props:{},data:function(){return{couponId:null,item:null,isShare:null,code:null}},onLoad(e){this.couponId=e.couponId,this.code=e.code,this.$isEmpty(e.isShare)?o.index.hideShareMenu():(this.isShare=e.isShare,this.genCode()),console.log(e.couponId),this.companyId=o.index.getStorageSync("companyId"),this.companyUserId=o.index.getStorageSync("companyUserId"),this.getCouponById()},onShareAppMessage(e){return o.index.showShareMenu({withShareTicket:!0}),wx.updateShareMenu({isPrivateMessage:!0,withShareTicket:!0,success(t){console.log("updateShareMenu: ",t)},fail(){}}),{title:this.item.title,path:"/pages_company/couponDetails?couponId="+this.item.couponId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId+"&code="+this.code}},mounted:function(){},onShow(){},methods:{genCode:function(){let e=this;var t={couponId:this.couponId};i.genCode(t).then(function(n){e.code=n.data}).catch(function(n){})},getCouponById:function(){let e=this;var t={couponId:this.couponId};i.getCouponById(t).then(function(n){e.item=n.data}).catch(function(n){o.index.showToast({title:n.msg,icon:"none",duration:2e3})})},receive:function(){var e={couponId:this.item.couponId,companyId:this.companyId,companyUserId:this.companyUserId,code:this.code};i.receive(e).then(function(t){t.code==200?o.index.showToast({title:"\u9886\u53D6\u6210\u529F",icon:"success",duration:2e3}):o.index.showToast({title:t.msg,duration:2e3})}).catch(function(t){o.index.showToast({title:t.msg,icon:"none",duration:2e3})})}}};function r(e,t,n,d,u,c){return o.e({a:e.item!=null},e.item!=null?o.e({b:o.t(e.item.price.toFixed(2)),c:o.t(e.item.minPrice.toFixed(2)),d:o.t(e.item.title),e:o.t(e.item.limitTime),f:e.item.remainNumber>0},e.item.remainNumber>0?{g:o.o(m=>c.receive())}:e.item.remainNumber==0?{}:{},{h:e.item.remainNumber==0}):{})}var s=o._export_sfc(a,[["render",r],["__scopeId","data-v-660e495e"],["__file","E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_company/couponDetails.vue"]]);a.__runtimeHooks=2;wx.createPage(s);
