<template>
|
<view class="container">
|
<navbar title = '会员卡共享'></navbar>
|
<view class="content">
|
<view class="img">
|
<image src="../../../../static/images/index/card11.png"></image>
|
<text>卡号:{{shareData.cardNumber}}</text>
|
</view>
|
<view @click="shareConfirm()" class="requset-btn">请求共享</view>
|
<view class="tips">
|
<text>1、提交请求共享,通知水卡实际拥有者进行确认。</text>
|
<text>2、水卡实际拥有者确认后,您可使用此卡消费。</text>
|
</view>
|
<view>
|
<uni-popup ref="messagePopup" type="center" backgroundColor="#d0dced" borderRadius="10rpx">
|
<view class="pop-text">
|
<text>提示</text>
|
<text>{{messageText}}</text>
|
</view>
|
</uni-popup>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref } from 'vue'
|
import { onLoad } from "@dcloudio/uni-app"
|
import { askShareApi } from '../../../../api/index.js'
|
const messagePopup = ref()
|
const messageText = ref()
|
const shareData = ref({
|
shareUserId:'',
|
cardNumber:'',
|
})
|
//共享请求
|
async function shareConfirm(){
|
console.log('发起请求')
|
shareData.value.shareUserId = JSON.parse(uni.getStorageSync('userInfo')).id
|
console.log('shareData.value',shareData.value)
|
await askShareApi(shareData.value).then((res) =>{
|
console.log('请求响应',res)
|
if(res.code == 200){
|
uni.showToast({
|
title:'已发起,待确认',
|
duration:1500,
|
})
|
setTimeout(() =>{
|
uni.navigateTo({
|
url:'/pages/index/index'
|
})
|
},1500)
|
}else if(res.code == 300){
|
messageText.value = res.msg
|
messagePopup.value.open('center')
|
}else{
|
uni.showToast({
|
title:'请求错误!',
|
icon:'none'
|
})
|
}
|
})
|
}
|
onLoad(async(option)=>{
|
shareData.value.cardNumber = option.codeParams
|
})
|
</script>
|
|
<style lang="scss">
|
.container{
|
width: 100%;
|
height: 100vh;
|
.content{
|
width: 100%;
|
height:calc(100vh - 176rpx);
|
background:linear-gradient(to top,#FFFFFF,#E8EFFF);
|
box-sizing: border-box;
|
padding:60rpx 32rpx 0;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
.img{
|
width: 100%;
|
position: relative;
|
margin-bottom:50rpx;
|
image{
|
width:100%;
|
height:290rpx;
|
}
|
text{
|
position: absolute;
|
left:20rpx;
|
top: 20rpx;
|
color: #FFFFFF;
|
}
|
}
|
.requset-btn{
|
width:400rpx;
|
height: 80rpx;
|
background: #2b74e1;
|
border-radius:40rpx;
|
text-align: center;
|
line-height: 80rpx;
|
color: #FFFFFF;
|
letter-spacing:5rpx;
|
margin-bottom: 50rpx;
|
}
|
.tips{
|
text{
|
display: block;
|
font-size:26rpx;
|
margin-bottom:10rpx;
|
color: #555555;
|
line-height:56rpx;
|
}
|
}
|
.pop-text{
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: space-evenly;
|
color: #648ecc;
|
padding: 20rpx 30rpx;
|
text{
|
text-align: center;
|
line-height: 50rpx;
|
margin-bottom:10rpx;
|
color: #5281c6;
|
letter-spacing:3rpx;
|
}
|
}
|
}
|
}
|
</style>
|