feat: 选品广场详情添加购买按钮
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
</view>
|
||||
<view class="ai-button1 h_80 line80 w_200" @click="go"> 去结算 </view>
|
||||
</view>
|
||||
<uni-popup ref="popupRef" type="bottom" border-radius="10px 10px 0 0">
|
||||
<uni-popup ref="popupRef" type="bottom" border-radius="10px 10px 0 0" @change="onPopupChange">
|
||||
<view class="p-x-32 p-y-40 bg17">
|
||||
<view class="flex-center ju-between p-b-44">
|
||||
<view>已加购商品</view>
|
||||
@@ -117,10 +117,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
const popupSpacerHeight = computed(() => {
|
||||
const deltaPx = uni.upx2px(30);
|
||||
return Math.max(0, (Number(props.bottomOffset) || 0) - deltaPx);
|
||||
});
|
||||
const safeAreaBottom = Number(uni.getSystemInfoSync()?.safeAreaInsets?.bottom || 0);
|
||||
const popupOpened = ref(false);
|
||||
const popupBottomInsetPx = ref(0);
|
||||
const popupSpacerHeight = computed(() => Math.max(0, Number(popupBottomInsetPx.value) || 0));
|
||||
const cartList = ref([]);
|
||||
let price = ref(0);
|
||||
let num = ref(0);
|
||||
@@ -155,15 +155,38 @@
|
||||
getCartList();
|
||||
});
|
||||
let popupRef = ref(null);
|
||||
const resolvePopupBottomInsetPx = () => {
|
||||
return Math.max(0, (Number(props.bottomOffset) || 0) - safeAreaBottom);
|
||||
};
|
||||
const onPopupChange = (e: any) => {
|
||||
popupOpened.value = !!e?.show;
|
||||
if (popupOpened.value) {
|
||||
popupBottomInsetPx.value = resolvePopupBottomInsetPx();
|
||||
} else {
|
||||
popupBottomInsetPx.value = 0;
|
||||
}
|
||||
};
|
||||
const showPopup = () => {
|
||||
if (!popupRef.value) return;
|
||||
|
||||
popupOpened.value = true;
|
||||
popupBottomInsetPx.value = resolvePopupBottomInsetPx();
|
||||
popupRef.value.open('bottom');
|
||||
};
|
||||
const hidePopup = () => {
|
||||
popupOpened.value = false;
|
||||
popupBottomInsetPx.value = 0;
|
||||
popupRef.value.close();
|
||||
};
|
||||
onMounted(() => { });
|
||||
watch(
|
||||
() => cartList.value?.length,
|
||||
(len) => {
|
||||
if (popupOpened.value && (!len || len <= 0)) {
|
||||
hidePopup();
|
||||
}
|
||||
},
|
||||
);
|
||||
//#region 选择规格弹窗
|
||||
let showSelectSku = ref(false);
|
||||
let goodsInfo = ref({});
|
||||
|
||||
Reference in New Issue
Block a user