goods.js 7.3 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/lottery/goods/goods"],{"012a":function(t,e,n){"use strict";var o=n("7082"),r=n.n(o);r.a},"0b4a":function(t,e,n){"use strict";var o,r=function(){var t=this,e=t.$createElement,n=(t._self._c,Number(100));t.$mp.data=Object.assign({},{$root:{m0:n}})},a=[];n.d(e,"b",(function(){return r})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return o}))},4861:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n("2f62");function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var c=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/app-quick-navigation/app-quick-navigation")]).then(function(){return resolve(n("cf64"))}.bind(null,n)).catch(n.oe)},l=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-rich/parse")]).then(function(){return resolve(n("ee52"))}.bind(null,n)).catch(n.oe)},s=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/app-goods-banner")]).then(function(){return resolve(n("de38"))}.bind(null,n)).catch(n.oe)},u=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/app-goods-service")]).then(function(){return resolve(n("be7d"))}.bind(null,n)).catch(n.oe)},p=function(){n.e("components/page-component/app-share-qr-code-poster/app-share-qr-code-poster").then(function(){return resolve(n("9f9b"))}.bind(null,n)).catch(n.oe)},d=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-iphone-x/app-iphone-x")]).then(function(){return resolve(n("bd7b"))}.bind(null,n)).catch(n.oe)},f=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-empty-bottom/app-empty-bottom")]).then(function(){return resolve(n("51dc"))}.bind(null,n)).catch(n.oe)},g=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/goods/app-goods-marketing")]).then(function(){return resolve(n("b3c0"))}.bind(null,n)).catch(n.oe)},m={name:"goods",components:{appQuickNavigation:c,appRichText:l,appGoodsBanner:s,appService:u,appShareQrCode:p,appIphoneX:d,appEmptyBottom:f,appGoodsMarketing:g},computed:a({},(0,o.mapState)({appImg:function(t){return t.mallConfig.plugin.lottery.app_image},isUnderlinePrice:function(t){return t.mallConfig.mall.setting.is_underline_price}})),data:function(){var t,e;return{integral_time:t,integral_animation:e,animation_trans_lottery:null,rule_list:[{key:1,value:"参与\n抽奖"},{key:2,value:"等待\n开奖"},{key:3,value:"幸运\n中奖"},{key:4,value:"下单\n收礼"}],times:{},poster:this.$api.lottery.poster,user_log:null,lottery:null,goods:null,lucky_list:null,lottery_id:"",award_bg:"",shareShow:!1,setting:null,new_status:0,template_message:null}},onHide:function(){clearInterval(this.integral_time)},onUnload:function(){clearInterval(this.integral_time)},onShareAppMessage:function(t){return this.$shareAppMessage({title:this.goods.name,path:"/plugins/lottery/goods/goods",params:{lottery_id:this.lottery.id}})},onLoad:function(e){var n=this;n.lottery_id=e.lottery_id,n.getSetting(),n.clerk(e.user_id),n.$showLoading({title:"加载中"}),n.$request({url:n.$api.lottery.goods,data:{lottery_id:n.lottery_id}}).then((function(e){if(n.$hideLoading(),0===e.code){var o=[e.data.goods,e.data.lottery,e.data.lucky_list,e.data.user_log,e.data.new_status,e.data.template_message];n.goods=o[0],n.lottery=o[1],n.lucky_list=o[2],n.user_log=o[3],n.new_status=o[4],n.template_message=o[5],n.setTimeStart(2==n.new_status?n.lottery.start_at:n.lottery.end_at)}else t.showToast({icon:"none",title:e.msg})})).catch((function(t){n.$hideLoading()}))},methods:{qrcode:function(){t.navigateTo({url:"/plugins/lottery/qrcode/qrcode"})},prize:function(){t.navigateTo({url:"/plugins/lottery/detail/detail?lottery_id="+this.lottery.id}),clearInterval(this.lotteryInter),this.award_bg=!1},rule:function(){t.navigateTo({url:"/plugins/lottery/rule/rule?rules="+this.setting.rule})},catchTouchMove:function(){return!1},getSetting:function(){var t=this;t.$request({url:t.$api.lottery.setting}).then((function(e){0===e.code&&(t.setting=e.data.setting)})).catch((function(t){console.log(t)}))},clerk:function(t){var e=this;t&&e.$request({url:e.$api.lottery.clerk,data:{user_id:t,lottery_id:e.lottery_id},method:"POST"}).then((function(t){console.log(t)}))},setTimeStart:function(t){var e=this;clearInterval(e.integral_time);var n=function(t){var n=t.replace(/-/g,"/"),o=parseInt((new Date(n).getTime()-(new Date).getTime())/1e3),r=0,a=0,i=0,c=0;o>0&&(r=Math.floor(o/86400),a=Math.floor(o/3600)-24*r,i=Math.floor(o/60)-24*r*60-60*a,c=Math.floor(o)-24*r*60*60-60*a*60-60*i),e.times={day:r,hour:a,minute:i,second:c},e.times<=0&&clearInterval(e.integral_time)};n(t),e.integral_time=setInterval((function(){n(t)}),1e3)},subscribe:function(){var e=this;if(!this.award_bg){var n=this;n.$subscribe(this.template_message).then((function(o){var r=e.template_message[0];"accept"==o[r]?t.showModal({title:"提示",content:"订阅成功",showCancel:!1,success:function(t){n.buyZero()}}):t.showModal({title:"提示",content:"取消订阅",showCancel:!1,success:function(t){n.buyZero()}})})).catch((function(t){n.buyZero()}))}},buyZero:function(){var t=this;t.award_bg=!t.award_bg,setTimeout((function(){var e=wx.createAnimation({duration:500,timingFunction:"linear",delay:0,transformOrigin:"50% 50%"});t.award_bg?e.width("360rpx").height("314rpx").step():e.scale(0,0).opacity(0).step(),t.animation_trans_lottery=e.export(),setTimeout((function(){var n=0;t.integral_animation=setInterval((function(){n%2===0?e.scale(.9).opacity(1).step():e.scale(1).opacity(1).step(),t.animation_trans_lottery=e.export(),n++,500===n&&(n=0)}),500)}),500)}),50)},detail:function(){clearInterval(this.integral_animation),this.award_bg=!1},onImageListClick:function(e){var n=[],o=e.currentTarget.dataset.index;for(var r in this.goods.pic_url)n.push(this.goods.pic_url[r].pic_url);t.previewImage({urls:n,current:n[o]})},buyNow:function(){t.navigateTo({url:"/pages/goods/goods?id="+this.lottery.buy_goods_id})},shareClick:function(){this.shareShow=!0}}};e.default=m}).call(this,n("543d")["default"])},7082:function(t,e,n){},cbe1:function(t,e,n){"use strict";(function(t){n("8748");o(n("66fd"));var e=o(n("f57b"));function o(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},cfa6:function(t,e,n){"use strict";n.r(e);var o=n("4861"),r=n.n(o);for(var a in o)"default"!==a&&function(t){n.d(e,t,(function(){return o[t]}))}(a);e["default"]=r.a},f57b:function(t,e,n){"use strict";n.r(e);var o=n("0b4a"),r=n("cfa6");for(var a in r)"default"!==a&&function(t){n.d(e,t,(function(){return r[t]}))}(a);n("012a");var i,c=n("f0c5"),l=Object(c["a"])(r["default"],o["b"],o["c"],!1,null,"4c21f9a6",null,!1,o["a"],i);e["default"]=l.exports}},[["cbe1","common/runtime","common/vendor"]]]);