95 lines
1.7 KiB
Vue
95 lines
1.7 KiB
Vue
<template>
|
|
<view>
|
|
<view class="cart-btn-bg" :style="{right:right+'rpx',bottom:bottom+'rpx'}">
|
|
<view class="cart-btn flex" @tap="toCart" :class="isSmall?'smallImg':''">
|
|
<image src="/static/public/icon-cart.png" mode="widthFix" lazy-load></image>
|
|
<view class="cart-total flex" v-if="total !== 0 && total < 99">{{total}}</view>
|
|
<view class="cart-total flex" v-else>99</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name:"customer-one",
|
|
props:{
|
|
right:{//距离右边多宽
|
|
type:Number,
|
|
default:28
|
|
},
|
|
bottom:{//距离底部多高
|
|
type:Number,
|
|
default:185
|
|
},
|
|
isSmall:{//是否是大图
|
|
type:Boolean,
|
|
default:false
|
|
},
|
|
total:{//购物车数量
|
|
type:Number,
|
|
default:1250
|
|
},
|
|
},
|
|
computed: {
|
|
// 主题颜色
|
|
publicColor() {
|
|
return '#0073bc'
|
|
}
|
|
},
|
|
data() {
|
|
return {};
|
|
},
|
|
methods:{
|
|
toCart(){
|
|
if(this.$toolAll.tools.judgeAuth()) {
|
|
// 已授权
|
|
uni.redirectTo({
|
|
url:`pages/cart/cart`
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.smallImg{transform: scale(.8);margin-right: -10rpx;}
|
|
.cart-btn-bg{
|
|
width: 120rpx;
|
|
height: 120rpx;
|
|
border-radius: 30rpx;
|
|
background-color: #0073bc;
|
|
animation: scale_name 1s linear alternate infinite;
|
|
position: fixed;
|
|
}
|
|
.cart-btn{
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: 100%;
|
|
height: 100%;
|
|
position: relative;
|
|
}
|
|
.cart-btn image{
|
|
width: 62rpx;
|
|
height: 62rpx;
|
|
}
|
|
.cart-total{
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: 36rpx;
|
|
height: 36rpx;
|
|
border-radius: 100%;
|
|
background-color: #FFFFFF;
|
|
font-size: 24rpx;
|
|
color: #068add;
|
|
position: absolute;
|
|
top: 20rpx;
|
|
right: 12rpx;
|
|
}
|
|
@keyframes scale_name{
|
|
from{transform: scale(.9);}
|
|
to{transform: scale(1);}
|
|
}
|
|
</style>
|