Browse Source

feat: 修改tip提示位置

liangan 1 tháng trước cách đây
mục cha
commit
437e942767

+ 3 - 26
src/pages/productDetail/components/CustomTooltip.vue

@@ -5,7 +5,6 @@ interface Props {
   autoHideDelay?: number
   icon?: string
   iconSize?: string
-  message?: string
   highlightText1?: string
   highlightText2?: string
   width?: string
@@ -16,9 +15,8 @@ const props = withDefaults(defineProps<Props>(), {
   autoHide: true,
   autoHideDelay: 10000,
   icon: '/static/icons/gift.png',
-  message: 'Full refund for unsuccessful group purchase $99.99 Receive red envelope rewards $1.8',
-  highlightText1: '$99.99',
-  highlightText2: '$1.8',
+  highlightText1: '',
+  highlightText2: '',
   width: '600rpx',
 })
 
@@ -91,27 +89,6 @@ function toggle() {
   }
 }
 
-// 处理消息文本,高亮特定文本
-function formatMessage() {
-  let formattedMessage = props.message
-
-  if (props.highlightText1) {
-    formattedMessage = formattedMessage.replace(
-      props.highlightText1,
-      `<text class="text-[var(--wot-color-theme)]">${props.highlightText1}</text>`,
-    )
-  }
-
-  if (props.highlightText2) {
-    formattedMessage = formattedMessage.replace(
-      props.highlightText2,
-      `<text class="text-[var(--wot-color-theme)]">${props.highlightText2}</text>`,
-    )
-  }
-
-  return formattedMessage
-}
-
 // 组件卸载时清除定时器
 onUnmounted(() => {
   clearAutoHideTimer()
@@ -150,7 +127,7 @@ defineExpose({
     </view>
     <!-- 倒三角箭头 -->
     <view
-      class="absolute left-1/2 top-full h-0 w-0 -translate-x-1/2"
+      class="absolute left-445rpx top-full h-0 w-0 -translate-x-1/2"
       style="border-left: 16rpx solid transparent; border-right: 16rpx solid transparent; border-top: 16rpx solid rgba(0, 0, 0, 0.8);"
     />
   </view>

+ 0 - 19
src/pages/productDetail/productDetail.vue

@@ -12,7 +12,6 @@
 // eslint-disable-next-line unused-imports/no-unused-imports
 import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
-import { getConfigByCode } from '@/api/common'
 import { myFavoriteAdd, myFavoriteDel } from '@/api/mine'
 import { preOrder as _preOrder } from '@/api/order'
 import { getDetail, pinkList } from '@/api/product'
@@ -200,14 +199,11 @@ function findMatchingAttrValue(selectedSpecs) {
     return selectedKeys.every(key => selectedSpecs[key] === attrValueSpecs[key])
   })
 }
-const rebate = ref<any>(0)
 // 查询商品详情
 async function queryDetail() {
   const res = await getDetail({ id: productId.value })
   console.log(res)
   detail.value = res.data
-  const rate = await getConfig()
-  rebate.value = formatNumber(rate * res.data.price)
   // 默认选择第一个规格
   setDefaultSpecs()
   paging.value.complete()
@@ -220,20 +216,6 @@ async function queryPinkInfo() {
   pinkInfo.value = res.data.list
 }
 
-async function getConfig() {
-  try {
-    const res = await getConfigByCode({ code: 'open_red_envelope_rate' })
-    console.log(res)
-    if (res.code === '200') {
-      return res.data.valueInfo / 100
-    }
-    else {
-      return 0
-    }
-  }
-  catch {}
-}
-
 // 设置默认规格选择
 function setDefaultSpecs() {
   if (detail.value.attr && detail.value.attr.length > 0) {
@@ -516,7 +498,6 @@ onShow(() => {
             <CustomTooltip
               v-model:visible="showTip"
               :highlight-text1="`৳${formatNumber(detail.price)}`"
-              :highlight-text2="`৳${rebate}`"
             />
           </view>
           <view class="rounded-r-full bg-[var(--wot-color-theme)] px-34rpx py-18rpx text-white" @click="openSku('join')">