feat: 实现装修秒杀活动购物车;联调秒杀活动加购。
This commit is contained in:
parent
601d49f812
commit
3f46bf31e8
@ -1051,12 +1051,12 @@ export default {
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
getGoodsStatus (item){
|
getGoodsStatus (item){
|
||||||
return item?.product_quantity == 0 || item?.item_quantity == 0 || typeof item.product_quantity == 'undefined' || typeof item.item_quantity == 'undefined'
|
return item?.product_quantity == 0 || item?.item_quantity == 0
|
||||||
},
|
},
|
||||||
|
|
||||||
async addCart(item) {
|
async addCart(item) {
|
||||||
|
|
||||||
if (item?.product_quantity == 0 || item?.item_quantity == 0 || typeof item.product_quantity == 'undefined' || typeof item.item_quantity == 'undefined') {
|
if (item?.product_quantity == 0 || item?.item_quantity == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
title: this.$.__("商品库存不足")
|
title: this.$.__("商品库存不足")
|
||||||
|
|||||||
@ -7,26 +7,20 @@
|
|||||||
<!-- #ifdef APP-PLUS -->
|
<!-- #ifdef APP-PLUS -->
|
||||||
<share-box-app :shareDataDefault="shareData" ref="shareBoxApp"></share-box-app>
|
<share-box-app :shareDataDefault="shareData" ref="shareBoxApp"></share-box-app>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
@import '../../styles/_variables.scss';
|
|
||||||
|
|
||||||
@import '../../styles/layout.scss';
|
|
||||||
|
|
||||||
.page {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 100%;
|
|
||||||
/* background-size: cover !important; */
|
|
||||||
background-position: top center !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import statusBar from '../../components/status-bar.vue';
|
import statusBar from '../../components/status-bar.vue';
|
||||||
|
|
||||||
@ -45,6 +39,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
|
goodsNum: 0,
|
||||||
options: {},
|
options: {},
|
||||||
PageData: {},
|
PageData: {},
|
||||||
PageContent: [],
|
PageContent: [],
|
||||||
@ -83,8 +78,17 @@ export default {
|
|||||||
'plantformInfo',
|
'plantformInfo',
|
||||||
'shopInfo',
|
'shopInfo',
|
||||||
'userInfo',
|
'userInfo',
|
||||||
'hasLogin'
|
'hasLogin',
|
||||||
|
"cartNum",
|
||||||
]),
|
]),
|
||||||
|
watch: {
|
||||||
|
cartNum: {
|
||||||
|
handler(newVal) {
|
||||||
|
this.goodsNum = newVal;
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
@ -225,6 +229,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['login', 'logout', 'getPlantformInfo', 'forceUserInfo', 'getUserInfo']),
|
...mapMutations(['login', 'logout', 'getPlantformInfo', 'forceUserInfo', 'getUserInfo']),
|
||||||
|
|
||||||
|
gopage(url){
|
||||||
|
this.$.navigateTo({
|
||||||
|
url
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getPageInfo: function(force_refresh) {
|
getPageInfo: function(force_refresh) {
|
||||||
var that = this,
|
var that = this,
|
||||||
params = {
|
params = {
|
||||||
@ -360,3 +370,76 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import '../../styles/_variables.scss';
|
||||||
|
|
||||||
|
@import '../../styles/layout.scss';
|
||||||
|
|
||||||
|
.page {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
/* background-size: cover !important; */
|
||||||
|
background-position: top center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diy_goods_carts {
|
||||||
|
position: fixed;
|
||||||
|
right: 24rpx;
|
||||||
|
bottom: 240rpx;
|
||||||
|
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>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user