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