|
@@ -72,7 +72,9 @@
|
|
</div>
|
|
</div>
|
|
<div class="notice-wrap">
|
|
<div class="notice-wrap">
|
|
<text class="title">提示:</text>
|
|
<text class="title">提示:</text>
|
|
- <text class="notice-item">1.充值后书币到账可能有延迟,1小时内未到账请到个人中心联系客服</text>
|
|
|
|
|
|
+ <text class="notice-item"
|
|
|
|
+ >1.充值后书币到账可能有延迟,1小时内未到账请到个人中心联系客服</text
|
|
|
|
+ >
|
|
<text class="notice-item"
|
|
<text class="notice-item"
|
|
>2.未满18周岁的未成年人应在法定监护人同意后进行充值。</text
|
|
>2.未满18周岁的未成年人应在法定监护人同意后进行充值。</text
|
|
>
|
|
>
|
|
@@ -103,14 +105,22 @@ import router from '@system.router'
|
|
import prompt from '@system.prompt'
|
|
import prompt from '@system.prompt'
|
|
import storage from '@system.storage'
|
|
import storage from '@system.storage'
|
|
|
|
|
|
-import { getChargeList, getUserInfo, checkWxOrder,advertOrders,getBannerData } from '../../api'
|
|
|
|
|
|
+import {
|
|
|
|
+ getChargeList,
|
|
|
|
+ getUserInfo,
|
|
|
|
+ checkWxOrder,
|
|
|
|
+ advertOrders,
|
|
|
|
+ getBannerData,
|
|
|
|
+ hasPendingTask
|
|
|
|
+} from '../../api'
|
|
import { configWxPay, configAliPay } from '../../helper'
|
|
import { configWxPay, configAliPay } from '../../helper'
|
|
import { getAppConfig } from '../../api/utils.js'
|
|
import { getAppConfig } from '../../api/utils.js'
|
|
let getConfig
|
|
let getConfig
|
|
|
|
|
|
export default {
|
|
export default {
|
|
public: {
|
|
public: {
|
|
- push_id: ''
|
|
|
|
|
|
+ push_id: '',
|
|
|
|
+ isPendingTask:false
|
|
},
|
|
},
|
|
protected: {
|
|
protected: {
|
|
bid: '',
|
|
bid: '',
|
|
@@ -129,12 +139,12 @@ export default {
|
|
showLoading: false,
|
|
showLoading: false,
|
|
checked: false,
|
|
checked: false,
|
|
loginPhone: '',
|
|
loginPhone: '',
|
|
- need_check_order:false,
|
|
|
|
|
|
+ need_check_order: false,
|
|
haslogin: '',
|
|
haslogin: '',
|
|
isVip: '',
|
|
isVip: '',
|
|
- pay_order_id:"",
|
|
|
|
- trade_no:"",
|
|
|
|
- pay_success:false,
|
|
|
|
|
|
+ pay_order_id: '',
|
|
|
|
+ trade_no: '',
|
|
|
|
+ pay_success: false,
|
|
last: null,
|
|
last: null,
|
|
payType: [
|
|
payType: [
|
|
{
|
|
{
|
|
@@ -232,9 +242,9 @@ export default {
|
|
let cur_pay_type = this.curPayType
|
|
let cur_pay_type = this.curPayType
|
|
let product_id = this.rechargeList[this.curSelect].product_id
|
|
let product_id = this.rechargeList[this.curSelect].product_id
|
|
let ret = null
|
|
let ret = null
|
|
- this.need_check_order = false;
|
|
|
|
- this.pay_order_id = "";
|
|
|
|
- this.trade_no = "";
|
|
|
|
|
|
+ this.need_check_order = false
|
|
|
|
+ this.pay_order_id = ''
|
|
|
|
+ this.trade_no = ''
|
|
if (cur_pay_type === 1) {
|
|
if (cur_pay_type === 1) {
|
|
ret = await configAliPay({
|
|
ret = await configAliPay({
|
|
product_id: product_id,
|
|
product_id: product_id,
|
|
@@ -242,25 +252,25 @@ export default {
|
|
send_order_id: this.send_order_id
|
|
send_order_id: this.send_order_id
|
|
})
|
|
})
|
|
// console.log('al111111111111111111111111',res);
|
|
// console.log('al111111111111111111111111',res);
|
|
- this.trade_no = ret.order;
|
|
|
|
- this.showToastByCode(ret.code);
|
|
|
|
|
|
+ this.trade_no = ret.order
|
|
|
|
+ this.showToastByCode(ret.code)
|
|
} else {
|
|
} else {
|
|
ret = await configWxPay({
|
|
ret = await configWxPay({
|
|
product_id: product_id,
|
|
product_id: product_id,
|
|
bid: this.bid,
|
|
bid: this.bid,
|
|
send_order_id: this.send_order_id
|
|
send_order_id: this.send_order_id
|
|
})
|
|
})
|
|
- this.trade_no = ret.order;
|
|
|
|
- this.pay_order_id =ret.order;
|
|
|
|
- this.need_check_order = true;
|
|
|
|
|
|
+ this.trade_no = ret.order
|
|
|
|
+ this.pay_order_id = ret.order
|
|
|
|
+ this.need_check_order = true
|
|
// this.back_click = 0;
|
|
// this.back_click = 0;
|
|
// console.log('wx111111111111111111111',res);
|
|
// console.log('wx111111111111111111111',res);
|
|
// if (fb && typeof fb === 'object')
|
|
// if (fb && typeof fb === 'object')
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// this.pay_order_id =ret.order;
|
|
// this.pay_order_id =ret.order;
|
|
// console.log('00000000000000000',ret,"paytype d",cur_pay_type);
|
|
// console.log('00000000000000000',ret,"paytype d",cur_pay_type);
|
|
- return false;
|
|
|
|
|
|
+ return false
|
|
// 成功支付后的回调操作
|
|
// 成功支付后的回调操作
|
|
if (ret.code === '9000') this.showWaitingWrap(ret)
|
|
if (ret.code === '9000') this.showWaitingWrap(ret)
|
|
else this.showToastByCode(ret.code)
|
|
else this.showToastByCode(ret.code)
|
|
@@ -299,26 +309,25 @@ export default {
|
|
if (data.index === 0) this.checkOrder(order)
|
|
if (data.index === 0) this.checkOrder(order)
|
|
},
|
|
},
|
|
cancel: () => {
|
|
cancel: () => {
|
|
-
|
|
|
|
console.log('cancel')
|
|
console.log('cancel')
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
- return false;
|
|
|
|
|
|
+
|
|
|
|
+ return false
|
|
},
|
|
},
|
|
showToastByCode(code) {
|
|
showToastByCode(code) {
|
|
this.showLoading = false
|
|
this.showLoading = false
|
|
- this.pay_success = false;
|
|
|
|
|
|
+ this.pay_success = false
|
|
let msg = '支付成功!'
|
|
let msg = '支付成功!'
|
|
-
|
|
|
|
|
|
+
|
|
switch (code) {
|
|
switch (code) {
|
|
case '9000':
|
|
case '9000':
|
|
- this.pay_success = true;
|
|
|
|
- try{
|
|
|
|
- advertOrders(this.trade_no);
|
|
|
|
- }catch(e){
|
|
|
|
- console.log(e);
|
|
|
|
- }
|
|
|
|
|
|
+ this.pay_success = true
|
|
|
|
+ try {
|
|
|
|
+ advertOrders(this.trade_no)
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e)
|
|
|
|
+ }
|
|
;(msg = '支付成功!'), router.back()
|
|
;(msg = '支付成功!'), router.back()
|
|
break
|
|
break
|
|
case '8000':
|
|
case '8000':
|
|
@@ -344,39 +353,50 @@ export default {
|
|
}
|
|
}
|
|
prompt.showToast({ message: msg })
|
|
prompt.showToast({ message: msg })
|
|
},
|
|
},
|
|
- onShow() {
|
|
|
|
- this.getUserInfo();
|
|
|
|
- if(this.need_check_order && this.pay_order_id){
|
|
|
|
- this.checkOrderNew(this.pay_order_id);
|
|
|
|
|
|
+ async onShow() {
|
|
|
|
+ try {
|
|
|
|
+ let { has_pend_task } = await hasPendingTask({ type: 'recharge' })
|
|
|
|
+ this.isPendingTask = has_pend_task
|
|
|
|
+ console.log(this.isPendingTask, 'this.isPendingTask')
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.lg(err)
|
|
|
|
+ }
|
|
|
|
+ this.getUserInfo()
|
|
|
|
+ if (this.need_check_order && this.pay_order_id) {
|
|
|
|
+ this.checkOrderNew(this.pay_order_id)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async checkOrderNew(order) {
|
|
|
|
+ console.log('需要查询订单', order)
|
|
|
|
+ // this.showLoading = true;
|
|
|
|
+ let fb = await checkWxOrder(order)
|
|
|
|
+ console.log('查询结果:', fb)
|
|
|
|
+ if (fb && typeof fb === 'object') {
|
|
|
|
+ this.showToastByCode('9000')
|
|
|
|
+ } else {
|
|
|
|
+ this.showToastByCode('6001')
|
|
}
|
|
}
|
|
- },async checkOrderNew(order){
|
|
|
|
- console.log("需要查询订单",order);
|
|
|
|
- // this.showLoading = true;
|
|
|
|
- let fb = await checkWxOrder(order);
|
|
|
|
- console.log('查询结果:',fb);
|
|
|
|
- if (fb && typeof fb === 'object'){
|
|
|
|
- this.showToastByCode('9000')
|
|
|
|
- }else{
|
|
|
|
- this.showToastByCode('6001')
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
onHide() {
|
|
onHide() {
|
|
//this.$app.$def.createShortcut(true);
|
|
//this.$app.$def.createShortcut(true);
|
|
- },onBackPress(){
|
|
|
|
|
|
+ },
|
|
|
|
+ onBackPress() {
|
|
if (this.pay_back && !this.pay_success) {
|
|
if (this.pay_back && !this.pay_success) {
|
|
- this.getActivity();
|
|
|
|
- return true;
|
|
|
|
- }else{
|
|
|
|
- this.getLastpage();
|
|
|
|
|
|
+ this.getActivity()
|
|
|
|
+ return true
|
|
|
|
+ } else {
|
|
|
|
+ this.getLastpage()
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
- },async getActivity(){
|
|
|
|
- // let back = await getBannerData(5);
|
|
|
|
- // console.log(back,JSON.stringify(back) === "{}",JSON.stringify(back));
|
|
|
|
- let back = [];
|
|
|
|
- if(JSON.stringify(back) === "{}" || JSON.stringify(back) === "[]"){
|
|
|
|
- console.log('000000000000000000000');
|
|
|
|
- let taht = this;
|
|
|
|
|
|
+ return true
|
|
|
|
+ },
|
|
|
|
+ async getActivity() {
|
|
|
|
+ // let back = await getBannerData(5);
|
|
|
|
+ // console.log(back,JSON.stringify(back) === "{}",JSON.stringify(back));
|
|
|
|
+ let back = []
|
|
|
|
+ if (JSON.stringify(back) === '{}' || JSON.stringify(back) === '[]') {
|
|
|
|
+ console.log('000000000000000000000')
|
|
|
|
+ let taht = this
|
|
|
|
+ if (this.isPendingTask) {
|
|
prompt.showDialog({
|
|
prompt.showDialog({
|
|
title: '温馨提示',
|
|
title: '温馨提示',
|
|
message: '每日完成任务,可以免费获取书币~',
|
|
message: '每日完成任务,可以免费获取书币~',
|
|
@@ -392,7 +412,7 @@ export default {
|
|
],
|
|
],
|
|
success: function(data) {
|
|
success: function(data) {
|
|
if (data.index === 1) {
|
|
if (data.index === 1) {
|
|
- taht.getLastpage();
|
|
|
|
|
|
+ taht.getLastpage()
|
|
} else {
|
|
} else {
|
|
router.push({
|
|
router.push({
|
|
uri: '/views/Task'
|
|
uri: '/views/Task'
|
|
@@ -403,37 +423,48 @@ export default {
|
|
console.log('取消前往')
|
|
console.log('取消前往')
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- }else{
|
|
|
|
- router.push({
|
|
|
|
- uri: back.redirect_url,
|
|
|
|
- params:back.param
|
|
|
|
- })
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.getLastpage()
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
- },getLastpage(){
|
|
|
|
- let backPage = {};
|
|
|
|
- try{
|
|
|
|
- let page = router.getState();
|
|
|
|
- let allPage = router.getPages();
|
|
|
|
-
|
|
|
|
- console.log('page = ',page,'all pages',allPage,'length',allPage.length);
|
|
|
|
- for(var k = allPage.length -1; k >= 0;k--){
|
|
|
|
- if(allPage[k].name != page.name && allPage[k].name != "views/Phone"){
|
|
|
|
- backPage = allPage[k];
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
+ router.push({
|
|
|
|
+ uri: back.redirect_url,
|
|
|
|
+ params: back.param
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return true
|
|
|
|
+ },
|
|
|
|
+ getLastpage() {
|
|
|
|
+ let backPage = {}
|
|
|
|
+ try {
|
|
|
|
+ let page = router.getState()
|
|
|
|
+ let allPage = router.getPages()
|
|
|
|
+
|
|
|
|
+ console.log(
|
|
|
|
+ 'page = ',
|
|
|
|
+ page,
|
|
|
|
+ 'all pages',
|
|
|
|
+ allPage,
|
|
|
|
+ 'length',
|
|
|
|
+ allPage.length
|
|
|
|
+ )
|
|
|
|
+ for (var k = allPage.length - 1; k >= 0; k--) {
|
|
|
|
+ if (allPage[k].name != page.name && allPage[k].name != 'views/Phone') {
|
|
|
|
+ backPage = allPage[k]
|
|
|
|
+ break
|
|
}
|
|
}
|
|
- } catch(e){
|
|
|
|
- backPage = {};
|
|
|
|
- // console.log('back err',e);
|
|
|
|
- }
|
|
|
|
- console.log(backPage,backPage.length,typeof backPage);
|
|
|
|
- if(JSON.stringify(backPage) === '{}'){
|
|
|
|
- router.replace({ uri: "/views/Index" });
|
|
|
|
- }else{
|
|
|
|
- router.back(backPage);
|
|
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ } catch (e) {
|
|
|
|
+ backPage = {}
|
|
|
|
+ // console.log('back err',e);
|
|
|
|
+ }
|
|
|
|
+ console.log(backPage, backPage.length, typeof backPage)
|
|
|
|
+ if (JSON.stringify(backPage) === '{}') {
|
|
|
|
+ router.replace({ uri: '/views/Index' })
|
|
|
|
+ } else {
|
|
|
|
+ router.back(backPage)
|
|
|
|
+ }
|
|
|
|
+ return true
|
|
},
|
|
},
|
|
onBackPressOld() {
|
|
onBackPressOld() {
|
|
if (this.pay_back) {
|
|
if (this.pay_back) {
|