<script lang="ts" setup>
import {useConfigStore} from "@/store";

const {t} = useI18n();

const configStore = useConfigStore();

// 用户会员状态是否已开通

const show = ref(false);
const priceData = ref({})

function onOpen(data: any, num: number) {
  priceData.value = data
  show.value = true;
}

function handleClose() {
  show.value = false;
}

defineExpose({
  onOpen,
});
</script>

<template>
  <wd-popup
      v-model="show"
      position="bottom"
      @close="handleClose"
  >
    <view>
      <view class="center h-102rpx bg-#F7F7F7 text-40rpx lh-40rpx font-bold text-#333">
        {{ t('pages-user.order.checkout.priceDetail.title') }}?
      </view>
      <view class="border-bottom text-32rpx lh-32rpx font-500 text-#333 py-36rpx px-30rpx">
        <view class="flex-center-sb mb-20rpx">
          <view>{{ t('pages-user.order.checkout.priceDetail.serviceFees') }}</view>
          <view>${{
              (Number(priceData?.tip) + Number(priceData?.deliveryFee)).toFixed(2)
            }}
          </view>
        </view>
        <view class="text-24rpx lh-28rpx text-#9E9E9E">
          {{ t('pages-user.order.checkout.priceDetail.desc') }}
        </view>
      </view>
      <view class="flex-center-sb border-bottom h-104rpx text-32rpx lh-32rpx font-500 text-#333 px-30rpx">
        <view>{{ t('pages-user.order.checkout.priceDetail.taxation') }}</view>
        <view>${{ Number(priceData?.tax) }}</view>
      </view>
      <view class="px-30rpx pt-40rpx">
        <wd-button
            block
            custom-class="!h-108rpx !text-36rpx !rounded-16rpx !bg-#14181B"
            @click="handleClose"
        >
          {{ t('common.gotIt') }}
        </wd-button>
      </view>
      <view :style="[configStore.iosSafeBottomPlaceholder]"></view>
    </view>
  </wd-popup>
</template>

<style lang="scss" scoped>

</style>