海南旅游项目 前端仓库
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.
 
 
 
 

110 lines
2.9 KiB

<template>
<view class="lf-p-40 lf-w-100 lf-h-100 lf-row-center" style="height: 1200rpx;">
<!-- <view class="lf-row-center lf-font-28">确认核销权限...</view> -->
<button class="lf-m-t-30 cu-btn" v-if="haveVerfiy==false" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
<text class="lf-font-32">确认核销</text>
</button>
<button class="lf-m-t-30 cu-btn1" v-else>
<text class="lf-font-32">核销完成</text>
</button>
</view>
</template>
<script>
export default {
data() {
return {
userInfo: '',
loadOptions: '',
haveVerfiy: false,
ifProduct: false,
strVerfiy: ''
}
},
onLoad(options) {
this.userInfo = uni.getStorageSync('userinfo');
this.loadOptions = decodeURIComponent(options.scene);
this.strVerfiy = this.loadOptions.slice(2,this.loadOptions.length);
var search_0$ = this.loadOptions.slice(0,2);
if(search_0$ == '0$') {
this.ifProduct = false;
}else {
this.ifProduct = true
}
},
methods: {
// 普通产品核销
getPhoneNumber(event){
if(this.userInfo.mobile == '') {
if(event.detail.errMsg == 'getPhoneNumber:ok'){
let encryptedData = event.detail.encryptedData;
let iv = event.detail.iv;
this.$http(this.API.API_WECHAT_SETPHONE, {
encryptedData,
iv,
// token: userInfo.token // 已在公共参数传
}).then(res => {
this.$msg('更新成功', {icon: 'success'});
uni.setStorageSync('userinfo', res.data);
if(this.ifProduct == true) {
this.$http(this.API.API_CONFIRMPRODUCT_CODE, {verify_code: this.strVerfiy}).then(res => {
this.$msg('核销成功!');
this.haveVerfiy = true
}).catch(err => {
this.$msg(JSON.stringify(err.msg))
});
}else {
this.$http(this.API.API_CONFIRM_CODE, {verify_code: this.strVerfiy}).then(res => {
this.$msg('核销成功!');
this.haveVerfiy = true
}).catch(err => {
this.$msg(JSON.stringify(err.msg))
});
}
})
}
}else {
if(this.ifProduct == true) {
this.$http(this.API.API_CONFIRMPRODUCT_CODE, {verify_code: this.strVerfiy}).then(res => {
this.$msg('核销成功!');
this.haveVerfiy = true
}).catch(err => {
this.$msg(JSON.stringify(err.msg))
});
}else {
this.$http(this.API.API_CONFIRM_CODE, {verify_code: this.strVerfiy}).then(res => {
this.$msg('核销成功!');
this.haveVerfiy = true
}).catch(err => {
this.$msg(JSON.stringify(err.msg))
});
}
}
},
}
}
</script>
<style scoped>
.cu-btn {
width: 260rpx;
height: 260rpx;
border-radius: 50%;
background-color: #1998FE;
color: white;
display: flex;
justify-content: center;
align-items: center;
}
.cu-btn1 {
width: 260rpx;
height: 260rpx;
border-radius: 50%;
background-color: #777;
color: white;
display: flex;
justify-content: center;
align-items: center;
}
</style>