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 lines
3.9 KiB

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods/externalCoupon/externalCoupon"],{3569:function(t,e,n){"use strict";n.r(e);var o=n("5784"),a=n("4d9b");for(var i in a)"default"!==i&&function(t){n.d(e,t,(function(){return a[t]}))}(i);n("a432");var u,r=n("f0c5"),c=Object(r["a"])(a["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],u);e["default"]=c.exports},"4d9b":function(t,e,n){"use strict";n.r(e);var o=n("e087"),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},5784: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=[]},6719:function(t,e,n){},a432:function(t,e,n){"use strict";var o=n("6719"),a=n.n(o);a.a},d24d:function(t,e,n){"use strict";(function(t){n("eba6");o(n("66fd"));var e=o(n("3569"));function o(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},e087:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n("b528"),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(),r=n.getMinutes(),c=n.getSeconds();return a=a>10?a:"0"+a,i=i>10?i:"0"+i,u=u>10?u:"0"+u,r=r>10?r:"0"+r,c=c>10?c:"0"+c,"".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={code: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={codeId:this.couponsDetails.highDiscountAgentCode.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(){t.showLoading({title:"登录中..."});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?(t.hideLoading(),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.hideLoading(),t.showToast({title:n.return_msg,icon:"none",duration:2e3}))}))},fail:function(e){t.hideLoading(),t.showToast({title:"微信登录授权失败",icon:"none"})}})}},fail:function(e){t.hideLoading()}})},toGoods:function(e){a.globalData.userInfo?t.navigateTo({url:"../../order/confirmation?id="+e}):t.showToast({icon:"none",title:"请点击领取后再使用",duration:2e3})}}};e.default=i}).call(this,n("543d")["default"])}},[["d24d","common/runtime","common/vendor"]]]);