activity.js 7.4 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/bargain/activity/activity"],{1531:function(t,e,i){},"2e73":function(t,e,i){"use strict";(function(t){i("8748");n(i("66fd"));var e=n(i("a32d"));function n(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,i("543d")["createPage"])},"5db0":function(t,e,i){"use strict";i.r(e);var n=i("9c7e"),a=i.n(n);for(var r in n)"default"!==r&&function(t){i.d(e,t,(function(){return n[t]}))}(r);e["default"]=a.a},"9bf0":function(t,e,i){"use strict";var n=i("1531"),a=i.n(n);a.a},"9c7e":function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i("2f62");function a(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function r(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?a(Object(i),!0).forEach((function(e){o(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function o(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var s=function(){Promise.all([i.e("common/vendor"),i.e("components/basic-component/app-layout/app-layout")]).then(function(){return resolve(i("3dd6"))}.bind(null,i)).catch(i.oe)},u=function(){Promise.all([i.e("common/vendor"),i.e("components/basic-component/app-form-id/app-form-id")]).then(function(){return resolve(i("e583"))}.bind(null,i)).catch(i.oe)},c={name:"activity",components:{appLayout:s,appFormId:u},data:function(){return{detail:{bargain_price_per:0},list:[],distance:0,more:!1,sizeAnimation:{},status:1,animationData:"",kanjia:!1,dialog:!1,info:{},bargain:{},toMore:!1,page:1,dd:0,hh:23,mm:59,ss:59,reset_time:0,changeTimer:null,timer:null,tip:"",title:"",order_id:"",rules:""}},computed:r({},(0,n.mapState)({theme:function(t){return t.mallConfig.theme},userInfo:function(t){return t.user.info},bargainImg:function(t){return t.mallConfig.plugin.bargain},mall:function(t){return t.mallConfig.mall}})),onShareAppMessage:function(t){var e=this;return this.$shareAppMessage({title:e.title,path:"/plugins/bargain/activity/activity",imageUrl:e.detail.app_share_pic?e.detail.app_share_pic:"",params:{user_id:e.userInfo.options.user_id,bargain_order_id:e.order_id}})},onUnload:function(){clearInterval(this.timer),clearInterval(this.changeTimer)},onLoad:function(t){var e=this;e.$store.dispatch("user/info"),e.$showLoading({type:"global",text:"加载中..."}),e.getSetting();var i=setInterval((function(){e.userInfo&&(clearInterval(i),t.order_id?(e.join(t.order_id),e.order_id=t.order_id):t.id?(e.getDetail(t.id,1),e.order_id=t.id):t.bargain_order_id&&(e.order_id=t.bargain_order_id,t.user_id==e.userInfo.options.user_id?e.getDetail(t.bargain_order_id,1):(e.status=2,e.join(t.bargain_order_id))),e.changeTimer=setInterval((function(){e.changeSize()}),300))}),300)},methods:{toRules:function(){t.navigateTo({url:"/plugins/bargain/rule/rule?rules="+this.rules})},getSetting:function(){var e=this;e.$request({url:e.$api.bargain.setting}).then((function(i){if(0==i.code){if(e.title=i.data.title.toString(),e.rules=i.data.rule,i.data.title.indexOf("\n")>-1){var n=i.data.title.split("\n"),a=Math.floor(Math.random()*n.length);e.title=n[a]}}else t.showToast({title:i.msg,icon:"none",duration:1e3})})).catch((function(t){e.$hideLoading()}))},join:function(e){var i=this;i.$request({url:i.$api.bargain.user_join_bargain,data:{bargain_order_id:e}}).then((function(n){if(0==n.code){var a=n.data.queueId,r=n.data.token;i.result(a,r,e)}else t.showToast({title:n.msg,icon:"none",duration:1e3}),"用户已参与本次砍价"==n.msg&&i.getDetail(e,1)})).catch((function(t){i.$hideLoading()}))},result:function(e,i,n){var a=this;a.$request({url:a.$api.bargain.user_join_bargain_result,data:{queueId:e,token:i}}).then((function(r){0==r.code?1==r.data.retry?setTimeout((function(){a.result(e,i,n)}),1e3):(a.$hideLoading(),a.info=r.data.info,a.bargain=r.data.bargain,a.bargainAnimation(),a.getDetail(n,1)):"已砍至最低价"==r.msg?(a.tip=r.msg,a.getDetail(n,1)):t.showToast({title:r.msg,icon:"none",duration:1e3})})).catch((function(t){a.$hideLoading()}))},getDetail:function(e,i){var n=this;n.$request({url:n.$api.bargain.activity,data:{bargain_order_id:e,page:i}}).then((function(e){setTimeout((function(){n.$hideLoading()}),500),0==e.code?e.data.list.length>0?(n.detail=e.data,n.reset_time=n.detail.reset_time,e.data.total_people>3&&(n.toMore=!0,3==e.data.list.length?n.more=!0:n.more=!1),n.list=n.list.concat(e.data.list),n.timer=setInterval((function(){n.time(),0==n.reset_time&&clearInterval(n.timer)}),1e3)):(n.tip="暂无更多用户",n.toMore=!1):t.showModal({title:"提示",content:e.data.msg,showCancel:!1,success:function(e){e.confirm&&t.redirectTo({url:"/pages/index/index"})}})})).catch((function(t){n.$hideLoading()}))},time:function(){this.reset_time=this.reset_time-1,this.dd=0,this.hh=parseInt(this.reset_time/3600),this.reset_time>86400&&(this.dd=parseInt(this.reset_time/86400),this.hh=parseInt((this.reset_time-86400*dd)/3600));var t=this.reset_time%3600;this.mm=parseInt(t/60),this.ss=parseInt(60*(t/60-this.mm)),this.hh<10&&(this.hh="0"+this.hh.toString()),this.mm<10&&(this.mm="0"+this.mm.toString()),this.ss<10&&(this.ss="0"+this.ss.toString())},bargainAnimation:function(){var t=this;t.kanjia=!0,t.dialog=!0,setTimeout((function(){t.kanjia=!1,t.success()}),1200),t.$forceUpdate()},lookMore:function(){this.page++,this.getDetail(this.order_id,this.page)},closeList:function(){this.list=this.list.slice(0,3),this.page=1,this.more=!0},success:function(){this.dialog=!0;var e=t.createAnimation({duration:500,timingFunction:"linear"});this.animation=e,e.scale(1).step().rotate(2).step().rotate(-2).step().rotate(0).step(),this.animationData=e.export()},changeSize:function(){var e=t.createAnimation({duration:1e3,timingFunction:"linear"});this.size=e,e.scale(.8).step().scale(1).step(),this.sizeAnimation=e.export()},toIndex:function(){t.reLaunch({url:"/pages/index/index"})},toBuy:function(){var e=this.detail,i=[{mch_id:0,bargain_order_id:e.bargain_order_id,goods_list:[{id:e.goods_id,attr:[],num:1,cart_id:0,goods_attr_id:e.goods_attr_id}]}];t.navigateTo({url:"/pages/order-submit/order-submit?mch_list="+JSON.stringify(i)+"&preview_url="+encodeURIComponent(this.$api.bargain.order_preview)+"&submit_url="+encodeURIComponent(this.$api.bargain.order_submit)})},toJoin:function(){this.detail.goods_id?t.navigateTo({url:"/plugins/bargain/goods/goods?goods_id="+this.detail.goods_id}):t.showModal({title:"提示",content:"活动已结束",showCancel:!1,success:function(e){e.confirm&&t.redirectTo({url:"/pages/index/index"})}})}}};e.default=c}).call(this,i("543d")["default"])},a32d:function(t,e,i){"use strict";i.r(e);var n=i("f8be"),a=i("5db0");for(var r in a)"default"!==r&&function(t){i.d(e,t,(function(){return a[t]}))}(r);i("9bf0");var o,s=i("f0c5"),u=Object(s["a"])(a["default"],n["b"],n["c"],!1,null,"667d0730",null,!1,n["a"],o);e["default"]=u.exports},f8be:function(t,e,i){"use strict";var n,a=function(){var t=this,e=t.$createElement;t._self._c;t._isMounted||(t.e0=function(e){t.dialog=!1},t.e1=function(e){t.tip=""})},r=[];i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return r})),i.d(e,"a",(function(){return n}))}},[["2e73","common/runtime","common/vendor"]]]);