支付宝支付

This commit is contained in:
唐明明
2021-10-28 14:15:47 +08:00
parent 89cb4bea28
commit bd50ffcf4d
41 changed files with 872 additions and 765 deletions

View File

@@ -118,20 +118,11 @@
</template>
<script>
import {
identities,
vipOrder,
vipWechatPay,
vipCont,
vipVoucherUpdate,
vipVoucher
} from '@/apis/interfaces/vip';
import {
wxConfig
} from '@/apis/interfaces/wx';
import {
uploads
} from '@/apis/interfaces/uploading';
import { identities, vipOrder, vipWechatPay, vipCont, vipVoucherUpdate, vipVoucher } from '@/apis/interfaces/vip';
import { wxConfig } from '@/apis/interfaces/wx';
import { getAliPayConfig } from '@/apis/interfaces/alipay'
import { uploads } from '@/apis/interfaces/uploading';
import cashierPay from '@/public/cashierPay'
export default {
data() {
return {
@@ -157,8 +148,7 @@
},
created() {
// 获取当前用户信息
this.idenInfo('cre')
this.idenInfo('cre')
},
methods: {
// 当前用户信息
@@ -214,7 +204,7 @@
},
// 开通会员
openOrder() {
openOrder() {
let can = this.canBtn,
identitiesId = this.identitie[this.tabsIndex].identity_id;
if (this.selected == false) {
@@ -225,24 +215,47 @@
return;
}
if (can.on_line) {
this.wxPayAppConfig()
uni.showActionSheet({
itemList: ['微信支付', '支付宝支付'],
success : res => {
this.payAppConfig(res.tapIndex)
}
})
//
} else {
this.canClick()
}
},
// 支付创建订单APP
wxPayAppConfig(){
},
// 创建订单
payAppConfig(payType){
let identity = this.identitie[this.tabsIndex].identity_id
vipOrder(identity,{
year:1,
}).then(res=>{
this.wechatAppPay(res.id)
}).then(res=>{
if(payType === 0) this.wechatAppPay(res.id)
if(payType === 1) this.aliPayConfig(res.id)
}).catch(err=>{
uni.showToast({
title:err.message,
icon:"none"
})
})
},
// 支付宝支付
aliPayConfig(orderId){
getAliPayConfig(orderId, {
type: 'app'
}).then(res => {
cashierPay.pay('alipay', res.wechat).then(payRes=> {
this.idenInfo()
})
}).catch(err => {
uni.showToast({
title:err.message,
icon:"none"
})
})
},
// 微信支付 APP
wechatAppPay(orderId){
@@ -250,27 +263,8 @@
type: 'app'
}).then(res=>{
let payConfig = JSON.parse(res)
console.log(payConfig,'console.log(res)')
uni.requestPayment({
provider: 'wxpay',
orderInfo: {...payConfig},
success: payRes => {
uni.showModal({
title : "开通提示",
content : "支付成功,已成功开通/升级节点身份",
showCancel : false,
success : ()=> {
this.idenInfo()
}
})
},
fail: payErr => {
console.log(payErr,'console.log(payErr)')
uni.showToast({
title: '支付失败,原因:' + payErr.errMsg,
icon : 'none'
})
}
cashierPay.pay('wxpay', payConfig).then(payRes=> {
this.idenInfo()
})
}).catch(err=>{
uni.showToast({