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