feat: 选品广场详情添加购买按钮
This commit is contained in:
+30
-3
@@ -68,14 +68,21 @@
|
||||
<detail-content-card class="detail-content-selector" :content="state.goodsInfo.description" />
|
||||
</view>
|
||||
</block>
|
||||
<view class="theme-ai">
|
||||
<card_payment ref="paymentRef" source="orderInfo" :actionStatus="timeText" @addCar="addCar" />
|
||||
<view class="theme-ai" v-if="state.goodsInfo && state.goodsInfo.id">
|
||||
<card_payment ref="paymentRef" source="orderInfo" :actionStatus="timeText" :bottomOffset="paymentBottomOffset"
|
||||
@addCar="addCar" @updatePrice="updatePrice" />
|
||||
</view>
|
||||
<su-fixed bottom placeholder bg="bg24" :zIndex="1"
|
||||
v-if="state.goodsInfo && state.goodsInfo.id && !hasCartItems">
|
||||
<view class="buy-now-bar bg24">
|
||||
<view class="ai-button1 buy-now-btn" @tap="addCar">立即购买</view>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import { computed, ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
// import { onPageScroll} from '@dcloudio/uni-app';
|
||||
@@ -114,6 +121,7 @@ const getInfo = async () => {
|
||||
};
|
||||
let id = ref();
|
||||
let shoppingPlazaId = ref();
|
||||
const hasCartItems = ref(false);
|
||||
onLoad(async (options) => {
|
||||
// 滚到顶部
|
||||
uni.pageScrollTo({
|
||||
@@ -130,6 +138,9 @@ function onSkuChange(e) {
|
||||
const onAddCart = () => { };
|
||||
const onBuy = () => { };
|
||||
let paymentRef = ref(null);
|
||||
const updatePrice = (val) => {
|
||||
hasCartItems.value = !!val;
|
||||
};
|
||||
const addCar = () => {
|
||||
paymentRef.value.addCar({ ...state.goodsInfo, shoppingPlazaId: shoppingPlazaId.value });
|
||||
};
|
||||
@@ -187,6 +198,9 @@ let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
const buyBarOffset =
|
||||
uni.upx2px(120) + Number(sheep?.$platform?.device?.safeAreaInsets?.bottom || 0);
|
||||
const paymentBottomOffset = computed(() => (hasCartItems.value ? 0 : buyBarOffset));
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.detail-card {
|
||||
@@ -457,6 +471,19 @@ height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.buy-now-bar {
|
||||
height: 120rpx;
|
||||
padding: 20rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.buy-now-btn {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:deep(.uni-countdown__number) {
|
||||
font-size: 24rpx !important;
|
||||
width: 40rpx !important;
|
||||
|
||||
@@ -330,7 +330,7 @@
|
||||
};
|
||||
|
||||
const system = uni.getSystemInfoSync();
|
||||
const tabbarBottomOffset = uni.upx2px(100);
|
||||
const tabbarBottomOffset = uni.upx2px(100) + Number(system.safeAreaInsets?.bottom || 0);
|
||||
const paymentBarReserve = uni.upx2px(148);
|
||||
const baseHeight =
|
||||
system.windowHeight -
|
||||
|
||||
Reference in New Issue
Block a user