This commit is contained in:
jqtmviyu@gmail.com 2021-03-05 19:30:24 +08:00
parent 697da82507
commit 9991d6ab11

View File

@ -40,6 +40,17 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 4. 底栏 -->
<view class="bottom">
<text class="total_text">合计</text>
<text class="price">{{totalPrice}}</text>
<view
class="bottom_btn"
:class="{ disabled: !address.userName }"
@tap="payHandle"
>去支付({{ totalCount }})</view>
</view>
</view> </view>
</template> </template>
@ -66,13 +77,44 @@ export default {
this.address = res this.address = res
} }
}) })
},
//
payHandle(){
if (!this.address.userName) {
uni.showToast({ title: "请选择收货地址", icon: "none" });
} else {
console.log("走支付逻辑");
} }
}, },
},
computed: { computed: {
// //
addressDetail (){ addressDetail (){
const {detailInfo, countyName, cityName, provinceName} = this.address const {detailInfo, countyName, cityName, provinceName} = this.address
return provinceName + cityName + countyName + detailInfo return provinceName + cityName + countyName + detailInfo
},
//
totalPrice(){
let totalPrice = 0
this.cartList.forEach(item => {
if(item.goods_select){
totalPrice += item.goods_price * item.goods_count
}
})
return totalPrice
},
//
totalCount(){
let totalCount = 0
//
// this.cartList.forEach(item => {
// if(item.goods_select){
// totalCount += item.goods_count
// }
// })
//
totalCount = this.cartList.filter(item=>item.goods_select).length
return totalCount
} }
}, },
} }
@ -146,4 +188,37 @@ export default {
} }
} }
} }
.bottom {
height: 83rpx;
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
border-top: 1rpx solid #ddd;
display: flex;
align-items: center;
padding: 0 20rpx;
.price {
font-size: 28rpx;
flex: 1;
}
.bottom_btn {
font-size: 22rpx;
width: 150rpx;
height: 52rpx;
border-radius: 26rpx;
color: #fff;
background-color: #ea4350;
display: flex;
justify-content: center;
align-items: center;
&.disabled {
background-color: #ccc;
}
}
}
</style> </style>