(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/ourPayment/ourPayment"],{2296:function(o,n,t){"use strict";t.r(n);var e=t("3db3"),a=t("6a16");for(var i in a)"default"!==i&&function(o){t.d(n,o,(function(){return a[o]}))}(i);t("9dd6");var s,u=t("f0c5"),c=Object(u["a"])(a["default"],e["b"],e["c"],!1,null,null,null,!1,e["a"],s);n["default"]=c.exports},3778:function(o,n,t){"use strict";(function(o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=function(){t.e("components/orderCoupon").then(function(){return resolve(t("5503"))}.bind(null,t)).catch(t.oe)},a={components:{orderCoupon:e},data:function(){return{buyMoney:"",companyId:"",merchantId:"",name:"",paySign:"",signType:"",timeStamp:"",nonceStr:"",package:"",flag:"",couponData:"",chooseCouponObj:"",ableConpon:"",orderSource:8}},onLoad:function(o){this.option=decodeURIComponent(o.q),this.merchantId?this.init():this.initTwo(),this.initCoupon()},methods:{clickNum:function(o){var n=this;this.buyMoney+=o,clearTimeout(this.flag),this.flag=setTimeout((function(){n.initCoupon()}),1500)},clickEnter:function(){var o=this;this.buyMoney=this.buyMoney.substr(0,this.buyMoney.length-1),clearTimeout(this.flag),this.flag=setTimeout((function(){o.initCoupon()}),1500)},couponChoose:function(o){this.chooseCouponObj=o},showCoupon:function(){this.$refs.orderCoupon.showCoupon()},init:function(){var n=this,t={merchantId:this.merchantId,companyId:this.companyId};this.$request("scenic/order/findCodePayInfo",t).then((function(t){"00"==t.code?n.name=t.data.name:o.showToast({title:t.message,icon:"none"})}))},initTwo:function(){var n=this,t={id:this.companyId};this.$request("user/company/detail",t).then((function(t){"00"==t.code?n.name=t.data.companyVo.companyName:o.showToast({title:t.message,icon:"none"})}))},initCoupon:function(){var n=this,t=[];this.chooseCouponObj="",this.ableConpon="";var e={money:parseFloat(this.buyMoney)||0,merchantId:this.merchantId,companyId:this.companyId,orderSource:this.orderSource,openid:o.getStorageSync("openid")};this.$request("wechatUser/myPage/usableCouponList",e).then((function(o){if("00"==o.code)if(n.couponData=o.data,o.data.usableCouponList.length>0){o.data.usableCouponList.forEach((function(o){t.push(o.savedMoney)}));var e=Math.max.apply(null,t),a=o.data.usableCouponList.findIndex((function(o){return e==o.savedMoney}));a>-1&&(n.chooseCouponObj=o.data.usableCouponList[a])}else o.data.unusableCouponList.length>0&&o.data.unusableCouponList.forEach((function(o,t){1==o.isProduct&&(n.ableConpon=o)}))}))},clickPay:function(){var n=this;if(parseFloat(this.buyMoney)){var t=[];""!=this.chooseCouponObj&&(t=[{couponId:this.chooseCouponObj.couponId,couponPrice:this.chooseCouponObj.savedMoney,isMerchant:this.chooseCouponObj.createSource,myCouponId:this.chooseCouponObj.id,couponType:this.chooseCouponObj.couponType}]);var e={companyId:this.companyId,merchantId:this.merchantId,userId:o.getStorageSync("openid"),orderMoney:parseFloat(this.buyMoney),payType:this.payType,orderSource:this.orderSource,couponList:t};this.$request("orderc/order/codePay",e).then((function(t){if("00"==t.code){if(t.data.errorMessage)return void o.showToast({title:t.data.errorMessage,icon:"none"});n.signType=t.data.signType,n.paySign=t.data.sign,n.timeStamp=t.data.timestamp,n.nonceStr=t.data.noncestr,n.package=t.data.package,n.goPay()}else o.showToast({title:t.message,icon:"none"})})).catch((function(o){}))}},goPay:function(){o.requestPayment({provider:"wxpay",timeStamp:this.timeStamp,nonceStr:this.nonceStr,package:this.package,signType:this.signType,paySign:this.paySign,success:function(n){o.redirectTo({url:"../paySuccess/paySuccess"})},fail:function(n){o.showToast({title:n.errMsg,icon:"none"})}})}},watch:{buyMoney:function(o,n){"."==o&&""==n&&(this.buyMoney="0."),"0"==o&&""==n&&(this.buyMoney="0."),2==o.length&&0==o.substr(0,1)&&"."!=o.substr(1,2)&&(this.buyMoney=o.substr(1,2)),isNaN(o)&&"."!=o&&(this.buyMoney=n);var t=String(this.buyMoney).indexOf(".")+1,e=String(this.buyMoney).length-t;e>2&&t>0&&(this.buyMoney=n)}}};n.default=a}).call(this,t("543d")["default"])},"3db3":function(o,n,t){"use strict";var e;t.d(n,"b",(function(){return a})),t.d(n,"c",(function(){return i})),t.d(n,"a",(function(){return e}));var a=function(){var o=this,n=o.$createElement,t=(o._self._c,""!=o.chooseCouponObj?o.chooseCouponObj.savedMoney.toFixed(2):null);o.$mp.data=Object.assign({},{$root:{g0:t}})},i=[]},"6a16":function(o,n,t){"use strict";t.r(n);var e=t("3778"),a=t.n(e);for(var i in e)"default"!==i&&function(o){t.d(n,o,(function(){return e[o]}))}(i);n["default"]=a.a},"7f8b":function(o,n,t){},"9dd6":function(o,n,t){"use strict";var e=t("7f8b"),a=t.n(e);a.a},d410:function(o,n,t){"use strict";(function(o){t("6909"),t("921b");e(t("66fd"));var n=e(t("2296"));function e(o){return o&&o.__esModule?o:{default:o}}o(n.default)}).call(this,t("543d")["createPage"])}},[["d410","common/runtime","common/vendor"]]]);