| xqd
@@ -32,6 +32,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<empty v-else style="margin-top: 50%;"></empty>
|
|
|
+
|
|
|
+ <u-modal :show="payVisiable" title="请确认支付是否已完成" content='' confirmText="查询支付结果" confirmColor="#26b3a0"
|
|
|
+ @confirm="isPaySuc"></u-modal>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
| xqd
@@ -76,7 +79,9 @@
|
|
|
course_id: '',
|
|
|
|
|
|
timer: '',
|
|
|
- currOrderId: -1
|
|
|
+ currOrderId: -1,
|
|
|
+
|
|
|
+ payVisiable: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
| xqd
@@ -95,51 +100,103 @@
|
|
|
window.addEventListener('beforeunload', this.handleRefresh)
|
|
|
},
|
|
|
async onShow() {
|
|
|
+ // return
|
|
|
// clearInterval(this.timer)
|
|
|
|
|
|
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'))
|
|
|
- })
|
|
|
+ // let waitPayOrder = res.data.find((item, index) => {
|
|
|
+ // return item.id == Number(uni.getStorageSync('myOrderId1'))
|
|
|
+ // })
|
|
|
|
|
|
- console.log('需要判断支付状态的那一项订单', waitPayOrder);
|
|
|
+ // 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'))
|
|
|
- })
|
|
|
+ // 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')
|
|
|
- } else if (!waitPayOrder.status && uni.getStorageSync('clickStudyBtn')) {
|
|
|
- uni.showToast({
|
|
|
- title: '支付失败,请稍后重试!',
|
|
|
- icon: 'error',
|
|
|
- duration: 1500
|
|
|
- })
|
|
|
- uni.removeStorageSync('clickStudyBtn')
|
|
|
- uni.removeStorageSync('myScoreId')
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.removeStorageSync('clickStudyBtn')
|
|
|
- uni.removeStorageSync('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);
|
|
|
},
|
|
|
onHide() {
|
|
|
- // clearInterval(this.timer)
|
|
|
+
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+
|
|
|
},
|
|
|
onUnload() {
|
|
|
window.removeEventListener('beforeunload', this.handleRefresh)
|
|
|
},
|
|
|
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);
|
| xqd
@@ -205,7 +262,37 @@
|
|
|
if (res2.code == 0) {
|
|
|
|
|
|
uni.setStorageSync('clickStudyBtn', true)
|
|
|
- window.open(res2.data)
|
|
|
+
|
|
|
+ // _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);
|
| xqd
@@ -231,11 +318,19 @@
|
|
|
// }
|
|
|
// }, 2000)
|
|
|
} else {
|
|
|
- uni.showToast({
|
|
|
- title: res2.msg,
|
|
|
- icon: 'none',
|
|
|
- duration: 1500
|
|
|
- })
|
|
|
+ if (res2.msg == '订单不存在') {
|
|
|
+ uni.showToast({
|
|
|
+ title: '该订单已支付,请下拉更新支付状态',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res2.msg,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1500
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
uni.showToast({
|