coupon.js 4.2 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/integral_mall/coupon/coupon"],{"5b43":function(e,n,t){"use strict";t.r(n);var o=t("7b46"),i=t.n(o);for(var a in o)"default"!==a&&function(e){t.d(n,e,(function(){return o[e]}))}(a);n["default"]=i.a},"6ed4":function(e,n,t){},"7b46":function(e,n,t){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=t("2f62");function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){c(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var r={name:"about",data:function(){return{coupon:{coupon:{min_price:"",rule:""}},success:!1,lose:!1,iphone_x:!1,exchangeCoupon:!1,current:"wechat"}},computed:a({},(0,o.mapState)({integralImg:function(e){return e.mallConfig.plugin.integral_mall},mall:function(e){return e.mallConfig.mall}})),onLoad:function(n){this.$commonLoad.onload(n);var t=this,o=n.id;t.$showLoading({type:"global",text:"加载中..."}),t.getList(o),e.getSystemInfo({success:function(e){(e.model.indexOf("iPhone X")>-1||e.model.indexOf("iPhone 11")>-1||e.model.indexOf("iPhone11")>-1||e.model.indexOf("iPhone12")>-1||e.model.indexOf("Unknown Device")>-1)&&(t.iphone_x=!0)}})},methods:{close:function(){this.success=!1,this.lose=!1},toList:function(){this.success=!1,e.navigateTo({url:"/pages/coupon/index/index"})},getList:function(n){var t=this;t.$request({url:t.$api.integral_mall.detail,data:{id:n}}).then((function(n){t.$hideLoading(),0==n.code?t.coupon=n.data.detail:e.showToast({title:n.msg,icon:"none",duration:1e3})})).catch((function(e){t.$hideLoading()}))},submit:function(){var n=this,t=n.coupon.id;n.exchangeCoupon=!1,null!=n.userInfo&&n.userInfo.integral<n.choose.integral_num?e.showToast({title:"积分不足",icon:"none",duration:1e3}):(e.showLoading({mask:!0,title:"领取中..."}),n.$request({url:n.$api.integral_mall.coupon_submit,data:{id:t},method:"post"}).then((function(t){if(0==t.code){var o=t.data.queue_id,i=t.data.token;n.getPayOrderId(o,i)}else e.hideLoading(),e.showToast({title:t.msg,icon:"none",duration:1e3})})).catch((function(n){e.hideLoading()})))},getPayOrderId:function(n,t){var o=this;this.$request({url:this.$api.integral_mall.coupon_pay,data:{queue_id:n,token:t}}).then((function(i){0===i.code?i.data.retry&&1===i.data.retry?o.getPayDataTimer=setTimeout((function(){o.getPayOrderId(n,t)}),1e3):(e.hideLoading(),o.pay(i.data.id)):(o.exchangeCoupon=!1,e.hideLoading(),e.showModal({title:"提示",content:i.msg,showCancel:!1}))})).catch((function(n){o.exchangeCoupon=!1,e.hideLoading(),e.showModal({title:"提示",content:n.errMsg,showCancel:!1})}))},pay:function(n){var t=this;this.$payment.pay(n).then((function(e){t.success=!0})).catch((function(n){e.showToast({title:"支付失败",icon:"none",duration:1e3})}))}}};n.default=r}).call(this,t("543d")["default"])},"9aae":function(e,n,t){"use strict";t.r(n);var o=t("d0eb"),i=t("5b43");for(var a in i)"default"!==a&&function(e){t.d(n,e,(function(){return i[e]}))}(a);t("dccb");var c,r=t("f0c5"),u=Object(r["a"])(i["default"],o["b"],o["c"],!1,null,"5213feaf",null,!1,o["a"],c);n["default"]=u.exports},ca48:function(e,n,t){"use strict";(function(e){t("2d0a");o(t("66fd"));var n=o(t("9aae"));function o(e){return e&&e.__esModule?e:{default:e}}e(n.default)}).call(this,t("543d")["createPage"])},d0eb:function(e,n,t){"use strict";var o;t.d(n,"b",(function(){return i})),t.d(n,"c",(function(){return a})),t.d(n,"a",(function(){return o}));var i=function(){var e=this,n=e.$createElement;e._self._c;e._isMounted||(e.e0=function(n){e.exchangeCoupon=!0},e.e1=function(n){e.exchangeCoupon=!1})},a=[]},dccb:function(e,n,t){"use strict";var o=t("6ed4"),i=t.n(o);i.a}},[["ca48","common/runtime","common/vendor"]]]);