|
@@ -33,8 +33,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
<empty v-else style="margin-top: 50%;"></empty>
|
|
<empty v-else style="margin-top: 50%;"></empty>
|
|
|
|
|
|
|
|
- <u-modal :show="payVisiable" title="请确认支付是否已完成" content='' confirmText="查询支付结果" confirmColor="#26b3a0"
|
|
|
|
|
- @confirm="isPaySuc"></u-modal>
|
|
|
|
|
|
|
+ <!-- <u-modal :show="payVisiable" title="请确认支付是否已完成" content='' confirmText="查询支付结果" confirmColor="#26b3a0"
|
|
|
|
|
+ @confirm="isPaySuc"></u-modal> -->
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
@@ -81,7 +81,7 @@
|
|
|
timer: '',
|
|
timer: '',
|
|
|
currOrderId: -1,
|
|
currOrderId: -1,
|
|
|
|
|
|
|
|
- payVisiable: false
|
|
|
|
|
|
|
+ // payVisiable: false
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -100,47 +100,9 @@
|
|
|
window.addEventListener('beforeunload', this.handleRefresh)
|
|
window.addEventListener('beforeunload', this.handleRefresh)
|
|
|
},
|
|
},
|
|
|
async onShow() {
|
|
async onShow() {
|
|
|
- // return
|
|
|
|
|
- // clearInterval(this.timer)
|
|
|
|
|
-
|
|
|
|
|
let res = await myScoreOrder()
|
|
let res = await myScoreOrder()
|
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
|
this.scoreOrderList = res.data
|
|
this.scoreOrderList = res.data
|
|
|
-
|
|
|
|
|
- // let waitPayOrder = res.data.find((item, index) => {
|
|
|
|
|
- // return item.id == Number(uni.getStorageSync('myOrderId1'))
|
|
|
|
|
- // })
|
|
|
|
|
-
|
|
|
|
|
- // console.log('需要判断支付状态的那一项订单', waitPayOrder);
|
|
|
|
|
-
|
|
|
|
|
- // console.log('存本地的ScoreId', Number(uni.getStorageSync('myScoreId')));
|
|
|
|
|
- // if (this.scoreOrderList.length != 0) {
|
|
|
|
|
- // if (waitPayOrder.status && uni.getStorageSync('clickStudyBtn')) {
|
|
|
|
|
- // uni.navigateTo({
|
|
|
|
|
- // url: '/pages/index/scorePaySuc/index?id=' + Number(uni.getStorageSync('myScoreId'))
|
|
|
|
|
- // })
|
|
|
|
|
-
|
|
|
|
|
- // uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
- // uni.removeStorageSync('myScoreId')
|
|
|
|
|
- // uni.removeStorageSync('myOrderId1')
|
|
|
|
|
- // } else if (!waitPayOrder.status && uni.getStorageSync('clickStudyBtn')) {
|
|
|
|
|
- // // clearInterval(this.timer)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // // uni.showToast({
|
|
|
|
|
- // // title: '支付失败,请稍后重试!',
|
|
|
|
|
- // // icon: 'error',
|
|
|
|
|
- // // duration: 1500
|
|
|
|
|
- // // })
|
|
|
|
|
- // uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
- // uni.removeStorageSync('myScoreId')
|
|
|
|
|
- // uni.removeStorageSync('myOrderId1')
|
|
|
|
|
- // }
|
|
|
|
|
- // } else {
|
|
|
|
|
- // uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
- // uni.removeStorageSync('myScoreId')
|
|
|
|
|
- // uni.removeStorageSync('myOrderId1')
|
|
|
|
|
- // }
|
|
|
|
|
}
|
|
}
|
|
|
console.log('我的课程订单返回值', res);
|
|
console.log('我的课程订单返回值', res);
|
|
|
},
|
|
},
|
|
@@ -154,78 +116,14 @@
|
|
|
window.removeEventListener('beforeunload', this.handleRefresh)
|
|
window.removeEventListener('beforeunload', this.handleRefresh)
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- async isPaySuc() {
|
|
|
|
|
- let res = await myScoreOrder()
|
|
|
|
|
- if (res.code == 0) {
|
|
|
|
|
- this.scoreOrderList = res.data
|
|
|
|
|
- let waitPayOrder = res.data.find((item, index) => {
|
|
|
|
|
- return item.id == Number(uni.getStorageSync('myOrderId1'))
|
|
|
|
|
- })
|
|
|
|
|
- if (this.scoreOrderList.length != 0) {
|
|
|
|
|
- if (waitPayOrder.status && uni.getStorageSync('clickStudyBtn')) {
|
|
|
|
|
- this.payVisiable = false
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: '/pages/index/scorePaySuc/index?id=' + Number(uni.getStorageSync(
|
|
|
|
|
- 'myScoreId'))
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
- uni.removeStorageSync('myScoreId')
|
|
|
|
|
- uni.removeStorageSync('myOrderId1')
|
|
|
|
|
- } else if (!waitPayOrder.status && uni.getStorageSync('clickStudyBtn')) {
|
|
|
|
|
- this.payVisiable = false
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '支付失败,请稍后重试!',
|
|
|
|
|
- icon: 'error',
|
|
|
|
|
- duration: 1500
|
|
|
|
|
- })
|
|
|
|
|
- uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
- uni.removeStorageSync('myScoreId')
|
|
|
|
|
- uni.removeStorageSync('myOrderId1')
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- this.payVisiable = false
|
|
|
|
|
- uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
- uni.removeStorageSync('myScoreId')
|
|
|
|
|
- uni.removeStorageSync('myOrderId1')
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- this.payVisiable = false
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: res.msg,
|
|
|
|
|
- icon: 'none',
|
|
|
|
|
- duration: 1500
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- // let res = await myScoreOrder()
|
|
|
|
|
- // if (res.code == 0) {
|
|
|
|
|
- // console.log('订单定时器每次请求的数据:', res);
|
|
|
|
|
- // let scoreOrderList = res.data
|
|
|
|
|
- // if (scoreOrderList[0].status) {
|
|
|
|
|
- // clearInterval(this.timer)
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
handleRefresh() {
|
|
handleRefresh() {
|
|
|
- uni.setStorageSync('from', 'user')
|
|
|
|
|
|
|
|
|
|
- uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
- uni.removeStorageSync('myScoreId')
|
|
|
|
|
},
|
|
},
|
|
|
async goScoreDetail(score) {
|
|
async goScoreDetail(score) {
|
|
|
- // this.currOrderId = score.id
|
|
|
|
|
- uni.setStorageSync('myOrderId1', score.id)
|
|
|
|
|
- // console.log('this.currOrderId', this.currOrderId);
|
|
|
|
|
- // return
|
|
|
|
|
- this.course_id = score.course_id
|
|
|
|
|
-
|
|
|
|
|
- uni.setStorageSync('myScoreId', score.course_id)
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
+ this.course_id = score.course_id
|
|
|
if (score.status) {
|
|
if (score.status) {
|
|
|
- uni.removeStorageSync('myScoreId')
|
|
|
|
|
- uni.removeStorageSync('clickStudyBtn')
|
|
|
|
|
|
|
+
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
url: '/pages/user/score/index?id=' + score.id
|
|
url: '/pages/user/score/index?id=' + score.id
|
|
|
})
|
|
})
|
|
@@ -237,17 +135,7 @@
|
|
|
confirmColor: 'rgb(38, 179, 160)',
|
|
confirmColor: 'rgb(38, 179, 160)',
|
|
|
success: async (res) => {
|
|
success: async (res) => {
|
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
|
- // let test = encodeURIComponent(
|
|
|
|
|
- // // 'http://localhost:8080/h5/pages/index/scorePaySuc/index?id=95&orderId=91'
|
|
|
|
|
- // 'https://ai5566.cn/h5/pages/index/scorePaySuc/index'
|
|
|
|
|
- // )
|
|
|
|
|
-
|
|
|
|
|
- // return location.href =
|
|
|
|
|
- // 'https://www.ai5566.cn/h5/pages/index/scorePaySuc/index'
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- console.log('isWechat()', isWechat());
|
|
|
|
|
// h5支付
|
|
// h5支付
|
|
|
if (!isWechat()) {
|
|
if (!isWechat()) {
|
|
|
let res1 = await myScoreOrderDetail({
|
|
let res1 = await myScoreOrderDetail({
|
|
@@ -261,62 +149,16 @@
|
|
|
console.log('res2', res2);
|
|
console.log('res2', res2);
|
|
|
if (res2.code == 0) {
|
|
if (res2.code == 0) {
|
|
|
|
|
|
|
|
- uni.setStorageSync('clickStudyBtn', true)
|
|
|
|
|
-
|
|
|
|
|
- // _this.timer = setInterval(async () => {
|
|
|
|
|
- // let res = await myScoreOrderDetail({
|
|
|
|
|
- // course_order_id: score.id
|
|
|
|
|
- // })
|
|
|
|
|
- // if (res.code == 0) {
|
|
|
|
|
- // console.log('订单定时器每次请求的数据:', res);
|
|
|
|
|
- // if (res.status) {
|
|
|
|
|
- // clearInterval(_this.timer)
|
|
|
|
|
- // uni.navigateTo({
|
|
|
|
|
- // url: '/pages/index/scorePaySuc/index?id=' +
|
|
|
|
|
- // _this
|
|
|
|
|
- // .course_id
|
|
|
|
|
- // })
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // }, 2000)
|
|
|
|
|
-
|
|
|
|
|
- // let addRedirectUrl = res2.data + '&redirect_url=' +
|
|
|
|
|
- // encodeURIComponent(
|
|
|
|
|
- // 'https://www.ai5566.cn/h5/pages/user/score/record/index'
|
|
|
|
|
- // )
|
|
|
|
|
- // return console.log('addRedirectUrl', addRedirectUrl);
|
|
|
|
|
- // window.open(res2.data)
|
|
|
|
|
- // window.open(addRedirectUrl)
|
|
|
|
|
- this.payVisiable = true
|
|
|
|
|
- location.href = res2.data
|
|
|
|
|
- // return
|
|
|
|
|
- // localStorage.setItem("payVisiable", true)
|
|
|
|
|
-
|
|
|
|
|
- // location.href = addRedirectUrl
|
|
|
|
|
-
|
|
|
|
|
- // console.log('h5支付返回的支付路径:', res2.data, _this
|
|
|
|
|
- // .course_id);
|
|
|
|
|
- // let redirect_url =
|
|
|
|
|
- // 'https://www.ai5566.cn/h5/pages/index/scorePaySuc/index?id=' +
|
|
|
|
|
- // _this
|
|
|
|
|
- // .course_id + '&orderId=' + score.id
|
|
|
|
|
-
|
|
|
|
|
- // let addUrl = res2.data + '&redirect_url=' +
|
|
|
|
|
- // encodeURIComponent(
|
|
|
|
|
- // redirect_url)
|
|
|
|
|
- // location.href = addUrl
|
|
|
|
|
- // console.log('h5支付返回的支付路径+redirect_url:', addUrl);
|
|
|
|
|
|
|
+ // uni.setStorageSync('clickStudyBtn', true)
|
|
|
|
|
+ uni.setStorageSync('course_id', this.course_id)
|
|
|
|
|
+ let addRedirectUrl = res2.data + '&redirect_url=' +
|
|
|
|
|
+ encodeURIComponent(
|
|
|
|
|
+ 'https://www.ai5566.cn/h5/pages/index/scorePayMiddle/index?id=' +
|
|
|
|
|
+ this.course_id
|
|
|
|
|
+ )
|
|
|
|
|
+ // return console.log(addRedirectUrl);
|
|
|
|
|
+ location.href = addRedirectUrl
|
|
|
|
|
|
|
|
- // _this.timer = setInterval(async () => {
|
|
|
|
|
- // let res = await myScoreOrder()
|
|
|
|
|
- // if (res.code == 0) {
|
|
|
|
|
- // console.log('订单定时器每次请求的数据:', res);
|
|
|
|
|
- // _this.scoreOrderList = res.data
|
|
|
|
|
- // if (_this.scoreOrderList[0].status) {
|
|
|
|
|
- // clearInterval(_this.timer)
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // }, 2000)
|
|
|
|
|
} else {
|
|
} else {
|
|
|
if (res2.msg == '订单不存在') {
|
|
if (res2.msg == '订单不存在') {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -358,6 +200,8 @@
|
|
|
wxsdk.wxpay(res3.data, res2.data, (res) => {
|
|
wxsdk.wxpay(res3.data, res2.data, (res) => {
|
|
|
if (res.errMsg == "chooseWXPay:ok") {
|
|
if (res.errMsg == "chooseWXPay:ok") {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
|
|
+ uni.setStorageSync('course_id',
|
|
|
|
|
+ this.course_id)
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
url: '/pages/index/scorePaySuc/index?id=' +
|
|
url: '/pages/index/scorePaySuc/index?id=' +
|
|
|
this
|
|
this
|