海南旅游项目 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

98 lines
2.2 KiB

<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
order_id: 0
}
},
onLoad(e) {
this.order_id = e.order_id
console.log(this.order_id)
if(this.order_id) {
this.getUserProfile()
}else {
this.order_id = '1111111';
this.getUserProfile();
console.log('oder_id',this.order_id)
}
},
methods: {
// 获取用户信息
getUserProfile(){
uni.getUserProfile({
desc: '您的信息将用于小程序显示',
lang: 'zh_CN',
complete: result => {
console.log(result)
if(result.errMsg == 'getUserProfile:ok'){
let encryptedData = result.encryptedData;
let iv = result.iv;
let signature = result.signature;
// let userInfo = uni.getStorageSync('userinfo') || {};
this.$http(this.API.API_GETUSERINFO, {
encryptedData,
iv,
// token: userInfo.token // 已在公共参数传
}).then(res => {
console.log("更新用户信息", res);
this.$msg('更新成功', {icon: 'success'});
uni.setStorageSync('userinfo', res.data);
this.payOnce()
setTimeout(() => {
this.$toBack();
}, 1000);
})
}
}
});
},
payOnce() {
this.$http(this.API.API_LF_PAY,{id: this.order_id}).then(res => {
uni.requestPayment({
orderInfo: res.data.order_num,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: (res) => {
this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'})
},
fail: (err) => {
this.$url('/pages/payState/paystate?ifSuccess=2&order_id='+this.order_id,{type: 'redirect'})
},
})
}).catch(err => {})
}
}
}
</script>
<style>
.btn{
margin: 0;
padding: 0;
width: 212rpx;
height: 82rpx;
background-color: #1998FE;
color: #FFFFFF;
line-height: 80rpx;
font-size: 32rpx;
border-radius: 41rpx;
}
.bref-box {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>