You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/unpackage/dist/build/mp-weixin/pages/goods/externalCoupon/externalCoupon.js

1 line
3.7 KiB

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods/externalCoupon/externalCoupon"],{"0f3c":function(t,e,n){},"1c50":function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n("53e0"),a=getApp(),i={data:function(){return{minecoupones:[],imageUrl:a.globalData.imgUrl,pageNum:1,pageSize:10,isNoMoreData:!1,couponsDetails:"",salesEndTime:"",codes:"",userInfo:""}},filters:{formatDate:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=new Date(t),o=n.getFullYear(),a=n.getMonth()+1,i=n.getDate(),u=n.getHours(),c=n.getMinutes(),r=n.getSeconds();return a=a>10?a:"0"+a,i=i>10?i:"0"+i,u=u>10?u:"0"+u,c=c>10?c:"0"+c,r=r>10?r:"0"+r,"".concat(o).concat(e).concat(a).concat(e).concat(i)}},onLoad:function(e){a.globalData.userInfo?this.userInfo=2:this.userInfo=1,t.login({provider:"weixin",success:function(t){a.globalData.code=t.code;var e={code:a.globalData.code};(0,o.HandleCode)(e).then((function(t){"000000"==t.return_code&&(a.globalData.openId=t.return_data.openId)}))}});var n=decodeURIComponent(e.q),i=n.split("=");this.codes=i[2],this.getDiscountByQrCode()},methods:{getDiscountByQrCode:function(){var t=this,e={discountAgentId:this.codes};(0,o.getDiscountByQrCode)(e).then((function(e){"000000"==e.return_code&&(t.couponsDetails=e.return_data,t.salesEndTime=e.return_data.highDiscount.salesEndTime,t.getCouponByDiscount(e.return_data.highDiscount.id))}))},getCouponByDiscount:function(t){var e=this,n={discountId:t};(0,o.getCouponByDiscount)(n).then((function(t){"000000"==t.return_code&&(e.minecoupones=t.return_data)}))},receiveDiscount:function(){t.showLoading({title:"领取中..."});var e={discountAgentId:this.couponsDetails.id};(0,o.receiveDiscount)(e).then((function(e){"000000"==e.return_code?(t.hideLoading(),t.showToast({icon:"none",title:e.return_data,duration:2e3})):(t.hideLoading(),t.showToast({icon:"none",title:e.return_msg,duration:2e3}))}))},getuserinfo:function(){var e=this;wx.login({success:function(n){if(n.code){n.code;t.getUserInfo({success:function(n){var i={openId:a.globalData.openId,iv:n.iv,encryptedData:n.encryptedData};(0,o.getUserInfo)(i).then((function(n){"000000"==n.return_code?(a.globalData.userInfo=n.return_data.object.highUser,a.globalData.token=n.return_data.uniqueCode,t.setStorage({key:"user",data:n.return_data.object.highUser}),t.setStorage({key:"token",data:n.return_data.uniqueCode}),e.receiveDiscount(),e.userInfo=2):t.showToast({title:n.return_msg,icon:"none",duration:2e3})}))},fail:function(e){t.showToast({title:"微信登录授权失败",icon:"none"})}})}},fail:function(t){}})},toGoods:function(e){t.navigateTo({url:"../goods?id="+e})}}};e.default=i}).call(this,n("543d")["default"])},"343d":function(t,e,n){"use strict";var o;n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o}));var a=function(){var t=this,e=t.$createElement,n=(t._self._c,t._f("formatDate")(t.salesEndTime,"-"));t.$mp.data=Object.assign({},{$root:{f0:n}})},i=[]},"85c0":function(t,e,n){"use strict";n.r(e);var o=n("1c50"),a=n.n(o);for(var i in o)"default"!==i&&function(t){n.d(e,t,(function(){return o[t]}))}(i);e["default"]=a.a},"9dba":function(t,e,n){"use strict";var o=n("0f3c"),a=n.n(o);a.a},a29a:function(t,e,n){"use strict";n.r(e);var o=n("343d"),a=n("85c0");for(var i in a)"default"!==i&&function(t){n.d(e,t,(function(){return a[t]}))}(i);n("9dba");var u,c=n("f0c5"),r=Object(c["a"])(a["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],u);e["default"]=r.exports},ac23:function(t,e,n){"use strict";(function(t){n("e5b1");o(n("66fd"));var e=o(n("a29a"));function o(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])}},[["ac23","common/runtime","common/vendor"]]]);