require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/users/user_spread_money/receiving"],{5176:function(t,n,i){"use strict";i.r(n);var e=i("7114"),o=i.n(e);for(var r in e)["default"].indexOf(r)<0&&function(t){i.d(n,t,(function(){return e[t]}))}(r);n["default"]=o.a},7114:function(t,n,i){"use strict";(function(t,e){var o=i("47a9");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(i("89cc")),a=i("92f9"),c=i("8f59"),s={mixins:[r.default],data:function(){return{id:0,type:1,infoData:{extract_price:"",package_info:"",mchid:"",wechat_appid:"",wechat_state:"",can_confirm:0},showBack:!1,confirming:!1,pollTimer:null,pollCount:0,maxPollCount:30}},computed:(0,c.mapGetters)(["isLogin"]),onLoad:function(t){var n=this,i=t.id||t.order_id;i&&(this.id=i,this.type=t.type||1,this.getInfo().then((function(t){n.isPendingState(t)&&1!==Number(n.infoData.can_confirm)&&n.startPolling()})).catch((function(){})))},onUnload:function(){this.stopPolling()},methods:{getInfo:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,a.extractDetailApi)({order_id:this.id,type:this.type}).then((function(n){t.infoData=n.data||{};var i=t.infoData.wechat_state||"";return"SUCCESS"===i&&(t.stopPolling(),t.confirming=!1,t.showBack=!0),i})).catch((function(i){return n||t.showError(i,!0),Promise.reject(i)}))},isPendingState:function(t){return["ACCEPTED","PROCESSING","WAIT_USER_CONFIRM","TRANSFERING","CANCELING"].includes(t)},confrimTap:function(){if(!this.confirming&&!this.showBack)if("SUCCESS"!==this.infoData.wechat_state){if(1!==Number(this.infoData.can_confirm))return this.startPolling(),this.$util.Tips({title:"转账状态确认中，请稍候"});var n=this;n.confirming=!0,t.canIUse("requestMerchantTransfer")?t.requestMerchantTransfer({mchId:n.infoData.mchid,appId:t.getAccountInfoSync().miniProgram.appId,package:n.infoData.package_info,success:function(){n.handleTransferAccepted()},fail:function(t){n.confirming=!1,n.showError(t&&t.errMsg||"收款操作未完成")}}):(n.confirming=!1,t.showToast({title:"你的微信版本过低，请更新至最新版本。",icon:"none"}))}else this.showBack=!0},handleTransferAccepted:function(){this.$util.Tips({title:"到账确认中",icon:"none"}),this.startPolling()},startPolling:function(){this.stopPolling(),this.confirming=!0,this.pollCount=0,this.pollWechatState()},pollWechatState:function(){var t=this;this.getInfo(!0).then((function(n){if("SUCCESS"!==n){if(!t.isPendingState(n))return t.stopPolling(),t.confirming=!1,t.showError("微信转账状态异常，请稍后查看提现记录");if(t.pollCount+=1,t.pollCount>=t.maxPollCount)return t.stopPolling(),t.confirming=!1,t.$util.Tips({title:"到账结果仍在确认中，请稍后在提现记录查看",icon:"none"});t.pollTimer=setTimeout((function(){t.pollWechatState()}),2e3)}})).catch((function(n){t.stopPolling(),t.confirming=!1,t.showError(n)}))},stopPolling:function(){this.pollTimer&&(clearTimeout(this.pollTimer),this.pollTimer=null)},showError:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i="string"===typeof t?t:t&&(t.msg||t.message||t.errMsg)||"收款失败，请稍后重试",e=n?{tab:3}:{};return this.$util.Tips({title:i},e)},backList:function(){this.stopPolling();var t=getCurrentPages();t.length>1?e.navigateBack():e.redirectTo({url:"/pages/users/user_spread_money/index?type=1"})}}};n.default=s}).call(this,i("3223")["default"],i("df3c")["default"])},9763:function(t,n,i){"use strict";i.d(n,"b",(function(){return e})),i.d(n,"c",(function(){return o})),i.d(n,"a",(function(){}));var e=function(){var t=this.$createElement;this._self._c},o=[]},d705:function(t,n,i){"use strict";i.r(n);var e=i("9763"),o=i("5176");for(var r in o)["default"].indexOf(r)<0&&function(t){i.d(n,t,(function(){return o[t]}))}(r);var a=i("828b"),c=Object(a["a"])(o["default"],e["b"],e["c"],!1,null,null,null,!1,e["a"],void 0);n["default"]=c.exports},df86:function(t,n,i){"use strict";(function(t,n){var e=i("47a9");i("f076");e(i("3240"));var o=e(i("d705"));t.__webpack_require_UNI_MP_PLUGIN__=i,n(o.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])}},[["df86","common/runtime","common/vendor"]]]);