| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | <template>	<view class="">		<view v-if="vuex_member_info.name" class="cart u-flex u-row-center" @click="$u.route('/shopping/cart',{type:'reLaunch'})">			<u-icon size="52rpx" class="icon" :name="staticUrl+'/img/cartico.png'"></u-icon>			<u-badge type="error" max="99" :value="cartTotal" :absolute="true" :offset="[0,5]"></u-badge>		</view>		<u-toast ref="uToast"></u-toast>	</view></template><script>	export default {		name:'cartfixed',		data() {			return {				cartTotal:0,				staticUrl:this.$commonConfig.staticUrl,			}		},		onShow() {		},		onLoad() {		},		mounted(){			this.getCartList()		},		methods: {			getCartList(isAdd){				if(!this.vuex_member_info.name){					return				}				this.$u.api.cartList().then(res=>{					if(isAdd){						if(res.data.total==this.cartTotal){							uni.showToast({								title:'添加成功',								icon:'success',								duration:1000							})																																									}else{							uni.showToast({								title:'添加成功',								icon:'success',								duration:1000							})																																		}					}					this.cartTotal = res.data.total;					console.log('getCartList',res);					}).catch(err=>{					console.log('getCartList',err.data);				})			},			addToCart(num){				this.getCartList()								console.log('addToCart',num);			}		}	}</script><style lang="scss" scoped>.cart{	position: fixed;	width: 100rpx;	height: 100rpx;	border-radius: 50%;	right: 20rpx;	bottom: 300rpx;	background: #FFFFFF;	box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.12);}</style>
 |