index.js 7.4 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/exchange/index/index"],{"1c18":function(t,e,n){"use strict";n.r(e);var a=n("7eab"),i=n("68ec");for(var o in i)"default"!==o&&function(t){n.d(e,t,(function(){return i[t]}))}(o);n("80cf");var r,c=n("f0c5"),s=Object(c["a"])(i["default"],a["b"],a["c"],!1,null,"0cca6fa6",null,!1,a["a"],r);e["default"]=s.exports},"68ec":function(t,e,n){"use strict";n.r(e);var a=n("7033"),i=n.n(a);for(var o in a)"default"!==o&&function(t){n.d(e,t,(function(){return a[t]}))}(o);e["default"]=i.a},7033:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=n("2f62");function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(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(){n.e("components/basic-component/app-tab-nav/app-tab-nav").then(function(){return resolve(n("9b24"))}.bind(null,n)).catch(n.oe)},s=function(){n.e("components/basic-component/u-mask/u-mask").then(function(){return resolve(n("555e"))}.bind(null,n)).catch(n.oe)},d=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-rich/parse")]).then(function(){return resolve(n("4851"))}.bind(null,n)).catch(n.oe)},u=function(){n.e("components/page-component/app-no-goods/app-no-goods").then(function(){return resolve(n("5cd3"))}.bind(null,n)).catch(n.oe)},l={name:"index",data:function(){return{currentRoute:this.$platDiff.route(),tabbarbool:!1,iphone_x:!1,tabList:[{id:0,name:"兑换礼品"},{id:1,name:"兑换记录"}],over:!1,hiddenBottom:!0,code:"",bottom:"-998rpx",activeTab:"0",list:[],setting:{},animationData:{},showRules:!1,dialog:!1,more:!1,loading:!1,is_not_wechat:!1,msg:"",other:"",page:1}},watch:{tabBarNavs:{handler:function(){this.b()},immediate:!0}},components:{"app-tab-nav":c,parse:d,"app-no-goods":u,"u-mask":s},computed:o(o({},(0,a.mapState)({tabBarNavs:function(t){return t.mallConfig.navbar.navs}})),(0,a.mapGetters)("mallConfig",{getTheme:"getTheme"})),onShareAppMessage:function(){return this.$shareAppMessage({title:this.$children[0].navigationBarTitle,path:"/plugins/exchange/index/index"})},onShareTimeline:function(){return this.$shareTimeline({title:this.$children[0].navigationBarTitle,query:{}})},onReachBottom:function(){this.more&&(this.page++,this.getMore())},onLoad:function(e){this.$commonLoad.onload(e);var n=this;e.code&&(n.code=e.code),e.token&&e.library_id&&e.created_at&&n.getActive(e.token,e.library_id,e.created_at),wx.showShareMenu({menus:["shareAppMessage","shareTimeline"]}),t.getSystemInfo({success:function(t){n.height=-t.screenHeight,(t.model.indexOf("iPhone X")>-1||t.model.indexOf("iPhone 11")>-1||t.model.indexOf("iPhone11")>-1||t.model.indexOf("iPhone12")>-1||t.model.indexOf("Unknown Device")>-1)&&(n.iphone_x=!0)}}),n.$request({url:n.$api.exchange.setting}).then((function(e){0==e.code?n.setting=e.data:t.showToast({title:e.msg,icon:"none",duration:1e3})}))},onShow:function(){"1"==this.activeTab&&this.getList()},methods:{getActive:function(e,n,a){var i=this,o=this;t.showLoading({mask:!0,title:"获取兑换码..."}),o.$request({url:o.$api.exchange.code,data:{token:e,library_id:n,created_at:a}}).then((function(e){t.hideLoading(),i.loading=!1,0==e.code?i.code=e.data.code:(i.msg=e.msg,i.other="",i.dialog=!0)})).catch((function(e){t.hideLoading()}))},b:function(){for(var t=this.currentRoute,e=0;e<this.tabBarNavs.length;e++)if(t.includes(this.tabBarNavs[e].url.split("?")[0]))return this.tabbarbool=!0;return this.tabbarbool=!1},showRule:function(){var e=this;e.over=!1,e.showRules=!0;var n=t.createAnimation({duration:1e3,timingFunction:"ease"});e.animationData=n,setTimeout((function(){var t=0;e.tabbarbool&&(t+=55),n.bottom(-500).bottom(t).step(),e.animationData=n.export(),setTimeout((function(){e.bottom=2*t+"rpx",e.over=!0}),1200)}),200)},scan:function(){var e=this;t.scanCode({success:function(n){if("CODE_128"==n.scanType||n.result&&12==n.result.length)e.code=n.result;else if(n.path){t.showLoading({mask:!0,title:"获取兑换码..."});var a=n.path;a=a.split("?");var i=a[1],o=new RegExp("scene=","g");i=a[1].replace(o,""),e.$request({url:e.$api.default.qrcode_parameter,data:{token:i}}).then((function(n){0===n.code&&(n.data.detail&&"auto"==n.data.detail.data.type?e.getActive(n.data.detail.data.token,n.data.detail.data.library_id,n.data.detail.data.created_at):(t.hideLoading(),t.showToast({title:"未获取到兑换码",icon:"none",duration:1e3}),e.code=n.data.detail.data.code))}))}else t.showToast({title:"暂不支持此二维码,请使用应用内扫一扫功能",icon:"none",duration:1e3})}})},tabStatus:function(t){if(this.loading)return!1;this.list=[],this.page=1,this.activeTab=t.currentTarget.dataset.id,this.getList()},getMore:function(){var e=this,n=this;if(this.loading)return!1;this.loading=!0,n.more=!1,t.showLoading({mask:!0,title:"加载中..."}),n.$request({url:n.$api.exchange.log,data:{page:n.page}}).then((function(a){t.hideLoading(),e.loading=!1,0==a.code?(n.list=n.list.concat(a.data.list),n.list.length==a.data.pagination.pageSize&&(n.more=!0)):t.showToast({title:a.msg,icon:"none",duration:1e3})})).catch((function(e){t.hideLoading()}))},getList:function(){var e=this,n=this;if(this.loading)return!1;this.loading=!0,n.page=1,n.more=!1,t.showLoading({mask:!0,title:"加载中..."}),n.$request({url:n.$api.exchange.log}).then((function(a){e.loading=!1,t.hideLoading(),0==a.code?(n.list=a.data.list,n.list.length==a.data.pagination.pageSize&&(n.more=!0)):t.showToast({title:a.msg,icon:"none",duration:1e3})})).catch((function(e){t.hideLoading()}))},toDetail:function(e){t.navigateTo({url:"/plugins/exchange/detail/detail?code="+e.code+"&exchange=1"})},toGift:function(){t.navigateTo({url:"/plugins/exchange/list/list"})},clerk:function(){var e=this,n=this;if(this.loading||!this.code)return!1;t.showLoading({mask:!0,title:"兑换中..."}),this.loading=!0;var a=this.code;n.$request({url:n.$api.exchange.info,data:{code:a}}).then((function(n){e.loading=!1,t.hideLoading(),0==n.code?(e.code="",t.navigateTo({url:"/plugins/exchange/detail/detail?code="+a})):(e.msg=n.msg,e.other="","该兑换码未到使用时间!"==n.msg&&(e.other=n.data.valid_start_time+"-"+n.data.valid_end_time+" 可用"),e.dialog=!0)})).catch((function(e){t.hideLoading()}))}}};e.default=l}).call(this,n("543d")["default"])},"7eab":function(t,e,n){"use strict";var a;n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return a}));var i=function(){var t=this,e=t.$createElement;t._self._c;t._isMounted||(t.e0=function(e){t.hiddenBottom=!1},t.e1=function(e){t.hiddenBottom=!0},t.e2=function(e){t.dialog=!1,t.code=""},t.e3=function(e){t.showRules=!1,t.bottom="-998rpx",t.animationData={}})},o=[]},"80cf":function(t,e,n){"use strict";var a=n("85c5"),i=n.n(a);i.a},"85c5":function(t,e,n){},d53b:function(t,e,n){"use strict";(function(t){n("2d0a");a(n("66fd"));var e=a(n("1c18"));function a(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])}},[["d53b","common/runtime","common/vendor"]]]);