Commit 096baa8b authored by 汪欢's avatar 汪欢

1

parent 381bdd91
......@@ -8,71 +8,52 @@ const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
Component({
props: {
onUserCredit:()=>{}
onUserCredit: () => { }
},
data: {
resList: resList,
enableTap:true
enableTap: true
},
methods: {
// 关闭
onOrderNowModalClose(){
const {onOrderNowModalClose} = this.props;
onOrderNowModalClose() {
const { onOrderNowModalClose } = this.props;
onOrderNowModalClose && onOrderNowModalClose();
},
// 购买判断
async consumeCredits(){
async consumeCredits() {
let vipCredits = this.props.vipCredits;
this.setData({
enableTap:false
enableTap: false
})
// console.log(this.props,'datas')
// API.getCredits().catch((res)=>{
// console.log('resdata',res)
// // if(res.success){
// let data = res.data;
// console.log(data,vipCredits.gradeCredits,'1111')
// // if(data >= vipCredits.gradeCredits){
// // console.log('购买成功!')
// // } else {
// // console.log('购买失败!')
// // }
// // }
// })
// let {message,data,code,success} = API.submit({floor: vipCredits.canBuyFloor, grade:vipCredits.grade}) || {};
await API.submit({floor: vipCredits.canBuyFloor, grade:vipCredits.grade}).then((res)=>{
console.log(res,'res');
if(res.success){
console.log('success')
// 更新积分
// API.getCredits().then((res)=>{
// if(res.success){
// let userCredits = res.data;
// API.submit({ floor: vipCredits.canBuyFloor, grade: vipCredits.grade }).catch((res) => {
// console.log(res, 'res');
// this.onOrderNowModalClose();
// this.props.onUserCredit();
// commonToast(res && res.message);
// });
// }
// })
API.submit({ floor: vipCredits.canBuyFloor, grade: vipCredits.grade }).then((resp) => {
if (resp.success && resp.data) {
this.setData({
enableTap:true
enableTap: true
})
commonToast("恭喜你购买成功");
this.onOrderNowModalClose();
this.props.onUserCredit();
// this.props.onUserCredit();
commonToast(resp.message);
}else{
// 错误码判断不同情况
commonToast(res.message);
// if(res.code === '500000'){
// }
// console.log('fail')
commonToast(resp.message)
}
})
},(rej)=>{
this.onOrderNowModalClose();
this.props.onUserCredit();
commonToast(rej.message);
})
}
......@@ -84,9 +65,9 @@ Component({
// });
},
didMount(){
let {vipCredits} = this.props;
console.log(this.props,'huiyuan')
didMount() {
let { vipCredits } = this.props;
console.log(this.props, 'huiyuan')
}
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment