一些优化
This commit is contained in:
@@ -90,6 +90,10 @@ import { ref, onMounted, computed } from 'vue'
|
||||
import course_api from "@/api/course_api.js"
|
||||
import { requestPayment } from '@/utils/payment.js'
|
||||
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
|
||||
|
||||
// 响应式数据
|
||||
const statusBarHeight = ref(0)
|
||||
const navBarHeight = ref(88)
|
||||
@@ -201,14 +205,27 @@ const confirmPayment = () => {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
order_pay_type.value = computeOrderPayType()
|
||||
console.log('确认支付,支付方式:', { usePoints: usePoints.value, useBalance: useBalance.value, order_pay_type: order_pay_type.value })
|
||||
let openid = ""
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
openid = uni.getStorageSync('DEV_APPID');
|
||||
} else {
|
||||
openid = uni.getStorageSync('AUTH_APPID');
|
||||
|
||||
if (process.env.UNI_PLATFORM == "h5") {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
openid = uni.getStorageSync('DEV_APPID');
|
||||
} else {
|
||||
openid = uni.getStorageSync('AUTH_APPID');
|
||||
}
|
||||
} else if(process.env.UNI_PLATFORM == "mp-weixin") {
|
||||
const {
|
||||
envVersion
|
||||
} = uni.getAccountInfoSync().miniProgram;
|
||||
if (envVersion == "release") {
|
||||
openid = uni.getStorageSync('DEV_APPID');
|
||||
} else {
|
||||
openid = uni.getStorageSync('AUTH_APPID');
|
||||
}
|
||||
}else{
|
||||
//app
|
||||
}
|
||||
course_api.createExcellencourseMixedOrder(courseId.value, order_pay_type.value, openid).then(res => {
|
||||
console.log('创建订单:', res)
|
||||
@@ -313,15 +330,13 @@ const updatePaymentMethod = () => {
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
courseId.value = options.id // 已支持 App-Plus
|
||||
console.log('课程ID:', options.id)
|
||||
})
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
// 获取页面参数
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const options = currentPage.options || {}
|
||||
|
||||
courseId.value = options.id
|
||||
console.log('课程ID:', options.id)
|
||||
getSystemInfo()
|
||||
getCourseInfo()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user