/** * 订单支付 */ import Vue from "vue"; //#ifdef H5 import $wxApi from "./wxapi.js"; //#endif import $http from "./utils/axios.js" export default { //微信支付 wxPay(obj = {}) { uni.showLoading({ title: '支付中' }); return new Promise(r => { $http.post("/wechat/h5/pay",obj) .then(res=>{ //#ifdef H5 $wxApi.JSAPI(res.retBody).then(r); //#endif this.payError(res); }) }); }, //支付错误处理 payError(res){ uni.hideLoading(); if(res.code == 623){ setTimeout(i=>{ new Vue().$api.goto("/pages/userCenter/myOrder/myOrder"); },2000); uni.showToast({ title:res.msg + " 即将跳转到订单页", icon:"none", duration:2000 }); } } }