Liuyi
2024-10-19 42e5ea86f7edc9361227edd979a8ae1952713161
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<template>
    <view class="container">
        <navbar title = '水卡共享'></navbar>
        <view class="content">
            <view class="code-box">
                <view v-if="userInfo.waterCardNumber && !isShareCard" class="code">
                    <l-qrcode :value="codeParams" size="260rpx" color="rgb(12, 15, 36)" :icon="headImg" iconSize="70rpx"></l-qrcode>
                    <text>会员卡:{{userInfo.waterCardNumber}}</text>
                </view>
                <view v-else class="none-code">
                    <image src="../../../../static/images/other/code-none.png"></image>
                    <text v-if="isShareCard">共享卡</text>
                    <text v-else>未绑定水卡</text>
                </view>
            </view>
            <view class="scan-box">
                <view class="scan-btn" @click="toScan()">扫码共享</view>
                <view class="tips">
                    <text>1、被共享者完善用户信息,点击扫码共享扫描二维码。</text>
                    <text>2、扫描成功后跳转确认页面点击确认,等待共享者在共享列表里点击确认即可共享成功。</text>
                    <text>3、共享者可在共享列表里维护该卡的共享卡信息。</text>
                </view>
            </view>
            <view @click="navTo()" class="btn-box">共享列表</view>
        </view>
    </view>
</template>
 
<script setup>
    import { ref } from 'vue'
    import  head  from '../../../../static/images/index/head.png'
    const userInfo = ref(JSON.parse(uni.getStorageSync('userInfo')))
    const isShareCard = ref(userInfo.value.userCardType)
    const codeParams = ref(userInfo.value.waterCardNumber) 
    const headImg = ref(head)
    function toScan(){
        //调用二维码扫描接口
        if(userInfo.value.waterCardNumber){
            uni.showToast({
                title:'已存在会员卡!',
                icon:'none'
            })
        }else{
            uni.scanCode({
                scanType: ['qrCode'],
                success: function (res) {
                    console.log('条码内容:' + res.result);
                    uni.navigateTo({
                        url:`/pages/functionList/share/shareConfirm/index?codeParams=${res.result}`
                    })
                }
            });
        }
    }
    function navTo(){
        uni.navigateTo({
            url:'/pages/functionList/share/shareList/index'
        })
    }
</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-top:60rpx;
        display: flex;
        flex-direction: column;
        align-items: center;
        .code-box{
            width: 80%;
            height:560rpx;
            background: #fff;
            border-radius:26rpx;
            border-bottom:2rpx solid #bdd7ff;
            margin-bottom: 20rpx;
            display: flex;
            justify-content: center;
            align-items: center;
            .code{
                width:300rpx;
                height: 326rpx;
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                align-items: center;
                text{
                    color: #4878bf;
                    font-size:600;
                }
            }
            .none-code{
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                align-items: center;
                image{
                    width:300rpx;
                    height:300rpx;
                }
                text{
                    color: #4878bf;
                    font-size:600;
                }
            }
        }
        .scan-box{
            width: 100%;
            height:500rpx;
            border-bottom:1rpx dashed #bdd7ff;
            // border-top:1rpx solid #bdd7ff;
            display: flex;
            align-items: center;
            justify-content: center;
            display: flex;
            flex-direction: column;
            justify-content:flex-start;
            align-items: center;
            padding:30rpx 0;
            box-sizing: border-box;
            .scan-btn{
                width:300rpx;
                height: 80rpx;
                background: #78a3ff;
                border-radius:40rpx;
                text-align: center;
                line-height: 80rpx;
                color: #FFFFFF;
                margin-bottom:50rpx;
            }
            .tips{
                width:86%;
                text{
                    display: block;
                    font-size:26rpx;
                    margin-bottom:20rpx;
                    color: #555555;
                    line-height:56rpx;
                }
            }
        }
        .btn-box{
            width:400rpx;
            height: 70rpx;
            background: #688ee1;
            border-radius:40rpx;
            text-align: center;
            line-height: 70rpx;
            color: #FFFFFF;
            position: absolute;
            bottom:120rpx;
            letter-spacing:5rpx;
        }
      }
}
            
</style>