|
@@ -180,7 +180,7 @@
|
|
|
import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
|
|
|
import { promoTerminalList } from '@/api/video.js'
|
|
|
import { getRewardRollList } from '@/api/rewardRule.js'
|
|
|
- import { getShopStatus } from '@/api/cart.js'
|
|
|
+ import { getShopStatus, getCartCount } from '@/api/cart.js'
|
|
|
import { getShopCategory, getShopProductList } from '@/api/shop.js'
|
|
|
import { openWebView, clickTab, toAuthStore, clickBannerList, toLogin } from "@/utils/index.js"
|
|
|
export default {
|
|
@@ -339,11 +339,16 @@
|
|
|
uni.$on("refashHome",()=>{
|
|
|
this.pageInit(2)
|
|
|
})
|
|
|
+ // 刷新购物车
|
|
|
+ uni.$on("refashCart",()=>{
|
|
|
+ this.cartCount()
|
|
|
+ })
|
|
|
},
|
|
|
// 页面卸载
|
|
|
onUnload() {
|
|
|
uni.$off('refashHome')
|
|
|
uni.$off('refashProm')
|
|
|
+ uni.$off('refashCart')
|
|
|
},
|
|
|
onHide() {
|
|
|
// 用户头像
|
|
@@ -468,7 +473,7 @@
|
|
|
// 有商城
|
|
|
if(this.hasShopiing){
|
|
|
// 隐藏tab 视频,显示tab购物车
|
|
|
- this.showCatTab()
|
|
|
+ this.cartCount()
|
|
|
// 商品分类
|
|
|
this.getGoodType(flag)
|
|
|
// 获取推荐产品
|
|
@@ -487,6 +492,15 @@
|
|
|
this.getRedPacketRule()
|
|
|
})
|
|
|
},
|
|
|
+ // 购物车数量
|
|
|
+ cartCount(){
|
|
|
+ getCartCount({}).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.$store.state.vuex_cartTotal = res.data?res.data.qty:0
|
|
|
+ this.showCatTab()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 商品一级分类
|
|
|
getGoodType(flag){
|
|
|
this.productTypeList = []
|
|
@@ -705,8 +719,14 @@
|
|
|
"selectedIconPath": "/static/tab/tab_cart_pressed.png",
|
|
|
"text": "购物车",
|
|
|
'customIcon': false,
|
|
|
+ 'count': this.$store.state.vuex_cartTotal,
|
|
|
+ 'isDot': false
|
|
|
})
|
|
|
}
|
|
|
+ // 购物车已存在
|
|
|
+ if(catIndex>=0){
|
|
|
+ this.$store.state.vuex_tabBarList[catIndex].count = this.$store.state.vuex_cartTotal
|
|
|
+ }
|
|
|
},
|
|
|
// 显示视频tab,隐藏购物车
|
|
|
showVideoTab(){
|