feat: 商品分类列表实现购物车
This commit is contained in:
parent
b3cfa37bb0
commit
6e01a07d0d
@ -132,6 +132,16 @@
|
|||||||
</movable-view>
|
</movable-view>
|
||||||
</movable-area>
|
</movable-area>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view
|
||||||
|
class="diy_goods_carts"
|
||||||
|
@click="gopage(`/pages/index/cart?category_id=${shopInfo.category_id}&store_id=${shopInfo.store_id}`)"
|
||||||
|
>
|
||||||
|
<view class="box">
|
||||||
|
<image class="icon" src="https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/icon/icon_shop.png" />
|
||||||
|
<text class="icon_badge">{{ goodsNum }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -150,6 +160,8 @@ import TpSearch from "@/components/tp-search/tp-search";
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
goodsNum: 0,
|
||||||
|
|
||||||
options: {},
|
options: {},
|
||||||
viewtype: 1,
|
viewtype: 1,
|
||||||
|
|
||||||
@ -238,7 +250,16 @@ export default {
|
|||||||
"shopInfo",
|
"shopInfo",
|
||||||
"userInfo",
|
"userInfo",
|
||||||
"hasLogin",
|
"hasLogin",
|
||||||
|
"cartNum",
|
||||||
]),
|
]),
|
||||||
|
watch: {
|
||||||
|
cartNum: {
|
||||||
|
handler(newVal) {
|
||||||
|
this.goodsNum = newVal;
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initReturnPos();
|
this.initReturnPos();
|
||||||
|
|
||||||
@ -352,6 +373,11 @@ export default {
|
|||||||
"forceUserInfo",
|
"forceUserInfo",
|
||||||
"getUserInfo",
|
"getUserInfo",
|
||||||
]),
|
]),
|
||||||
|
gopage(url){
|
||||||
|
this.$.navigateTo({
|
||||||
|
url
|
||||||
|
});
|
||||||
|
},
|
||||||
initReturnPos: function () {
|
initReturnPos: function () {
|
||||||
let view = uni.createSelectorQuery().in(this).select(".movableArea");
|
let view = uni.createSelectorQuery().in(this).select(".movableArea");
|
||||||
let that = this;
|
let that = this;
|
||||||
@ -614,4 +640,61 @@ export default {
|
|||||||
.active {
|
.active {
|
||||||
background-color: #c0a080;
|
background-color: #c0a080;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.diy_goods_carts {
|
||||||
|
position: fixed;
|
||||||
|
right: 24rpx;
|
||||||
|
bottom: 240rpx;
|
||||||
|
z-index: 100;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
color: #666;
|
||||||
|
text-align: center;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 100%;
|
||||||
|
padding: 12rpx;
|
||||||
|
box-shadow: 2rpx 4rpx 20rpx rgba(0,0,0,0.3);
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon_badge {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: -5px;
|
||||||
|
top: -5px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 24rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
color: #fff;
|
||||||
|
background: #dd524d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.current {
|
||||||
|
color: #dd524d;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user