| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581 |
- <template>
- <view >
- <!-- 扫一扫错误回调 -->
- <u-modal title="扫描异常" confirm-color="#dc9b21" v-model="scanNotify.scan" :content="scanNotify.scanMessage"></u-modal>
- <view style="position: relative;">
- <image src="https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/00abb22b11f346b197c073772e53675c-5anE2S2y6WGxc24e57de38088eafef56be419623c2e3.png" class="bg-img"></image>
- <image src="https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/e187781c8fa14a2fa277ab426d630000-mPfi6nPhpDetaa367231fd73497e172f2af4d37c41c4.png" class="shuiyin" mode=""></image>
- <view class="card">
- <view class="info" v-if="vuex_userId">
- <view class="flex margin-right-20">
- <u-avatar :src="userInfo.avatar" size="100"></u-avatar>
- <view class="nickname">
- <block style="display: flex;">
- <text >{{userInfo.nickName}}</text>
- <view v-if="vuex_agenter_type != '普通用户'" class="cu-tag sm margin-left-20" style="border-radius: 0 20rpx 20rpx 20rpx;background-color: #ea3723;color: #FFFFFF;">
- <text>{{vuex_agenter_type}}</text>
- </view>
- </block>
- </view>
- </view>
- <view class="center margin-right-10">
- <view @click="$jump('/pagesA/pages/notice/notice?ids='+JSON.stringify(notReadList))" class="margin-right-20 center" style="position: relative;">
- <image style="width: 52rpx;height: 52rpx;" src="../../static/icon/message.png" mode=""></image>
- <view v-if="$isNotEmpty(notReadList)" class="cu-tag bg-red sm round" style="position: absolute;top: -5rpx;right: -10rpx;">
- {{notReadList.length}}
- </view>
- </view>
- <view class="center">
- <image @click="$jump('/pagesA/pages/setting/setting')" style="width: 52rpx;height: 52rpx;" src="../../static/icon/setting2.png" mode=""></image>
- </view>
- </view>
- </view>
- <view class="info" v-else>
- <view class="flex">
- <image class="avatar" src="/static/icon/avatar.png"></image>
- <view class="nickname" >
- <block style="display: flex;">
- <text >用户未登录</text>
- <view @click="showLogin" class="cu-tag bg-tag sm round margin-left-20">
- 点击登录
- </view>
- </block>
- </view>
- </view>
- </view>
-
-
- <view class="cu-list grid col-3 no-border" style="border-radius:20rpx ;">
- <view class="cu-item" @click="item.name=='扫一扫'? scanCode() :jump(item.path)" v-for="(item,index) in menuList" :key="index">
- <view class="grid-icon" >
- <image style="width: 66rpx;height: 66rpx;" :src="item.icon"/>
- </view>
- <text style="color: #242424;font-size: 26rpx;" >{{item.name}}</text>
- <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
- </view>
- </view>
- </view>
- </view>
- <view class="navbar-top" :style="{ 'background': 'rgba(255, 139, 47,'+toumindu+')'}">
- <view class="text-center text-white title ">联兑通</view>
- </view>
-
- <view class="account" style="padding: 0;">
- <view style="padding: 20rpx 20rpx 0 20rpx;">
- <text class="title">我的账单</text>
- </view>
- <my-bills :data="userInfo" @click="jump"></my-bills>
- </view>
-
- <!-- <view class="account" style="padding: 0;">
- <view style="padding: 20rpx 20rpx 0 20rpx;">
- <text class="title">我的订单</text>
- </view>
- <my-order @click="jump"></my-order>
- </view> -->
-
-
- <view class="exchange">
- <view class="top" style="padding: 20rpx 30rpx 10rpx;">
- <text>积分通兑</text>
- <text @click="jump('/pagesA/pages/my-points/exchange')">更多 ></text>
- </view>
-
- <view class="menu-list">
- <view class="item item1">
- <image src="@/static/icon/jiayou.png" mode=""></image>
- <text class="title" style="color: #F6532A;">积分加油站</text>
- <view class="cu-btn round sm" >
- 去充值
- </view>
- </view>
- <view class="item item2">
- <image src="@/static/icon/yidong.png" mode=""></image>
- <text class="title" style="color: #4AB0FF;">中国移动</text>
- <view class="cu-btn round sm" >
- 120:100兑入
- </view>
- </view>
- <view class="item item3">
- <image src="@/static/icon/BOC.png" mode=""></image>
- <text class="title" style="color: #CF4948;">中国银行</text>
- <view class="cu-btn round sm">
- 530:100兑入
- </view>
- </view>
- </view>
- </view>
-
- <view class="consume" v-if="false">
- <view class="top" style="padding: 20rpx 30rpx 10rpx;">
- <text>赚积分</text>
- <text>更多 ></text>
- </view>
- <view class="cu-list grid col-3 no-border" style="border-radius:20rpx ;">
- <view class="cu-item" @click="jump(item.path)" v-for="(item,index) in gainList" :key="index">
- <view class="grid-icon" >
- <image style="width: 160rpx;height: 160rpx;border-radius: 16rpx;" :src="item.icon"/>
- </view>
- <text style="color: #222222;font-size: 26rpx;" >{{item.name}}</text>
- <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
- </view>
- </view>
- </view>
-
- <view class="consume" @click="jump('/pages/consume/consume',1)">
- <view class="top" style="padding: 20rpx 30rpx 10rpx;">
- <text>去花积分</text>
- <text>更多 ></text>
- </view>
-
- <view class="cu-list grid col-4 no-border" style="border-radius:20rpx ;">
- <view class="cu-item" @click.stop="jumpMiniProgram(item.path)" v-for="(item,index) in pointsList" :key="index">
- <view class="grid-icon" >
- <image style="width: 88rpx;height: 88rpx;" :src="item.icon"/>
- </view>
- <text style="color: #222222;font-size: 26rpx;" >{{item.name}}</text>
- <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
- </view>
- </view>
- </view>
-
- <login ref="login" @signIn="signIn"></login>
- <toast ref="toast" ></toast>
- </view>
- </template>
- <script>
- import myBills from "@/components/my-bills.vue"
- import login from "@/components/login.vue"
- import crypto from "@/utils/crypto.js"
- export default {
- components:{
- login,
- myBills
- },
- data() {
- return {
- scanNotify:{scan: false,scanMessage:'扫描错误,请稍后重试!' },
- toumindu: 0.00,
- //功能列表
- menuList:[],
- gainList:[],
- pointsList:[],
- //用户信息
- userInfo:{},
- userDataStatistical:{},
- //信息未读数id列表
- notReadList:[],
-
- //跳回收银台的逻辑
- query:''
- }
- },
- onPageScroll(obj){
- this.toumindu = obj.scrollTop*0.006;
- },
- onLoad(options) {
- uni.hideLoading()
- //获取从收银台传过来的参数,处理新用户扫码进入收银台再进入首页的情况
- if (!this.$isEmpty(options.query)) {
- this.query=options.query
- }
- },
- onShow() {
- uni.hideLoading()
- this.fetchStatic()
- this.login()
- },
- methods: {
- init(){
- this.fetchUserInfo()
- this.fetchNoticeNotReadCount()
- },
- fetchNoticeNotReadCount(){
- let params={
- receiverId:this.vuex_userId,
- }
- this.$api.notice.notReadIdList(params).then(res=>{
- this.notReadList=res.data || []
- })
- },
- async fetchUserInfo(){
- let params={
- id:this.vuex_userId
- }
- this.$api.loginUser.detail(params).then(res=>{
- if (this.$isEmpty(res.data)) {
- this.handeGetUserInfoError()
- }else{
- this.userInfo=res.data
- this.$u.vuex('vuex_agenter_type',res.data.userType)
- }
- }).catch(err=>{
- this.handeGetUserInfoError()
- })
-
- },
- handeGetUserInfoError(){
- //清除userId和手机号
- this.$u.vuex('vuex_userId',null)
- this.$u.vuex('vuex_phone',null)
- this.$cache.remove('lifeData')
- this.$cache.remove('userInfo')
- //刷新当前页
- this.login()
- },
- // 登录 begin
- showLogin(){
- this.$refs.login.show()
- },
- showPhoneModal(){
- this.$refs.login.showPhoneModal()
- },
- signIn(resp){
- //获取手机号
- if (this.$isEmpty(this.vuex_phone)) {
- this.showPhoneModal()
- }else{
- this.$refs.toast.info('登录成功')
- }
- //获取数据
- this.init()
-
- // #ifdef MP-WEIXIN
- //处理跳回收银台的情况
- if (!this.$isEmpty(this.query)) {
- uni.redirectTo({
- url:"/pagesC/pages/checkstand/index?query="+this.query
- })
- }
- // #endif
- },
- async login(e){
- if (this.$isEmpty(this.vuex_userId)) {
- this.showLogin()
- return
- }
- //获取数据
- this.init()
- //获取手机号
- if (this.$isEmpty(this.vuex_phone)) {
- this.showPhoneModal()
- }
- },
-
- // 登录 end
- scanCode(){
- if (this.$isEmpty(this.vuex_userId)) {
- this.login()
- return
- }
- const _this = this;
- uni.scanCode({
- success: function (res) {
- let result=res.result
- let url=result.split("#")[1]
- _this.jump(url)
- },
- fail: (res) => {
- console.log(res);
- if(res.errMsg!='scanCode:fail cancel'){
- this.scanNotify = {scan: true,scanMessage: res.errMsg};
- }
- }
- });
- },
- jump(url,type){
- if (type==1) {
- uni.switchTab({
- url
- })
- return
- }
- if (this.$isEmpty(this.vuex_userId)) {
- console.log("123");
- this.login()
- return
- }
- uni.navigateTo({
- url
- })
- },
- jumpMiniProgram(appid,path){
- this.$mpi.navigateToMiniProgram(appid)
- },
- fetchStatic(){
- this.menuList=[
- {
- icon:'/static/icon/scan.png',
- name:'扫一扫',
- path:'/pagesC/pages/checkstand/index'
- },
- {
- icon:'/static/icon/pay.png',
- name:'付款码',
- path:'/pagesC/pages/checkstand/pay-qrcode'
- },
- {
- icon:'/static/icon/order6.png',
- name:'我的订单',
- path:'/pages/order/order'
- }
- ]
- this.gainList=[
- {
- icon:'/static/icon/daili.png',
- name:'成为代理',
- path:'/pages/mine/card/card'
- },
- {
- icon:'/static/icon/xianfeng.png',
- name:'音乐先锋榜',
- path:'/pages/mine/card/card'
- },
- {
- icon:'/static/icon/xianfeng.png',
- name:'音乐先锋榜',
- path:'/pages/mine/card/card'
- },
- ]
- this.pointsList=[
- {
- icon:'/static/icon/life.png',
- name:'生活服务',
- path:''
- },
- {
- icon:'/static/icon/jiaotong.png',
- name:'交通出行',
- path:'wxaf35009675aa0b2a'
- },
- {
- icon:'/static/icon/shop.png',
- name:'购物',
- path:'wx57426a7da2ea4f6a'
- },
- {
- icon:'/static/icon/yiyao.png',
- name:'医疗',
- path:'wxd78a776416719686'
- },
-
- ]
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .bg-tag{
- color: #FFFFFF;
- background-color: #EA3723;
- }
- .shuiyin{
- overflow: hidden;
- width: 260rpx;
- height: 280rpx;
- position: absolute;
- right: 10rpx;
- top: 30rpx;
- }
-
- .bg-img{
- width: 100vw;
- height: 420rpx;
- }
-
- .navbar-top{
- position: fixed;
- width: 100%;
- top: 0;
- z-index:99999;
- padding-top:var(--status-bar-height);
- transition: top .25s;
- .title{
- padding: 18.18rpx 0;
- }
- }
- .card{
- position: relative;
- margin: -240rpx 20rpx 0;
- border-radius: 20rpx;
- background-color: #FFFFFF;
-
- .info{
- padding: 20rpx 20rpx 0;
- display: flex;
- justify-content: space-between;
-
- .avatar{
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- }
-
- .nickname{
- width: calc(100% - 120rpx);
- font-weight: 800;
- color: #222222;
- font-size: 30rpx;
- margin-left: 20rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- }
-
- .account{
- padding: 20rpx;
- color: #222222;
- margin: 20rpx;
- border-radius: 20rpx;
- background-color: #FFFFFF;
-
- .title{
- padding-left: 20rpx;
- font-weight: 800;
- font-size: 34rpx;
- color: #26272F;
- }
-
-
- .menu{
- display: flex;
- justify-content: space-around;
-
- view{
- padding-top: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-
-
- text:first-child{
- font-weight: 800;
- padding-bottom: 10rpx;
- font-size: 32rpx;
- color: #FF9447;
- }
-
- text:last-child{
- }
- }
- }
- }
-
- .exchange{
- border-radius: 20rpx;
- background-color: #FFFFFF;
- padding: 10rpx 10rpx 30rpx;
- margin: 20rpx;
-
- .top{
- text:first-child{
- font-size: 34rpx;
- font-weight: 800;
- color: #26272F;
- }
-
- text:last-child{
- padding-top: 10rpx;
- font-size: 26rpx;
- color: #999999;
- }
- }
-
- .menu-list{
- display: flex;
- justify-content: space-around;
-
- .item{
- margin-top: 20rpx;
- width: 31%;
- padding: 15rpx 0;
- border-radius: 16rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
-
- .title{
- font-weight: 800;
- margin-bottom: 10rpx;
- }
-
- image{
- margin-bottom: 10rpx;
- border-radius: 50%;
- padding: 15rpx;
- background-color: #FFFFFF;
- width: 70rpx;
- height: 70rpx;
- }
- }
-
- .item1{
- background-image: linear-gradient(to right,#F7F0E7,#E9CEB9);
-
- view{
- font-size: 26rpx;
- padding: 10rpx 50rpx;
- background-color: #FF9447;
- color: #FFFFFF;
- }
- }
- .item2{
- background-image: linear-gradient(to right,#E8F2FC,#C3D5ED);
-
- view{
- font-size: 26rpx;
- padding: 10rpx 20rpx;
- background-color: #4AB0FF;
- color: #FFFFFF;
- }
- }
-
- .item3{
- background-image: linear-gradient(to right,#F7E9E9,#EAC4C3);
- view{
- font-size: 26rpx;
- padding: 10rpx 20rpx;
- background-color: #CF4948;
- color: #FFFFFF;
- }
- }
-
- }
-
-
-
- }
-
-
- .consume{
- border-radius: 20rpx;
- background-color: #FFFFFF;
- padding: 10rpx 10rpx 30rpx;
- margin: 20rpx;
-
- .top{
- text:first-child{
- font-size: 34rpx;
- font-weight: 800;
- color: #26272F;
- }
-
- text:last-child{
- padding-top: 10rpx;
- font-size: 26rpx;
- color: #999999;
- }
- }
- }
-
- .top{
- display: flex;
- justify-content: space-between;
- }
- </style>
|