|
@@ -53,7 +53,8 @@
|
|
|
ref
|
|
|
} from "vue";
|
|
|
import {
|
|
|
- orderAdd
|
|
|
+ orderAdd,
|
|
|
+ orderPayAli
|
|
|
} from "@/api/order.js"
|
|
|
import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
|
|
|
import cacheManager from "@/utils/cacheManager.js";
|
|
@@ -105,34 +106,55 @@
|
|
|
|
|
|
function creatOrder(data) {
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ if(payType.value =='weixin'){
|
|
|
+ toast("微信支付暂未开通,请选择支付宝")
|
|
|
+ return false
|
|
|
+ }
|
|
|
let req = {
|
|
|
cardId: cardId.value
|
|
|
}
|
|
|
orderAdd(req).then(res => {
|
|
|
- cacheManager.updateVipStatus('auth', cardId.value)
|
|
|
- cacheManager.updateObject('auth', {
|
|
|
- growthType: 1
|
|
|
+ console.log('res',res);
|
|
|
+ orderPayAli({id:res.data.id}).then(res2=>{
|
|
|
+ console.log('res2',res2);
|
|
|
+ uni.requestPayment({
|
|
|
+ "provider": "alipay",
|
|
|
+ "orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串
|
|
|
+ success: function (res) {
|
|
|
+ var rawdata = JSON.parse(res.rawdata);
|
|
|
+ console.log('支付成功');
|
|
|
+ console.log('rawdata',rawdata);
|
|
|
+ // toast("支付成功");
|
|
|
+ cacheManager.updateVipStatus('auth', cardId.value)
|
|
|
+ cacheManager.updateObject('auth', {
|
|
|
+ growthType: 1
|
|
|
+ })
|
|
|
+ if (isVip != 'VIP') {
|
|
|
+ daoPokeRef.value.handleShow();
|
|
|
+ } else {
|
|
|
+ daoPokeAllRef.value.handleShow();
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ daoPokeRef.value.handleClose();
|
|
|
+ daoPokeAllRef.value.handleClose();
|
|
|
+ if(formPage.value =='my'){
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/my/index'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/study/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }, 3000)
|
|
|
+ },
|
|
|
+ fail: function (err) {
|
|
|
+ toast('支付失败:' + JSON.stringify(err));
|
|
|
+ }
|
|
|
+ });
|
|
|
})
|
|
|
- if (isVip != 'VIP') {
|
|
|
- daoPokeRef.value.handleShow();
|
|
|
- } else {
|
|
|
- daoPokeAllRef.value.handleShow();
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- daoPokeRef.value.handleClose();
|
|
|
- daoPokeAllRef.value.handleClose();
|
|
|
- if(formPage.value =='my'){
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/my/index'
|
|
|
- })
|
|
|
- }else{
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/study/index'
|
|
|
- })
|
|
|
- }
|
|
|
- }, 3000)
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|