Fix:3880 【商城小程序】搜索界面-增加商品到购物车,红点提示未及时同步更新数量
This commit is contained in:
@@ -46,6 +46,7 @@ export default {
|
|||||||
numType: 0
|
numType: 0
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.CartCount = res.data.count
|
this.CartCount = res.data.count
|
||||||
|
this.$forceUpdate()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -112,7 +113,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.getCartCount())
|
this.handleOk(() => this.getCartCount())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.attr.cartAttr = !this.isOpen ? true : false
|
this.attr.cartAttr = !this.isOpen ? true : false
|
||||||
@@ -245,7 +246,7 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
handleOk(cb = '') {
|
handleOk(cb) {
|
||||||
const productSelect = this.getAttrItemData(this.attrValue)
|
const productSelect = this.getAttrItemData(this.attrValue)
|
||||||
// 如果有属性,没有选择,提示用户选择
|
// 如果有属性,没有选择,提示用户选择
|
||||||
const hasNo = (this.attr.productAttr.length && productSelect === undefined && this.isOpen) || productSelect.stock === 0
|
const hasNo = (this.attr.productAttr.length && productSelect === undefined && this.isOpen) || productSelect.stock === 0
|
||||||
|
|||||||
@@ -175,7 +175,7 @@
|
|||||||
:cartNum="cart_num"
|
:cartNum="cart_num"
|
||||||
:showOk="true"
|
:showOk="true"
|
||||||
@changeFun="changeFun"
|
@changeFun="changeFun"
|
||||||
@ok="handleOk(getCartCount())"
|
@ok="handleOk(() => this.getCartCount())"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -188,9 +188,6 @@ import NP from 'number-precision'
|
|||||||
import NoGoodData from '@/components/good/NoData'
|
import NoGoodData from '@/components/good/NoData'
|
||||||
import Recommend from '@/components/Recommend'
|
import Recommend from '@/components/Recommend'
|
||||||
import goCartMixin from '@/mixins/goCartMixins'
|
import goCartMixin from '@/mixins/goCartMixins'
|
||||||
import {
|
|
||||||
getCartCount,
|
|
||||||
} from '@/api/store'
|
|
||||||
export default {
|
export default {
|
||||||
name: 'GoodsList',
|
name: 'GoodsList',
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
Reference in New Issue
Block a user