Fix:3880 【商城小程序】搜索界面-增加商品到购物车,红点提示未及时同步更新数量
This commit is contained in:
+14
-2
@@ -33,10 +33,22 @@ export default {
|
||||
unique: ''
|
||||
}
|
||||
},
|
||||
cart_num: 1
|
||||
cart_num: 1,
|
||||
CartCount: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取购物车数量
|
||||
getCartCount () {
|
||||
const isLogin = this.isLogin
|
||||
if (isLogin) {
|
||||
getCartCount({
|
||||
numType: 0
|
||||
}).then(res => {
|
||||
this.CartCount = res.data.count
|
||||
})
|
||||
}
|
||||
},
|
||||
getSkuActiveStatus(selectedSku) {
|
||||
getProductSkuBySelected({ id: this.id, selectedSku }).then(res => {
|
||||
const { success, data } = res
|
||||
@@ -100,7 +112,7 @@ export default {
|
||||
const onlyOne = Object.keys(data.productValue).length === 1
|
||||
|
||||
if(onlyOne) {
|
||||
this.handleOk()
|
||||
this.handleOk(this.getCartCount())
|
||||
return
|
||||
}
|
||||
this.attr.cartAttr = !this.isOpen ? true : false
|
||||
|
||||
@@ -201,7 +201,6 @@ export default {
|
||||
mixins: [goCartMixin],
|
||||
data () {
|
||||
return {
|
||||
CartCount: 0,
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
list: [],
|
||||
query: {
|
||||
@@ -232,17 +231,7 @@ export default {
|
||||
!this.loading && this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 获取购物车数量
|
||||
getCartCount () {
|
||||
const isLogin = this.isLogin
|
||||
if (isLogin) {
|
||||
getCartCount({
|
||||
numType: 0
|
||||
}).then(res => {
|
||||
this.CartCount = res.data.count
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
goShoppingCart() {
|
||||
this.$yrouter.switchTab('/pages/cart')
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user