| | |
| | | <script setup> |
| | | import { onMounted, ref } from "vue"; |
| | | import { getVipInfoApi,getUserInfo,reportLossApi,removeCardApi } from '../../api/index.js' |
| | | import { getVipInfoApi,getUserInfo,reportLossApi,removeCardApi,buyWaterApi } from '../../api/index.js' |
| | | import { onShow,getCurrentPages } from '@dcloudio/uni-app' |
| | | //状态栏高度 |
| | | const topHeight = ref(0) |
| | |
| | | await getVipInfoApi().then((res) =>{ |
| | | if(res.code == 200 && res.data.id){ |
| | | cardInfo.value.waterCardNumber = res.data.cardNumber |
| | | cardInfo.value.state = res.data.state == 2 ? true : false//state:2:挂失,1:正常 |
| | | cardInfo.value.cardType = res.data.cardType |
| | | //用户信息处理存储 |
| | | cardInfo.value.state = res.data.state == 2 ? true : false//state:2:挂失,1:正常 是否挂失 |
| | | cardInfo.value.userCardType = res.data.userCardType == 2 ? true : false //userCardType:2:共享卡,1:正常卡 |
| | | |
| | | isLoss.value = cardInfo.value.state |
| | |
| | | //调用二维码扫描接口 |
| | | uni.scanCode({ |
| | | scanType: ['qrCode'], |
| | | success: function (res) { |
| | | success: async function (res) { |
| | | console.log('条码内容:' + res.result); |
| | | let data = { |
| | | cardType:cardInfo.value.cardType, |
| | | card:cardInfo.value.waterCardNumber, |
| | | sn:res.result |
| | | } |
| | | await buyWaterApi(data).then((res) =>{ |
| | | if(res.code == 200){ |
| | | uni.navigateTo({ |
| | | url:'/pages/scanWater/index' |
| | | }) |
| | | }else{ |
| | | uni.showToast({ |
| | | title:'扫码失败!', |
| | | icon:'none' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | |
| | | navTo(url) |
| | | }else if(isUrl == 2){ |
| | | if(cardInfo.value.waterCardNumber){ |
| | | //不是共享卡且未挂失 |
| | | if(!isShareCard.value && !cardInfo.value.state){ |
| | | uni.showModal({ |
| | | title: '会员卡挂失', |
| | | content: '确认挂失会员卡?', |
| | |
| | | } |
| | | } |
| | | }) |
| | | }else if(isShareCard.value){ |
| | | uni.showToast({ |
| | | title:'共享卡无权限', |
| | | icon:'none' |
| | | }) |
| | | }else if(cardInfo.value.state){ |
| | | uni.showToast({ |
| | | title:'已挂失', |
| | | icon:'none' |
| | | }) |
| | | } |
| | | }else{ |
| | | uni.showToast({ |
| | | title:'未绑定会员卡!', |
| | |
| | | } |
| | | }else if(isUrl == 3){ |
| | | if(cardInfo.value.waterCardNumber){ |
| | | if(!isShareCard.value){ |
| | | uni.showModal({ |
| | | title: '会员卡注销', |
| | | content: '确认注销会员卡?', |
| | |
| | | }) |
| | | } |
| | | }) |
| | | }else{ |
| | | console.log('点击了取消8') |
| | | } |
| | | } |
| | | }) |
| | | }else{ |
| | | uni.showToast({ |
| | | title:'共享卡无权限', |
| | | icon:'none' |
| | | }) |
| | | } |
| | | }else{ |
| | | uni.showToast({ |
| | | title:'未绑定会员卡!', |
| | |
| | | }) |
| | | } |
| | | }else{ |
| | | uni.showToast({ |
| | | title: '该功能正在升级中!', |
| | | duration: 2000, |
| | | icon:'none', |
| | | }); |
| | | upGrade() |
| | | } |
| | | } |
| | | function upGrade(){ |
| | |
| | | } |
| | | onMounted( async() =>{ |
| | | getTopHeight() |
| | | await getInfo() |
| | | }) |
| | | onShow(async() =>{ |
| | | getTopHeight() |
| | | await getInfo() |
| | | }) |
| | | uni.showShareMenu({ |
| | |
| | | <view class="content"> |
| | | <view class="card-box" :style="{paddingTop:topHeight + 'rpx'}"> |
| | | <view class="user-info" > |
| | | <image class="user-img" src='../../static/images/index/head.png' alt=''></image> |
| | | <image v-if="cardInfo.headImg" class="user-img" :src='cardInfo.headImg' alt=''></image> |
| | | <image v-else class="user-img" src='../../static/images/index/head.png' alt=''></image> |
| | | <text @click="navTo('/pages/userInfo/index')">{{cardInfo.userName}}</text> |
| | | <image @click="navTo('/pages/userInfo/index')" class="user-more"src="../../static/images/index/back.png"></image> |
| | | <view class="user-add-card" @click="navTo('/pages/addCard/index')"> |
| | |
| | | .user-img{ |
| | | width:90rpx; |
| | | height:90rpx; |
| | | border-radius:50%; |
| | | margin-right:20rpx; |
| | | } |
| | | text{ |