|
|
@@ -89,6 +89,7 @@
|
|
|
import ReduceQrcode from '@/components/reduce-qrcode/reduce-qrcode.vue';
|
|
|
import CommonDialog from '@/components/common-dialog.vue';
|
|
|
import ConditionPopup from '../components/condition-popup.vue';
|
|
|
+ import { eventBus } from '@/utils/event-bus.js';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -125,13 +126,22 @@
|
|
|
};
|
|
|
},
|
|
|
onShow() {
|
|
|
- this.loadData();
|
|
|
- this.getShippingText();
|
|
|
- this.$updateCartBadge();
|
|
|
+ this.refreshCartPage();
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ // Tab 页通过事件触发刷新,避免父页面访问 $refs 时占位组件未就绪报错
|
|
|
+ this.cartPageRefreshHandler = () => {
|
|
|
+ this.refreshCartPage();
|
|
|
+ };
|
|
|
+ eventBus.on('cartPageRefresh', this.cartPageRefreshHandler);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.cartPageRefreshHandler) {
|
|
|
+ eventBus.off('cartPageRefresh', this.cartPageRefreshHandler);
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.loadData();
|
|
|
- this.getShippingText();
|
|
|
+ this.refreshCartPage();
|
|
|
},
|
|
|
// 分享配置
|
|
|
onShareAppMessage(res) {
|
|
|
@@ -203,6 +213,11 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ refreshCartPage() {
|
|
|
+ this.loadData();
|
|
|
+ this.getShippingText();
|
|
|
+ this.$updateCartBadge();
|
|
|
+ },
|
|
|
getShippingText() {
|
|
|
this.$u.api.getShippingTempleteAjax().then(res => {
|
|
|
if (res.code === 200) {
|